# CVE-2023-51652: OWASP.AntiSamy mXSS when preserving comments

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 6.1
- **CVSS:** 6.1 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: Required; Scope: Changed (impact reaches other components); Confidentiality impact: Low; Integrity impact: Low; Availability impact: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.63% (percentile 45, 2026-11-26)
- **CWE:** CWE-79
- **Aliases:** GHSA-8x6f-956f-q43w
- **Published:** 2024-01-02T16:38:28.000Z
- **Modified:** 2026-06-17T06:41:24.377Z

## Who should check

- Projects that depend on NuGet package OWASP.AntiSamy (\< 1.2.0)
- Anyone running spassarop antisamy-dotnet \< 1.2.0

## Description

OWASP AntiSamy .NET is a library for performing cleansing of HTML coming from untrusted sources. Prior to version 1.2.0, there is a potential for a mutation cross-site scripting (mXSS) vulnerability in AntiSamy caused by flawed parsing of the HTML being sanitized. To be subject to this vulnerability the \`preserveComments\` directive must be enabled in your policy file and also allow for certain tags at the same time. As a result, certain crafty inputs can result in elements in comment tags being interpreted as executable when using AntiSamy's sanitized output. This is patched in OWASP AntiSamy .NET 1.2.0 and later. See important remediation details in the reference given below. As a workaround, manually edit the AntiSamy policy file (e.g., antisamy.xml) by deleting the \`preserveComments\` directive or setting its value to \`false\`,  if present. Also it would be useful to make AntiSamy remove the \`noscript\` tag by adding a line described in the GitHub Security Advisory to the tag definitions under the \`\<tagrules\>\` node, or deleting it entirely if present. As the previously mentioned policy settings are preconditions for the mXSS attack to work, changing them as recommended should be sufficient to protect you against this vulnerability when using a vulnerable version of this library. However, the existing bug would still be present in AntiSamy or its parser dependency (HtmlAgilityPack). The safety of this workaround relies on configurations that may change in the future and don't address the root cause of the vulnerability. As such, it is strongly recommended to upgrade to a fixed version of AntiSamy.

## Affected and fixed versions

- NuGet `OWASP.AntiSamy`: affected \< 1.2.0; fixed 1.2.0 (osv)
- spassarop antisamy-dotnet: \< 1.2.0 (cvelist)

## Mitigation

- Upgrade OWASP.AntiSamy to 1.2.0 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2023-51652. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2023-51652.md
Affected: OWASP.AntiSamy < 1.2.0
Fixed in: 1.2.0

Steps:
1. Search this machine and project for OWASP.AntiSamy (NuGet), spassarop antisamy-dotnet: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2023-51652 being exploited?

There is no confirmed exploitation: CVE-2023-51652 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.63% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2023-51652?

Medium: CVSS 6.1 (v3.1, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work.

### Which versions are affected by CVE-2023-51652?

OWASP.AntiSamy \< 1.2.0.

### Is there a fix for CVE-2023-51652?

Yes. Fixed in 1.2.0. Upgrade OWASP.AntiSamy to 1.2.0 or later.

### How do I check if I'm affected by CVE-2023-51652?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/spassarop/antisamy-dotnet/security/advisories/GHSA-8x6f-956f-q43w>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2023-51652>
- patch: <https://github.com/spassarop/antisamy-dotnet/commit/7e500daef6ad9c10e97c68feab78f4cb6e3083c6>
- patch: <https://github.com/spassarop/antisamy-dotnet/commit/8117911933e75a25cd0054ef017577486338444a>
- other: <https://github.com/spassarop/antisamy-dotnet>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2023-51652>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-8x6f-956f-q43w> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2023-51652> · JSON: <https://flawdb.com/api/v1/entries/CVE-2023-51652>
