Home > Ask the Security Channel Experts > Information Security Threats and Countermeasures Questions & Answers > Cross-site scripting vulnerability penetration testing
Ask The Security Channel Expert: Questions & Answers
EMAIL THIS

Cross-site scripting vulnerability penetration testing

Retired Expert - Russell Dean Vines EXPERT RESPONSE FROM: Retired Expert - Russell Dean Vines

Pose a Question
Other Security Channel Categories
Meet all Security Channel Experts
Become an Expert for this site


Security Channel Update
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 04 April 2007
I would like to know how to test a Web application for cross-site scripting (XSS) vulnerabilities, how to perform penetration testing for such vulnerabilities and what type of code would exhibit such threats.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Information Security Threats and Countermeasures
Security for mobile broadband
Understanding smurf attacks
What are the network security risks of streaming video?
Spyware removal from computers
Malware removal without antivirus software
Threat matrix and risk analysis resources
Blade server security on a storage area network (SAN)
Blade server security hardware advice
When should automated penetration testing be supplemented with manual pen testing?
Protecting your customer's Windows 2003 server from hackers

Pen Testing Methodology
Penetration testing 101: How to offer pen test services
Penetration testing reconnaissance -- Footprinting, scanning and enumerating
Penetration testing -- Big bad bugs
Penetration testing -- Securing wireless access points
Penetration testing -- Social engineering, IDS and honey pots
VPN penetration testing
Secure the domain controller with a penetration test
Storage penetration testing
When should automated penetration testing be supplemented with manual pen testing?
Web application penetration testing: Best practices

Web Threats
SenSage tapped to participate in McAfee's Sales Teaming Program
Bot and botnet 101
Security for mobile broadband
Spyware removal from computers
Filter URLs to reduce information security threats
Protecting your customer's Windows 2003 server from hackers
Super Bowl Trojan infects dozens of sites
Debate: Is malware or lost hardware the greater driver for mobile security?
Code mutation, fragmentation and concealment: Hacker techniques to watch
Spam botnets get smarter, target victims using personal data revealed on social networking sites

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


Dynamic Web sites suffer from a threat that static Web sites don't, called cross-site scripting (XSS). An XSS vulnerability is created by the failure of a Web-based application to validate user-supplied input before returning it to the client system.

XSS attacks usually come in the form of embedded JavaScript; however, any embedded active content is a potential source of danger, including ActiveX, VBscript and Flash.

The XSS flaw exploit can cause serious problems -- including accessing the user's session cookie -- thereby allowing an attacker to hijack the session and take over the account. It can also install malware, redirect the browser and disclose sensitive information.

XSS has been around for quite awhile. A simple code example of an XSS vulnerability is as follows:

  1. Sample web request code could be:

  2. The HTML returned by the server after making this request includes the code:

    "<h1>Section Title</h1>"

  3. The user input passed to the "title" query string parameter was probably placed in a string variable and inserted by the Web application into an <h1> tag.

By providing the input the attacker controls the HTML. If the site is not filtering input server-side, an attacker could inject code by breaking out of the <h1> tag, such as:

Therefore, the HTML output from the attacker's input would look like:

XSS flaws can be difficult to identify and remove from a web application. The best way to find flaws is to perform a security review of the code and search for all places where input from an HTTP request could possibly make its way into the HTML output. Note that a variety of different HTML tags can be used to transmit a malicious JavaScript.

As far as testing for XSS vulnerabilities, automated scripts can be used, but the testing is most typically performed manually. Microsoft has a good piece on how to test for XSS using various tools and a reporting methodology.

Nessus, Nikto and some other available tools can help scan a website for these flaws, but can only scratch the surface. If one part of a website is vulnerable, there is a high likelihood that there are other problems as well.

The best way to protect a web application from XSS attacks is ensure that your application performs validation of all headers, cookies, query strings, form fields, and hidden fields (i.e., all parameters) against a rigorous specification of what should be allowed.

To learn more about penetration testing, visit the Penetration Testing Project Guide.




Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsITKnowledge ExchangeTipsMultimediaWhite PapersBlogsEvents
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2006 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts