Variant · Low-Medium

CWE-647: Use of Non-Canonical URL Paths for Authorization Decisions

The product defines policy namespaces and makes authorization decisions based on the assumption that a URL is canonical. This can allow a non-canonical URL to bypass the authorization.

CWE-647 · Variant Level ·2 Mitigations

Description

The product defines policy namespaces and makes authorization decisions based on the assumption that a URL is canonical. This can allow a non-canonical URL to bypass the authorization.

If an application defines policy namespaces and makes authorization decisions based on the URL, but it does not require or convert to a canonical URL before making the authorization decision, then it opens the application to attack. For example, if the application only wants to allow access to http://www.example.com/mypage, then the attacker might be able to bypass this restriction using equivalent URLs such as: Therefore it is important to specify access control policy that is based on the path information in some canonical form with all alternate encodings rejected (which can be accomplished by a default deny rule).

Potential Impact

Access Control

Bypass Protection Mechanism

Confidentiality

Read Files or Directories

Mitigations & Prevention

Architecture and Design

Make access control policy based on path information in canonical form. Use very restrictive regular expressions to validate that the path is in the expected form.

Architecture and Design

Reject all alternate path encodings that are not in the expected canonical form.

Detection Methods

  • Automated Static Analysis High — Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then sea

Taxonomy Mappings

  • The CERT Oracle Secure Coding Standard for Java (2011): IDS02-J — Canonicalize path names before validating them

Frequently Asked Questions

What is CWE-647?

CWE-647 (Use of Non-Canonical URL Paths for Authorization Decisions) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Variant-level weakness. The product defines policy namespaces and makes authorization decisions based on the assumption that a URL is canonical. This can allow a non-canonical URL to bypass the authorization.

How can CWE-647 be exploited?

Attackers can exploit CWE-647 (Use of Non-Canonical URL Paths for Authorization Decisions) to bypass protection mechanism. This weakness is typically introduced during the Implementation, Operation phase of software development.

How do I prevent CWE-647?

Key mitigations include: Make access control policy based on path information in canonical form. Use very restrictive regular expressions to validate that the path is in the expected form.

What is the severity of CWE-647?

CWE-647 is classified as a Variant-level weakness (Low-Medium abstraction). Its actual severity depends on the specific context and how the weakness manifests in your application.