Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Attempted to address the comments

Proper input validation can prevent insertion of malicious data into the system. However, such validation fails to provide the assurance that validated data remains consistent throughout its lifetime. For example, if an insider is insiders are allowed to insert data into a database without validation, she they can glean unauthorized information or execute arbitrary code on the client side by means of attacks such as a Cross-Site Scripting (XSS) attack [OWASP 2011]. (Note that, although this is not necessarily an attack from one site to another, the term Cross-Site Scripting attack is still applied to such attacks.Output filtering sanitization to prevent such attacks is as important as input validation.

As with input validation, normalize data before filtering sanitizing for malicious characters. All output characters other than those known to be safe should be encoded to avoid vulnerabilities caused by data that bypasses validation.

...

This compliant solution defines a ValidateOutput class that normalizes the output to a known character set, performs output validation sanitization using a white-list and encodes any non-specified data values to enforce a double checking mechanism. Note that required white-listing patterns may vary according to the specific needs of different fields [OWASP 2008].

...

Failure to encode or escape output before it is displayed or passed across a trust boundary can result in the execution of arbitrary code.

Related Vulnerabilities

The Apache GERONIMO-1474 vulnerability, reported in January 2006, allowed attackers to submit URLs containing JavaScript.  The Web-Access-Log viewer did not sanitize the data it forwarded to the administrator console, thereby enabling a classic Cross-Site Scripting attack.

Bibliography

[MITRE 2009] CWE ID 116 "Improper Encoding or Escaping of Output"
[OWASP 2008] How to add validation logic to HttpServletRequest, XSS (Cross Site Scripting) Prevention Cheat Sheet
[OWASP 2011] Cross-site Scripting (XSS)

...