Page MenuHomePhabricator

XSS in Parser::replaceInternalLinks2 during replacement of percent encoding in unclosed internal links
Closed, ResolvedPublic

Description

Put

[[#%3Cscript%3Ealert(1)%3C/script%3E|

On a line by itself, and you get an XSS.

It appears that this was fixed in the main code branch in r13302 by @GWicke, but the e1_img code patch was missed. The e1_img code path was added in r5693, so this issue basically effects all versions of MW ever.

@Legoktm helped discover this vulnrability

Event Timeline

For reference:

This has been tested and is ready for deployment.

dpatrick claimed this task.

This patch has been deployed:

21:16 dapatrick: Deployed patch for T137264 to wmf.5 and wmf.6
demon changed the visibility from "Custom Policy" to "Public (No Login Required)".Aug 23 2016, 1:23 AM
demon changed Security from Software security bug to None.

Change 306129 had a related patch set uploaded (by Ejegg):
SECURITY: XSS in unclosed internal links

https://gerrit.wikimedia.org/r/306129

Change 306129 merged by jenkins-bot:
SECURITY: XSS in unclosed internal links

https://gerrit.wikimedia.org/r/306129

Change 306120 merged by jenkins-bot:
SECURITY: XSS in unclosed internal links

https://gerrit.wikimedia.org/r/306120

Change 306111 merged by jenkins-bot:
SECURITY: XSS in unclosed internal links

https://gerrit.wikimedia.org/r/306111

Change 306092 merged by jenkins-bot:
SECURITY: XSS in unclosed internal links

https://gerrit.wikimedia.org/r/306092

Change 306101 merged by jenkins-bot:
SECURITY: XSS in unclosed internal links

https://gerrit.wikimedia.org/r/306101

Point of interest, it appears that this vulnerability was at least attempted to be used in the wild. The script mentioned in T419143 appears to attempt to use it. Obviously in Wikimedia's case it has long since been patched, however it appears that that script may have been copied and originally targeted at other wikis. Its hard to know when the script was originally written, but its probable the original target was using an outdated version of MediaWiki at the time and was vulnerable.