Cross-Site Scripting (XSS) on Wiki pages

Bug #1797927 reported by Lorenzo Di Fuccia
260
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Documentation
Fix Released
Undecided
Unassigned

Bug Description

I found this security issue on the Ubuntu Wiki pages (wiki.ubuntu.com).

The issue is a Reflected Cross-Site Scripting (XSS) from the URL path.

When you directly reach a page that does not exist, the Wiki will show you an error message reflecting what you searched.

The user-supplied input is not validated and escaped, so it lead to an arbitrary HTML and JavaScript code injection on the page.

Proof-of-Concept:

Reach the following page:
https://wiki.ubuntu.com/notexists%22%20onclick=%22alert('XSS')

MITRE CWE: CWE-79 Type 1
OWASP Top 10 2017: A7 - Cross-Site Scripting (XSS)

Tags: xss
information type: Private Security → Public Security
information type: Public Security → Private Security
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks for your report.

I'm not able to reproduce the behavior, though. When I try to access a page which does not exist, it simply takes me to a page where I'm offered a URL to create it, for instance:

https://wiki.ubuntu.com/notexists?action=edit

So can you please let us know which steps exactly you take to encounter the problem.

Changed in ubuntu-docs:
status: New → Incomplete
Revision history for this message
Lorenzo Di Fuccia (l.difuccia) wrote :

It seems that the wiki is down.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Not any longer. (At least not for me.)

Revision history for this message
Lorenzo Di Fuccia (l.difuccia) wrote :

Let's explain better this vulnerability:

Reaching the page https://wiki.ubuntu.com/notexists%22%20onclick=%22alert('XSS'), the path following the hostname is reflected on the response body showing an error message warning the user that the page searched doesn't exists.

The wiki application create an HTML "h2" title with an HTML "a" link showing the searched path and with the path appended on the "href" attribute of the HTML tag. The user input is appended without sanitization, so an attacker can inject other HTML/JavaScript code to the page DOM.

The payload that I used on this XSS close the "href" attribute with the quote and then use the "onclick" event attribute of the HTML "a" element in order to call the JavaScript function "alert" when the user click on the title.

When you open the link with the XSS payload Google Chrome browser will block the page rendering because warned by the XSS Auditor Engine that reveals the XSS injection.
(Attached file XSS_01.png shows this).

Instead if you use Mozilla Firefox the page will be displayed, even with the XSS.
So the file XSS_02.png shows the page rendered and the HTML "a" element with the injected "onclick" attribute.

After clicking on the title link you will display the "alert" (file XSS_02.png).

If you instead use the "onmouseover" event attribute in the XSS payload you will only need to move the mouse over the title in order to trigger the XSS.

Revision history for this message
Lorenzo Di Fuccia (l.difuccia) wrote :
Revision history for this message
Lorenzo Di Fuccia (l.difuccia) wrote :
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks for elaborating. This is over my head, but I subscribed the Ubuntu Security Team.

Changed in ubuntu-docs:
status: Incomplete → New
Revision history for this message
Lorenzo Di Fuccia (l.difuccia) wrote :

How can I request a CVE for this vulnerability?

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

I'm not sure, but I think the security folks will handle that if they think it's motivated.

Revision history for this message
Alex Murray (alexmurray) wrote :

The Ubuntu wiki is a MoinMoin instance - the question then is this an issue with the Ubuntu wiki MoinMoin configuration, or is this an upstream bug in MoinMoin itself?

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Good question, Alex. I have absolutely no idea. A third option may be that we are not using the latest MoinMoin version.

Subscribed Alan Pope, who might be able to provide guidance, and changed the information type to "Public Security".

information type: Private Security → Public Security
Revision history for this message
Lorenzo Di Fuccia (l.difuccia) wrote :
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

@Lorenzo: Yes, indeed. Seems like the version on the Ubuntu server is just 1.9.8, so a MoinMoin upgrade should fix it.

Thanks!

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

I filed this issue:

https://github.com/canonical-websites/www.ubuntu.com/issues/4246

Hopefully that will bring the right people's attention to this bug.

Revision history for this message
Peter Mahnke (peterm-ubuntu) wrote :

Gunnar, this isn't a web team issue, but for IS.

I have filed the issue in their RT system with a pointer to this.

Hopefully, they can help.

Peter

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

@Lorenzo: Peter let me know that this should be fixed now. Can you please check again, and confirm?

Revision history for this message
Lorenzo Di Fuccia (l.difuccia) wrote :
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks. Keeping this bug open for now, then, to track the issue.

Revision history for this message
Paul Collins (pjdc) wrote :

This turned to be a bug in our theme's code and not in Moin. I've fixed the theme bug and confirmed that the test case supplied above no longer succeeds.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

On 2018-10-25 04:28, Paul Collins wrote:
> This turned to be a bug in our theme's code and not in Moin. I've
> fixed the theme bug and confirmed that the test case supplied above
> no longer succeeds.

@Lorenzo: Do you have time to test this a last(?) time?

Changed in ubuntu-docs:
status: New → Incomplete
Revision history for this message
Lorenzo Di Fuccia (l.difuccia) wrote :

Yes, now the XSS seems to be fixed.

https://github.com/canonical-websites/www.ubuntu.com/issues/4246#issuecomment-436184341

This issue can be closed.
Thank you for the work done.

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks for reporting it! Closing.

Changed in ubuntu-docs:
status: Incomplete → Fix Released
Changed in canonical-website-content:
status: New → Fix Released
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.