Using Unicode Encoding to Bypass Validation Logic |
Attack Pattern ID: 71 (Detailed Attack Pattern Completeness: Complete) | Typical Severity: High | Status: Draft |
Summary
An attacker may provide a unicode string to a system component that is not unicode aware and use that to circumvent the filter or cause the classifying mechanism to fail to properly understanding the request. That may allow the attacker to slip malicious data past the content filter and/or possibly cause the application to route the request incorrectly.
Attack Execution Flow
Survey the application for user-controllable inputs:
Using a browser or an automated tool, an attacker follows all public links and actions on a web site. He records all the links, the forms, the resources accessed and all other potential entry-points for the web application.
Attack Step Techniques
ID Attack Step Technique Description Environments 1 Use a spidering tool to follow and record all links and analyze the web pages to find entry points. Make special note of any links that include parameters in the URL.
env-Web2 Use a proxy tool to record all user input entry points visited during a manual traversal of the web application.
env-Web3 Use a browser to manually explore the website and analyze how it is constructed. Many browsers' plugins are available to facilitate the analysis or automate the discovery.
env-WebIndicators
ID type Indicator Description Environments 1 Positive Inputs are used by the application or the browser (DOM)
env-Web2 Inconclusive Using URL rewriting, parameters may be part of the URL path.
env-Web3 Inconclusive No parameters appear to be used on the current page. Even though none appear, the web application may still use them if they are provided.
env-Web4 Negative Applications that have only static pages or that simply present information without accepting input are unlikely to be susceptible.
env-WebOutcomes
ID type Outcome Description 1 Success A list of URLs, with their corresponding parameters (POST, GET, COOKIE, etc.) is created by the attacker.2 Success A list of application user interface entry fields is created by the attacker.3 Success A list of resources accessed by the application is created by the attacker.Security Controls
ID type Security Control Description 1 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).2 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.3 Preventative Use CAPTCHA to prevent the use of the application by an automated tool.4 Preventative Actively monitor the application and either deny or redirect requests from origins that appear to be automated.
Probe entry points to locate vulnerabilities:
The attacker uses the entry points gathered in the "Explore" phase as a target list and injects various Unicode encoded payloads to determine if an entry point actually represents a vulnerability with insufficient validation logic and to characterize the extent to which the vulnerability can be exploited.
Attack Step Techniques
ID Attack Step Technique Description Environments 1 Try to use Unicode encoding of content in Scripts in order to bypass validation routines.
env-Web2 Try to use Unicode encoding of content in HTML in order to bypass validation routines.
env-Web3 Try to use Unicode encoding of content in CSS in order to bypass validation routines.
env-WebIndicators
ID type Indicator Description Environments 1 Positive The application accepts user-controllable input.
env-WebOutcomes
ID type Outcome Description 1 Success The attacker's Unicode encoded payload is processed and acted on by the application without filtering or transcoding2 Failure The application decodes the charset and filters the inputs.Security Controls
ID type Security Control Description 1 Preventative Implement input validation routines that filter or transcode for Unicode content.2 Preventative Specify the charset of the HTTP transaction/content.3 Detective Monitor inputs to web servers. Alert on unusual charset and/or characters.4 Preventative Actively monitor the application and either deny or redirect requests from origins that appear to be attack attempts.
Description
A very common technique for a unicode attack involves traversing directories looking for interesting files. An example of this idea applied to the Web is
In this case, the attacker is attempting to traverse to a directory that is not supposed to be part of standard Web services. The trick is fairly obvious, so many Web servers and scripts prevent it. However, using alternate encoding tricks, an attacker may be able to get around badly implemented request filters.
In October 2000, a hacker publicly revealed that Microsoft's IIS server suffered from a variation of this problem. In the case of IIS, all the attacker had to do was provide alternate encodings for the dots and/or slashes found in a classic attack. The unicode translations are
Using this conversion, the previously displayed URL can be encoded as
Related Vulnerabilities
CVE-2000-0884
Skill or Knowledge Level: Medium
An attacker needs to understand unicode encodings and have an idea (or be able to find out) what system components may not be unicode aware.
Ensure that the system is Unicode aware and can properly process Unicode data. Do not make an assumption that data will be in ASCII.
Ensure that filtering or input validation is applied to canonical data.
Assume all input is malicious. Create a white list that defines all valid input to the software system based on the requirements specifications. Input that does not match against the white list should not be permitted to enter into the system.
- Privilege Escalation
- Run Arbitrary Code
- Data Modification
- Denial of Service
CWE-ID | Weakness Name | Weakness Relationship Type |
---|---|---|
176 | Failure to Handle Unicode Encoding | Targeted |
171 | Cleansing, Canonicalization, and Comparison Errors | Targeted |
179 | Incorrect Behavior Order: Early Validation | Targeted |
180 | Incorrect Behavior Order: Validate Before Canonicalize | Targeted |
173 | Failure to Handle Alternate Encoding | Targeted |
172 | Encoding Error | Targeted |
184 | Incomplete Blacklist | Targeted |
183 | Permissive Whitelist | Targeted |
74 | Failure to Sanitize Data into a Different Plane ('Injection') | Targeted |
20 | Improper Input Validation | Targeted |
697 | Insufficient Comparison | Targeted |
692 | Incomplete Blacklist to Cross-Site Scripting | Targeted |
Nature | Type | ID | Name | Description | View(s) this relationship pertains to![]() |
---|---|---|---|---|---|
PeerOf | ![]() | 43 | Exploiting Multiple Input Interpretation Layers | Mechanism of Attack1000 | |
PeerOf | ![]() | 64 | Using Slashes and URL Encoding Combined to Bypass Validation Logic | Mechanism of Attack1000 | |
PeerOf | ![]() | 72 | URL Encoding | Mechanism of Attack1000 | |
PeerOf | ![]() | 79 | Using Slashes in Alternate Encoding | Mechanism of Attack1000 | |
ChildOf | ![]() | 267 | Leverage Alternate Encoding | Mechanism of Attack (primary)1000 | |
PeerOf | ![]() | 78 | Using Escaped Slashes in Alternate Encoding | Mechanism of Attack1000 | |
PeerOf | ![]() | 80 | Using UTF-8 Encoding to Bypass Validation Logic | Mechanism of Attack1000 |
Canonicalize data prior to performing any validation or filtering on it. Be aware of alternate encodings.
CWE - Input Validation
Submissions | ||||
---|---|---|---|---|
Submitter | Organization | Date | ||
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004. | Cigital, Inc | 2007-03-01 |
Modifications | |||||
---|---|---|---|---|---|
Modifier | Organization | Date | Comments | ||
Eugene Lebanidze | Cigital, Inc | 2007-02-26 | Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software" | ||
Sean Barnum | Cigital, Inc | 2007-03-05 | Review and revise | ||
Richard Struse | VOXEM, Inc | 2007-03-26 | Review and feedback leading to changes in Name, Related Attack Patterns | ||
Sean Barnum | Cigital, Inc | 2007-04-13 | Modified pattern content according to review and feedback | ||
Romain Gaucher | Cigital, Inc | 2009-02-10 | Created draft content for detailed description | ||
Sean Barnum | Cigital Federal, Inc | 2009-04-13 | Reviewed and revised content for detailed description |