---
title: "CWE-180: Incorrect Behavior Order: Validate Before Canonicalize"
url: https://radicalnotion.ai/cwe/cwe-180
type: cwe
description: "The product validates input before it is canonicalized."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-180: Incorrect Behavior Order: Validate Before Canonicalize

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 43
- **Of those, in CISA KEV:** 0
- **New in 2026:** 37
- **CWE catalog version:** 4.21

## Description

The product validates input before it is canonicalized.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** Python (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Access Control | Bypass Protection Mechanism | This prevents the product from detecting data that becomes invalid after the canonicalization step. An attacker can bypass the validation and launch attacks that expose weaknesses that would otherwise be prevented, such as injection. |

## Potential mitigations

### Implementation (Input Validation)

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.

## Demonstrative examples

### Example 1

The following code attempts to validate a given input path by checking it against an allowlist and then return the canonical path. In this specific case, the path is considered valid if it starts with the string "/safe\_dir/".

Bad code:

```java
String path = getInputPath();
if (path.startsWith("/safe_dir/"))
{
    File f = new File(path);
    return f.getCanonicalPath();
}
```

Good code:

```java
String path = getInputPath();
File f = new File(path);
if (f.getCanonicalPath().startsWith("/safe_dir/"))
{
    return f.getCanonicalPath();
}
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2002-0433 | List files in web server using "\*.ext" |
| CVE-2003-0332 | Product modifies the first two letters of a filename extension after performing a security check, which allows remote attackers to bypass authentication via a filename with a .ats extension instead of a .hts extension. |
| CVE-2002-0802 | Database consumes an extra character when processing a character that cannot be converted, which could remove an escape character from the query and make the application subject to SQL injection attacks. |
| CVE-2000-0191 | Overlaps "fakechild/../realchild" |
| CVE-2004-2363 | Product checks URI for "\<" and other literal characters, but does it before hex decoding the URI, so "%3E" and other sequences are allowed. |

## Real CVEs with this weakness (sample of 12 of 43)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-34475 | Varnish Cache: Varnish Cache and Varnish Enterprise: Cache poisoning and authentication bypass via unchecked URL handling | critical | 9.8 | - | No | 2026-03-27 |
| CVE-2024-24790 | Unexpected behavior from Is methods for IPv4-mapped IPv6 addresses in net/netip | critical | 9.8 | - | No | 2024-06-05 |
| CVE-2022-26136 | - | critical | 9.8 | - | No | 2022-07-20 |
| CVE-2026-126837 | Attacker able to redirect a client's database traffic to a host they control via special characters in an SRV target, bypassing the SRV parent-domain guard | critical | 9.1 | - | No | 2026-11-12 |
| CVE-2026-73420 | NextAuth.js: Email normalizer validates the address before Unicode normalization, allowing a homoglyph @ bypass | critical | 9.1 | - | No | 2026-08-13 |
| CVE-2026-24895 | FrankenPHP affected by Path Confusion via Unicode casing in CGI path splitting allows execution of arbitrary files | high | 8.9 | - | No | 2026-02-12 |
| CVE-2022-26137 | - | high | 8.8 | - | No | 2022-07-20 |
| CVE-2026-82481 | - | high | 8.7 | - | No | 2026-08-29 |
| CVE-2026-52747 | ModSecurity: Multipart form-data parser silently strips embedded line breaks from form-field values, enabling request-body inspection bypass | high | 8.6 | - | No | 2026-07-10 |
| CVE-2026-48721 | Warp: Env-var prefixes can lead to denylisted command autoexecution | high | 8.6 | - | No | 2026-06-24 |
| CVE-2026-39364 | Vite has a \`server.fs.deny\` bypass with queries | high | 8.2 | - | No | 2026-04-07 |
| CVE-2026-69246 | Guzzle: Noncanonical host can bypass host-based checks | high | 7.2 | - | No | 2026-08-03 |

## Related attack patterns (CAPEC)

- [CAPEC-267](https://radicalnotion.ai/capec/capec-267): Leverage Alternate Encoding
- [CAPEC-3](https://radicalnotion.ai/capec/capec-3): Using Leading 'Ghost' Character Sequences to Bypass Input Filters
- [CAPEC-71](https://radicalnotion.ai/capec/capec-71): Using Unicode Encoding to Bypass Validation Logic
- [CAPEC-78](https://radicalnotion.ai/capec/capec-78): Using Escaped Slashes in Alternate Encoding
- [CAPEC-79](https://radicalnotion.ai/capec/capec-79): Using Slashes in Alternate Encoding
- [CAPEC-80](https://radicalnotion.ai/capec/capec-80): Using UTF-8 Encoding to Bypass Validation Logic

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-179](https://radicalnotion.ai/cwe/cwe-179) | Incorrect Behavior Order: Early Validation |
| Child | [CWE-647](https://radicalnotion.ai/cwe/cwe-647) | Use of Non-Canonical URL Paths for Authorization Decisions |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Validate-Before-Canonicalize | - | - |
| OWASP Top Ten 2004 | Unvalidated Input | A1 | CWE More Specific |
| The CERT Oracle Secure Coding Standard for Java (2011) | Normalize strings before validating them | IDS01-J | Exact |
| SEI CERT Oracle Coding Standard for Java | Normalize strings before validating them | IDS01-J | Exact |
| OpenSSF Secure Coding Guide for Python | Canonicalize Input Before Validating | pyscg-0044 | - |

## Frequently asked questions

### What is CWE-180?

The product validates input before it is canonicalized.

### What CVEs are caused by CWE-180?

43 recorded CVEs are attributed to CWE-180, including CVE-2026-34475, CVE-2024-24790 and CVE-2022-26136.

### Is CWE-180 part of the OWASP Top 10?

CWE-180 maps to OWASP Top Ten 2004: Unvalidated Input (A1) in the OWASP security taxonomy.

### How do you prevent CWE-180?

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.

### What are the consequences of CWE-180?

Exploiting CWE-180 can lead to: Bypass Protection Mechanism.

### Is CWE-180 actively exploited?

43 recorded CVEs are caused by CWE-180; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/180.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-180). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
