Base · Medium

CWE-184: Incomplete List of Disallowed Inputs

The product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional...

CWE-184 · Base Level ·17 CVEs ·1 Mitigations

Description

The product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional processing takes place, but the list is incomplete.

Potential Impact

Access Control

Bypass Protection Mechanism

Demonstrative Examples

The following code attempts to stop XSS attacks by removing all occurences of "script" in an input string.
Bad
public String removeScriptTags(String input, String mask) {return input.replaceAll("script", mask);}
Because the code only checks for the lower-case "script" string, it can be easily defeated with upper-case script tags.
This example takes user input, passes it through an encoding scheme, then lists the contents of the user's home directory based on the user name.
Bad
sub GetUntrustedInput {return($ARGV[0]);}
                     sub encode {my($str) = @_;$str =~ s/\&/\&amp;/gs;$str =~ s/\"/\&quot;/gs;$str =~ s/\'/\&apos;/gs;$str =~ s/\</\&lt;/gs;$str =~ s/\>/\&gt;/gs;return($str);}
                     sub doit {my $uname = encode(GetUntrustedInput("username"));print "<b>Welcome, $uname!</b><p>\n";system("cd /home/$uname; /bin/ls -l");
                     }
The programmer attempts to encode dangerous characters, however the denylist for encoding is incomplete (CWE-184) and an attacker can still pass a semicolon, resulting in a chain with OS command injection (CWE-78).
Additionally, the encoding routine is used inappropriately with command execution. An attacker doesn't even need to insert their own semicolon. The attacker can instead leverage the encoding routine to provide the semicolon to separate the commands. If an attacker supplies a string of the form:
Attack
' pwd
then the program will encode the apostrophe and insert the semicolon, which functions as a command separator when passed to the system function. This allows the attacker to complete the command injection.

Mitigations & Prevention

Implementation

Do not rely exclusively on detecting disallowed inputs. There are too many variants to encode a character, especially when different environments are used, so there is a high likelihood of missing some variants. Only use detection of disallowed inputs as a mechanism for detecting suspicious activity. Ensure that you are using other protection mechanisms that only identify "good" input - such as lists of allowed inputs - and ensure that you are properly encoding your outputs.

Detection Methods

  • Black Box — Exploitation of a vulnerability with commonly-used manipulations might fail, but minor variations might succeed.

Real-World CVE Examples

CVE IDDescription
CVE-2024-6091Chain: AI agent platform does not restrict pathnames containing internal "/./" sequences (CWE-55), leading to an incomplete denylist (CWE-184) that does not prevent OS command injection (CWE-78)
CVE-2024-4315Chain: API for text generation using Large Language Models (LLMs) does not include the "\" Windows folder separator in its denylist (CWE-184) when attempting to prevent Local File Inclusio
CVE-2024-44335Chain: filter only checks for some shell-injection characters (CWE-184), enabling OS command injection (CWE-78)
CVE-2008-2309product uses a denylist to identify potentially dangerous content, allowing attacker to bypass a warning
CVE-2005-2782PHP remote file inclusion in web application that filters "http" and "https" URLs, but not "ftp".
CVE-2004-0542Programming language does not filter certain shell metacharacters in Windows environment.
CVE-2004-0595XSS filter doesn't filter null characters before looking for dangerous tags, which are ignored by web browsers. MIE and validate-before-cleanse.
CVE-2005-3287Web-based mail product doesn't restrict dangerous extensions such as ASPX on a web server, even though others are prohibited.
CVE-2004-2351Resultant XSS when only <script> and <style> are checked.
CVE-2005-2959Privileged program does not clear sensitive environment variables that are used by bash. Overlaps multiple interpretation error.
CVE-2005-1824SQL injection protection scheme does not quote the "\" special character.
CVE-2005-2184Detection of risky filename extensions prevents users from automatically executing .EXE files, but .LNK is accepted, allowing resultant Windows symbolic link.
CVE-2007-1343Product uses list of protected variables, but accidentally omits one dangerous variable, allowing external modification
CVE-2007-5727Chain: product only removes SCRIPT tags (CWE-184), enabling XSS (CWE-79)
CVE-2006-4308Chain: product only checks for use of "javascript:" tag (CWE-184), allowing XSS (CWE-79) using other tags

Showing 15 of 17 observed examples.

Taxonomy Mappings

  • PLOVER: — Incomplete Blacklist

Frequently Asked Questions

What is CWE-184?

CWE-184 (Incomplete List of Disallowed Inputs) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Base-level weakness. The product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional...

How can CWE-184 be exploited?

Attackers can exploit CWE-184 (Incomplete List of Disallowed Inputs) to bypass protection mechanism. This weakness is typically introduced during the Implementation, Architecture and Design phase of software development.

How do I prevent CWE-184?

Key mitigations include: Do not rely exclusively on detecting disallowed inputs. There are too many variants to encode a character, especially when different environments are used, so there is a high likelihood of missing so

What is the severity of CWE-184?

CWE-184 is classified as a Base-level weakness (Medium abstraction). It has been observed in 17 real-world CVEs.