# CVE-2024-10491: Preload arbitrary resources by injecting additional `Link` headers

> Attackers can inject malicious resources via unsanitized Link headers in Express, potentially leading to code execution or security bypasses.

- **Severity:** Medium 4.0 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 29 Oct 2024
- **Updated:** 29 Oct 2024
- **Also known as:** DEBIAN-CVE-2024-10491, GHSA-cm5g-3pgc-8rg4

## What is CVE-2024-10491?

CVE-2024-10491 is a medium-severity vulnerability in express, published on 29 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A vulnerability has been identified in the Express response.links function, allowing for arbitrary resource injection in the Link header when unsanitized data is used.

The issue arises from improper sanitization in `Link` header values, which can allow a combination of characters like `,`, `;`, and `<>` to preload malicious resources.

This vulnerability is especially relevant for dynamic parameters.

Weakness: CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component)

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

2 open source packages ship an affected version, including express. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `express` | npm | All versions | 4.0.0-rc1 |
| `express` | npm | All versions | 4.0.0-rc1 |

Products: Openjsf Express.

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

Upgrade express to 4.0.0-rc1 or later.

## Is CVE-2024-10491 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-10491 exists.

## Other vulnerabilities in express

- [CVE-2024-29041](https://insights.sbomify.com/CVE-2024-29041/): Express.js Open Redirect in malformed URLs (medium 6.1)
- [CVE-2014-6393](https://insights.sbomify.com/CVE-2014-6393/): No Charset in Content-Type Header in express (medium 6.1)
- [CVE-2024-43796](https://insights.sbomify.com/CVE-2024-43796/): express vulnerable to XSS via response.redirect() (medium 5.0)

## Fix prompt for AI coding agents

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

What it is: CVE-2024-10491 is a medium-severity vulnerability in express, published on 29 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-10491 exists.

Affected packages and fixed versions:
- express (npm): affected all versions; fixed in 4.0.0-rc1
- express (npm): affected all versions; fixed in 4.0.0-rc1

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

## Sources

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

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