CWE-178: Improper Handling of Case Sensitivity (Base)

Description: The product does not properly account for differences in case sensitivity when accessing or determining the properties of a resource, leading to inconsistent results.

Extended Description: Improperly handled case sensitive data can lead to several possible consequences, including: case-insensitive passwords reducing the size of the key space, making brute force attacks easier bypassing filters or access controls using alternate names multiple interpretation errors using alternate names.



Applicable Platforms: ::LANGUAGE CLASS:Not Language-Specific:LANGUAGE PREVALENCE:Undetermined::

Modes of Introduction: ::PHASE:Implementation::



Common Consequences: ::SCOPE:Access Control:IMPACT:Bypass Protection Mechanism::


Potential Mitigations: ::PHASE:Architecture and Design:STRATEGY:Input Validation:DESCRIPTION:Avoid making decisions based on names of resources (e.g. files) if those resources can have alternate names.::PHASE:Implementation:STRATEGY:Input Validation:DESCRIPTION: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.::PHASE:Implementation:STRATEGY:Input Validation:DESCRIPTION: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.::

Observed Examples: ::REFERENCE:CVE-2000-0499:DESCRIPTION:Application server allows attackers to bypass execution of a jsp page and read the source code using an upper case JSP extension in the request.:LINK:https://www.cve.org/CVERecord?id=CVE-2000-0499::REFERENCE:CVE-2000-0497:DESCRIPTION:The server is case sensitive, so filetype handlers treat .jsp and .JSP as different extensions. JSP source code may be read because .JSP defaults to the filetype text.:LINK:https://www.cve.org/CVERecord?id=CVE-2000-0497::REFERENCE:CVE-2000-0498:DESCRIPTION:The server is case sensitive, so filetype handlers treat .jsp and .JSP as different extensions. JSP source code may be read because .JSP defaults to the filetype text.:LINK:https://www.cve.org/CVERecord?id=CVE-2000-0498::REFERENCE:CVE-2001-0766:DESCRIPTION:A URL that contains some characters whose case is not matched by the server's filters may bypass access restrictions because the case-insensitive file system will then handle the request after it bypasses the case sensitive filter.:LINK:https://www.cve.org/CVERecord?id=CVE-2001-0766::REFERENCE:CVE-2001-0795:DESCRIPTION:Server allows remote attackers to obtain source code of CGI scripts via URLs that contain MS-DOS conventions such as (1) upper case letters or (2) 8.3 file names.:LINK:https://www.cve.org/CVERecord?id=CVE-2001-0795::REFERENCE:CVE-2001-1238:DESCRIPTION:Task Manager does not allow local users to end processes with uppercase letters named (1) winlogon.exe, (2) csrss.exe, (3) smss.exe and (4) services.exe via the Process tab which could allow local users to install Trojan horses that cannot be stopped.:LINK:https://www.cve.org/CVERecord?id=CVE-2001-1238::REFERENCE:CVE-2003-0411:DESCRIPTION:chain: Code was ported from a case-sensitive Unix platform to a case-insensitive Windows platform where filetype handlers treat .jsp and .JSP as different extensions. JSP source code may be read because .JSP defaults to the filetype text.:LINK:https://www.cve.org/CVERecord?id=CVE-2003-0411::REFERENCE:CVE-2002-0485:DESCRIPTION:Leads to interpretation error:LINK:https://www.cve.org/CVERecord?id=CVE-2002-0485::REFERENCE:CVE-1999-0239:DESCRIPTION:Directories may be listed because lower case web requests are not properly handled by the server.:LINK:https://www.cve.org/CVERecord?id=CVE-1999-0239::REFERENCE:CVE-2005-0269:DESCRIPTION:File extension check in forum software only verifies extensions that contain all lowercase letters, which allows remote attackers to upload arbitrary files via file extensions that include uppercase letters.:LINK:https://www.cve.org/CVERecord?id=CVE-2005-0269::REFERENCE:CVE-2004-1083:DESCRIPTION:Web server restricts access to files in a case sensitive manner, but the filesystem accesses files in a case insensitive manner, which allows remote attackers to read privileged files using alternate capitalization.:LINK:https://www.cve.org/CVERecord?id=CVE-2004-1083::REFERENCE:CVE-2002-2119:DESCRIPTION:Case insensitive passwords lead to search space reduction.:LINK:https://www.cve.org/CVERecord?id=CVE-2002-2119::REFERENCE:CVE-2004-2214:DESCRIPTION:HTTP server allows bypass of access restrictions using URIs with mixed case.:LINK:https://www.cve.org/CVERecord?id=CVE-2004-2214::REFERENCE:CVE-2004-2154:DESCRIPTION:Mixed upper/lowercase allows bypass of ACLs.:LINK:https://www.cve.org/CVERecord?id=CVE-2004-2154::REFERENCE:CVE-2005-4509:DESCRIPTION:Bypass malicious script detection by using tokens that aren't case sensitive.:LINK:https://www.cve.org/CVERecord?id=CVE-2005-4509::REFERENCE:CVE-2002-1820:DESCRIPTION:Mixed case problem allows admin to have Admin rights (alternate name property).:LINK:https://www.cve.org/CVERecord?id=CVE-2002-1820::REFERENCE:CVE-2007-3365:DESCRIPTION:Chain: uppercase file extensions causes web server to return script source code instead of executing the script.:LINK:https://www.cve.org/CVERecord?id=CVE-2007-3365::REFERENCE:CVE-2021-39155:DESCRIPTION:Chain: A microservice integration and management platform compares the hostname in the HTTP Host header in a case-sensitive way (CWE-178, CWE-1289), allowing bypass of the authorization policy (CWE-863) using a hostname with mixed case or other variations.:LINK:https://www.cve.org/CVERecord?id=CVE-2021-39155::

Functional Areas: ::File Processing::

Affected Resources: ::File or Directory::

Notes: ::TYPE:Research Gap:NOTE:These are probably under-studied in Windows and Mac environments, where file names are case-insensitive and thus are subject to equivalence manipulations involving case.::