Description
There is an XSS issue in the handling of User Agent strings in stats/useragents.py
Steps to reproduce
Query the wiki with an user agent such as "'></script></textarea><script>alert("XSS")</script>;
Navigate to a wiki page with <<StatsChart(useragents)>> (such as EventStats/UserAgents) and you'll see an alert pop up
Example
Component selection
- MoinMoin/stats/useragents.py
Details
The user agent data is saved at around line 76 of useragents.py
MoinMoin Version |
1.9.7 |
OS and Version |
|
Python Version |
|
Server Setup |
|
Server Details |
|
Language you are using the wiki in (set in the browser/UserPreferences) |
|
Workaround
Discussion
Issue Reporter: "The obvious fix would be to use the wikiutil.escape function to ua before saving it to cache."
Comment: Yeah, that would fix it.
I prefer to have the raw data in the cache, though. And escape it only when it is used in html context.
Thanks for finding / reporting this one. If you want to test the fix: this wiki is running the current code.
-- ThomasWaldmann 2014-08-20 09:02:20
To the anon issue reporter: did you find this by accident or are you doing a systematic security review? Just asking because I want to do a new release soon. -- ThomasWaldmann 2014-08-20 10:12:09
We discovered this issue during an automated scan with IBM Security AppScan Standard 9.0.0.1 (part of a pre-deployment checklist). Rerunning the test, and doing some more targeted tests with the same tool, did not find any further issues.
-- JussiEronen 2014-08-27 08:29:04
OK, great. Thanks for reporting!
Plan
- Priority:
- Assigned to:
Status: Issue was fixed by: http://hg.moinmo.in/moin/1.9/rev/7dd392e803fa