CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

BaseStableExploit Likelihood: High🏆 #1 in Top 25 (2024)

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.

View on MITRE
4,442Related CVEs
45.54Severity Score
Back to CWE Lookup

Extended Description

There are many variants of cross-site scripting, characterized by a variety of terms or involving different attack topologies. However, they all indicate the same fundamental weakness: improper neutralization of dangerous input between the adversary and a victim.

Technical Details

Structure
Simple
Vulnerability Mapping
ALLOWED

Applicable To

Languages
Not Language-Specific
Platforms

🏆 CWE Top 25 Historical Ranking

2023:#2
Score: 45.54
4,278 CVEs
2024:#1↑1
Score: 45.54
4,442 CVEs
Trend:Worsening (moved down 1 ranks)

Source-backed guidance

Additional facts reviewed against primary or authoritative security sources.

Combine code review with SAST, DAST, IAST, and fuzzing

Inventory every path that carries untrusted data into browser output, including parameters, headers, URLs, cookies, JSON, SOAP, and XML. Pair source review with automated fuzzing and dynamic tests, then run SAST, DAST, and IAST in CI/CD so server-rendered, stored, and client-side injection paths are checked before release. Treat findings as data-flow defects from source to browser interpreter, not merely suspicious string matches.

OWASP Top 10:2025 A05 InjectionOWASP Foundation

Match the XSS defense to the browser parsing context

Start with the framework's default output encoding, then encode untrusted values for their exact HTML, attribute, URL, CSS, or JavaScript context. When users must author HTML, sanitize it with a maintained sanitizer and avoid changing the content afterward. Replace unsafe DOM sinks such as innerHTML with text-only sinks where possible; treat Content Security Policy as defense in depth rather than the primary fix.

Cross Site Scripting Prevention Cheat SheetOWASP Foundation

Enforce Trusted Types at browser injection sinks

For DOM-based XSS paths, route data through narrowly scoped Trusted Type policies before it reaches injection sinks such as innerHTML, document.write, script URLs, or eval-like APIs. Enforce Content-Security-Policy: require-trusted-types-for 'script' so unsupported raw string writes fail instead of executing, and restrict allowed policy names with the trusted-types directive. Use a temporary default policy only to locate and migrate legacy sink writes.

Trusted Types APIMozilla MDN

Model user-assisted reflected XSS with CVE-2025-20250

NVD maps CVE-2025-20250 in Cisco Webex to CWE-79: insufficient filtering allowed an unauthenticated remote attacker to craft a malicious link and persuade a user to open it. The CNA scored it CVSS 3.1 6.1 Medium with user interaction required and changed scope, with low confidentiality and integrity impact. Use this scenario to test link-delivered reflections, output encoding, user-interaction assumptions, and whether injected script crosses a trust boundary in the victim's browser.

CVE-2025-20250 DetailNIST National Vulnerability Database

Map CWE-79 work to OWASP A05:2025 Injection

Track CWE-79 under OWASP A05:2025 Injection while keeping the control plan specific to the browser interpreter. The mapping makes XSS part of the broader injection governance program: separate untrusted data from executable syntax, cover all interpreter boundaries in review and testing, and measure remediation through the same SAST, DAST, IAST, and fuzzing pipeline used for other injection classes. Preserve CWE-79 as the precise root-cause identifier for individual findings.

OWASP Top 10:2025 A05 InjectionOWASP Foundation

Exercise every reflected input in its actual browser context

Follow WSTG-INPV-01 by enumerating visible and hidden input vectors, sending harmless markers and context-aware test strings, and locating each reflection in returned HTML. Verify whether HTML, attribute, URL, CSS, and JavaScript contexts receive the correct output encoding. Repeat with alternate encodings and syntax variations, and assess actual browser execution rather than assuming a denylist, browser feature, or web application firewall blocks the payload.

Testing for Reflected Cross Site Scripting (WSTG-INPV-01)OWASP Foundation

Frequently Asked Questions

What is CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')?+

CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. There are many variants of cross-site scripting, characterized by a variety of terms or involving different attack topologies. However, they all indicate the same fundamental weakness: improper neutralization of dangerous input between the adversary and a victim.

Is CWE-79 in the CWE Top 25 Most Dangerous Software Weaknesses?+

Yes. CWE-79 ranked #1 in the CWE Top 25 for 2024, associated with 4,442 CVEs that year. The CWE Top 25 highlights the most common and impactful software weaknesses based on real-world vulnerability data.

What are the security consequences of Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')?+

If exploited, CWE-79 (Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) it can compromise Access Control, Confidentiality, Integrity and Availability, leading to outcomes such as Bypass Protection Mechanism, Read Application Data and Execute Unauthorized Code or Commands.

How do you prevent or mitigate Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')?+

Recommended mitigations for CWE-79 include: Understand the context in which your data will be used and the encoding that will be expected. This is especially important when transmitting data between different components, or when generating outputs that can contain multiple encodings at the same time, such as web pages or multi-part mail messages. Study all expected communication protocols and data representations to determine the required encoding strategies. For any data that will be output to another web page, especially any data that was received from external inputs, use the appropriate encoding on all non-alphanumeric characters. Parts of the same output document may require different encodings, which will vary depending on whether the output is in the: HTML body Element attributes (such as src="XYZ") URIs JavaScript sections Cascading Style Sheets and style property etc. Note that HTML Entity Encoding is only appropriate for the HTML body. Consult the XSS Prevention Cheat Sheet [REF-724] for more details on the types of encoding and escaping that are needed.

How is Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') detected?+

CWE-79 can be detected using Automated Static Analysis and Black Box. Combining automated tooling with manual review typically yields the best coverage.

Which programming languages are affected by Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')?+

CWE-79 commonly affects Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')?+

MITRE documents real CVEs mapped to CWE-79, including CVE-2024-49038, CVE-2024-54142, CVE-2021-25926, CVE-2021-25963 and CVE-2021-1879. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-79 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More

Advertisement