Skip to content
XSS Disclosed report Beginner

XSS in editor by any user

A user could inject an XSS payload into Phabricator's editor by abusing nested parsing of meme syntax, where the src value was treated as a link and automatically linked.

tunnelshade Follow

Originally disclosed on HackerOne

Bounty$1,000 View original
  • Triaged in 1 hour
  • Fixed in 2 hours
  • Paid in 2 hours
  • Disclosed after 43 days

Steps

  • Open any editor in phabricator where memes can be used (literally anywhere :P)
  • Enter the following and save it & BOOM
{meme, src= http://dummy//onerror=eval(prompt(1))// }

Why ?

  • Nested parsing is causing the src value to be treated as a link which is automatically made link by fabricator. So, a whole mess-up of syntax happening there.
  • \\ are being used as space separators since those replaced.

Fix ?

  • May be to avoid nested parsing, it messes up things. But the choice is yours since you have more knowledge of the application needs

The original report as published on HackerOne, by tunnelshade. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 5 min read.

What the report shows

This is a cross-site scripting report against Phabricator, filed on HackerOne by tunnelshade and disclosed on 13 August 2014. The bounty was 1,000 USD. The weakness is recorded as generic cross-site scripting. The report does not give a CVSS score or a severity rating.

The affected feature is the editor: any place in Phabricator where memes can be used. The researcher's point is that this is not one specific form, it is every editor that accepts meme syntax.

The reproduction is two steps:

  1. Open any editor in Phabricator where memes can be used.
  2. Enter the following and save it.
Text
{meme, src= http://dummy//onerror=eval(prompt(1))// }

The researcher describes the result as BOOM, meaning the script runs. The payload calls prompt(1) through eval, which is a harmless proof of execution rather than a weaponised attack.

The report does not describe the response, the rendered HTML, or which user role is needed beyond the title's claim that this works for any user. It also does not record whether a fix was applied or what the fix was.

Root cause

The report attributes the bug to nested parsing. The value given to src is treated as a link, and Phabricator's renderer automatically turns links into anchors. The researcher calls this "a whole mess-up of syntax".

The second part of the explanation concerns the double backslash. The report says \\ is used as a space separator because those characters get replaced. In the payload, // appears twice: once after http://dummy and once at the end. The report says the double backslash is used as a space separator because those characters get replaced, and that the nested parsing causes a mess-up of syntax.

The report attributes the bug to nested parsing: the src value is treated as a link and automatically linkified. Two parsers disagree about where the value ends, and the browser follows the second one.

Impact

The title states the payload works for any user. The report itself demonstrates only prompt(1) and does not discuss session theft, privilege escalation or worming. Those are consequences a reader can infer from stored XSS in a multi-user tool, not claims the report makes.

How this kind of bug works

Stored XSS in a rich-text or markup feature usually comes from a mismatch between two layers. The first layer is the application's own mini-language: meme syntax, markdown, wiki markup, shortcodes. It has its own tokeniser, and it may rewrite parts of the input, for example turning bare URLs into links or normalising whitespace and separators. The second layer is HTML: the renderer assembles tags and attributes from the parsed tokens and hands the result to the browser.

The bug appears when the first layer's output is inserted into the second without context-aware escaping. If a value that the author intended as an attribute value can contain characters that close the attribute or the tag, the browser will parse the remainder as new attributes or new elements. Event handler attributes such as onerror, onload or onmouseover are the usual target because they need no user interaction beyond rendering.

Defences that stop this class are structural rather than cosmetic. Build DOM nodes and set attributes through an API that escapes values, rather than concatenating strings. Run the rendered output through a sanitiser with an allowlist of tags and attributes, and strip all event handlers and javascript: URLs. Apply a Content Security Policy that forbids inline script, so an injected handler does not execute even if it reaches the page. Keep the markup parser and the HTML serialiser in agreement about escaping rules.

How to test for it

Look for any input that goes through a custom markup parser: comment bodies, task descriptions, wiki pages, profile fields, chat messages, and anything with shortcode or directive syntax such as {name, key=value}.

  1. Map the syntax. Find the documentation or the parser source and list every directive, its attributes, and any characters the parser rewrites.
  2. Send a benign marker first, for example a directive whose attribute value is a unique string, and inspect the rendered HTML to see exactly which element and attributes your input produced.
  3. Then try to break out of the attribute context. Useful probes are quote characters, whitespace variants, the parser's own separator characters, and URL-like values that the linkifier may rewrite. The goal is to make an event handler attribute appear on the generated element.
  4. Use a payload that fails to load, such as an image pointing at a non-existent host, so an onerror handler fires without user interaction.
  5. Confirm execution with a harmless call such as prompt or alert, and check whether the payload persists and is shown to other users.

A positive result is your marker appearing as a new attribute or element in the DOM, followed by script execution in the browser. Common false positives are payloads that are escaped and merely displayed as text, payloads that only execute in your own browser through a client-side preview that is never stored, and reflected cases where the value comes back only in a response to your own request. Always verify the stored path by reloading as a second account.

How it is fixed

Escape attribute values for the HTML context they are placed in, and never concatenate raw user input into tag markup. Where a markup language must produce HTML, render through a sanitiser with a strict allowlist and drop event handler attributes and dangerous URL schemes. Fix the parser so that separators and link rewriting cannot change the boundaries of an attribute value. Add a Content Security Policy without unsafe-inline as defence in depth, and add regression tests that feed hostile directive syntax through the renderer and assert on the output.

Hunting notes

This class hides in features that were added later on top of an existing renderer: custom directives, embeds, mention syntax, and anything that accepts key-value attributes. Recon signals include a documentation page describing markup extensions, parser or renderer source in the repository, and editors that accept more than plain text. When you report, show the exact stored input, the rendered markup, and proof of execution in a second user's session, and keep the proof payload non-destructive. That combination is what makes a program accept the finding as stored XSS rather than a display quirk.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 8 min read.

What happened, in plain words

Phabricator is a web application that teams use to manage software work: tasks, code reviews, project discussions and so on. Many of its screens contain an editor, a text box where you write a comment, a task description or a wiki page. Some of these editors understand a small extra language on top of plain text, so that you can write a short instruction and the application turns it into something richer, such as an embedded image. One of those instructions is the meme directive, written as {meme, ...}.

The report, filed on HackerOne by tunnelshade and disclosed on 13 August 2014, shows that this directive could be abused. A user who typed a specially crafted meme instruction into any editor that supports memes could get JavaScript code to run. The bounty was 1,000 USD, and the weakness is recorded as generic cross-site scripting. The report gives no CVSS score and no severity rating.

The researcher's proof is deliberately harmless: it opens a small pop-up box with the number 1 in it. That is enough to prove that code runs, without doing anything damaging.

The reproduction

The report gives two steps.

  1. Open any editor in Phabricator where memes can be used. The researcher stresses that this is not one particular form: it is every editor that accepts meme syntax.
  2. Enter the following and save it.
Text
{meme, src= http://dummy//onerror=eval(prompt(1))// }

Saving the text is the moment that matters. The researcher sums up the result as BOOM, meaning the script runs.

The payload, piece by piece

  • {meme, ... } is the directive: it tells the editor that this is not ordinary text but an instruction to build a meme element, normally an image.
  • src= is the attribute that says where the image should be loaded from. In normal use it would hold a real picture address.
  • http://dummy is the value given to src in the payload.
  • // after the host is one of the double backslashes the report talks about. The report says \\ is used as a space separator because those characters get replaced.
  • onerror= is an HTML attribute that names code to run when an image fails to load.
  • eval(prompt(1)) is the code that would run. prompt(1) opens a dialog box showing 1, and eval executes whatever it is given. It is a proof of execution, not an attack.

Why it worked

The report blames nested parsing. The value given to src is treated as a link, and Phabricator automatically turns links into clickable anchors. The researcher calls this "a whole mess-up of syntax": two different parts of the software each read the same text in their own way, and they disagree about where the address ends and where new attributes begin. The report says two parts of the software read the same text differently, causing a mess-up of syntax.

The report does not show the HTML that was generated, so the exact mechanism is implied rather than demonstrated. It also does not say which user role is needed beyond the title's claim that this works for any user, and it does not record whether a fix was applied or what that fix was.

Why it matters

The report itself only demonstrates the pop-up and does not discuss stealing sessions, escalating privileges or spreading automatically; those are consequences a reader can infer from stored cross-site scripting in a multi-user tool, not claims the report makes.

The suggested fix

The report's own suggestion is short: perhaps avoid nested parsing, because it messes things up. The researcher adds that the choice belongs to the maintainers, who know the application's needs better.

In general, how this kind of bug works

This is stored cross-site scripting, usually shortened to stored XSS. A web page is built from HTML, a language of tags and attributes that the browser reads and turns into what you see. If an application puts text written by a user into that HTML without neutralising the special characters, the browser cannot tell the difference between the application's own markup and the user's text. Anything the user wrote that looks like a tag or an attribute is then treated as one.

Rich-text and markup features make this more likely, because they sit between two layers. The first layer is the application's own mini-language, with its own rules: it may rewrite bare web addresses into links, or normalise spaces and separators. The second layer is HTML, which the application assembles from the result. The bug appears when the first layer's output is dropped into the second without escaping suited to that spot. If a value meant to be an attribute value can contain characters that close the attribute, the browser reads the remainder as new attributes. Event handlers such as onerror are popular targets because they need no click: the browser runs them as soon as the element renders or fails.

Defences are structural. Build page elements through an interface that escapes values instead of gluing strings together. Pass rendered output through a sanitiser that allows only known tags and attributes and strips event handlers and javascript: addresses. Add a Content Security Policy that forbids inline script, so an injected handler does not run even if it reaches the page. And keep the markup parser and the HTML writer in agreement about escaping.

How to test for it

Look for any input that goes through a custom markup parser: comment bodies, task descriptions, wiki pages, profile fields, chat messages, and anything with directive syntax such as {name, key=value}.

  1. Map the syntax. Find the documentation or the parser source and list every directive, its attributes, and any characters the parser rewrites.
  2. Send a harmless marker first, for example a directive whose attribute value is a unique string, and inspect the rendered HTML to see which element and attributes your input produced.
  3. Try to break out of the attribute. Useful probes are quote characters, whitespace variants, the parser's own separator characters, and web addresses that the linkifier may rewrite. The goal is to make an event handler appear on the generated element.
  4. Use a value that fails to load, such as an image pointing at a non-existent host, so an onerror handler fires without user interaction.
  5. Confirm execution with a harmless call such as prompt or alert, then check whether the payload persists and is shown to other users.

A positive result is your marker appearing as a new attribute or element, followed by script execution. Common false positives are payloads that are escaped and merely shown as text, payloads that only run in your own browser through a preview that is never stored, and reflected cases where the value comes back only in the response to your own request. Always verify the stored path by reloading as a second account.

How it is fixed

Escape attribute values for the HTML context they land in, and never concatenate raw user input into tag markup. Where a markup language must produce HTML, render through a sanitiser with a strict allowlist and drop event handler attributes and dangerous address schemes. Fix the parser so that separators and link rewriting cannot change the boundaries of an attribute value. Add a Content Security Policy without unsafe-inline as defence in depth, and add regression tests that feed hostile directive syntax through the renderer and check the output.

Hunting notes

This class hides in features added later on top of an existing renderer: custom directives, embeds, mention syntax, and anything that accepts key-value attributes. Signals worth watching are a documentation page describing markup extensions, parser or renderer source in the repository, and editors that accept more than plain text. When you report, show the exact stored input, the rendered markup, and proof of execution in a second user's session, and keep the proof payload non-destructive. That combination is what makes a program accept the finding as stored XSS rather than a display quirk.

Glossary

  • Phabricator: a web application for managing software work such as tasks, code reviews and project discussions.
  • Editor: a text box in a web application where a user writes content such as a comment or description.
  • Directive: a short instruction inside text, such as {meme, ...}, that the application turns into something richer.
  • Attribute: a named setting on an HTML element, for example where an image should load from.
  • HTML: the language of tags and attributes that browsers read to build a page.
  • Cross-site scripting (XSS): a bug where text controlled by a user is treated as code by another user's browser.
  • Stored XSS: XSS where the malicious text is saved by the application and shown to everyone who later views the page.
  • Payload: the piece of text an attacker submits to trigger the bug.
  • src: the HTML attribute that holds the address an image is loaded from.
  • onerror: an HTML attribute holding code that runs when an image fails to load.
  • eval: a JavaScript function that executes the code it is given.
  • prompt: a JavaScript function that opens a dialog box; here used as a harmless proof that code ran.
  • Nested parsing: two parts of the software reading the same text with different rules, so they disagree about where a value ends.
  • Escaping: converting special characters in text so the browser treats them as plain text rather than markup.
  • Sanitiser: a component that removes dangerous tags and attributes from generated HTML.
  • Allowlist: a list of things that are permitted, with everything else rejected.
  • Content Security Policy (CSP): a rule set a site sends to the browser saying which scripts may run.
  • DOM: the browser's in-memory model of the page, built from the HTML.
  • False positive: a test result that looks like a bug but is not one.
  • Reflected XSS: XSS where the payload comes back only in the response to the attacker's own request and is not stored.
  • CVSS: a standard scoring system for the severity of a vulnerability.

More by tunnelshade

View all

4 more disclosed reports, best first.

More from Phabricator

View all

The newest disclosed reports for this program.

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.