Skip to content

KaTeX's `\includegraphics` does not escape filename

Moderate severity GitHub Reviewed Published Mar 24, 2024 in KaTeX/KaTeX • Updated Mar 25, 2024

Package

npm katex (npm)

Affected versions

>= 0.11.0, < 0.16.10

Patched versions

0.16.10

Description

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:

References

@edemaine edemaine published to KaTeX/KaTeX Mar 24, 2024
Published to the GitHub Advisory Database Mar 25, 2024
Reviewed Mar 25, 2024
Published by the National Vulnerability Database Mar 25, 2024
Last updated Mar 25, 2024

Severity

Moderate
6.3
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
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

Weaknesses

CVE ID

CVE-2024-28245

GHSA ID

GHSA-f98w-7cxr-ff2h

Source code

Credits

Checking history
See something to contribute? Suggest improvements for this vulnerability.