11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

612 Part V: Assessing Your <strong>Security</strong>Check That Output Is EncodedWhile not a replacement for checking that input is well-formed <strong>and</strong> correct, youshould check that HtmlEncode is used to encode HTML output that includes anytype of input. Also check that UrlEncode is used to encode URL strings. Input datacan come from query strings, form fields, cookies, HTTP headers, <strong>and</strong> input readfrom a database, particularly if the database is shared by other applications. Byencoding the data, you prevent the browser from treating the HTML as executablescript.Check for Correct Character EncodingTo help prevent attackers using canonicalization <strong>and</strong> multi-byte escape sequences totrick your input validation routines, check that the character encoding is set correctlyto limit the way in which input can be represented.Check that the application <strong>Web</strong>.config file has set the requestEncoding <strong>and</strong>responseEncoding attributes configured by the element as shownbelow.Character encoding can also be set at the page level using a tag orResponseEncoding page-level attribute as shown below.For more information, see Chapter 10, “Building Secure ASP.NET Pages <strong>and</strong>Controls.”Check the validateRequest Attribute<strong>Web</strong> applications that are built using the .NET Framework version 1.1 perform inputfiltering to eliminate potentially malicious input, such as embedded script. Do notrely on this, but use it for defense in depth. Check the element in yourconfiguration file to confirm that the validateRequest attribute is set to true. This canalso be set as a page-level attribute. Scan your .aspx source files for validateRequest,<strong>and</strong> check that it is not set to false for any page.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!