Stealing Chrome cookies without a password
mango.pdf.zone
mango.pdf.zone
On platforms that have a decent OS-level keychain API (not Windows), this technique does not actually bypass password encryption and may trigger a password prompt/require the user to enter their password. This depends on whether the user previously granted permanent access to a given secret by a given application (e.g. by clicking “Always Allow” in the macOS keychain prompt). The author of the exploit probably did this at some point and forgot about it, which is why this appears to be a bypass of Chrome’s cookie db encryption.
Ultimately, encrypting the cookie DB provides limited protection anyway and if you have user privileges then you’ll eventually be able to access their data. This is not news, although it was the topic of some controversy back when Chrome resisted making changes to support this specific threat model, which is impossible to completely defend in the general case from the POV of a typical application developer on a modern desktop OS.
Hmm, so privilege de-escalation... You can just install a keylogger at that point, so I don't see the problem.
Of course, regardless of what they do, you could probably just run a quick Frida (https://frida.re/) script to patch into Chrome and dump the key to disk when the decryption function is called.
From the 10 immutable laws of security: Law #1: If a bad guy can persuade you to run his program on your computer, it's not solely your computer anymore.
The point is that you pwned the computer already, and this is just one of dozens of things you could already do with that privilege.
$ find "$HOME/Library/Application Support/Firefox/Profiles" -name cookies.sqlite -exec sh -c "sqlite3 '{}' 'SELECT * FROM moz_cookies'" \;http://raidersec.blogspot.com/2013/06/how-browsers-store-you...
They are encrypted at rest, and encrypted before sync.
* Normally you can't access Chrome's decrypted cookie storage unless you're in an interactive session and you've unlocked the keychain.
* An attacker running code on your computer (nefarious NPM package, etc) can spawn a headless chrome session with remote debugging enabled and then slurp out all the decrypted cookies through the remote debugging socket
Chrome is very frightening to me. It's just this massive God program that has a huge attack surface and a lot of really valuable goodies like this that attackers would love to get at.
I think the right way to look at it is that it's a smaller OS. Different in nature, but browsers are now in the OS league for how much damage a compromise can do.
Also I don't know about you but I've never needed to enter a password to start Chrome, so...
Now you can, and that is stupid. To enable headless mode should require root.
This may be a more convenient way to do so, but ultimately it's an attack that's rather hard to defend against under the usual desktop user-based access control model.
[0] https://security.stackexchange.com/a/170485/117977
[1] Code that shows, say, a false user login screen or exploits a previously unknown OS vuln to escalate privileges.
or you could go to the site, autofill the password, then extract the password input's value using the dev console.
kidding aside, this could be run from a USB key, automatically, in a very stealthy way. so yeah, worse.
Are you actually able to reproduce?
Edit: It works if you change the input type. Sigh. The web is brutal.
var inputs = document.getElementsByTagName('input'); for(var i = 0; i < inputs.length; i++) { if(inputs[i].type.toLowerCase() == 'password') { alert(inputs[i].value); } }
Disguise it as an extension with other functionality to get people to download it. Or, like this posted thread, if you have access to the PC, just install and run it.
Google even provides a sample[1] that shows this works, here's a screenshot: https://imgur.com/a/FYdc0KY
As is, the example doesn't show the cookie contents, but you can make this change and see the cleartext cookie:
//cell.innerText = cookies.length;
cell.innerText = JSON.stringify(cookies);
//cell.setAttribute("class","cookie_count");
[1] https://chromium.googlesource.com/chromium/src/+/master/chro...1/ Take the backup of Data/Profile X folder under AppData/Local/Google.
2/ Did a fresh Chrome uninstall and install.
3/ Copy paste and override the folder.
It worked flawlessly and I got my old settings/sessions etc. back.
I have tried it doing it from one machine to another - it worked, and with certain subfolders. You only need a few files. I took cache folder just to be safe and things like history, session, bookmarks, along with Cookies, Cookie journal, and local storage. (you might not need the last two.). Of course, this is a year old, and could be patched. But I was able to get my logins back with no debugger needed. A handy way if you are looking to do a fresh install and get rid of faulty chrome. But someone somewhere can write a powershell script to do this (and transfer on cloud) and a lot of gullible folks can fall for this in the promise of things like 'Faster chrome', 'improve speed of your chrome' etc. and should be patched.
ETA: And really, more websites need to bind cookies to an IP address (or at least a /24). Although if the attacker's got code execution that won't really help. (Nothing will.)
I travel quite a lot, and sometimes connect without a VPN. Last time I login to Google was from Sri Lanka, and now I'm in Georgia, having g traveled everywhere in Europe and South East Asia (so not the same /24), but I never had to log in again.
The same goes for Facebook, GitHub, HN, Reddit, Yahoo, and Hotmail. These are enough to ruin someones life I guess.
I love how Github's access system works. Everytime I want to delete something, add SSH/GPG keys, etc, they prompt the passwords again.
means cookies are not encrypted, or rather are automagically decrypted by DPAPI layer, anything can read them
https://bugs.chromium.org/p/chromium/issues/detail?id=875046
* Endpoint compromise is (and has been for awhile) outside of Chrome's threat model. This comes up a lot. The simple way to understand it is that the Chromium team refuses to get into an arms race with malware developers to protect secrets from code running at the same (or greater) privilege level as Chromium itself.†
* Token Binding is a particularly complicated feature, so the effort/reward calculation was unfriendly.
* Nobody was using it (on the clientside, with extension developers or people enabling the feature flag, or on the serverside, with major sites actually enabling it).
* Token Binding alters the semantics for cookies, which the rest of the development ecosystem generally assumes to be simple bearer tokens, which has the effect of breaking features and extensions that depend on those semantics. Again, if the reward were higher, this wouldn't have been a dealbreaker.
Token binding is, I think, pretty much a dead letter at this point.
† FWIW: I think this is a super-reasonable position for them to take.
Chrome is encrypting the cookies at rest so there is some protection of the secrets. I wish Chrome would allow a master password (per profile) to further protect the stored passwords and cookies.
If someone is running arbitrary code on your machine, they can probably use a keylogger to steal master passwords or do other nefarious things.