Detecting and exploiting XSS with Xenotix XSS Exploit Framework


Published on

Whitepaper on Xenotix XSS Exploit Framework

Published in: Education
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Detecting and exploiting XSS with Xenotix XSS Exploit Framework

  1. 1. Detecting and Exploiting XSS with Xenotix XSS Exploit Framework Ajin Abraham keralacyberforce.inIntroductionCross Site Scripting or XSS vulnerabilities have been reported and exploited since 1990s. XSS gotlisted as the top 2nd Vulnerability in the OWASP 2010 Web application Vulnerabilities list.Figure 1: Top 10 Web Application Vulnerabilities OWASPCross-site scripting (XSS) is a type of security vulnerability typically found in web applications whichallows the attackers to inject client-side script into web pages viewed by other users. The executionof the injected code takes place at client side. A cross site scripting vulnerability can be used by theAjin Abraham Kerala Cyber Force Learn | Contribute | Share
  2. 2. attacker to bypass the Same Origin Policy (SOP). In the past, the potentials of XSS vulnerability werenot known. XSS was mainly used for stealing cookies and for temporary or permanent defacementsand was not considered as high risk vulnerability. But later XSS tunneling and Payload deliveringshowed us the potential of XSS Vulnerability. Most of the large websites like Google, Facebook,Twitter, Microsoft, and Amazon etc. even now suffers from XSS bugs. That’s a brief introductionabout XSS.Threats due to XSSXSS Tunneling: With XSS Tunnel a hacker will obtain the traffic between the victim and awebserver.Client side code injection: A hacker can inject malicious codes and execute them at client side.DOS: A hacker can perform DOS against a remote server or against the client itself.Cookie Stealing: A hacker can obtain the session cookies or tokens of a victim.Malware Spreading: A hacker can spread malwares with a website which is vulnerable to XSS.Phishing: A hacker can embed or redirect to a fake page of the website to get the logincredentials of the victim.Defacing: Temporary or permanent defacement of web application is possible.Need for a new ToolMany tools are available for detecting XSS vulnerabilities in web applications. But most of theseare not so easier to use or you should specify XSS payloads manually. I found many Penetrationtesters just using <script>alert(‘XSS’)</script> or <script>alert(document.cookie)</script> as thePOC for the detected XSS vulnerability which often fails to create an impression on their clientsthat XSS is a severe threat. So I thought of the possibility of a new user friendly tool with apayload list to test against XSS in a web application and an XSS Exploitation Framework. After a5 months research, I built a XSS payload database of over 500+ XSS payloads and implementeda tool in VB.NET and that is Xenotix XSS Exploit Framework.Ajin Abraham Kerala Cyber Force Learn | Contribute | Share
  3. 3. What is Xenotix XSS Exploit Framework?Figure 2: Xenotix XSS Exploit FrameworkXenotix XSS Exploit Framework is a penetration testing tool to detect and exploit XSSvulnerabilities in Web Applications. This tool can inject codes into a webpage which arevulnerable to XSS. It is basically a payload list based XSS Scanner and XSS Exploitation kit. Itprovides a penetration tester the ability to test all the XSS payloads available in the payload listagainst a web application to test for XSS vulnerabilities. The tool supports both manual modeand automated time sharing based test modes. The exploitation framework in the tool includesa XSS encoder, a victim side XSS keystroke logger, an Executable Drive-by downloader and a XSSReverse Shell. These exploitation tools will help the penetration tester to create proof ofconcept attacks on vulnerable web applications during the creation of a penetration test report.Features of Xenotix XSS Exploit FrameworkThe features of Xenotix XSS Exploit Framework are  Built in XSS Payloads  Automated Testing  XSS Keylogger  XSS Executable Drive-by downloader  XSS Payload EncoderAjin Abraham Kerala Cyber Force Learn | Contribute | Share
  4. 4.  XSS Reverse Shell  XSS DDoSer  XSS Cookie ThiefBuilt in Payload ListIt is having an inbuilt XSS payload list of above 500+ XSS payloads. It includes HTML5compactable XSS injection payloads. Most of the XSS filters are implemented using StringReplace filter, htmlentities filter and htmlspecialcharacters filter. Most of these weakly designedfilters can be bypassed by specific XSS payloads present in the inbuilt payload list.Figure 3: XSS Payload count in different Vulnerability ScannersThe above chart shows the number of XSS Payloads in different XSS Scanning tools available inmarket. Xenotix XSS Exploit Framework got the world’s second largest XSS Payload list after IBMAppScan Security which is having 700 million payloads.Automatic XSS TestingThe tool is having an automatic test mode based on a time interval. You have to specify thetime interval according to the time taken by a webpage to load which depends on yourbandwidth. It will test all the payloads one by one after the specified time interval. With thisfeature automated XSS testing can be done. You don’t have to check all the 500+ payloadsmanually.Ajin Abraham Kerala Cyber Force Learn | Contribute | Share
  5. 5. XSS KeyloggerFigure 4: XSS Keylogger WorkingThe tool includes an inbuilt victim side Key logger which is implemented using JavaScript andPHP. PHP is served with the help of a portable PHP server named QuickPHP by Zach Saw. AJavaScript file is injected into the web application vulnerable to XSS and is presented to thevictim. The script captures the keystrokes made by the victim and send to a PHP file whichfurther write down the logs into a text file.XSS Executable Drive-by DownloaderFigure 5: Executable Drive-by Downloader WorkingAjin Abraham Kerala Cyber Force Learn | Contribute | Share
  6. 6. Java Drive-by download can be implemented with Xenotix XSS Exploit Framework. It allows theattacker to download and run a malicious executable file on the victim’s system without hisknowledge and permission. You have to specify the URL for the malicious executable and thenembed the drive-by implemented webpage into a XSS vulnerable page and serve your victim.When the victim view the injected page, the java applet client.jar will access the commandprompt and with the help of echo command, write down some scripts to a Visual basic scriptfile named winconfig.vbs in the temp directory(%temp%) and then the cmd.exe will startwinconfig.vbs. The winconfig.vbs will download the malicious executable specified by you in theURL to temp directory and rename it as update.exe and finally it will execute update.exe. Thedownloading and executing of the malicious executable happened without the knowledge andpermission of the victim.XSS Payload EncoderThe inbuilt Encoder will allow encoding into different forms to bypass various filters and WebApplication Firewalls. The encoder supports Base64 Encoding, URL Encoding, HEX Encoding,HTML Characters Conversion, Character Code Conversion and IP to Dword, Hex and Octalconversions.XSS Reverse ShellA XSS Reverse Shell can be implemented with Xenotix XSS Exploit Framework. This is madepossible with the help of Java Drive-By. The XSS vulnerable web application exploited with theinjectable scripts generated by XSS Reverse Shell when presented to a victim will initiate thedrive by download of a Reverse TCP connecting shell. After the drive-by download, the reverseshell is executed by the same method used in Java Drive-by.Figure 6: Establishing a reverse shell by exploiting XSS in web applications.Ajin Abraham Kerala Cyber Force Learn | Contribute | Share
  7. 7. The advantage of this method is that the reverse shell is downloaded and executed in thevictim’s system without his knowledge. But for the execution of reverse shell, it will pop up aUAC dialog requesting for the permission to run the executable. The tool is having an inbuiltListener that listens to the reverse shell. It is designed in a user friendly manner. All you have todo is to specify the reverse connection IP and port.XSS DDoSerFigure 7: Distributed Denial of Service Attack with Xenotix XSS Exploit FrameworkWith HTML 5 comes great power. We harvest the power of HTML 5 to abuse the Cross OriginResource Sharing (CORS) and WebSocket to implement a DDoS attack. WebSocket is a technologythat allow web applications to have a bidirectional channel to a URI endpoint. Sockets can send andreceive data to and from a web server and respond to opening or closing a WebSocket. TheXMLHttpRequest is a JavaScript object which is used to exchange data between a server and abowser behind the scene. This can be used for Cross Origin Resource Sharing (CORS). We canperform a combined and powerful DDoS attack by abusing these two technologies. This moduleabuses WebSocket and creates numerous socket connections with a target server to slow it down.Along with it by abusing CORS, the add-on create numerous fake GET requests to slow down thetarget server. When we send the first request to the target server and the response does not containthe Access-Control-Allow-Origin header with a suitable value then at times the browser refuses tosend more requests to the same URL. However this can be easily bypassed by making every requestunique by adding a non-existing query-string parameter with changing values.Ajin Abraham Kerala Cyber Force Learn | Contribute | Share
  8. 8. XSS Cookie ThiefFigure 8: XSS Cookie Thief ConsoleIt’s the traditional Cookie Stealer but a bit advanced and with real time cookie viewer. Thismodule allows the pentester to create cookie stealing POC.Testing a website with Xenotix XSS Exploit FrameworkTo test a website URL, say you suspect that the variable ‘term’ is vulnerable to XSS.Figure 9: Testing a Website with Xenotix XSS Exploit FrameworkAjin Abraham Kerala Cyber Force Learn | Contribute | Share
  9. 9. For testing against XSS in Xenotix XSS Exploit Framework you should specify the protocol, whichis http or https. Then give the website URL other than the suspected variable in the field afterthe protocol and specify the suspected variable in the Variable to test field. Now selectbetween Inbuilt XSS Payloads or Custom XSS payloads. You can select between Manual Modeand Auto Mode to start testing.Features for the Next BuildCurrent version of XSS Exploit Framework is based on Internet Explorer’s webpage renderingengine Trident. Since XSS got slightly different behavior in different Web Browsers, the supportfor the Gecko (Used by Mozilla Firefox) and Webkit (used by Chrome, Opera, and Safari)Rendering engines will be added up in the next build. The support for XSS in POST Parameterand XSS testing by modifying the headers will be included in the next build. XSS Proxy to tunnelthe victim-server traffic will be added in future builds. Automatic detection of parameters orvariables vulnerable against XSS and DOM Based XSS detection will be added up in next build.ConclusionXSS in popular website is a high security threat. Xenotix XSS Exploit Framework can be used bySecurity Analysts to perform penetration test on Web Applications against XSS vulnerability andto create POC with the inbuilt exploitation framework. Most of the security tools related to XSSare either XSS Scanners or XSS Exploitation tools. Xenotix XSS Exploitation Framework is thefirst of its kind to act both as an XSS vulnerability scanner as well as XSS exploitation framework.Bug bounty programs like Google Vulnerability Reward Program, Facebook Bounty, Paypal bugbounty etc. are there. So go for a XSS hunting and grab your bounty. Download:  Our Favorite XSS Filters/IDS and how to Attack Them - Eduardo Vela and David Lindsay.  Blackbox Reversing of XSS Filters - Alexander Sotirov.  Advanced Cross-Site-Scripting with Real-time Remote Attacker Control - Anton Rager  Bypass XSS filters - k3nz0  XSS for Fun and Profit - Lord Epsylon  Bypassing Web Application Firewalls (WAFs) - Ing. Pavol Lupták  Abusing Internet Explorer 8’s XSS Filters –Eduardo Vela Nava, David LindsayAjin Abraham Kerala Cyber Force Learn | Contribute | Share
  10. 10. Websites  OWASP’s Cross-site Scripting (XSS)  CGISecuritys Cross Site Scripting FAQ  Gunter Ollmanns XSS paper  PeterWs Cross Site Request Forgery (CSRF) Concept  CERT info on XSS  Remote Scripting with IFRAMEs  HTML5 Security Cheat sheet  Cross Site Scripting - XSS - The Underestimated Exploit Abraham Kerala Cyber Force Learn | Contribute | Share