# CVE-2024-55601: Hugo does not escape some attributes in internal templates

> Hugo fails to escape HTML attributes in internal templates, allowing attackers to inject scripts via Markdown content.

- **Severity:** Medium 5.3 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA: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:** 9 Dec 2024
- **Updated:** 10 Dec 2024
- **Also known as:** DEBIAN-CVE-2024-55601, GHSA-c2xf-9v2r-r2rx, GO-2024-3314, UBUNTU-CVE-2024-55601

## What is CVE-2024-55601?

CVE-2024-55601 is a medium-severity cross-site scripting vulnerability in gohugoio hugo, published on 9 Dec 2024. 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

Hugo is a static site generator. Starting in version 0.123.0 and prior to version 0.139.4, some HTML attributes in Markdown in the internal templates listed below not escaped in internal render hooks. Those whoa re impacted are Hugo users who do not trust their Markdown content files and are using one or more of these templates: `_default/_markup/render-link.html` from `v0.123.0`; `_default/_markup/render-image.html` from `v0.123.0`; `_default/_markup/render-table.html` from `v0.134.0`; and/or `shortcodes/youtube.html` from `v0.125.0`. This issue is patched in v0.139.4. As a workaround, one may replace an affected component with user defined templates or disable the internal templates.

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

## Which versions are affected by CVE-2024-55601?

3 open source packages ship an affected version, including github.com/gohugoio/hugo.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/gohugoio/hugo` | Go | From 0.123.0 | 0.139.4 |
| `github.com/gohugoio/hugo` | Go | From 0.123.0 | 0.139.4 |
| `github.com/gohugoio/hugo` | Go | From 0.123.0 | 0.139.4 |

## How do I fix CVE-2024-55601?

Upgrade github.com/gohugoio/hugo to 0.139.4 or later.

## Is CVE-2024-55601 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-55601 and fix it if it is affected.

What it is: CVE-2024-55601 is a medium-severity cross-site scripting vulnerability in gohugoio hugo, published on 9 Dec 2024. 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-2024-55601 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/gohugoio/hugo (Go): affected from 0.123.0; fixed in 0.139.4
- github.com/gohugoio/hugo (Go): affected from 0.123.0; fixed in 0.139.4
- github.com/gohugoio/hugo (Go): affected from 0.123.0; fixed in 0.139.4

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-2024-55601/ (Markdown: https://insights.sbomify.com/CVE-2024-55601/index.md)
```

## Sources

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

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