---
title: "CWE-82: Improper Neutralization of Script in Attributes of IMG Tags in a Web Page"
url: https://radicalnotion.ai/cwe/cwe-82
type: cwe
description: "The web application does not neutralize or incorrectly neutralizes scripting elements within attributes of HTML IMG tags, such as the src attribute."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-82: Improper Neutralization of Script in Attributes of IMG Tags in a Web Page

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 9
- **Of those, in CISA KEV:** 0
- **New in 2026:** 2
- **CWE catalog version:** 4.21

## Description

The web application does not neutralize or incorrectly neutralizes scripting elements within attributes of HTML IMG tags, such as the src attribute.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Technologies:** Web Based (Often), Web Server (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity, Availability | Read Application Data, Execute Unauthorized Code or Commands | Attackers can embed XSS exploits into the values for IMG attributes (e.g. SRC) that is streamed and then executed in a victim's browser. Note that when the page is loaded into a user's browser, the exploit will automatically execute. |

## Potential mitigations

### Implementation (Output Encoding)

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 (Attack Surface Reduction)

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.

Effectiveness: Defense in Depth

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2006-3211 | Stored XSS in a guestbook application using a javascript: URI in a bbcode img tag. |
| CVE-2002-1649 | javascript URI scheme in IMG tag. |
| CVE-2002-1803 | javascript URI scheme in IMG tag. |
| CVE-2002-1804 | javascript URI scheme in IMG tag. |
| CVE-2002-1805 | javascript URI scheme in IMG tag. |
| CVE-2002-1806 | javascript URI scheme in IMG tag. |
| CVE-2002-1807 | javascript URI scheme in IMG tag. |
| CVE-2002-1808 | javascript URI scheme in IMG tag. |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2024-52427 | WordPress Event Tickets with Ticket Scanner plugin \<= 2.3.11 - Remote Code Execution (RCE) vulnerability | critical | 9.9 | - | No | 2024-11-18 |
| CVE-2024-52434 | WordPress Popup by Supsystic plugin \<= 1.10.29 - Remote Code Execution (RCE) vulnerability | critical | 9.1 | - | No | 2024-11-18 |
| CVE-2024-52393 | WordPress Podlove Podcast Publisher plugin \<= 4.1.15 - Admin+ Remote Code Execution (RCE) vulnerability | critical | 9.1 | - | No | 2024-11-14 |
| CVE-2024-48042 | WordPress Contact Form by Supsystic plugin \<= 1.7.28 - Remote Code Execution (RCE) vulnerability | critical | 9.1 | - | No | 2024-10-16 |
| CVE-2024-49271 | WordPress Unlimited Elements For Elementor (Free Widgets, Addons, Templates) plugin \<= 1.5.121 - Remote Code Execution (RCE) vulnerability | critical | 9.1 | - | No | 2024-10-16 |
| CVE-2025-53194 | WordPress JetEngine \<= 3.7.0 - Remote Code Execution (RCE) Vulnerability | high | 8.5 | - | No | 2025-08-20 |
| CVE-2023-54423 | OpenMage magento-lts before 20.2.0 Stored XSS via TinyMCE WYSIWYG Editor | high | 8.3 | - | No | 2026-11-13 |
| CVE-2023-30963 | Stored XSS in Foundry Slate Query Dropdown menu | medium | 5.4 | - | No | 2023-07-10 |
| CVE-2026-56735 | Zammad: Improper neutralization of \`srcset\` attribute in IMG tags in Zammad | medium | 5.3 | - | No | 2026-09-25 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-83](https://radicalnotion.ai/cwe/cwe-83) | Improper Neutralization of Script in Attributes in a Web Page |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Script in IMG tags | - | - |
| Software Fault Patterns | Tainted input to command | SFP24 | - |

## Frequently asked questions

### What is CWE-82?

The web application does not neutralize or incorrectly neutralizes scripting elements within attributes of HTML IMG tags, such as the src attribute.

### What CVEs are caused by CWE-82?

9 recorded CVEs are attributed to CWE-82, including CVE-2024-52427, CVE-2024-52434 and CVE-2024-52393.

### How do you prevent CWE-82?

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.

### How is CWE-82 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

### What are the consequences of CWE-82?

Exploiting CWE-82 can lead to: Read Application Data, Execute Unauthorized Code or Commands.

### Is CWE-82 actively exploited?

9 recorded CVEs are caused by CWE-82; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/82.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-82). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
