CAPEC-78 - Using Escaped Slashes in Alternate Encoding

This attack targets the use of the backslash in alternate encoding. An attacker 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 attacker tries to exploit alternate ways to encode the same character which leads to filter problems and opens avenues to attack.






  • Attack Methods 3
  • Injection
  • Protocol Manipulation
  • API Abuse
  • Purposes 2
  • Penetration
  • Exploitation
  • Sec Principles 1
  • Reluctance to Trust
  • Scopes 4
  • Read files or directories
  • Read application data
  • Confidentiality
  • DoS: resource consumption (memory)
  • Availability
  • Execute unauthorized code or commands
  • Availability
  • Integrity
  • Confidentiality
  • Bypass protection mechanism
  • Authorization
  • Access_Control
  • Confidentiality

Low level: The attacker can naively try backslash character and discover that the target host uses it as escape character.

Medium level: The attacker may need deep understanding of the host target in order to exploit the vulnerability. The attacker may also use automated tools to probe for this vulnerability.

The application accepts the backlash character as escape character.

The application server does incomplete input data decoding, filtering and validation.

An attacker can manually inject backslash characters in the data sent to the target host and observe the results of the request.

The attacker may also run scripts or automated tools against the target host to uncover a vulnerability related to the use of the backslash character.

Never trust user-supplied input.

Step 1 -

The attacker can send input data to the host target (e.g., via http request or command line request.

Step 2 -

The attacker craft malicious input data which includes escaped slashes. The attacker may need multiple attempts before finding a successful combination..

All client-supplied input must be validated through filtering and all output must be properly escaped.

Verify that the user-supplied data does not use backslash character to escape malicious characters.

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.

Be aware of the threat of alternative method of data encoding.

Regular expressions can be used to filter out backslash. Make sure you decode before filtering and validating the untrusted input data.

In the case of path traversals, use the principle of least privilege when determining access rights to file systems. Do not allow users to access directories/files that they should not access.

Any security checks should occur after the data has been decoded and validated as correct data format. Do not repeat decoding process, if bad character are left after decoding process, treat the data as suspicious, and fail the validation process.

Avoid making decisions based on names of resources (e.g. files) if those resources can have alternate names.