https://cypher.codes/writing/intercepting-suspicious-chrome-...
- Note: my project specifically tries to protect users from Facebook hijacking and ad injection attacks - the two most common attacks on the CWS!
I once worked on a price comparison plugin and Firefox is very strict about what your plugins are allowed to do. They review each one and have some strict rules: like you can't load and execute Javascript from the web.
Most of our competitors just sent every URL you visited to their server. We wanted to be better than that since that is an obvious privacy issue.
So we made all our plugins (IE, FF, Chrome) download a whitelist (regex array) of shopping domains our search engine supported and it would only make API calls to our server if it matched that list AND you were on a product page.
Had the added benefit of reducing our server load too.
The server still gets a list of every page you visit on eCommerce sites but better than on all sites.
Footnote: I can't visit the page. Blocked by corporate.
You could, for example, exfiltrate data by injecting an image tag with some extra url parameters on the url. Doesn't have to be xhr or websockets.
people sell their high value extensions, then the new owners load them full of malware
chrome doesn't let you turn the updating off... I have previously resorted to removing update URL from the extension manifest manually...
I wrote some scripts to provide version pinning (just automates the manual editing of the manifests) but then you have to consider critical vulnerabilities in things like the LastPass extension where you absolutely want updates ASAP. So then you either have to have a curated extension list or maybe just separate extensions into "trusted" ie provided by reputable businesses as part of their product (lastpass, okta, etc) and "un-trusted." Even then, if the malware isn't in your face, you have no idea if the pinned version of your un-trusted extensions is actually non-malicious without auditing the code.
The ability of extensions to log form data to external servers allows for massive potential abuse. Not sure why Google would allow it. I imagine millions of logins have been stolen this way.
http://www.tomsguide.com/faq/id-2384484/enable-disable-chrom...
It's how SimilarWeb and other clickstream companies get their data. They claim it's harmless, but they have the ability to know everything you've inputted, and all the secure URL's you've visited (aka that intranet page with all your company salaries or passwords that you think nobody on the web knows about)
https://labs.detectify.com/2015/11/19/chrome-extensions-aka-...
You probably could still create interactions with on-site JS that leak data sometimes, so it wouldn't be perfect, but that's page-specific and a lot more work.
Chrome extension sandboxing is mostly about controlling what webpages an extension can manipulate, not so much about how it can manipulate it. It's not obvious that there is a better sandboxing solution for the general case. (There are possibilities for specific uses though: Safari has APIs for extensions to use set up regexes to block images/ads without needing permission to run arbitrary code on sites.)
"Send and receive data from anywhere on the internet"
Image doesn't load if you don't accept. Same goes for any tag or function that accesses external URI's.
If we assume that any code parsed from eval (and equivalent functions) inherits the association of the code eval was called from, then if the webpage defines a function like this:
function runAfterOneSecond(fn) {
setTimeout(fn, 1000);
}
Then the extension can inject a script tag that calls runAfterOneSecond but passes it a string (which setTimeout evals internally) that contains code to inject an image. If that eval'd code is supposed to retain the association with the extension, then that would have to be tracked through the string. Do all strings now require an association field? What if the page code creates a new string based on that string? Does that new string get the association too? What if two strings associated with different extensions are combined? Do the associations get combined so that any code created from the string (or created from anything created from that string transitively) has the union of all of their security limitations?If instead of tracking the associations of values, you tracked whether the extension was on the call stack at the time of code being parsed, then you're out of luck there too. Imagine a page with the code `eval(getCode())`: if the extension overrode the getCode() function, then it could get the page to eval whatever it wanted. Certain popular web frameworks often eval code from the DOM (think inline templates), so it would be easy to write a more generic attack to have the extension stick some code into the DOM formatted in the specific way that the web framework recognizes so that it will eval and run it later.
And even if you did manage to successfully restrict extensions from network requests, you'd end up with an extension that can't ever add elements to the page or manipulate elements that reference any external content. You couldn't make an extension for previewing an image on link hover. You could only add a button with an icon on it if that icon was an inline data uri. You probably couldn't reuse classnames from the page's css that referenced a remote background image or font. I would expect that nearly all page-interacting extensions would request the network permission just so they could get anything done. Chrome probably wouldn't spell out that permission in the permissions dialog (instead grouping it into the "Extension can read and change your data on all sites you visit" line) because of how common it was. ... And then they probably wouldn't go through the huge amount of effort and redesigns to support that permission in the first place.
Presumably the implementation would have a mechanism for tracking injected code and treating modified code as suspect.