Back to overview

Data validation & encoding 5

Centralized output encoding routines are a good programming practice, but developers need to understand how they work, how to use them and any limitations. Such routines can be tested independently of other code and not only provide assurance on the quality of the validation, but it makes refactorization an easy task and it eliminates code duplicates and bad interpretations. Ouput encodings are a must when handling data from un-trusted sources. It should also be a mandatory security check when outputting data to queries for SQL, XML, and LDAP and in every case when hazardous special characters must be allowed as input (such as < > " ' % ( ) & + \ ). Some common attacks of bad implementation (or lack) of output encoding routines are:

Cross Site Scripting (XSS). Code injection. Fuzzing. If third party output encoding libraries are used, it is important to test each routine before its implementation.

NB: This card relates to bypass of output encoding. See VE 6 for the similar bypass of input data validation.

How to play?

Jee can bypass the centralized encoding routines since they are not being used everywhere, or the wrong encodings are being used

Mappings

Owasp ASVS (4.0): 1.1.6 ,5.3.3 ,5.2.1 ,5.2.2 ,5.2.5

Capec: 28 ,31 ,152 ,160 ,468

Owasp SCP: 3,15,18,19,20,21,22,168

Owasp Appsensor:

Safecode: 2,17

ASVS (4.0) Cheatsheetseries Index

ASVS V1.1 - Secure Software Development Lifecycle Requirements

ASVS V5.3 - Output encoding and Injection Prevention Requirements

ASVS V5.2 - Sanitization and Sandboxing Requirements

Attacks

SQL Injection

Cross-Site Scripting (XSS)

Privilege escalation

Loading comments 0%

Github logo View source on GitHub

Provided by dotNET lab

This website is created, hosted and provided by dotNET lab. dotNET lab provides training and guidance on secure software development. Contact us to get in touch!

OWASP Cornucopia

OWASP Cornucopia is originally created by Colin Watson. It is open source and can be downloaded free of charge from the OWASP website. It is is free to use. It is licensed under the Creative Commons Attribution-ShareAlike 3.0 license, so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. OWASP does not endorse or recommend commercial products or services. OWASP Cornucopia is licensed under the Creative Commons Attribution-ShareAlike 3.0 license and is © 2012-2016 OWASP Foundation.