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.
Last updated
Overview
CWE-173 (Improper Handling of Alternate Encoding) is a variant-level software weakness catalogued by MITRE in the Common Weakness Enumeration (CWE). It describes a recurring type of mistake that can lead to exploitable security vulnerabilities.
Real-world CVEs
5 recorded CVEs are caused by CWE-173 (Improper Handling of Alternate Encoding). The highest-severity and most recent are shown first. 2 new CWE-173 CVEs have been recorded so far in 2026.
- CVE-2026-10050
Digest authentication lossy encoding
High · CVSS 8.7 · EPSS 40th2026-08-04 - CVE-2026-19611
Wildfly-elytron: org.wildfly.security/wildfly-elytron-password-impl: wildfly-elytron: password keyspace reduction via nfkc fullwidth folding
High · CVSS 7.4 · EPSS 27th2026-08-20 - CVE-2023-26303High · CVSS 7.1 · EPSS 13th2023-02-22
- CVE-2023-26302
markdown-it-py CLI crash on invalid UTF-8 characters
High · CVSS 7.1 · EPSS 13th2023-02-22 - CVE-2024-54158Medium · CVSS 5.3 · EPSS 23th2024-12-04
Common consequences
What can happen when CWE-173 is exploited.
Bypass Protection Mechanism
Affects: Access Control
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
How to prevent it
Practical mitigations for CWE-173, grouped by where in the lifecycle they apply.
Avoid making decisions based on names of resources (e.g. files) if those resources can have alternate names.
Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
Use and specify an output encoding that can be handled by the downstream component that is reading the output. Common encodings include ISO-8859-1, UTF-7, and UTF-8. When an encoding is not specified, a downstream component may choose a different encoding, either by assuming a default encoding or automatically inferring which encoding is being used, which can be erroneous. When the encodings are inconsistent, the downstream component might treat some character or byte sequences as special, even if they are not special in the original encoding. Attackers might then be able to exploit this discrepancy and conduct injection attacks; they even might be able to bypass protection mechanisms that assume the original encoding is also being used by the downstream component.
Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.
Terminology & mappings
Mapped taxonomies
- PLOVER: Alternate Encoding
Attack patterns
CAPEC attack patterns that exploit this weakness.
- CAPEC-120: Double Encoding
- CAPEC-267: Leverage Alternate Encoding
- CAPEC-3: Using Leading 'Ghost' Character Sequences to Bypass Input Filters
- CAPEC-4: Using Alternative IP Address Encodings
- CAPEC-52: Embedding NULL Bytes
- CAPEC-53: Postfix, Null Terminate, and Backslash
- CAPEC-64: Using Slashes and URL Encoding Combined to Bypass Validation Logic
- CAPEC-71: Using Unicode Encoding to Bypass Validation Logic
- CAPEC-72: URL Encoding
- CAPEC-78: Using Escaped Slashes in Alternate Encoding
- CAPEC-79: Using Slashes in Alternate Encoding
- CAPEC-80: Using UTF-8 Encoding to Bypass Validation Logic
Frequently asked questions
Common questions about CWE-173.
- What is CWE-173?
- 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.
- What CVEs are caused by CWE-173?
- 5 recorded CVEs are attributed to CWE-173, including CVE-2026-10050, CVE-2026-19611, CVE-2023-26303.
- How do you prevent CWE-173?
- Avoid making decisions based on names of resources (e.g. files) if those resources can have alternate names.
- What are the consequences of CWE-173?
- Exploiting CWE-173 can lead to: Bypass Protection Mechanism.
- Is CWE-173 actively exploited?
- 5 recorded CVEs are caused by CWE-173; none are currently in CISA's KEV catalog of actively exploited flaws.
References
- MITRE CWE definition (CWE-173) (opens in a new tab)
- CWE-173 vulnerabilities on NVD (opens in a new tab)
- Learn: What is a CWE?
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Stay ahead of CWE-173
Get alerted the moment a new CWE-173 vulnerability affects your stack, with AI-written analysis, severity context, and remediation guidance.