Dark Mode

Settings

Capec-78 Detail

Using Escaped Slashes in Alternate Encoding

Detailed Software Likelihood: High Typical Severity: High

Parents: 267

Threats: T62 T290 T291

Description

This attack targets the use of the backslash in alternate encoding. An adversary can provide a backslash as a leading character and causes a parser to believe that the next character is special. This is called an escape. By using that trick, the adversary tries to exploit alternate ways to encode the same character which leads to filter problems and opens avenues to attack.

Not present

Explore
  1. Survey the application for user-controllable inputs: Using a browser, an automated tool or by inspecting the application, an adversary records all entry points to the application.

  2. Techniques
    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.
    Use a proxy tool to record all user input entry points visited during a manual traversal of the web application.
    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.
    Manually inspect the application to find entry points.
Experiment
  1. Probe entry points to locate vulnerabilities: The adversary uses the entry points gathered in the "Explore" phase as a target list and attempts to escape multiple different special characters using a backslash.

  2. Techniques
    Escape a special character with a backslash to bypass input validation.
    Try different encodings of both the backslash and the special character to see if this bypasses input validation
Exploit
  1. Manipulate input: Once the adversary determines how to bypass filters that filter out special characters using an escaped slash, they will manipulate the user input in a way that is not intended by the application.

  1. The application accepts the backlash character as escape character.
  2. The application server does incomplete input data decoding, filtering and validation.

Not present

Low Medium
The adversary can naively try backslash character and discover that the target host uses it as escape character.
The adversary may need deep understanding of the host target in order to exploit the vulnerability. The adversary may also use automated tools to probe for this vulnerability.
Integrity Availability Authorization Access Control Confidentiality
Execute Unauthorized Commands (Run Arbitrary Code) Resource Consumption (Denial of Service) Bypass Protection Mechanism Bypass Protection Mechanism Read Data
Execute Unauthorized Commands (Run Arbitrary Code) Execute Unauthorized Commands (Run Arbitrary Code)
Bypass Protection Mechanism
  1. For example, the byte pair \0 might result in a single zero byte (a NULL) being sent. Another example is \t, which is sometimes converted into a tab character. There is often an equivalent encoding between the back slash and the escaped back slash. This means that \/ results in a single forward slash. A single forward slash also results in a single forward slash. The encoding looks like this: / yields /\/ yields /
  2. An attack leveraging escaped slashes in slternate encodings is very simple. If you believe the target may be filtering the slash, attempt to supply \/ and see what happens. Example command strings to try out include CWD ..\/..\/..\/..\/winnt which converts in many cases to CWD ../../../../winnt To probe for this kind of problem, a small C program that uses string output routines can be very useful. File system calls make excellent testing fodder. The simple snippet int main(int argc, char argv[]){puts("\/ \\\ \? \\. \| ");return 0; } produces the output / \ ? . | Clearly, the back slash is ignored, and thus we have hit on a number of alternative encodings to experiment with. Given our previous example, we can extend the attack to include other possibilities: CWD ..\?\?\?\?\/..\/..\/..\/winntCWD \\.\\.\/\\.\\.\/\\.\\.\/\\.\\.\/winntCWD ..\|\|\|\|\/..\/..\/..\/winnt