Skip to content
XSS Advisory Intermediate CVE-2024-37304

GHSL-2024-016: Insufficient markdown sanitization in nuget.org - CVE-2024-37304

NuGetGallery's markdown sanitisation failed to filter JavaScript protocol links in autolinks, allowing an attacker to create a package readme with a link that executes JavaScript when clicked. This could enable actions such as redirecting the victim, spoofing content, or extracting data from the page.

jarlob Follow

Originally disclosed on GitHub Security Lab

NuGetGallery powers https://nuget.org/ - the main public source for dotnet packages. Readme files in markdown format associated with NuGet packages are rendered as HTML.

jarlob, on GitHub Security Lab

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The sanitisation logic only checked regular markdown links, not autolinks, so autolinks with non-HTTP protocols were not filtered.

Impact

The attacker can only obfuscate the name of a rendered autolink, and some social engineering may be needed to trick the victim to click; cookies are HttpOnly, but other actions like redirecting, spoofing content, or extracting data are possible.

What the attacker needed

Ability to upload a package; victim clicks the link

The fix

The issue was fixed in a commit and release v2024.05.28.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you view a package's readme on nuget.org, the site converts markdown to HTML and tries to block dangerous links like those starting with 'javascript:'. However, it missed a type of link called an autolink, so an attacker could craft a readme with a link that runs code in your browser if you click it. This is a cross-site scripting (XSS) issue, but it requires the victim to click the link.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by jarlob

View all

192 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.