# CVE-2023-3978: Improper rendering of text nodes in golang.org/x/net/html

> Attackers can inject malicious scripts via improperly escaped text nodes in the Go HTML library, leading to cross-site scripting attacks.

- **Severity:** Medium 6.1 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 2 Aug 2023
- **Updated:** 27 Sep 2024
- **Also known as:** AZL-27810, AZL-27813, AZL-27818, AZL-27831, AZL-31690, AZL-31858, AZL-33331, AZL-34542, AZL-34582, AZL-34624, AZL-34907, AZL-35120, AZL-35299, AZL-35348, AZL-42867, AZL-43555, AZL-44055, CLEANSTART-2026-HD07846, CLEANSTART-2026-JY50773, DEBIAN-CVE-2023-3978, GHSA-2wrh-6pvc-2jm9, GO-2023-1988, MINI-4xg8-c4hc-rr6m, RHSA-2024:0944, SUSE-EL-9-CLIENT-TOOLS-2024-4019, SUSE-SU-2024:4010-1, SUSE-SU-2024:4011-1, SUSE-SU-2024:4019-1, UBUNTU-CVE-2023-3978, openSUSE-SU-2024:14218-1

## What is CVE-2023-3978?

CVE-2023-3978 is a medium-severity cross-site scripting vulnerability in golang.org/x/net/html, published on 2 Aug 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Text nodes not in the HTML namespace are incorrectly literally rendered, causing text which should be escaped to not be. This could lead to an XSS attack.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation)

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

3 open source packages ship an affected version, including golang.org/x/net. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `golang.org/x/net` | Go | All versions | 0.13.0 |
| `golang.org/x/net` | Go | All versions | 0.13.0 |
| `golang.org/x/net` | Go | All versions | 0.13.0 |
| `podman` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-catatonit` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-catatonit-debuginfo` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-debuginfo` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-debugsource` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-docker` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-gvproxy` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-gvproxy-debuginfo` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-plugins` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-plugins-debuginfo` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-remote` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-remote-debuginfo` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman-tests` | Red Hat:openshift:4.14::el8 | All versions | 3:4.4.1-11.2.rhaos4.14.el8 |
| `podman` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `podman-debuginfo` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `podman-debugsource` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `podman-docker` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `podman-gvproxy` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `podman-gvproxy-debuginfo` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `podman-plugins` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `podman-plugins-debuginfo` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `podman-remote` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `podman-remote-debuginfo` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `podman-tests` | Red Hat:openshift:4.14::el9 | All versions | 3:4.4.1-11.2.rhaos4.14.el9 |
| `golang` | SUSE:EL-9:Update:Products:ManagerTools:Update | All versions | 1.20.12-1.3.1 |
| `golang-github-lusitaniae-apache_exporter` | SUSE:EL-9:Update:Products:ManagerTools:Update | All versions | 1.0.8-1.14.1 |
| `scap-security-guide` | SUSE:EL-9:Update:Products:ManagerTools:Update | All versions | 0.1.74-1.29.1 |
| `spacecmd` | SUSE:EL-9:Update:Products:ManagerTools:Update | All versions | 5.0.10-1.41.1 |
| `uyuni-tools` | SUSE:EL-9:Update:Products:ManagerTools:Update | All versions | 0.1.23-1.11.1 |
| `golang-github-prometheus-promu` | SUSE:Linux Enterprise Module for Package Hub 15 SP5 | All versions | 0.16.0-150000.3.21.4 |
| `golang-github-prometheus-promu` | SUSE:Linux Enterprise Module for Package Hub 15 SP6 | All versions | 0.16.0-150000.3.21.4 |
| `golang-github-lusitaniae-apache_exporter` | SUSE:Manager Client Tools 12 | All versions | 1.0.8-1.24.3 |
| `golang-github-prometheus-promu` | SUSE:Manager Client Tools 12 | All versions | 0.16.0-1.21.3 |
| `mgr-daemon` | SUSE:Manager Client Tools 12 | All versions | 4.3.11-1.53.2 |
| `spacecmd` | SUSE:Manager Client Tools 12 | All versions | 5.0.10-38.150.2 |
| `spacewalk-client-tools` | SUSE:Manager Client Tools 12 | All versions | 4.3.21-52.104.2 |
| `uyuni-common-libs` | SUSE:Manager Client Tools 12 | All versions | 5.0.5-1.45.2 |

Products: Golang Networking.

## How do I fix CVE-2023-3978?

Upgrade golang.org/x/net to 0.13.0 or later.

## Is CVE-2023-3978 being exploited?

There is no known exploitation of CVE-2023-3978 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-3978 and fix it if it is affected.

What it is: CVE-2023-3978 is a medium-severity cross-site scripting vulnerability in golang.org/x/net/html, published on 2 Aug 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2023-3978 in the wild and no public exploit code.

Affected packages and fixed versions:
- golang.org/x/net (Go): affected all versions; fixed in 0.13.0
- golang.org/x/net (Go): affected all versions; fixed in 0.13.0
- golang.org/x/net (Go): affected all versions; fixed in 0.13.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-3978/ (Markdown: https://insights.sbomify.com/CVE-2023-3978/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-3978
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-3978
- OSV: https://osv.dev/vulnerability/CVE-2023-3978

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-3978/
Summaries are generated and may contain mistakes; the official description above is the record.
