How We Are Able To Hack Any Company By Sending Message – $20,000 Bounty [CVE-2021–34506]
Microsoft Edge's built-in translator failed to sanitise HTML before translating, so a page containing an XSS payload would execute script when translated. An attacker could run JavaScript on any site a victim visited in Edge with auto-translate enabled, leading to universal XSS.
Published on blog.cyberxplore.com
Hello Folks , I hope everyone is doing well in this pandemic & making full use of it for learning new stuff in their daily life . so this a story about hacking into any companies even the big ones are on list like facebook , google , microsoft etc. so how does this all begin to know this we need to start from scratch .
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
Microsoft Edge ships with an internal translator that is pre-installed in the browser. When a page is detected as being in a different language, Edge offers to translate it, and the translation is performed by a script exposed as Microsoft.JS. The researchers describe this component as having vulnerable code that takes HTML tags, including an img tag, without sanitising the input or converting the payload into text while translating.
The write-up is about a universal XSS (uXSS) in that translator, tracked as CVE-2021-34506. Unlike a reflected or stored XSS that lives in one application, a uXSS exploits a client-side flaw in the browser or a browser extension to create an XSS condition and run malicious code; the behaviour of the browser is affected and its security features may be bypassed or disabled.
The work was done by Shivam Kumar Singh (@MrRajputHacker) and Vansh Devgan (@Th3Pr0xyB0y).
Setup
The path to the bug started on a mail.ru subdomain in a HackerOne program. That program is in Russian, and the researchers normally use Firefox with Burp Suite to test web applications. Firefox did not translate the pages well, so they looked for translation extensions and found that many had been removed because they contained vulnerable code. That led them to think about how much access a browser extension has: on any site, an extension can reach the complete DOM of the page, cookies and anything else JavaScript can do.
They dropped the mail.ru subdomain and decided to target Microsoft Edge, which has a bounty program. Before moving fully to the browser, they went back to the same site to try translating it in Edge, which by then had a new update containing a new translator by Microsoft.
The reproduction environment is:
- Microsoft Edge, version 91.0.864.48 (Official build) (arm64).
- A local Python HTTP server serving the proof-of-concept file.
- The Edge translator, with auto-translate enabled for the remote scenario.
Finding it
The mail.ru page they were testing was already filled with XSS payloads. When they translated that page in Edge, they got many popups. They repeated the same thing in Chrome and got no popup. That difference is what made them dig into the translator.
They found that the internal translator took any HTML tag containing an img tag without sanitising the input or converting the payload into text while translating. The translator was taking the payload "><img src=x onerror=alert(1)> and executing it as JavaScript, because there was no proper validation check to sanitise it or convert the complete DOM into text before processing it for translation.
The affected code appears to be in the function startPageTranslation. The snippet they published shows the wrapper that calls into the Edge script:
function translateInternal(originalLang, targetLang, shouldTranslateFullPageInOneGo) {
resetDataBeforeTranslateCall();
try {
originalLang = GetEdgeLanguageCode(originalLang);
targetLang = GetEdgeLanguageCode(targetLang);
/**
* This will call the startPageTranslation function of edge script
*/
Microsoft.JS.startPageTranslation(originalLang, targetLang, shouldTranslateFullPageInOneGo, ""/*domTranslatorSessionId*/
, ""/*token*/
, onSuccessCallback, onTranslateApiCalled, onErrorCallback);
console.error("edge Translation started");
} catch (err) {
console.error("Translate: " + err);
errorCode = ERROR["UNEXPECTED_SCRIPT_ERROR"];
return false;
}
return true;
Exploitation
To prove the vulnerability existed, they created a POC.html file containing text in different languages together with the well-known XSS payload "><img src=x onerror=alert(1)>.
<b><u>SOME TEXT IN DIFFERENT LANGUAGE </u></b>
<br>
Políticas de Privacidade
Usaremos seus dados pessoais para resolver disputas, solucionar problemas e aplicar nossos Termos e Condições de Uso.
<br>
Para prevenir abusos no app/site, o Badoo usa decisões automáticas e moderadores para bloquear contas, como parte de seu procedimento de moderação. Para isso, nós conferimos contas e mensagens para encontrar conteúdo que indicam quebra dos nossos Termos e Condições de Uso. Isso é feito através de uma
<b><u>OUR PAYLOAD IN TEXT FORM </u></b>
<br>
<br>
"><img src=x onerror=alert(1)>
<br>
<br>
<br>
Políticas de Privacidade
Usaremos seus dados pessoais para resolver disputas, solucionar problemas e aplicar nossos Termos e Condições de Uso.
The file contains text in different languages together with the payload.
Step 1: create the file
Download the POC.html file from the snippet above, or copy the code into a file, name it POC.html and save it.
Step 2: serve it over HTTP
Start a Python server in the same folder where the POC file is located, on localhost:
python3 -m http.server 80
Serving the file over HTTP rather than opening it directly matters. Sometimes the translator does not show up for translating text when an HTML page is simply opened, possibly because the document location is about:html in that case.
Step 3: open it in Edge
Open Microsoft Edge (version 91.0.864.48 (Official build) (arm64)) and visit:
http://localhost/POC.html
By the time the article was written, the browser had most likely already been updated to a secure version, which is why the reader may not be able to reproduce it.
Step 4: accept the translation
The translator shows a message that the page is in another language and asks whether to translate it. Click the translate button.
Step 5: the payload fires
The result is alert(1).

Root cause
The internal translator processed page content without sanitising it or converting the complete DOM into text before sending it for translation. A payload embedded in the page text, "><img src=x onerror=alert(1)>, was therefore taken and executed as JavaScript. The published snippet points at startPageTranslation in the Edge script as the affected function, called through translateInternal.
Because the flaw is in the browser's own translation component rather than in a single site, it is not tied to one origin. Any page that reflects the payload is enough; the researchers only needed the reflection.
Impact
The researchers summarise the impact in four statements:
- Any page reflecting
"><img src=x onerror=alert(1)>(or any XSS payload) is vulnerable; only the reflection is needed. - Any person from another country who does not know English and reads about XSS on an English site is vulnerable, because they will translate the page and the XSS will pop up.
- All users using Edge are vulnerable to XSS that can trigger on any website.
- Any person who receives an email or message containing content in a different language plus an XSS payload is vulnerable.
For a remote exploit, two conditions must hold:
- The person should be using Microsoft Edge.
- The person should have auto-translate on.
The researchers describe several ways they could have hacked large services:
- Facebook: create a profile with a name in a different language plus an XSS payload and send a friend request to a victim using Edge; as soon as the victim checks the profile, the XSS pops up because of auto-translation.
- Google: write a review for a company, HackENews, with a different language plus an XSS payload; anyone browsing that review link gets the XSS popup because of auto-translation.
- YouTube: create a video and enter a comment with an XSS payload plus a different language; anyone viewing that video in Edge gets the XSS popup because of auto-translation. YouTube and Google share the same POC video.
- Windows Store applications: web-based applications on the Windows Store, for example Instagram, are also vulnerable, because the store ships applications with the same Microsoft Edge translator that was responsible for triggering the uXSS.
Fix
Microsoft handled the report on the following timeline:
| Date | Event |
|---|---|
| 3 June 2021 | Report sent to Microsoft |
| 7 June 2021 | Reply from Microsoft, reviewing |
| 8 June 2021 | Additional impact information sent |
| 15 June 2021 | Report triaged |
| 17 June 2021 | $20,000 bounty awarded |
| 19 June 2021 | Pre-release patch |
| 24 June 2021 | Patch update pushed and CVE assigned as CVE-2021-34506 |
Microsoft's release notes and acknowledgement for CVE-2021-34506 are linked in the write-up. The report does not describe the code change itself.
Variants to test
- A positive result is the payload executing in the context of the page, which would indicate the translation path is not sanitising or text-encoding the DOM before processing.
- A positive result is the same popup from a payload embedded in page content.
- A positive result is execution without any interaction beyond viewing the content.
- A positive result is execution once the page is translated, which confirms the flaw is in the browser component rather than the site.
What happened, in plain words
Microsoft Edge, the web browser made by Microsoft, comes with a translation feature built in. When you open a page that looks like it is written in another language, Edge offers to translate it for you. The researchers Shivam Kumar Singh (@MrRajputHacker) and Vansh Devgan (@Th3Pr0xyB0y) found that this translation feature could be tricked into running code that an attacker put on a page. Because the flaw is inside the browser itself and not inside one particular website, it can trigger on any website a person visits with Edge. That class of bug is called universal XSS, or uXSS, and this one was tracked as CVE-2021-34506. Microsoft paid a $20,000 bounty for it.
To follow the story you only need to know a few ideas, and each one is explained where it first appears.
Background: what the pieces are
A browser is the program you use to open websites, such as Edge, Chrome or Firefox. It reads the page's code and draws the page on your screen.
HTML is the language pages are written in. It is made of tags, which are instructions in angle brackets. For example, <b> makes text bold and <img> puts a picture on the page. A tag can carry extra settings called attributes, such as src=x, which tells the browser where the picture is.
JavaScript is the programming language that runs inside the browser and makes pages interactive. A browser can run JavaScript that is written into a page. That is normal and useful, but it also means that if an attacker can get their own JavaScript into a page, the browser will run it.
XSS (cross-site scripting) is the name for that attack: getting your own JavaScript to run in someone else's browser, in the context of a website. The classic example is a page that shows whatever text a visitor typed without cleaning it first. If the visitor types JavaScript instead of plain text, the browser may run it.
Sanitising means cleaning input before using it: removing or neutralising anything that the browser would treat as code rather than as text. Encoding (or converting to text) is the related idea of turning characters that have a special meaning into harmless text so they are displayed, not executed.
The DOM (Document Object Model) is the browser's internal, live model of the page: every heading, image, link and piece of text as objects the browser and JavaScript can read and change. When people say a script can reach the complete DOM, they mean it can see and modify everything on the page.
A cookie is a small piece of data a website stores in your browser, commonly used to remember that you are logged in. If someone can read your cookies for a site, they may be able to act as you on that site. That is why access to the DOM and cookies matters so much.
A browser extension is a small add-on you install in your browser to add features, such as a translation tool. Extensions are powerful: on any site you visit, an extension can reach the complete DOM of the page, the cookies, and anything else JavaScript can do. That power is exactly why a buggy extension is dangerous.
An API is a defined way for one piece of software to ask another piece of software to do something. Think of it as a service counter: you make a request in an agreed format and get a result back. In this story, the browser's translation feature is exposed to the browser's own scripts through an API called Microsoft.JS.
A proof of concept (POC) is a small, safe demonstration that a bug is real, usually the smallest thing that makes the problem visible. Here the visible result is a popup box, produced by the JavaScript function alert(1), which simply shows a message on screen.
A local server is a small program on your own computer that serves files over HTTP, the same protocol websites use, so your browser treats the file like a real web page instead of a file on disk. localhost is the name your computer uses for itself.
A CVE is a public catalogue number for a known security flaw, so that everyone can refer to the same bug. A bounty is a reward a company pays to someone who reports a security problem responsibly.
How the researchers got there
The story starts on a subdomain of mail.ru, found through a program on the bug bounty platform HackerOne. A subdomain is a smaller site under a main domain, like a section of a large site. That program's pages are in Russian. The researchers normally test web applications with Firefox and a tool called Burp Suite, which lets you inspect and change the requests your browser sends. Firefox did not translate those pages well, so they went looking for translation extensions.
While searching, they found that many translation extensions had been removed because they contained vulnerable code. That raised a question: how much harm can a vulnerable extension do to the people using it? The answer is a lot, because of the access described above: on any site, an extension can reach the complete DOM, the cookies and anything else JavaScript can do. Rather than keep hunting on the mail.ru subdomain, they changed direction.
One of them, MrRajputHacker, had already found several vulnerabilities in Microsoft products. The pair decided to target Microsoft Edge, because Microsoft runs a bounty program for it. Before committing fully to the browser, they went back to the same site to try translating it in Edge one last time. Edge had recently been updated and now contained a new translator made by Microsoft.
The mail.ru page they were testing was already full of XSS payloads from earlier testing. When they translated that page in Edge, they got many popups. They did the same in Chrome and got no popup at all. That difference is what sent them digging into the translator.
The bug itself
They found that the internal translator took any HTML tag containing an img tag without sanitising the input or converting the payload into text while translating. In other words, the translator was taking the payload
"><img src=x onerror=alert(1)>
and executing it as JavaScript, because there was no proper validation check to sanitise it or convert the complete DOM into text before processing it for translation.
Let us read that payload piece by piece, because it is the heart of the whole story.
"and>close whatever attribute and tag the page was already inside. This is why the payload starts with those two characters: it breaks out of the surrounding HTML so that what follows is treated as a new tag.<img src=x ...>starts an image tag.src=xsays the image is at the addressx, which does not exist.onerror=alert(1)is an attribute that tells the browser: if loading this image fails, run this JavaScript. Sincexis not a real image, loading always fails, so the JavaScript always runs.alert(1)shows a popup with the number 1.
The trick is that the payload looks like ordinary text on the page, but once the browser builds the page from it, the onerror part becomes live JavaScript.
The affected code appears to be in the function startPageTranslation. A function is a named block of code that does one job; here, it is the job of starting the translation of a page. The snippet the researchers published shows the wrapper that calls into the Edge script:
function translateInternal(originalLang, targetLang, shouldTranslateFullPageInOneGo) {
resetDataBeforeTranslateCall();
try {
originalLang = GetEdgeLanguageCode(originalLang);
targetLang = GetEdgeLanguageCode(targetLang);
/**
* This will call the startPageTranslation function of edge script
*/
Microsoft.JS.startPageTranslation(originalLang, targetLang, shouldTranslateFullPageInOneGo, ""/*domTranslatorSessionId*/
, ""/*token*/
, onSuccessCallback, onTranslateApiCalled, onErrorCallback);
console.error("edge Translation started");
} catch (err) {
console.error("Translate: " + err);
errorCode = ERROR["UNEXPECTED_SCRIPT_ERROR"];
return false;
}
return true;
Line by line, in plain words:
function translateInternal(originalLang, targetLang, shouldTranslateFullPageInOneGo) {declares a function namedtranslateInternal. It takes three inputs: the language the page is in, the language to translate into, and a true/false setting for whether to translate the whole page in one go.resetDataBeforeTranslateCall();clears out any leftover data from a previous translation attempt, so each run starts clean.try {begins a block where errors are caught rather than crashing everything.originalLang = GetEdgeLanguageCode(originalLang);converts the source language into the code format Edge uses internally, for example turning a language name into a short code.targetLang = GetEdgeLanguageCode(targetLang);does the same for the destination language.- The comment
This will call the startPageTranslation function of edge scriptexplains the next line: the real translation work lives in Edge's own script, not here. Microsoft.JS.startPageTranslation(...)is the call into that script, passing the two language codes, the whole-page setting, two empty strings (a session identifier and a token, both left blank here), and three callback functions. A callback is a function you hand over so it can be called later, when something finishes or fails:onSuccessCallbackfor success,onTranslateApiCalledwhen the translation service is called, andonErrorCallbackfor errors.console.error("edge Translation started");writes a message to the browser's developer console, a hidden log for debugging.} catch (err) {catches any error thrown inside thetryblock.console.error("Translate: " + err);logs that error.errorCode = ERROR["UNEXPECTED_SCRIPT_ERROR"];records a specific error code meaning an unexpected script error happened.return false;reports failure to whoever called the function.return true;(after thecatch) reports success when nothing went wrong.
Proving it
To prove the vulnerability existed, they created a POC.html file containing text in different languages together with the well-known XSS payload "><img src=x onerror=alert(1)>.
<b><u>SOME TEXT IN DIFFERENT LANGUAGE </u></b>
<br>
Políticas de Privacidade
Usaremos seus dados pessoais para resolver disputas, solucionar problemas e aplicar nossos Termos e Condições de Uso.
<br>
Para prevenir abusos no app/site, o Badoo usa decisões automáticas e moderadores para bloquear contas, como parte de seu procedimento de moderação. Para isso, nós conferimos contas e mensagens para encontrar conteúdo que indicam quebra dos nossos Termos e Condições de Uso. Isso é feito através de uma
<b><u>OUR PAYLOAD IN TEXT FORM </u></b>
<br>
<br>
"><img src=x onerror=alert(1)>
<br>
<br>
<br>
Políticas de Privacidade
Usaremos seus dados pessoais para resolver disputas, solucionar problemas e aplicar nossos Termos e Condições de Uso.
What each part does:
<b><u>SOME TEXT IN DIFFERENT LANGUAGE </u></b>is a bold, underlined heading. It is there for the human reader, to label the section.<br>inserts a line break.- The Portuguese paragraphs are ordinary text in another language. The text is about privacy policies and moderation, which is irrelevant to the attack; any foreign-language text would do.
<b><u>OUR PAYLOAD IN TEXT FORM </u></b>labels the next section, again for the reader."><img src=x onerror=alert(1)>is the payload, sitting in the page as text. The point is that it is present as page content, so the translation path has to process it.- The closing Portuguese paragraph repeats the foreign-language text.
Step 1: create the file
Download the POC.html file from the snippet above, or copy the code into a file, name it POC.html and save it. The name matters only because the later steps refer to it.
Step 2: serve it over HTTP
Start a Python server in the same folder where the POC file is located, on localhost:
python3 -m http.server 80
This command runs Python's built-in web server. python3 is the Python interpreter, -m http.server tells it to run its simple HTTP server module, and 80 is the port, the numbered door a web server listens on; port 80 is the default for ordinary web traffic. The server serves whatever files are in the folder it was started from, so the POC file becomes reachable as a web address.
Serving the file over HTTP rather than opening it directly matters. Sometimes the translator does not show up for translating text when an HTML page is simply opened, possibly because the document location is about:html in that case. In plain words: when you double-click a file, the browser sees a local file, not a web page, and the translation feature may not offer to help. Going through a local server makes the browser treat it like a normal site.
Step 3: open it in Edge
Open Microsoft Edge (version 91.0.864.48 (Official build) (arm64)) and visit:
http://localhost/POC.html
http:// is the protocol, localhost is your own computer, and /POC.html is the file being requested. By the time the article was written, the browser had most likely already been updated to a secure version, which is why the reader may not be able to reproduce it.
Step 4: accept the translation
The translator shows a message that the page is in another language and asks whether to translate it. Click the translate button. Click the translate button.
Step 5: the payload fires
The result is alert(1): a popup appears. That popup is the proof. It means the browser executed the attacker's JavaScript, not because the website allowed it, but because the browser's own translation feature passed the payload through without cleaning it.

Why it is universal
The internal translator processed page content without sanitising it or converting the complete DOM into text before sending it for translation. A payload embedded in the page text, "><img src=x onerror=alert(1)>, was therefore taken and executed as JavaScript. The published snippet points at startPageTranslation in the Edge script as the affected function, called through translateInternal.
Because the flaw is in the browser's own translation component rather than in a single site, it is not tied to one origin. An origin is the combination of protocol, host and port that browsers use to decide which site is which; normally JavaScript from one origin cannot touch another. Here the flaw is in the browser's own translation component, so it is not tied to one origin. Any page that reflects the payload is enough; the researchers only needed the reflection. Reflection means the site simply echoes back something you sent it, for example showing your search term on the results page.
Impact
The researchers summarise the impact in four statements:
- Any page reflecting
"><img src=x onerror=alert(1)>(or any XSS payload) is vulnerable; only the reflection is needed. - Any person from another country who does not know English and reads about XSS on an English site is vulnerable, because they will translate the page and the XSS will pop up.
- All users using Edge are vulnerable to XSS that can trigger on any website.
- Any person who receives an email or message containing content in a different language plus an XSS payload is vulnerable.
For a remote exploit, two conditions must hold:
- The person should be using Microsoft Edge.
- The person should have auto-translate on.
Auto-translate is one of the two conditions the researchers give for a remote exploit.
The researchers describe several ways they could have hacked large services.
- Facebook: create a profile with a name in a different language plus an XSS payload and send a friend request to a victim using Edge; as soon as the victim checks the profile, the XSS pops up because of auto-translation.
- Google: write a review for a company, HackENews, with a different language plus an XSS payload; anyone browsing that review link gets the XSS popup because of auto-translation.
- YouTube: create a video and enter a comment with an XSS payload plus a different language; anyone viewing that video in Edge gets the XSS popup because of auto-translation. YouTube and Google share the same POC video.
- Windows Store applications: web-based applications on the Windows Store, for example Instagram, are also vulnerable, because the store ships applications with the same Microsoft Edge translator that was responsible for triggering the uXSS.
The common thread is user-generated content: places where ordinary people can put text that others will see, such as names, reviews and comments. If that text can contain a foreign language plus a payload, and the viewer's browser translates it, the payload runs.
The fix
Microsoft handled the report on the following timeline:
| Date | Event |
|---|---|
| 3 June 2021 | Report sent to Microsoft |
| 7 June 2021 | Reply from Microsoft, reviewing |
| 8 June 2021 | Additional impact information sent |
| 15 June 2021 | Report triaged |
| 17 June 2021 | $20,000 bounty awarded |
| 19 June 2021 | Pre-release patch |
| 24 June 2021 | Patch update pushed and CVE assigned as CVE-2021-34506 |
Triaged means the company confirmed the report was valid and started handling it. A patch is an update that fixes the flaw. Microsoft's release notes and acknowledgement for CVE-2021-34506 are linked in the write-up. The report does not describe the code change itself.
Variants to test
These are the kinds of places where the same idea could be tried again. Each one follows the same pattern: put foreign-language text plus a payload somewhere the browser will translate, then see whether the payload runs.
- A positive result is the payload executing in the context of the page, which would indicate the translation path is not sanitising or text-encoding the DOM before processing.
- A positive result is the same popup from a payload embedded in page content.
- A positive result is execution without any interaction beyond viewing the content.
- A positive result is execution once the page is translated, which confirms the flaw is in the browser component rather than the site.
Glossary
- API: a defined way for one piece of software to ask another to do something, like a service counter with an agreed request format.
- Attribute: an extra setting inside an HTML tag, such as
srcoronerror. - Auto-translate: a browser setting that translates pages automatically, without asking the user first.
- Bounty: a reward a company pays for a responsibly reported security flaw.
- Browser: the program used to open websites, such as Edge, Chrome or Firefox.
- Browser extension: an add-on installed in a browser that adds features and can access the pages you visit.
- Callback: a function handed over to be called later, when something finishes or fails.
- Cookie: a small piece of data a website stores in your browser, often used to keep you logged in.
- CVE: a public catalogue number for a known security flaw.
- DOM (Document Object Model): the browser's live internal model of a page, which scripts can read and change.
- Encoding: turning characters with special meaning into harmless text so they are displayed rather than executed.
- Function: a named block of code that performs one job.
- HTML: the language web pages are written in, made of tags in angle brackets.
- HTTP: the protocol browsers and web servers use to exchange pages and data.
- JavaScript: the programming language that runs inside the browser and makes pages interactive.
- localhost: the name a computer uses for itself.
- Origin: the combination of protocol, host and port that browsers use to separate one site from another.
- Patch: an update that fixes a flaw.
- Payload: the piece of code an attacker wants the victim's browser to run.
- Port: the numbered door a network service listens on; port 80 is the default for ordinary web traffic.
- Proof of concept (POC): a small, safe demonstration that a bug is real.
- Reflection: when a site echoes back something a visitor sent, such as a search term.
- Sanitising: cleaning input so that anything the browser would treat as code is removed or neutralised.
- Subdomain: a smaller site under a main domain, like a section of a large site.
- Tag: an instruction in HTML written in angle brackets, such as
<img>. - Triaged: confirmed as valid and taken into handling by the company.
- Universal XSS (uXSS): an XSS caused by a flaw in the browser or an extension rather than in one website, so it can affect any site.
- XSS (cross-site scripting): getting your own JavaScript to run in someone else's browser in the context of a website.