CAPEC-267

Leverage Alternate Encoding
High
High
Draft
2014-06-23
00h00 +00:00
2022-09-29
00h00 +00:00
Alerte pour un CAPEC
Stay informed of any changes for a specific CAPEC.
Notifications manage

Descriptions CAPEC

An adversary leverages the possibility to encode potentially harmful input or content used by applications such that the applications are ineffective at validating this encoding standard.

Informations CAPEC

Execution Flow

1) Explore

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

Technique
  • 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.
2) Experiment

[Probe entry points to locate vulnerabilities] The adversary uses the entry points gathered in the "Explore" phase as a target list and injects various payloads using a variety of different types of encodings 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.

Technique
  • Try to use different encodings of content in order to bypass validation routines.

Prerequisites

The application's decoder accepts and interprets encoded characters. Data canonicalization, input filtering and validating is not done properly leaving the door open to harmful characters for the target host.

Skills Required

An adversary can inject different representation of a filtered character in a different encoding.
An adversary may craft subtle encoding of input data by using the knowledge that they have gathered about the target host.

Mitigations

Assume all input might use an improper representation. Use canonicalized data inside the application; all data must be converted into the representation used inside the application (UTF-8, UTF-16, etc.)
Assume all input is malicious. Create an allowlist that defines all valid input to the software system based on the requirements specifications. Input that does not match against the allowlist should not be permitted to enter into the system. Test your decoding process against malicious input.

Related Weaknesses

CWE-ID Weakness Name

CWE-173

Improper Handling of Alternate Encoding
The product does not properly handle when an input uses an alternate encoding that is valid for the control sphere to which the input is being sent.

CWE-172

Encoding Error
The product does not properly encode or decode the data, resulting in unexpected values.

CWE-180

Incorrect Behavior Order: Validate Before Canonicalize
The product validates input before it is canonicalized, which prevents the product from detecting data that becomes invalid after the canonicalization step.

CWE-181

Incorrect Behavior Order: Validate Before Filter
The product validates data before it has been filtered, which prevents the product from detecting data that becomes invalid after the filtering step.

CWE-73

External Control of File Name or Path
The product allows user input to control or influence paths or file names that are used in filesystem operations.

CWE-74

Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.

CWE-20

Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.

CWE-697

Incorrect Comparison
The product compares two entities in a security-relevant context, but the comparison is incorrect, which may lead to resultant weaknesses.

CWE-692

Incomplete Denylist to Cross-Site Scripting
The product uses a denylist-based protection mechanism to defend against XSS attacks, but the denylist is incomplete, allowing XSS variants to succeed.

References

REF-108

WASC Threat Classification 2.0
http://projects.webappsec.org/Improper-Input-Handling

REF-109

OWASP
http://www.owasp.org/index.php/Category:Encoding

REF-110

OWASP
https://owasp.org/www-project-proactive-controls/v3/en/c4-encode-escape-data

REF-69

OWASP Cheatsheets
https://www.owasp.org/www-community/xss-filter-evasion-cheatsheet

REF-112

Secure Programming for Linux and Unix HOWTO
David Wheeler.
http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/character-encoding.html

REF-113

Wikipedia
http://en.wikipedia.org/wiki/Character_encoding

REF-114

IDS Evasion with Unicode
Eric Hacker.
http://www.securityfocus.com/infocus/1232

Submission

Name Organization Date Date release
CAPEC Content Team The MITRE Corporation 2014-06-23 +00:00

Modifications

Name Organization Date Comment
CAPEC Content Team The MITRE Corporation 2017-01-09 +00:00 Updated Related_Attack_Patterns
CAPEC Content Team The MITRE Corporation 2018-07-31 +00:00 Updated Description Summary, Examples-Instances, References
CAPEC Content Team The MITRE Corporation 2019-04-04 +00:00 Updated Consequences
CAPEC Content Team The MITRE Corporation 2020-07-30 +00:00 Updated Mitigations, Skills_Required, Taxonomy_Mappings
CAPEC Content Team The MITRE Corporation 2020-12-17 +00:00 Updated References
CAPEC Content Team The MITRE Corporation 2021-06-24 +00:00 Updated Related_Weaknesses
CAPEC Content Team The MITRE Corporation 2022-02-22 +00:00 Updated Example_Instances, Execution_Flow, Skills_Required
CAPEC Content Team The MITRE Corporation 2022-09-29 +00:00 Updated Taxonomy_Mappings