Closed Bug 246743 Opened 22 years ago Closed 22 years ago

"category" isn't escaped (XSS security hole)

Categories

(addons.mozilla.org Graveyard :: Public Pages, defect)

x86
All
defect
Not set
blocker

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: wolf)

References

()

Details

(Keywords: wsec-xss)

http://update.mozilla.org/extensions/moreinfo.php?id=35&vid=36&category=%22%3Cscript%3Ealert(5)%3C/script%3E demonstrates an XSS hole in update.mozilla.org. Impact: * XPI whitelisting is useless until this hole is fixed. * Attackers can spoof content on update.mozilla.org (including the update.mozilla.org front page).
Summary: "category" param is an XSS security hole → "category" isn't escaped (XSS security hole)
Severity: normal → blocker
Status: NEW → ASSIGNED
OS: Windows XP → All
I put a fix for this online.. Jesse, since you're alot better at security than me, does that fix appear to have solved the issue?
It seems like you fixed it by stripping out <> tags. I can still break the page: http://update.mozilla.org/extensions/moreinfo.php?id=35&vid=36&category=%22%3Efoo Maybe I can't inject scripts anymore, but I'm not sure. It would be easier to convince me that you've fixed the hole if you fixed it by making the page correct -- by escaping <>&" as HTML entities when they appear in hrefs.
Does the fix you've implemented apply to every field being read in? A HREF="moreinfo.php?id=35&vid=36&category="alert(5)&page=releases" That has three quotes in it. My prefereence would be a sanitize() function that runs through all variables.
The fix is. //Attempt to fix Bug 246743 foreach ($_GET as $key => $val) { $_GET["$key"] = str_replace("\\","",strip_tags($_GET["$key"])); } Applied globally before any data is output. It's not an ideal fix, more of a "prevent anything bad from being done" method to limit the security implications of the bug quickly type thing, I'm realizing now. :-/ I really should not print anything from $_get in the page w/o verifying it matches something expected, you broke the page because of that. :-/ So, this bug remains open.. better fix forthcoming.
You need to do this for POST, too.
*** Bug 247318 has been marked as a duplicate of this bug. ***
Bug 247318 and this one both appear to have the same root cause to me.. lacking data integrity checking. Bug 247318 deals with the unlaunched admin portions of the site, which are known untested and incomplete. (which is why they're not up yet. )
The reason I filed a separeate bug is that these are separate issues in terms of coding. And I'm filing bugs against the unreleased backend so that they get fixed _before_ it is released.
The fix for Bug 248242 also affects this bug, which should be fixed now also. The entities in the URL should now be escaped, as well as html tags removed entirely, the pages will still "look" broke in some cases, since the URLs were not valid, but that's a seperate issue. Marking as fixed, reopen if i'm wrong. :-)
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Group: security
Component: Update → Web Site
Product: mozilla.org → Update
Version: other → unspecified
Group: webtools-security
Group: webtools-security
Group: update-security
Can this be made public now?
Should be. I'd hope all of the Update 1.0-era security bugs (which afaik were all fixed.) are open at this point.
Group: update-security
Adding keywords to bugs for metrics, no action required. Sorry about bugmail spam.
Keywords: wsec-xss
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.