---
title: "GHSA-f98w-7cxr-ff2h: KaTeX's `\\includegraphics` does not escape filename"
description: "Moderate severity. KaTeX's `\\includegraphics` does not escape filename. Affects katex; fixed in 0.16.10."
url: https://inlinr.com/advisories/GHSA-f98w-7cxr-ff2h
lang: en
---

[Packages](https://inlinr.com/packages) / [katex](https://inlinr.com/packages/katex) / [Security](https://inlinr.com/packages/katex/security)

Moderate Vulnerability GHSA-f98w-7cxr-ff2h CVE-2024-28245 Published 25 Mar 2024

# KaTeX's \`\\includegraphics\` does not escape filename

Your version 

Affected releases · [katex](https://inlinr.com/packages/katex)

- 0.16.x 0.16.0 – 0.16.9 Fixed in 0.16.10
- 0.15.x and older 0.11.0 – 0.15.6 No fix, no longer updated

On 0.16.x, the newest line:

```
npm install katex@0.16.10
```

Every release on a timeline

1. Not affected

0.1.0 – 0.10.2  
19 releases
2. Affected

0.11.0 – 0.16.9  
46 releases
3. Fixed

0.16.10 – 0.19.1  
53 releases, latest

118 stable releases of katex, oldest to newest.

## What happens

Impact

KaTeX users who render untrusted mathematical expressions could encounter malicious input using `\includegraphics` that runs arbitrary JavaScript, or generate invalid HTML.

Patches

Upgrade to KaTeX v0.16.10 to remove this vulnerability.

Workarounds

- Avoid use of or turn off the `trust` option, or set it to forbid `\includegraphics` commands.
- Forbid inputs containing the substring `"\\includegraphics"`.
- Sanitize HTML output from KaTeX.

Details

`\includegraphics` did not properly quote its filename argument, allowing it to generate invalid or malicious HTML that runs scripts.

For more information

If you have any questions or comments about this advisory:

- Open an issue or security advisory in the [KaTeX repository](https://github.com/KaTeX/KaTeX/ "https://github.com/KaTeX/KaTeX/")
- Email us at katex-security@mit.edu

## How it is exploited

Exploitable over the network, with a low-privilege account and no action from a user.

- **Confidentiality**: low
- **Integrity**: low
- **Availability**: low

CVSS:3.1/​AV:N/​AC:L/​PR:L/​UI:N/​S:U/​C:L/​I:L/​A:L

## References

- [Reference](https://github.com/KaTeX/KaTeX/security/advisories/GHSA-f98w-7cxr-ff2h "https://github.com/KaTeX/KaTeX/security/advisories/GHSA-f98w-7cxr-ff2h")  
github.com/KaTeX/KaTeX/security/advisories/GHSA…
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2024-28245 "https://nvd.nist.gov/vuln/detail/CVE-2024-28245")  
nvd.nist.gov/vuln/detail/CVE-2024-28245
- [Fix commit](https://github.com/KaTeX/KaTeX/commit/c5897fcd1f73da9612a53e6b5544f1d776e17770 "https://github.com/KaTeX/KaTeX/commit/c5897fcd1f73da9612a53e6b5544f1d776e17770")  
c5897fc
- [Package](https://github.com/KaTeX/KaTeX "https://github.com/KaTeX/KaTeX")  
github.com/KaTeX/KaTeX

A whole project to check? Paste its package.json in the [dependency check](https://inlinr.com/tools/dependency-check): every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.
