CWEweakness
CWE-85 Doubled Character XSS Manipulations
- Abstraction
- Variant
- Structure
- Simple
- Status
- Draft
- Languages
- Not Language-Specific
- CWE version
- 5.0
Description
The web application does not filter user-controlled input for executable script disguised using doubling of the involved characters.
Common consequences
• Confidentiality, Integrity, Availability: Read Application Data, Execute Unauthorized Code or Commands
Potential mitigations
• [Implementation] Resolve all filtered input to absolute or canonical representations before processing.
• [Implementation] Carefully check each input parameter against a rigorous positive specification (allowlist) defining the specific characters and format allowed. All input should be neutralized, not just parameters that the user is supposed to specify, but all data in the request, including tag attributes, hidden fields, cookies, headers, the URL itself, and so forth. A common mistake that leads to continuing XSS vulnerabilities is to validate only fields that are expected to be redisplayed by the site. We often encounter data from the request that is reflected by the application server or the application that the development team did not anticipate. Also, a field that is not currently reflected may be used by a future developer. Therefore, validating ALL parts of the HTTP request is recommended.
• [Implementation] Use and specify an output encoding that can be handled by the downstream component that is reading the output. Common encodings include ISO-8859-1, UTF-7, and UTF-8. When an encoding is not specified, a downstream component may choose a different encoding, either by assuming a default encoding or automatically inferring which encoding is being used, which can be erroneous. When the encodings are inconsistent, the downstream component might treat some character or byte sequences as special, even if they are not special in the original encoding. Attackers might then be able to exploit this discrepancy and conduct injection attacks; they even might be able to bypass protection mechanisms that assume the original encoding is also being used by the downstream component.
The problem of inconsistent output encodings often arises in web pages. If an encoding is not specified in an HTTP header, web browsers often guess about which encoding is being used. This can open up the browser to subtle XSS attacks.
• [Implementation] With Struts, write all data from form beans with the bean's filter attribute set to true.
• [Implementation] To help mitigate XSS attacks against the user's session cookie, set the session cookie to be HttpOnly. In browsers that support the HttpOnly feature (such as more recent versions of Internet Explorer and Firefox), this attribute can prevent the user's session cookie from being accessible to malicious client-side scripts that use document.cookie. This is not a complete solution, since HttpOnly is not supported by all browsers. More importantly, XmlHttpRequest and other powerful browser technologies provide read access to HTTP headers, including the Set-Cookie header in which the HttpOnly flag is set.
Observed examples
• CVE-2002-2086: XSS using "<script".
• CVE-2000-0116: Encoded "javascript" in IMG tag.
• CVE-2001-1157: Extra "<" in front of SCRIPT tag.
Related
Attack pattern · CAPEC (1)
- CAPEC-245 XSS Using Doubled Characters attack pattern
Observed example · CVE (3)
- CVE-2002-2086 Multiple cross-site scripting (XSS) vulnerabilities in magicHTML of SquirrelMail before 1.2.6 allow remote attackers to inject arbitrary… vulnerability
- CVE-2001-1157 Baltimore Technologies WEBsweeper 4.0 and 4.02 does not properly filter Javascript from HTML pages, which could allow remote attackers to… vulnerability
- CVE-2000-0116 Firewall-1 does not properly filter script tags, which allows remote attackers to bypass the "Strip Script Tags" restriction by including… vulnerability
Child of · CWE (1)
- CWE-79 Improper Neutralization of Input During Web Page Generation weakness
Peer of · CWE (1)
- CWE-675 Multiple Operations on Resource in Single-Operation Context weakness
Referenced by CAPEC · weakness (1)
- CAPEC-245 XSS Using Doubled Characters attack pattern
Referenced by CVE · weakness (2)
- CVE-2024-13721 The Plethora Plugins Tabs + Accordions plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the anchor parameter in all… vulnerability
- CVE-2022-41676 Raiden MAILD Mail Server website mail field has insufficient filtering for user input. vulnerability