Firefox-Passwords-Decryptor: Extracts and decrypts passwords saved in Firefox
110 points
8 months ago
| 9 comments
| github.com
| HN
freitzzz
8 months ago
[-]
The additional features this tool brings (port enumeration, list usb devices, system info), makes me thing the tool was not designed for good/ethical reasons, but to ease the life of infostealers that are usually distributed via Discord.
reply
kuschku
8 months ago
[-]
It's not even done well.

Say you're building a feature for a password manager to import passwords from firefox. You'd want the the firefox decryption functions to be available as library.

Or say you're building a tool to extract data from broken hard drives, partially recovered filesystems, etc. Again, you'd want to have this available as a library so you can import the functions you need and use them in your own tooling.

Normally you'd expect this package to primarily export a lib with a "cli" subfolder that provides a sample CLI tool that imports the lib.

The fact that this tool requires libusb which is solely needed for the useless list usb devices functionality is extremely sketchy. It makes using this tool legitimately harder and only helps attackers.

reply
dlenski
8 months ago
[-]
There are a large number of similar projects out there.

I implemented login credential extraction for both Chrom* and FF-based browsers in the somewhat shambolic but generally-useful `browser_cookie3` Python module last year:

https://github.com/borisbabic/browser_cookie3/compare/master...

reply
NotPractical
8 months ago
[-]
> Safari listed as supported

Interesting, does this work on the latest releases? If so you might want to let this fellow know to adjust their threat model accordingly :)

https://news.ycombinator.com/item?id=41912226

reply
dlenski
8 months ago
[-]
My personal threat model for all Apple products is that I don't care about them at all: http://dlenski.github.io/macOS_nope.html
reply
NotPractical
8 months ago
[-]
Love the brutal honesty! Even as a macOS user I admit that it's difficult to justify learning the Apple-proprietary tech needed to port apps to it (and automated testing is indeed a nightmare). Curious as to your thoughts on Android?
reply
reddalo
8 months ago
[-]
Is it even safe to use browser-integrated password managers? I think they're so much easier to use than external solutions such as KeepassXC, but if it's so easy to decrypt their databases...
reply
sureIy
8 months ago
[-]
Safari's absolutely. It uses a OS-wide keychain secured via hardware.
reply
NotPractical
8 months ago
[-]
Chrome uses it too. However the CDP protocol allows any local app to control the browser so you can use that to open the browser in windowless mode, examine the list of passwords at chrome://passwords, then open a bunch of tabs to all of those sites and extract the passwords from the HTML forms they get auto-inserted into.
reply
larschdk
8 months ago
[-]
Does this prevent other software running on the same hardware from accessing the keychain?

E.g. on Windows, any program can access the entirety of the credential store for the current user.

reply
bdash
8 months ago
[-]
Each keychain item on macOS has an access control list associated with it that lists the applications that are granted access to the keychain item. If an application not on the ACL attempts to access a keychain item, macOS prompts the user for authorization. The ACL entries identify applications based on properties of their code signature and so are not spoofable.
reply
sureIy
8 months ago
[-]
Correct. The best part of this system (Keychain Access) is that it has been around for more than 20 years. Only this year it got a UX makeover.

One interesting thing I noticed is that Chrome and Firefox can also seamlessly see and use Passkeys I stored in Safari even if normally they don't read the passwords from there.

Using each passkey however still requires a fingerprint every time.

reply
bdash
8 months ago
[-]
Passkeys are a different story than the keychain more generally. Other browsers that work with passkeys via the system APIs had to jump through hoops and get Apple's approval to do so: https://developer.apple.com/documentation/bundleresources/en...
reply
account42
8 months ago
[-]
Why is this surprising and why do you expect the situation with external password managers to be different? If you can decrypt it other software running on your computer can too.
reply
graemep
8 months ago
[-]
A password manager integrated with the browser could be compromised by a vulnerability in the browser as well exploited by something running within the browser.
reply
psychoslave
8 months ago
[-]
Well, unless there is zero integration with the browser, then it’s just a matter of time before some exploit will expose how to retrieve arbitrary information from the external tool.

And of course, the external tool can have plenty of exploitable leaks unrelated to whether or not it’s integrated to some browser.

If the goal is to have better security, no method of using password alone will bring significant improvement to an authentication system, no matter how great the password manager it’s used with.

reply
dspillett
8 months ago
[-]
> Well, unless there is zero integration with the browser, then it’s just a matter of time before some exploit…

Which is why my password manager has zero integration directly with the browser, or anything else for that matter. There is a tiny little bit of extra legwork caused by this⁰, but IMO it is a good compromise between convenience and easily available attack surface.

----

[0] and it might be susceptible to attacks that manage to listen to the OS message queue & clipboard where a browser integrated method would not be, but once something is that far into your system there isn't much that is going to help you except maybe an orbital nuke.

reply
neobrain
8 months ago
[-]
> Which is why my password manager has zero integration directly with the browser, or anything else for that matter

The ideal amount of integration is actually non-zero. Manually copy-pasting passwords makes you susceptible to URL phishing, unless you also consistently copy from the browser URL bar into your password manager.

reply
NotPractical
8 months ago
[-]
This is a much more likely attack scenario than browser zero days.
reply
graemep
8 months ago
[-]
Any tool can have leaks, but integration with an application that connects to large numbers of servers over the internet seems to be a huge increase in attack surface to me, compared to a password manager that is external to the browser.
reply
adrianN
8 months ago
[-]
That depends on how it is designed.
reply
graemep
8 months ago
[-]
Is Firefox's designed in a way that prevents that?

Given it can automatically insert passwords for a site, something in the browser can access passwords.

reply
eesmith
8 months ago
[-]
What is your risk model? An attacker who can install cameras in your house to see your PIN/password? An attacker with a blunt object and the clear intent to harm you if you don't unlock your phone? Your spouse who you trust enough to loan your device to look at a cat pic?
reply
reddalo
8 months ago
[-]
My threat model is accidentally installing malware that reads the database of my passwords. I trust my KeepassXC database because I use a strong and long password, so even if malware can read my KeepassXC file, it won't be able to extract the passwords. I feel like Firefox is not as safe.
reply
gruez
8 months ago
[-]
>I trust my KeepassXC database because I use a strong and long password, so even if malware can read my KeepassXC file, it won't be able to extract the passwords. I feel like Firefox is not as safe.

You can set a "primary password" for firefox's password manager, meaning that you first have to enter a password before you can access the stored passwords. That should provide equivalent security to using KeepassXC.

reply
reddalo
8 months ago
[-]
> You can set a "primary password" for firefox's password manager

Wow. I've been using Firefox for 18+ years and I've never knew about this feature! Thanks!

reply
eesmith
8 months ago
[-]
So malware which installs a key scanner to read everything you enter is outside of your threat model, as is external surveillance to record what you type.

Choose a password manager which you like. I like having a paper book with a dumb-ass encryption scheme, because my threat model is that I am not going to worry about physical attacks, and servers will detect attempts to brute-force the dumb-ass scheme by adding delays after the first few failures.

I use Firefox's manager for my Mastodon accounts, because no one cares for my 10 followers, and the instance manager can resolve things if needed.

reply
0xEF
8 months ago
[-]
Isn't your last paragraph part of the problem, though? To paraphrase, you use Firefox's password manager for things you don't care about. So, those simple passwords are tied to small accounts that, individually add up to nothing, but together start to build a little cache of your emails, throwaway passwords and other tiny bits of data that all get collated with other data scraped about you. This much larger data cache then gets sold and used I attacks like credential stuffing to access even more data, etc.

You're posture is assuming that if it doesn't matter to you, then it doesn't matter at all, and that simply is not true.

reply
dwattttt
8 months ago
[-]
He stated the higher security model he uses; a paper book. As well as his threat model, which is pretty coherent and relevant in this modern age.

I'd love to see someone "hack" his book, it would be quite the impressive hack.

reply
psychoslave
8 months ago
[-]
Surprising that someone care to invest so much effort in it unless it can unlock some institutional level threats to leverage on for some geo-political negotiation or at least plots between big companies. But impressive hack, not necessarily.

https://xkcd.com/538/

https://xkcd.com/2176/

reply
eesmith
8 months ago
[-]
> little cache of your emails, throwaway passwords

I have five passwords in my Firefox manager. (More if I include the ones which are no longer valid, like a few ftp passwords, and passwords to routers I no longer use.)

I think I'm safe.

I avoid online services which require identity as much as I can, because yes, any data builds up. Which means, yes, I buy things in stores, not online, I use cash, not credit/debit/e-cash, and I don't use apps.

If you do use online services, apps, etc., then it sure feels like you are assuming that information leak doesn't matter to you, so it doesn't matter at all.

reply
Fokamul
8 months ago
[-]
Trust me, automated bot sending malware always care about your accounts.
reply
eesmith
8 months ago
[-]
With 50 people or so people active on my instance, the change will be noticed quickly, the account suspended, and the owner will get a hold of me through other means.

Everything I post is with the knowledge it will be public, analyzed, regurgitated, and held against me in a court of law.

reply
xvector
8 months ago
[-]
Your malware would still need the password for the PBKDF step to decrypt the Firefox database
reply
otabdeveloper4
8 months ago
[-]
> risk model

Hah. Don't bother us with your mumbo-jumbo, we're doing computer security here.

reply
eesmith
8 months ago
[-]
I will take Kamchatka from Alaska, using my model cannon, my model horsemen and my three model soldiers.
reply
paulryanrogers
8 months ago
[-]
Every KeePass-based solution I've tried was far from ready for normal users. Because they need browser integration out of the box, and it has to be smooth. Even BitWarden is still too difficult to use.
reply
mrweasel
8 months ago
[-]
I never found a way to lock the password manager in Firefox with its own password. They probably aren't bad, but they are also way behind on features and general usability, as compared to standalone password managers.

If you have passwords that are used outside the browser, putting them into the browsers password manager, getting them out feels a little cumbersome.

Related to the tool: Why not just click the export button in Firefox?

reply
chungy
8 months ago
[-]
Check "Use a Primary Password" in preferences.
reply
blibble
8 months ago
[-]
reasonably certain this doesn't encrypt your cookies

which are in some cases better than your passwords (already passed 2FA, etc)

reply
rkangel
8 months ago
[-]
I would love to hear any suggestions for how to remove all my stored passwords in Firefox. I used to use Firefox password manager but moved to Bitwarden. It has been surprisingly difficult to remove passwords completely as I'm using Firefox Sync, and they just get restored from one of my devices.
reply
gtirloni
8 months ago
[-]
You have to sign out of all devices and choose to delete the local data while you do so.

Another option is to delete your Mozilla account and recreate it, if you're not using it for anything other than Firefox Sync.

reply
icf80
8 months ago
[-]
No Primary Password ?
reply
java-man
8 months ago
[-]
Firefox is using TripleDES??
reply
jackjeff
8 months ago
[-]
It uses both AES and TripleDES

If you glance at the code there's a single "key encryption key" in the whole SQLITE file (in the 'metadata' table). That key is decrypted using AES with the PBKDF2 derived secret.

Then each password is in turn encrypted using TripleDES. The "data encryption key" for each these records is in turn encrypted using the aforementioned "key encryption key".

My suspicion is that the TripleDES format must be really old, and when they migrated the crypto layer to use AES they just re-encrypted the top layer (the "key encryption key" later) to use AES. It's much faster (and safer) to just re-encrypt all the TripleDES keys with the new AES than go and mess with "all" the records in the database. It's inelegant and lazy but you effectively get "AES level" of security without having to do all the work, so to speak…

https://github.com/Sohimaster/Firefox-Passwords-Decryptor/bl...

reply
alexey-salmin
8 months ago
[-]
I don't know about the particular case of TripleDES+AES but I think in a general case you can't claim that A+B encryption is always at least as strong as B alone. The A part can result in e.g. first bytes of input being the same enabling a crib-type attack.
reply
jackjeff
8 months ago
[-]
I'm not defending this choice, and I think you're right in general.

In this case, the only thing encrypted with TripleDES is the password itself, so the practicality of a crib or other known plaintext attacks is debatable in my opinion.

If you use the same (or similar) password everywhere, then you have bigger worries than Firefox use of TripleDES. Password stuffing based with leaks from poorly hashed password DB (cough facebook cough) is likely the most practical attack vector in this case.

If all your passwords are like q@qrG#Z4ARYm^qjeTEMN2Kh45v^p7L# then crib like attacks are impractical.

There are other weird/debatable choices in the Firefox encryption layer:

- Why bother with CBC? Things like AES-GCM or other authenticated* encryption mode would be nicer. Not sure it's a flaw here (google the cryptographic doom principle of Moxie Marlinspike)

- Why not wrap the encryption keys with some kind of "key wrap" mode instead. There are such things as AES-KV for instance.

- Why do the weird PBDKF2 derivation here? It's not based on a password the player enters, so there's nothing to "strengthen"? Seems oddly unnecessary (or I don't understand and there's a password somewhere).

- If there's a password then PBKDF2 is really really shit compared to scrypt or even better one the variant of argon OWASP said you should use.

