The information in this article applies to:
SUMMARYThis article describes how to identify and correct Microsoft Transaction Server/Active Server Pages (ASP) applications that are susceptible to cross-site scripting security issues (CSSI). Only input that is not correctly validated or formatted makes your application vulnerable to attack. MORE INFORMATION
CSSI issues are rooted in the way an application handles data validation and formatting, so it is best tackled from the presentation layer. Q253119 HOWTO: Review ASP Code for CSSI VulnerabilityThe following steps will help you identify and correct ASP applications susceptible to CSSI:
Guidelines for FormattingThese guidelines will help you identify where to tackle formatting appropriately.When writing information to a page, the specific application data must be HTMLEncoded. It is important not to HTMLEncode tags that are intended to end up in the HTML page. Therefore, if your component functions return HTML, the HTMLEncode has to be done inside them. To HTMLEncode a string from a component, you need a reference to the ASP server object. You can obtain this reference from the MTS ObjectContext.Items collection:
Example: This code will generate table rows with values taken from a recordset. This code does not encode the output:
When this code is fixed, note that the values themselves are HTMLEncoded, rather than the whole HTML string:
Note the use of the intermediate oServer object reference. This is included to take advantage of early binding and to avoid resolving the ObjectContext.Item lookup every time. To declare an object as ASPTypeLibrary.Server, you must include a reference to "Microsoft Active Server Pages Object Library".
Please take into account the following guidelines:
REFERENCESFor more information, see the following advisory from the Computer Emergency Response Team (CERT) at Carnegie Mellon University: http://www.cert.org/advisories/CA-2000-02.htmlFor additional information, click the article number below to view the article in the Microsoft Knowledge Base: Q252985 HOWTO: Prevent Cross-Site Scripting Security Issues For Web Applications Q253119 HOWTO: Review ASP Code for CSSI Vulnerability Q253120 HOWTO: Review Visual InterDev Generated Code for CSSI Vulnerability Q253117 HOWTO: Prevent Internet Explorer and Outlook Express CSSI Vulnerability Additional query words: kbCSSI
Keywords : kbDSupport kbCSSI |
Last Reviewed: February 2, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |