Skip to content
XSS Write-up Advanced

First bounty, time to step up my game

An outdated upload plugin contained a Flash component vulnerable to cross-site scripting, but strict input filters limited the payload to alphanumeric characters and dots. The author used a Same Origin Method Execution attack to make a victim's browser delete their own profile picture, demonstrating impact beyond a simple alert.

Roderick Schaefer Follow

Published on kciredor.com

After publishing my first blog I kept on trying to hack different companies and websites.

Roderick Schaefer, on kciredor.com

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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

This is the story of a Same Origin Method Execution (SOME) issue found on a company website during the author's second month of full-time bug bounty work. The company and its URLs are masked because the issue was not to be made public, so treat the specifics as illustrative rather than reproducible.

The feature involved is an upload plugin used by the target company. The plugin tries to support uploads across as many browsers and versions as possible and ships a Flash component. That Flash component was vulnerable to cross-site scripting. The XSS on its own was not enough to prove exploitability, and the author used SOME to turn the limited input allowed by the vulnerable parameters into a working attack that deletes a user's profile picture.

Setup

The work was done by browsing the target's websites with Burp proxying traffic to build a sitemap, and with the Retire.js Chrome extension enabled. Retire.js flagged that a specific library was out of date, which is how the vulnerable upload plugin came to attention. The author then cloned the library from GitHub including submodules and read through the code to understand the filters on the vulnerable parameters.

No accounts, roles or specific versions are given in the report.

Finding it

Extensive recon of the different websites owned by the target company showed they were using an old version of an upload plugin. While browsing and proxying everything through Burp, Retire.js pointed out that this specific library was out of date, so the author started looking into it and searched for published issues.

The Flash component of the plugin was vulnerable to XSS. The author notes that this will pop an alert box containing kciredor, but that an alert of a nickname is not the end of the story. Trying to alert document.cookie instead does not work, and simply reporting the XSS at that point would have got the author into trouble because exploitability could not be proven.

Reading the cloned library source revealed the constraints on the two parameters involved:

  • the target parameter is filtered with a regex allowing a-zA-Z0-9._
  • the uid parameter is filtered with a regex allowing a-zA-Z0-9_

That does not leave much room to get things done. The author credits smiegles for a heads-up on SOME attacks, notes that there is a PoC to get inspired by, and points to Ben Hayak's whitepaper on Same Origin Method Execution. The impact of SOME is roughly the same as XSS, and because alphanumeric input plus a dot is enough to make a SOME attack work, the allowed character set was sufficient.

Exploitation

Step 1: find a callable method in the page

In the context of the website being attacked, the author tried to build a DOM path to the user profile delete button, but without success. The delete profile function is called, but a confirm box asks whether the user really wants to delete their profile. That kind of user interaction is not what the attack needs.

Trying to submit the form manually by calling the form's submit function ran into another obstacle: the submit name was DOM clobbered by a form input. A call to delete the profile picture, however, worked. That function was well hidden; the author found it by downloading all the obfuscated and concatenated JavaScript the site served and analysing it after deobfuscation.

Step 2: deliver the attack

The remaining problem is making sure someone actually clicks the link containing the attack. That depends on the context of the website. The report gives the example that on something like eBay you could add a link claiming there is more info and pictures behind it. In the context of the company being attacked it was easy to find a good reason.

The end result was a page, poc.html. The report describes the flow rather than reproducing the file: a user is given the link to poc.html and clicks the button. A new browser tab opens at the target location, and after a timeout the JavaScript clicks a DOM element that performs the actual profile picture deletion.

Step 3: report and fix

The author's suggestion for fixing the issue was simply to upgrade the library, because the issue has been fixed in more recent versions.

Root cause

The old upload plugin's Flash component was vulnerable to XSS, and the two parameters involved are restricted to a-zA-Z0-9._ (target) and a-zA-Z0-9_ (uid). Those filters block the usual XSS payloads that would read document.cookie, but they do not block SOME, which needs only alphanumeric characters and a dot to name a method on an object in the same origin. The plugin's attempt to support as many browsers and versions as possible, including through Flash, kept an outdated and vulnerable component in production. The report does not describe the server-side or client-side code that performs the reflection, so the exact mechanism is not stated.

Impact

SOME gives roughly the same impact as XSS. In this case the attacker could make a victim's browser call the delete profile picture function on the target site, without further interaction beyond clicking the initial link and waiting for the timeout. The delete profile function itself was not usable because of its confirm box, and the form submit route was blocked by DOM clobbering of the submit name. The attack therefore depends on a suitable method being reachable in the page.

Fix

Upgrade the upload plugin library. The issue is fixed in more recent versions, and that was the author's suggested remediation.

Variants to test

  1. Look for old upload or media plugins with Flash components on other targets. A positive result is a parameter that reflects into a Flash or JavaScript context and executes an alert.
  2. Check the character filters on reflected parameters. If only a-zA-Z0-9._ or similar pass, try SOME instead of a classic XSS payload; a positive result is a same-origin method being invoked from a crafted page.
  3. Enumerate same-origin methods that change state without a confirm dialogue. A positive result is a function such as a delete or update call that runs from a DOM path built with alphanumeric characters and dots.
  4. Download and deobfuscate the site's concatenated JavaScript to find hidden functions. A positive result is a callable method that is not exposed in the visible UI.
  5. Test whether form submit names are DOM clobbered by inputs. A positive result is a form whose submit function cannot be called because an input shadows the name, which may push you towards another method.
Twitter
Twitter From the original on kciredor.com
Reddit
Reddit
LinkedIn
LinkedIn
Facebook
Facebook

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

This is the story of a security bug the author found on a company website during his second month of working full time on bug bounties. A bug bounty is a scheme where companies pay people for reporting security problems to them instead of exploiting them. The company and its web addresses are hidden here because the issue was not meant to be made public, so the details are there to explain the idea rather than to let you repeat the attack.

The feature involved is an upload plugin. A plugin is a piece of software that a website installs to add a feature, in this case letting users upload files. This particular plugin tried to support uploads on as many browsers and browser versions as possible, and to do that it included a Flash component. Flash was a browser add-on that let websites run animations and interactive content; it is now discontinued, but at the time it was common. That Flash component had a cross-site scripting flaw. Cross-site scripting, usually shortened to XSS, means a website takes something an attacker supplies and runs it as code in the victim's browser, as if the site itself had written it.

XSS on its own was not enough here to prove the bug could actually be exploited, so the author used a related technique called Same Origin Method Execution, or SOME, to turn the very limited input the vulnerable parameters allowed into a working attack. The attack deletes a user's profile picture.

Setup

To find bugs you first need to know what a website is made of. The author browsed the target company's websites with a tool called Burp proxying the traffic. A proxy sits between your browser and the website and records every request and response, so you end up with a map (a sitemap) of every page and file the site loads. He also had a Chrome extension called Retire.js switched on. Retire.js watches the JavaScript libraries a page loads and warns you when one of them is an old version with known security problems. A JavaScript library is a bundle of ready-made code that a site includes rather than writing everything itself.

Retire.js flagged that a specific library was out of date, and that is how the vulnerable upload plugin came to attention. The author then cloned the library from GitHub, including its submodules, and read through the code. GitHub is a website where source code is hosted and shared; cloning means downloading a copy. Submodules are extra code repositories that a project pulls in, so cloning with submodules gives you the complete source. Reading the source is how he learned exactly which characters the vulnerable parameters would accept.

The report does not give any accounts, roles or specific version numbers.

Finding it

Extensive recon of the different websites owned by the target company showed they were using an old version of an upload plugin. Recon, short for reconnaissance, means mapping out what a company has online before you attack anything: which sites, which pages, which software. While browsing and proxying everything through Burp, Retire.js pointed out that this specific library was out of date, so the author started looking into it and searched for published issues. Published issues are bug reports and advisories that other people have already written about a piece of software; if a library is old and someone has documented a flaw in it, that documentation tells you what to try.

The Flash component of the plugin was vulnerable to XSS. The author notes that this will pop an alert box containing kciredor, his handle. An alert box is the small pop-up a browser shows when JavaScript calls alert(). It is the classic harmless proof that you can run code: you make the browser display a word of your choosing. But an alert of a nickname is not the end of the story. He tried to alert document.cookie instead, and that does not work. A cookie is a small piece of data a website stores in your browser, and it is often what keeps you logged in; document.cookie is the JavaScript way of reading it. If an attacker can read a victim's cookie, they may be able to take over the session, so being able to alert it is a much stronger proof of harm than alerting a nickname. Simply reporting the XSS at that point would have got the author into trouble, because he could not prove exploitability: he could show code ran, but not that it could do anything damaging.

