| Attack Pattern ID | Pattern Abstraction: Detailed 32 |
| Typical Severity | High |
| Description | Summary A variant of cross-site scripting called "reflected" cross-site scripting, the HTTP Query Strings attack consists of passing a malicious script inside an otherwise valid HTTP request query string. This is of significant concern for sites that rely on dynamic, user-generated content such as bulletin boards, news sites, blogs, and web enabled administration GUIs. The malicious script may steal session data, browse history, probe files, or otherwise execute attacks on the client side. Once the attacker has prepared the malicious HTTP query it is sent to a victim user (perhaps by email, IM, or posted on an online forum), who clicks on a normal looking link that contains a poison query string. This technique can be made more effective through the use of services like http://tinyurl.com/, which makes very small URLs that will redirect to very large, complex ones. The victim will not know what he is really clicking on. Attack Execution Flow Explore Spider: Using an automated tool, an attacker follows all public links on a web site. He records all the links he finds. |
Attack Step Techniques |
|---|
| Description | Environments |
|---|
| Use a spidering tool to follow and record all links. Make special note of any links that include parameters in the URL. | env-Web | | Use a proxy tool to record all links visited during a manual traversal of the web application. Make special note of any links that include parameters in the URL. Manual traversal of this type is frequently necessary to identify forms that are GET method forms rather than POST forms. | env-Web |
|
Indicators of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c32s1i1 | Positive | URL parameters are used. | env-Web | | c32s1i2 | Inconclusive | No parameters appear on the URL. Even though none appear, the web application may still use them if they are provided. | env-Web | | c32s1i3 | Negative | Applications that have only static pages or that simply present information without accepting input are unlikely to be susceptible. | env-Web |
|
Outcome |
|---|
| ID | Type | Description |
|---|
| c32s1o1 | Success | A list of URLs, with their corresponding parameters is created by the attacker. |
|
Security Controls |
|---|
| ID | Type | Description |
|---|
| c32s1s1 | Detective | Monitor velocity of page fetching in web logs. Humans who view a page and select a link from it will click far slower and far less regularly than tools. Tools make requests very quickly and the requests are typically spaced apart regularly (e.g. 0.8 seconds between them). | | c32s1s2 | Detective | Create links on some pages that are visually hidden from web browsers. Using IFRAMES, images, or other HTML techniques, the links can be hidden from web browsing humans, but visible to spiders and programs. A request for the page, then, becomes a good predictor of an automated tool probing the application. | | c32s1s3 | Preventative | Actively monitor the application and either deny or redirect requests from origins that appear to be automated. |
Experiment Attempt variations on input parameters: Possibly using an automated tool, an attacker requests variations on the URLs he spidered before. He sends parameters that include variations of script. He records all the responses from the server that include unmodified versions of his script.. |
Attack Step Techniques |
|---|
| Description | Environments |
|---|
| Use a list of XSS probe strings to inject in parameters of known URLs | env-Web | | Use a proxy tool to record results of manual input of XSS probes in known URLs. | env-Web |
|
Indicators of Susceptibility
|
|---|
| ID | Type | Description | Environments |
|---|
| c32s2i1 | Positive | The output of pages includes some form of a URL parameter. E.g., ?error="File not Found" becomes "File not Found" in the title of the web page. | env-Web | | c32s2i2 | Positive | Input parameters become part of JavaScript, VBScript, or other script in a web page. | env-Web |
|
Outcomes |
|---|
| ID | Type | Description |
|---|
| c32s3o1 | Success | The attacker's cross-site scripting string is repeated back verbatim. | | c32s3o2 | Failure | All HTML-sensitive characters are consistently reencoded before being sent to the web browser. | | c32s3o3 | Inconclusive | Some sensitive characters are consistently encoded, but others are not. |
|
Security Controls |
|---|
| ID | Type | Description |
|---|
| c32s3s1 | Detective | Monitor input to web servers, application servers, and other HTTP infrastructure (e.g., load balancers). Alert on standard XSS probes. The majority of attackers use well known strings to check for vulnerabilities. Use the same vulnerability catalogs that hackers use. | | c32s3s2 | Preventative | Actively monitor the application and either deny or redirect requests from origins that appear to be generating XSS probes. |
Exploit Steal session IDs or other credentials: After determining that a parameter is vulnerable, the attacker creates exploit URLs and tries to get victims to click on them. The attack vector can be through email, web pages (guest books, forums) or through application specific mechanisms (e.g., application workflow pages or elements) |
Attack Step Techniques |
|---|
| Description | Environments |
|---|
| Develop malicious javascript that is loaded by the victim's browser and sends document information to the attacker. | env-Web | | Develop malicious javascript that takes commands from an attacker's server and then causes the browser to execute appropriately. | env-Web |
|
Outcomes |
|---|
| ID | Type | Description |
|---|
| c32s4o1 | Success | The attacker gets the user's cookies or other session identifiers. | | c32s4o2 | Success | The attacker gets the content of the page the user is viewing. | | c32s4o3 | Success | The attacker causes the user's browser to visit a page with malicious content. |
|
Security Controls |
|---|
| ID | Type | Description |
|---|
| c32s4s1 | Detective | Monitor server logs for scripting parameters. | | c32s4s2 | Detective | Monitor server logs for referrers. If users are being tricked into clicking XSS links through forums or other web postings, their web browsers will be providing Referer headers most of the time. These can help indicate that the actual request is illegitimate. |
|
| Attack Prerequisites | Target client software must allow scripting such as Javascript. Server software must allow display of remote generated HTML without sufficient input or output validation. |
| Typical Likelihood of Exploit |
High
|
| Methods of Attack | - Injection
- Protocol Manipulation
|
| Examples-Instances | Description http://user:host@example.com:8080/oradb<script>alert('Hi')</script>
Description Web applications that accept name value pairs in a HTTP Query string are inherently at risk to any value (or name for that matter) that an attacker would like to enter in the query string. This can be done manually via web browser or trivially scripted to post the query string to multiple sites. In the latter case, in the instance of many sites using similar infrastructure with predictable http queries being accepted and operated on (such as blogging software, Google applications, and so on), a single malicious payload can be scritped to target a wide variety of sites. Web 2.0 type sites like Technorati and del.icio.us rely on user generated content like tags to build http links that are displayed to other users. del.icio.us allows users to identify sites, tag them with metadata and provide URL, descriptions and more data. This data is then echoed back to any other web browser that is interested in the link. If the data is not validated by the del.icio.us site properly then an abritrary code can be added into the standard http string sent to del.icio.us by the attacker, for example formatted as normal content with a URL and description and tagged as Java, and available to be clicked on (and executed by) any user browsing for Java content that clicks on this trojaned content.
|
| Attacker Skill or Knowledge Required |
Low → To place malicious payload on server via HTTP
High → Exploiting any information gathered by HTTP Query on script host
|
| Resources Required |
Ability to send HTTP post to scripting host and collect output
|
| Solutions and Mitigations |
Design: Use browser technologies that do not allow client side scripting.
Design: Utilize strict type, character, and encoding enforcement
Design: Server side developers should not proxy content via XHR or other means, if a http proxy for remote content is setup on the server side, the client's browser has no way of discerning where the data is originating from.
Implementation: Ensure all content that is delivered to client is sanitized against an acceptable content specification.
Implementation: Perform input validation for all remote content, including remote and user-generated content
Implementation: Perform output validation for all remote content.
Implementation: Disable scripting languages such as Javascript in browser
Implementation: Session tokens for specific host
Implementation: Patching software. There are many attack vectors for XSS on the client side and the server side. Many vulnerabilities are fixed in service packs for browser, web servers, and plug in technologies, staying current on patch release that deal with XSS countermeasures mitigates this.
Implementation: Privileges are constrained, if a script is loaded, ensure system runs in chroot jail or other limited authority mode
|
| Attack Motivation-Consequences | - Information Leakage
- Run Arbitrary Code
|
| Context Description | “Attack Pattern: HTTP Query Strings A query string takes variable = value pairs. These are passed to the target executable or script designated in the request. A variable can be injected with script. The script is processed and stored in a way that is later visible to a user." [Hoglund and McGraw 04]
|
| Injection Vector |
Script delivered through standard web server, such as a web server with user-generated content.
|
| Payload |
HTTP Request Query String
|
| Activation Zone |
Client web browser where script is executed
|
| Payload Activation Impact |
Client web browser may be used to steal session data, passwords, cookies, and other tokens.
|
| Related Weaknesses | | CWE-ID | Weakness Name | Weakness Relationship Type |
|---|
| 79 | Failure to Sanitize Directives in a Web Page (aka 'Cross-site scripting' (XSS)) | Targeted | | 84 | Failure to Resolve Encoded URI Schemes in a Web Page | Targeted | | 85 | Doubled Character XSS Manipulations | Targeted | | 20 | Insufficient Input Validation | Targeted | | 86 | Invalid Characters in Identifiers | Targeted |
|
| Purpose | Exploitation |
| CIA Impact | | Confidentiality Impact | Integrity Impact | Availability Impact |
|---|
| High | High | Low |
|
| Technical Context | | Architectural Paradigm | Framework | Platform | Language |
|---|
| Client-Server | All | All | All |
|
| References |
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.
|
| Source | | Submission(s) |
|---|
| Submitter | Organization | Date | Comment |
|---|
| G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. | Cigital, Inc | 2007-01-01 | |
| Modification(s) |
|---|
| Modifier | Organization | Date | Comment |
|---|
| Gunnar Peterson | Cigital, Inc | 2007-02-28 | Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software" | | Sean Barnum | Cigital, Inc | 2007-03-09 | Review and revise | | Richard Struse | VOXEM, Inc | 2007-03-26 | Review and feedback leading to changes in Name and Examples | | Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback |
|