19
Example Language: C (Bad)
...
sethostid(argv[1]);
...
Although a process must be privileged to successfully invoke sethostid(), unprivileged users may
be able to invoke the program. The code in this example allows user input to directly control the
value of a system setting. If an attacker provides a malicious value for host ID, the attacker can
misidentify the affected machine on the network or cause other unintended behavior.
Example 2:
The following Java code snippet reads a string from an HttpServletRequest and sets it as the active
catalog for a database Connection.
Example Language: Java (Bad)
...
conn.setCatalog(request.getParameter("catalog"));
...
In this example, an attacker could cause an error by providing a nonexistent catalog name or
connect to an unauthorized portion of the database.
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 994 SFP Secondary Cluster: Tainted Input to Variable 888 2417
MemberOf 1349 OWASP Top Ten 2021 Category A05:2021 - Security
Misconfiguration
1344 2493
MemberOf 1368 ICS Dependencies (& Architecture): External Digital
Systems
1358 2505
MemberOf 1403 Comprehensive Categorization: Exposed Resource 1400 2528
Taxonomy Mappings
Mapped Taxonomy Name Node ID Fit Mapped Node Name
7 Pernicious Kingdoms Setting Manipulation
Software Fault Patterns SFP25 Tainted input to variable
Related Attack Patterns
CAPEC-ID Attack Pattern Name
13 Subverting Environment Variable Values
69 Target Programs with Elevated Privileges
76 Manipulating Web Input to File System Calls
77 Manipulating User-Controlled Variables
146 XML Schema Poisoning
176 Configuration/Environment Manipulation
203 Manipulate Registry Information
270 Modification of Registry Run Keys
271 Schema Poisoning
579 Replace Winlogon Helper DLL
References
CWE Version 4.14
CWE-20: Improper Input Validation
CWE-20: Improper Input Validation