263 points · by syck · 5y ago · 119 comments
Whoa. That's just ... Wow.
https://en.wikipedia.org/wiki/RSA_Security#Relationship_with...
And, as everyone in the former USSR knows, there is no such thing as a former KGB officer
Seeding with the current time is the real sin here.
If you generate long elaborate passwords then they can resist some of these flaws but the point is you don't want to introduce a flaw when they are simpler and better solutions out there.
Mistakes are natural, you want to provide the utmost resistance to such exploits which can stack up to become viable.
hiKxChDiaHNAtgVz
vis-à-vis: kähdikyylkönekkimahdakerttaksa
One is a 16 random `[a-zA-Z0-9]` characters, the other is a 32 character long nonce word, containing <ä> and <ö> among others that conforms to Finnish phonology, but otherwise is devoid of any meaning and phonology but easier to remember to speakers of Finnish.
One is a 16.Does 32 characters opposed to 16 offset that the latter conforms to the phonology of a language with 6 million speakers?
There are 36^16 possible passwords with the first scheme. I don't know how you generated the second. One way of doing it would be to generate all valid Finnish syllables and select randomly from that. If the number of possible syllables raised to the power of the number of syllables in your password is greater than 36^16, then it's more secure.
I recently signed up for a ticketing website to buy tickets for a concert and was appalled that the site wouldn't accept my 50+ character generated password... I had to enter something between 8 and 15 characters.
Still seems to me that "^Zh7*2wNfRG7ehj" would still be inherently less secure than "thisisasuperlongpasswordandithas12345alotofcharactersinitthatwouldtake12345rainbowtablesalongtimetocalculatefor"
15 vs 111 characters to find permutations for.
That is, of course, even assuming that the password db for the site is even hashed (AND salted) or not.
Psuedo-random is always better because anything else usually follows a pattern that can be exploited(sequence, structure, words, statistical bias)
If we can't make assumptions about the secret, the only solution is plain brute-force when it comes to the number of characters squared the length of the password.
As somebody who only ever uses rng for games, and then indeed seeds with os.microtime(), what's the issue and what is a better approach?
In terms of a global password manager, it's extremely bad, you now can use things like "member since x" to guess a password. If, for example, a database with credentials are leaked, you've significantly shorted the amount of passwords that need to be brute forced for a given target (assuming you know what password manager software they are using)
A good approach would have been something as simple as adding the master password into the seed. (Master password + time). An even better approach would be using a more cryptographically secure random number from the system for either the whole thing or at very least for the seed. (On linux systems /dev/random). You certainly could combine all those approaches to make the password much harder to guess.
The proper way to do this for cryptographic purposes is use the RNG facility provided by the kernel, which mixes in local entropy. Or go directly to the CPU like Intel’s RDRAND instruction. But the kernel should be using this if it’s enabled.
See here for an online poker game which actually had this flaw: https://news.ycombinator.com/item?id=7207851
I had to generate a 20 char random key string in Rust the other day, I just wrote:
rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(20)
.map(char::from)
.collect()
There. Uniform, decent entropy, explicit, simple.For example, even assuming nanoseconds, that's only log(10^9) bits of entropy if you can guess what second (not that hard, may even be public). That's nowhere near enough.
I'd also doubt that many ways you try to get a nanosecond resolution time actually have that resolution, there's probably discrete steps of lower resolution.
- getRandomValues() is not guaranteed to be running in a secure context.
- There is no minimum degree of entropy mandated by the Web Cryptography specification
- User agents are instead urged to provide the best entropy they can when generating random numbers, using a well-defined, efficient pseudorandom number generator built into the user agent itself, but seeded with values taken from an external source of pseudorandom numbers, such as a platform-specific random number function, the Unix /dev/urandom device, or other source of random or pseudorandom data.
From https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getR...
Is there a better solution?
Beyond that, you need to prove that no other party (i.e., the 'attacker') can predict the output any better than random chance, even if they've seen all the output leading up to it.
Beyond even that, many CSRNGs attempt to recover from 'state compromise': even if a snapshot of all the contents of the secret state get leaked somehow the system will soon return to producing secure output.
It doesn't mandate entropy requirements, probably because that's a somewhat contentious measure that not all OSes provide information about (see also: the long and tedious arguments about merging /dev/random and /dev/urandom). As long as the browsers use the underlying OS primitives, it will be fine.
Browsers do a thousand things essential for security that are far harder than providing cryptographically random numbers, and I highly doubt they'll screw it up.
Gather all the sources of random sources you can and hash them together -- add in any information based on user input (key presses / mouse movements), and personally I'd provide each users with a securely generated random 1K string (which could be sent once at install) to provide more random data.
https://www.cloudflare.com/learning/ssl/lava-lamp-encryption...
window.crypto.getRandomValues = (arrayBufferView) => arrayBufferView.fill(4);
For sure using more entropy from JS will not do much in case of a targeted attack that did compromise the downloaded code or the runtime, but the scenario of a larger scale attack on WebCrypto is what I was thinking about.
Can somebody please correct me if I'm wrong, but to bruteforce a password attackers need offline access to the stored passwords data and I'm assuming it mustn't be stored in a proper encrypted way
why should the onus be on the end client/ user to use 'crazy' lenght and complex passwords(I'm excluding stupidily simple passwords such as 123456 etc..)
surely a well design vault/ safe for the passwords and a restricted client logon system would stop all/ most attackers
- For internet-facing systems, your threat model should acknowledge that the user database is going to leak. It happens all the time, even though many businesses don’t admit it. (You can tell how rampant the problem is: use unique email addresses per service, wait a year or two, and check how much spam you get on those addresses.)
- Encryption is irrelevant when your threat model involves a leaked user database. That’s because if a service keeps passwords encrypted at rest, decryption keys may be available to the system at runtime. So you can assume that the decryption key is going to ship along with the leak.
- Hashing passwords, if done properly, will buy you some time against an offline brute-forcer. But not if the space of possible passwords is as tiny as in the Kaspersky case. So hashing isn’t going to help much here as well. In other words, if a database of Kaspersky-generated passwords is ever leaked, consider them easily brute-forced, no matter what.
- Even if logon attempts are limited and the database never leaks, the password is still at risk. The attacker may learn the time where the victim’s account was created, guess the timestamp in seconds, apply the Kaspersky algorithm and get the password right in four or five attempts if they’re lucky.
Anecdote: I've been using a catch all email address on my own domain for about six months, and signed up for hundreds of services. So far, excluding aggressive marketing emails from the services I signed up for, I've gotten about five spam emails, and all of them were to random aliases on my domain that I've never used or shared like sales@yositosdomain but I am very curious to see how many spam emails I get to different aliases over time.
- Website is compromised, database is dumped
- It contains hashed user passwords that you'd have to bruteforce if you want to recover them
- If you know roughly how long the password is and when it was generated (and what character set it uses) and that you know that it was probably generated by this Karspersky product, you can use that to generate all possible combinations and speed up the bruteforcing considerably.
It definitely hinges on a very specific set of circumstances and wouldn't be trivial to exploit, but it's still a pretty silly and easily avoided flaw for a password generator to have.
One thing though with the database dump scenario is, password managers by design discourage password reuse, so bruteforcing a password in a past leak might not help with the current passwords. Which imo makes using a password manager (albiet a bad one) still a net positive.
I’m on that list and I’m scared.
But good to note that mt19937 is still not cryptographically secure.
https://en.wikipedia.org/wiki/Kaspersky_bans_and_allegations...
Pretty terrible bug to be unpatched and presumably uncommunicated for 2 years. Ouch.
Insert Kaspersky owned by Russia intelligence conspiracy here...
https://cs6.pikabu.ru/post_img/big/2017/07/04/11/14991974131...
The only organizations in the USSR who were hunting for best talent were KGB and military. So when the first businesses emerged and started hunting, almost all talent came from there.
BTW: that whole thing must be before 1991 (KGB) and kaspersky was founded in 1997 (where KGB wasn't anymore).
The country is now ran by a clique of ex-KGB hardliners but I guess that does not count because it was renamed in 1991.
I rarely use the premium features, but I pay for premium anyway to support the project. Costs a dollar a month, so barely noticeable.
https://bitwarden.com/blog/post/admin-password-reset-is-out/
This simplified a bunch of things for me:
* Dev deployments of an app, where I have one or two different logins (eg, the default admin login) but it's deployed on a bunch of subdomains and/or internal IPs and/or internal non-FQDN hosts
* A bunch of work systems on different domains where there's old-style SSO (synchronized password, but login form as part of the app)
* Android apps just get a URI like com.domain.AppName and can otherwise be consolidated with other entries, etc
Everything else was the same and I didn't feel like I losing out, so it was easy to switch. They have an import tool that made it easier
A year ago, one of my accounts forced me to enable two factor auth, so I spent time looking into how to make it less onerous. Turns out the TOTP code stuff is an open standard and there is a command line tool [1] you can use to generate the codes.
Thought that was really neat. I wrote a little script to integrate with my password manager and went from avoiding two factor auth to enabling it everywhere.
One of the my favorite features that I cannot find in other password managers it the built-in 2fa support. Click to login to a 2fa enabled site and it copies the code to your clipboard so you just paste and voila at the next screen. Perfect!
So, if I have a long secret, perhaps a config section, I have to manually copy and paste it into a text editor in order to properly search through it.
tr -cd "[:alnum:]" < /dev/urandom | fold -w 20 | sed 10q
And a real TL;DR:
Upgrade your Kaspersky Password Manager
A password manager might have extra features such as browser plugins that provide a larger attack surface, but they can be switched off entirely. So, if you use more functionality than the encrypted text file, you might have more risk, fair enough, but when you use the same functionality, the risk seems comparable (or even: a password manager seems to offer somewhat more functionality for comparable risk).
For example, that company may not be able to see your passwords. But they probably can see the servers/sites the passwords are for and maybe the hash.
I will not even speak about all the break-ins that seem to be occurring on CLoud Systems.
Encryption? what kind of KDF are you using? probably something old and quite brittle when it comes to hardware cracking.
sit this one down boy