XSS Via XML Value Processing
An XML import feature allowed user-supplied values to be reflected into an onclick event handler without proper sanitisation, enabling cross-site scripting. An attacker could inject a payload that executes JavaScript when a user clicks a button, potentially leading to data theft or other malicious actions.
numbshiva.medium.com
Published on numbshiva.medium.com
XXE is not the only vulnerability that can be introduced to a web application when processing XML files. If the values within strings are not handled correctly, it may also be possible for an attacker to introduce a cross-site scripting payload that could be triggered any under circumstance where the value is returned…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application used a regex-based sanitisation that only removed specific characters and patterns, allowing other characters to break out of the JavaScript context.
Impact
The payload required a user to click a button, and the malicious value was visible on screen before clicking, limiting practical exploitation; however, if the value were hidden or automatically processed, it could become a zero-click attack.
What the attacker needed
Ability to upload XML files; victim clicks a button
The fix
The application should use proper context-aware output encoding instead of regex-based sanitisation to prevent injection into JavaScript contexts.
How it was found
- Upload an XML file containing a crafted value in a field that is later reflected.
- Observe that the value is inserted into an onclick event handler in the HTML.
- Inject a payload that closes the function call and adds JavaScript code.
- Bypass the regex filter by using 'javascript:eval' and base64 encoding.
- The payload executes when a user clicks the button.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The application let users upload XML files and later showed some of the values on a web page. Those values were placed inside a JavaScript event handler without being properly cleaned, so an attacker could include code that runs when someone clicks a button. This is called cross-site scripting (XSS), where an attacker's code runs in another user's browser.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.