GHSL-2021-1043: Cross-Site Scripting (XSS) in emoji-button - CVE-2021-43785
The emoji-button library inserted the emoji field of a custom emoji directly into an HTML img tag without escaping. An attacker who could influence that field could supply markup that runs script in the page, leading to cross-site scripting.
Originally disclosed on GitHub Security Lab
An attacker that is able to influence the field emoji when creating a rn instance is able to supply arbitrary html or javascript that will be rendered in the context of a user leading to XSS.
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 report has not been written yet. The Original tab links to the source.
How it worked
Impact
This issue may lead to XSS, allowing script to run in the context of a user viewing the page.
What the attacker needed
Attacker can influence the emoji field; victim views the page with the picker
The fix
The maintainer pushed a fix and published an advisory the same day.
How it was found
- Create a picker instance with a custom emoji whose emoji field contains HTML markup.
- Attach the picker to a trigger element and open it.
- The library renders the custom emoji as an image tag, and the injected markup executes.
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 report has not been written yet. The Original tab links to the source.
A web page can build HTML from text. If that text comes from someone else and is not cleaned, the browser treats it as real markup, so an image tag with an error handler can run JavaScript. Here the library put the emoji value straight into an image tag, so a crafted value could run code in the visitor'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.