|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CWE-501: Trust Boundary Violation
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) Example
Language: Java usrname = request.getParameter("usrname"); if (session.getAttribute(ATTR_USR) == null) { session.setAttribute(ATTR_USR, usrname);
} (Bad Code) Example
Language: 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:
September 12, 2011
|
|
CWE is a Software Assurance strategic initiative co-sponsored by the National Cyber Security Division of the U.S. Department of Homeland Security. This Web site is sponsored and managed by The MITRE Corporation to enable stakeholder collaboration. Copyright © 2006-2012, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation. Contact cwe@mitre.org for more information. |
|||