Reading the cloned library source revealed the constraints on the two parameters involved. A parameter is a named value passed in a web address or request, like the q in a search URL. A regex, short for regular expression, is a pattern that describes which characters are allowed; anything outside the pattern is rejected. The two filters were:

  • the target parameter is filtered with a regex allowing a-zA-Z0-9._
  • the uid parameter is filtered with a regex allowing a-zA-Z0-9_

In plain words: target accepts the letters a to z in both upper and lower case, the digits 0 to 9, a dot and an underscore. uid accepts the same letters and digits and an underscore, but no dot. That does not leave much room to get things done, because most classic XSS payloads need characters such as brackets, quotes, slashes or angle brackets, and all of those are blocked.

The author credits smiegles for a heads-up on SOME attacks, notes that there is a PoC to get inspired by, and points to Ben Hayak's whitepaper on Same Origin Method Execution. A PoC, or proof of concept, is a small working example that demonstrates an attack. A whitepaper is a longer technical document explaining a topic in depth. The impact of SOME is roughly the same as XSS, and because alphanumeric input plus a dot is enough to make a SOME attack work, the allowed character set was sufficient. That is the key insight: SOME needs only letters, digits and dots, which is exactly what these filters let through.

Exploitation

Step 1: find a callable method in the page

A method is simply a named action that a piece of JavaScript code can perform, such as deleteProfilePicture(). SOME works by making the victim's browser call one of these methods on the target site, from a page the attacker controls. The catch is that the attacker can only name the method using the characters the filter allows, so the method has to be reachable by a path of names joined with dots, like something.something.else.

In the context of the website being attacked, the author tried to build a DOM path to the user profile delete button, but without success. The DOM, or Document Object Model, is the browser's internal tree of everything on a page: buttons, forms, images and so on. A DOM path is a chain of names that leads from the top of the page down to one specific element, and clicking that element is what triggers its action. The delete profile function is called, but a confirm box asks whether the user really wants to delete their profile. A confirm box is the browser dialogue with OK and Cancel buttons. That kind of user interaction is not what the attack needs, because the whole point is to act without the victim deciding anything.

Trying to submit the form manually by calling the form's submit function ran into another obstacle: the submit name was DOM clobbered by a form input. DOM clobbering is a quirk of browsers: if a page contains an element with a certain name or id, that name can become a property on the page's JavaScript objects, hiding or replacing what was there before. Here an input field had taken over the name the code wanted to use, so the call did not reach the submit function.

A call to delete the profile picture, however, worked. That function was well hidden; the author found it by downloading all the obfuscated and concatenated JavaScript the site served and analysing it after deobfuscation. Obfuscated means the code has been deliberately made hard to read, for example by renaming variables to meaningless short names. Concatenated means many separate files have been glued into one big file. Deobfuscation is the process of tidying that back up so a human can follow it. This is why the step was taken: the visible page did not show the function, so the only way to find it was to read the code the browser actually runs.

Step 2: deliver the attack

The remaining problem is making sure someone actually clicks the link containing the attack. That depends on the context of the website. The report gives the example that on something like eBay you could add a link claiming there is more info and pictures behind it. In the context of the company being attacked it was easy to find a good reason. This is social engineering in the mild sense: you are not breaking any technology, you are giving a person a believable reason to click.

The end result was a page, poc.html. The report describes the flow rather than reproducing the file: a user is given the link to poc.html and clicks the button. A new browser tab opens at the target location, and after a timeout the JavaScript clicks a DOM element that performs the actual profile picture deletion. A timeout is a scheduled delay: the code waits a set number of seconds before running the next step, which gives the new tab time to load. The victim sees a page load and then their profile picture is gone, without ever pressing a delete button themselves.

Step 3: report and fix

The author's suggestion for fixing the issue was simply to upgrade the library, because the issue has been fixed in more recent versions. Upgrading means replacing the old plugin with a newer release in which the flaw has already been corrected.

Root cause

The vulnerable Flash component in the old upload plugin was susceptible to cross-site scripting. Reflecting means the site takes a value from the request and puts it straight back into the page. The two parameters involved are restricted to a-zA-Z0-9._ (target) and a-zA-Z0-9_ (uid). Those filters block the usual XSS payloads that would read document.cookie, but they do not block SOME, which needs only alphanumeric characters and a dot to name a method on an object in the same origin. Same origin is the browser's rule for what counts as the same website: the same scheme, host and port. Code from one origin is allowed to touch things from the same origin, which is exactly why a method on the target site can be called from a page that has managed to run in that origin.

