cve.bz

CAPEC-243

XSS Targeting HTML Attributes

Medium severityDetailed pattern

An adversary inserts commands to perform cross-site scripting (XSS) actions in HTML attributes. Many filters do not adequately sanitize attributes against the presence of potentially dangerous commands even if they adequately sanitize tags. For example, dangerous expressions could be inserted into a style attribute in an anchor tag, resulting in the execution of malicious code when the resulting page is rendered. If a victim is tricked into viewing the rendered page the attack proceeds like a normal XSS attack, possibly resulting in the loss of sensitive cookies or other malicious activities.

On this page

Ask an AI about this attack pattern

Show the promptExplain the attack pattern CAPEC-243: XSS Targeting HTML Attributes: how it unfolds, what it needs and how to prevent and detect it in my systems. Use https://capec.mitre.org/data/definitions/243.html and https://cve.bz/cve/capec/243?via=ask-ai-copy, which lists recent CVEs with the weaknesses it exploits. Cite the sources.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this attack pattern's id and public links.

How the attack unfolds

  1. Explore

    The attacker looks for a way in.

    1. [Survey the application for user-controllable inputs] Using a browser or an automated tool, an adversary follows all public links and actions on a web site. They record all the links, the forms, the resources accessed and all other potential entry-points for the web application.

      3 techniques
      • Use a spidering tool to follow and record all links and analyze the web pages to find entry points. Make special note of any links that include parameters in the URL.
      • Use a proxy tool to record all links visited during a manual traversal of the web application.
      • Use a browser to manually explore the website and analyze how it is constructed. Many browsers' plugins are available to facilitate the analysis or automate the discovery.
  2. Experiment

    They probe what they found.

    1. [Probe identified potential entry points for XSS targeting HTML attributes] The adversary uses the entry points gathered in the "Explore" phase as a target list and injects various malicious expressions as input, hoping to embed them as HTML attributes.

      2 techniques
      • Inject single and double quotes into URL parameters or other inputs to see if they are filtered out. Also use URL encoding to bypass filters.
      • Use single or double quotes to close attribute evaluation and enter a new attribute that contains an expression.
    2. [Craft malicious XSS URL] Once the adversary has determined which parameters are vulnerable to XSS, they will craft a malicious URL containing the XSS exploit. The adversary can have many goals, from stealing session IDs, cookies, credentials, and page content from the victim.

      2 techniques
      • Execute a script using an expression embedded in an HTML attribute, which avoids needing to inject a script tag.
      • Send information gathered from the malicious script to a remote endpoint.
  3. Exploit

    They carry out the attack.

    1. [Get victim to click URL] In order for the attack to be successful, the victim needs to access the malicious URL.

      2 techniques
      • Send a phishing email to the victim containing the malicious URL. This can be hidden in a hyperlink as to not show the full URL, which might draw suspicion.
      • Put the malicious URL on a public forum, where many victims might accidentally click the link.

Prerequisites

  • The target application must fail to adequately sanitize HTML attributes against the presence of dangerous commands.

Resources required

  • The adversary must trick the victim into following a crafted link to a vulnerable server or view a web post where the dangerous commands are executed.

Mitigations

  • Design: Use libraries and templates that minimize unfiltered input.

  • Implementation: Normalize, filter and use an allowlist for all input including that which is not expected to have any scripting content.

  • Implementation: The victim should configure the browser to minimize active content from untrusted sources.

Weaknesses it exploits

  • CWE-83 Improper Neutralization of Script in Attributes in a Web Page

Recent CVEs with these weaknesses

  1. 5.1CVE-2026-112356

    GFI KerioConnect (Kerio Connect) before 10.0.9 Patch 2 contains a cross-site scripting vulnerability in the Webmail component that allows a remote attacker to spoof link targets or inject HTML into a message as rendered in a victim's authe…

  2. 6.2CVE-2026-112353

    GFI KerioConnect (Kerio Connect) before 10.0.8 Patch 2 contains a stored cross-site scripting vulnerability in the Webmail component that allows a remote attacker to run JavaScript in a victim's authenticated Webmail session by uploading a…

  3. 7.4CVE-2026-61791

    OCO-Server is a self-hosted endpoint management application for computer inventory, software deployment, and mobile device management. Prior to 1.2.1, `Html::commandButton()` in `lib/Html.class.php` embeds an action URL containing a stored…

  4. 5.4CVE-2026-58391

    OPNsense is a FreeBSD based firewall and routing platform. Prior to version 26.1.11, Firewall Rules and NAT views place stored category names and alias descriptions into HTML title attributes in filter_rule.volt and nat_rule.volt without q…

  5. 7.6CVE-2026-108260

    Tina is a headless content management system. Prior to 0.2.1, the tina-markdown element in packages/@tinacms/web-components/src/tina-markdown.js assigns a rich-text node.url value directly to an anchor href without validating the URL schem…

  6. 8.2CVE-2026-91127

    File Viewer is a browser-native viewer for Office, PDF, CAD, archive, and other files in private and internal web applications. Prior to @file-viewer/doc 2.3.1 and msdoc-viewer 0.2.2, the legacy DOC renderer emitted document-controlled hyp…

  7. 9.3CVE-2026-45118

    MyBB is free and open source forum software. Prior to 1.8.40, the Contact module does not validate a redirect URL or protocol correctly, resulting in an open redirect and reflected JavaScript code injection. contact.php accepts the redirec…

  8. 8.3CVE-2026-45733

    Trilium Notes is a cross-platform, hierarchical note taking application focused on building large personal knowledge bases. Prior to 0.103.0, the #iconClass label value is returned raw by getNoteIcon() and inserted without HTML attribute e…

The newest records naming one of them. Each weakness's page lists them all.

Part of

MITRE's words, unchanged: CAPEC-243 at MITRE. CAPEC is Copyright © 2007–2026, The MITRE Corporation, used under the CAPEC terms of use: “The MITRE Corporation (MITRE) hereby grants you a non-exclusive, royalty-free license to use Common Attack Pattern Enumeration and Classification (CAPEC™) for research, development, and commercial purposes. Any copy you make for such purposes is authorized provided that you reproduce MITRE’s copyright designation and this license in any such copy.” CAPEC and the CAPEC logo are trademarks of The MITRE Corporation. Credits. All attack patterns.