Description Summary The product mixes trusted and untrusted data in the same data
structure or structured message.
Extended Description By combining trusted and untrusted data in the same data structure, it becomes easier for programmers to mistakenly trust unvalidated data. Example 1 The following code accepts an HTTP request and stores the username parameter in the HTTP session object before checking to ensure that the user has been authenticated. (Bad Code) Java usrname = request.getParameter("usrname"); if (session.getAttribute(ATTR_USR) == null) { session.setAttribute(ATTR_USR, usrname);
} (Bad Code) C# usrname = request.Item("usrname"); if (session.Item(ATTR_USR) == null) { session.Add(ATTR_USR, usrname);
} Without well-established and maintained trust boundaries, programmers will inevitably lose track of which pieces of data have been validated and which have not. This confusion will eventually allow some data to be used without first being validated.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Page Last Updated:
October 29, 2009
|
|
CWE is a Software Assurance strategic initiative sponsored by the National Cyber Security Division of the U.S. Department of Homeland Security. This Web site is hosted by The MITRE Corporation. Contact cwe@mitre.org for more information. |
|||