The plugin's attempt to support as many browsers and versions as possible, including through Flash, kept an outdated and vulnerable component in production. Production means the live site real users visit. The report does not describe the server-side or client-side code that performs the reflection, so the exact mechanism is not stated.

Impact

SOME gives roughly the same impact as XSS. In this case the attacker could make a victim's browser call the delete profile picture function on the target site, without further interaction beyond clicking the initial link and waiting for the timeout. The delete profile function itself was not usable because of its confirm box, and the form submit route was blocked by DOM clobbering of the submit name. The attack therefore depends on a suitable method being reachable in the page.

Fix

Upgrade the upload plugin library. The issue is fixed in more recent versions, and that was the author's suggested remediation.

Variants to test

  1. Look for old upload or media plugins with Flash components on other targets. A positive result is a parameter that reflects into a Flash or JavaScript context and executes an alert.
  2. Check the character filters on reflected parameters. If only a-zA-Z0-9._ or similar pass, try SOME instead of a classic XSS payload; a positive result is a same-origin method being invoked from a crafted page.
  3. Enumerate same-origin methods that change state without a confirm dialogue. A positive result is a function such as a delete or update call that runs from a DOM path built with alphanumeric characters and dots.
  4. Download and deobfuscate the site's concatenated JavaScript to find hidden functions. A positive result is a callable method that is not exposed in the visible UI.
  5. Test whether form submit names are DOM clobbered by inputs. A positive result is a form whose submit function cannot be called because an input shadows the name, which may push you towards another method.
Twitter
Twitter From the original on kciredor.com
Reddit
Reddit
LinkedIn
LinkedIn
Facebook
Facebook

Glossary

  • Bug bounty: a programme where a company rewards people for reporting security flaws instead of exploiting them.
  • Plugin: add-on software a website installs to gain a feature, such as file uploads.
  • Flash: a discontinued browser add-on that ran interactive content; it had a long history of security problems.
  • Cross-site scripting (XSS): a flaw where a site runs attacker-supplied input as code in the victim's browser.
  • Same Origin Method Execution (SOME): an attack that makes a victim's browser call a named method on the target site, using only characters that can name that method.
  • Burp: a tool that sits between browser and website, recording and letting you edit requests and responses.
  • Proxy: an intermediary that forwards traffic and can log or modify it.
  • Sitemap: a map of the pages and files a site loads, built here from proxied traffic.
  • Retire.js: a browser extension that warns when a page loads an outdated JavaScript library with known issues.
  • JavaScript library: a bundle of ready-made code a site includes.
  • GitHub: a website for hosting and sharing source code.
  • Cloning: downloading a full copy of a code repository.
  • Submodule: an extra repository that a project pulls in, so cloning with submodules gets the complete source.
  • Recon: reconnaissance; mapping out what a company has online before attacking.
  • Published issue: a bug report or advisory someone has already written about a piece of software.
  • Alert box: the pop-up a browser shows when JavaScript calls alert(); a harmless proof that code ran.
  • Cookie: a small piece of data a site stores in your browser, often used to keep you logged in.
  • document.cookie: the JavaScript way of reading the current page's cookies.
  • Exploitability: whether a flaw can actually be turned into real harm, not just a harmless proof.
  • Parameter: a named value passed in a web address or request.
  • Regex: a pattern describing which characters or text are allowed or matched.
  • PoC (proof of concept): a small working example that demonstrates an attack.
  • Whitepaper: a longer technical document explaining a topic in depth.
  • Method: a named action in JavaScript code, such as a delete function.
  • DOM (Document Object Model): the browser's internal tree of everything on a page.
  • DOM path: a chain of names leading from the top of the page to one specific element.
  • Confirm box: the browser dialogue with OK and Cancel that asks the user to agree.
  • DOM clobbering: a browser quirk where an element's name or id replaces a property on a JavaScript object, hiding what was there.
  • Obfuscated: code deliberately made hard to read.
  • Concatenated: many files glued into one.
  • Deobfuscation: tidying obfuscated code so a human can follow it.
  • Social engineering: giving a person a believable reason to do something, such as click a link.
  • Timeout: a scheduled delay before the next step of code runs.
  • Reflecting: a site taking a value from the request and putting it straight back into the page.
  • Same origin: the browser's rule for what counts as the same website: same scheme, host and port.
  • Production: the live site real users visit.
  • Session: the state of being logged in, usually held together by a cookie.
  • Remediation: the fix for a security issue.
  • Enumerate: to list out systematically, for example all the methods a page exposes.

More by Roderick Schaefer

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.