Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Every time NuGetGallery receives a HTTP request it looks for a cookie named
__Controller::TempData
and loads key-value pairs from itscontent into
WebViewPage.TempData
dictionary. The value of theTempData["RawErrorMessage"]
is is injected into HTML as is without any encoding inHeader.cshtml
- basically in all pages.The cookie is untrusted input and can be set for example from related subdomain.
See https://www.usenix.org/system/files/conference/usenixsecurity15/sec15-paper-zheng.pdf and https://media.blackhat.com/eu-13/briefings/Lundeen/bh-eu-13-deputies-still-confused-lundeen-slides.pdf for more information.
For example, a XSS vulnerability in a subdomain of https://nuget.org (or any other deployment of NuGetGallery) would enable an attacker to create a
__Controller::TempData
"shadow" cookie in a victim's, NuGetGallery administrator, browser with a/Admin
path. This cookie would supersede the genuinepath=/; HttpOnly; Secure
cookie when the victim opens their NuGetGallery deployment Admin area.This is not exploitable by itself as it requires another XSS in subdomain or MitM to unencrypted subdomain endpoint. However it 1. allows for persistence (the cookie is reloaded and injected for every page visit) 2. Doesn't require the browser user to be logged into NugetGallery to inject XSS payload into the shadow cookie when visiting the vulnerable subdomain.