reply
kuschku
8 months ago
[-]
> - Why do the weird PBDKF2 derivation here? It's not based on a password the player enters, so there's nothing to "strengthen"? Seems oddly unnecessary (or I don't understand and there's a password somewhere).

If you set a master password, firefox uses that master password instead as input to PBKDF2.

reply
jackjeff
8 months ago
[-]
Ab yeah. In that case it makes perfect sense.

But honestly I’d stay away from PBDKF2 at this stage. If you look at OWASP they recommend 600k rounds. That number is getting bigger and bigger all the time (10k rounds used to be enough over a decade ago)

https://cheatsheetseries.owasp.org/cheatsheets/Password_Stor...

I would use Argon or scrypt (which is basically PBKDF2 in a loop with some weird mixes) instead.

reply
captn3m0
8 months ago
[-]
The README is surely LLM slop.
reply
dlenski
8 months ago
[-]
What…?
reply
TheChaplain
8 months ago
[-]
reply
dlenski
8 months ago
[-]
I’m familiar with _the term_ and the phenomenon, but I am incredulous at the evidence-free claim that the project’s README is AI slop.
reply
hulitu
8 months ago
[-]
> Firefox is using TripleDES??

What's wrong with it ? /s

reply
penguin359
8 months ago
[-]
I would mostly say that it's just slow and AES is a much more modern and faster (partly due to hardware acceleration built into modern chips) that is already built info Firefox to support TLS anyways. There are some known attacks against 3DES now, but nothing that completely breaks it yet. And, since this is just for local storage, primarily, it shouldn't be as vulnerable as using 3DES for TLS channel encryption.
reply
wtallis
8 months ago
[-]
For a password manager, whether a cipher is fast or slow could mean something entirely different than for something that has to encrypt and decrypt large amounts of data. Cycles per byte is probably completely irrelevant here and I'd expect performance to basically be a function of how many cache misses (both data and code) are incurred to decrypt a single password.
reply
N-Krause
8 months ago
[-]
Thanks, even tho the comment above signaled sarcasm, the explanation was helpful for me, as I really had no idea what 3DES means and why it could be problematic.
reply
Dalewyn
8 months ago
[-]
I shudder to think that even a simple Google query leading to a Wikipedia article was too much effort here...

https://en.wikipedia.org/wiki/Triple_DES

reply
bbarnett
8 months ago
[-]
Any "simple" Google query now means pages of nonsense answers, promoted sites, AI "help", before you even get to a cogent result.

Much better to just talk to others than use Google.

reply
echoangle
8 months ago
[-]
When I google „TripleDES“, the first result is a box showing the Wikipedia article on Triple DES. Click on that and you’re done.
reply
lupusreal
8 months ago
[-]
Create a search keyword for Wikipedia. Then you can type "wiki whatever" into your address bar and be taken right to Wikipedia without the google middleman.
reply
dspillett
8 months ago
[-]
> promoted sites, AI "help"

I've been experimenting with Kagi for those reasons (amongst others) and finding it works well. Far from ideal for all as it isn't free after 100 queries, but it seems to be a workable solution to the problem for me for now.

reply
andrepd
8 months ago
[-]
Agree with the sentiment, but that's a Wikipedia link. Wikipedia is (as of yet) immune to LLM slop
reply
nneonneo
8 months ago
[-]
Meh...not immune, just resistant. There's unfortunately a big difference. LLM slop is coming in at the corners, typically on articles that are less well-patrolled.
reply
Scoundreller
8 months ago
[-]
Reddit, got it.

and Google and quora are in cahoots, right?

reply
N-Krause
8 months ago
[-]
The problem wasn't that a google search was to much effort, I just happened to be in the comments and saw this right with an explanation below it.

I actually read up on it quite a bit afterwards.

Feels very unwarranted to just assume laziness into a simple thank you for information spreading.

reply
mambo45
8 months ago
[-]
Is this some AI generated rubbish or actual code that works? If this is code that works, does setting a primary password protect against this decryptor?
reply
nikolayasdf123
8 months ago
[-]
does Chrome doing this better?
reply
bdash
8 months ago
[-]
https://security.googleblog.com/2024/07/improving-security-o... talks a little about improvements Chrome has made on Windows to make it harder for malicious software to access the encryption key used to encrypt cookies and passwords on disk.
reply
de_elusive
8 months ago
[-]
You still need access to the key to decrypt it regardless of the browser.
reply
mambo45
8 months ago
[-]
Is this some AI generated bullshit?
reply