5 ms·
Maybe it goes without saying, but for this to work, your password must be bad to begin with. Or at least, the article does not point to any significant design
by loeg 7y ago
Maybe it goes without saying, but for this to work, your password must be bad to begin with. Or at least, the article does not point to any significant design weaknesses in LUKS; it instead documents a variety of ways to get passphrase-encrypted secrets into existing tools for bruteforcing passwords. The article suggests it is about backup or data recovery, but I think it is probably more interesting to people in the business of digital forensics.
- polack 7y agoI agree with you, but I actually used the brute force for data recovery. I had a NAS with a 22 characters passphrase that I had up and running for years and eventually forgot the password to. When I set it up I practiced the password enough times that I was sure I would never forget it so I never stored it anywhere. After years of never rebooting the NAS parts of the passphrase eventually got blurry and when I was about to move I realized I couldn't remember it anymore. I didn't really have anything of high value stored on it, but it kind of became a pet project to try to "crack" into it again. Together with Hashcat and the extracted header I eventually managed to brute force it after a couple of weeks :)
- CaptainMarvel 7y agoHow did you brute force 22 characters? Did you somehow use your fuzzy memory of the password to help?
- polack 7y agoYes, sorry I was unclear about that. I knew multiple parts of it, but not what position the segments would go into. I had also mixed the passphrase up with another old obsolete one, so I had too many of these segments (back then I broke up the passphrases into blocks of 4 chars in my head) to fit in. There was also a couple of chars that I was uncertain about so those got "fully" brute forced. The worst part about the process was that it was hard to create rules for Hashcat to generate all different possibilities for the passphrase with all the information I knew about it baked in.
- MawKKe 7y agoSo.. nothing to do with LUKS?
- lucb1e 7y agoJust because luks isn't bad doesn't mean you can't use cracking tools to recover data when you forgot half the password, only have surveillance footage of the password being typed, have a bad password, etc. Since the article doesn't document any (new) luks weaknesses, none of the comments will be about luks being insecure.
- MayeulC 7y agoI've been in the same situation multiple times. I don't recall a case where the data was of critical importance, so I could get away with it, but using the parts of the passphrase I knew in a combined bruteforce/dictionary attack definitely crossed my mind. Do you have some links to reference material on how to achieve that?
- DyslexicAtheist 7y agoone way to solve the problem of memorizing (long passwords) is to use something like this: to avoid forgetting it use a string of words that make sense to your brain[1] but are unlikely to be encountered in the wild (in any texts). Example passphrase: "My hamster kicks soapy homework with smurf locks like a tandem at 45 o clock!" Then use this to generate a hash which can never be remembered in itself, and is unlikely to be brute-forced: $ echo -n "My hamster kicks soapy homework with smurf locks like a tandem at 45 o clock!" | sha512sum 7364796a1ad957d7c524165aa2fec2501eaa59e6bd8380bad3252504cdb8592018e30ae2fff1b2c2295e6da7a7f47f52ef1c0e3010c054598d76fe0c6d64bac6 - this way there is no need to remember the hash itself as long as you know how to recreate the hash (+ have the tooling present like sha512sum). In case you want to change the hash without having to remember a new passphrase just twiddle with the input string (by changing one character only) to get a totally new hash. If you're on a multi-tenant machine this is probably dangerous since running `ps` might show other users on the system the input string when you run the command. Not an issue with single user systems. In case you want to avoid the command being recorded in your shell history file you can prefix the whole command with a blank (space). Benefit of this is you get a pretty long hash that is impossible to brute-force and extremely hard to remember, which makes it really useful as a master-password.
- Thorrez 7y agoOne weakness of this is that sha512sum is a fast hash, ideally it would use a slow and memory hard-hash. Of course if your password is strong enough it doesn't matter. An example attack would be an attacker compromises the password database of a site you use, and that site doesn't hash passwords. Next the attacker cracks that hash, which requires your password to be somewhat weak, but is aided by you not using a slow hash. Next the attacker uses that cracked master password variation to crack your LUKS setup. While LUKS uses a slow memory-hard hash, the attacker doesn't need to do many attempts, because the password is a small variation of the password the attacker already knows.
- zaarn 7y agoThat would matter less if you use the hash as a password as the comment suggests; in that case it matters what the website below in the stack uses.
- Nokinside 7y agoOfthentimes password is there to discourage. Information is sensitive but it's more important that you can get it even if you lose the password than keeping it secret. And sometimes you have a really good long password that decays in your memory until you can't get it right. After few hundred tries you must either give up or start cracking it systematically using parts that you remember.
- mirimir 7y agoYeah, been there. I have a few LUKS encrypted backup drives with forgotten passphrases. And in many cases, I've also forgotten what's on them. At least one has a fortune in Bitcoin, I suspect. But the passphrases are all ~50 or more characters.
- badrabbit 7y agoCould luks have been designed to use memory-hard hash funcrions to prevent brute forcing like this?
- aaronmdjones 7y agoLUKS2 (the current version) does support Argon2 with up to 4 GiB of memory and 4 threads.
- loeg 7y agoPer the article, LUKS is designed to use 2 seconds of PBKDF2 iterations, which is going to be vastly greater than the 2016 NIST recommended minimum of 10,000 iterations. So brute forcing is already quite slow, although not as memory hard as newer KDFs like scrypt/argon. It's not a bad design for 2004. As the sibling commenter and article point out, LUKS2 defaults to argon2i with 2 seconds of iteration time and 1GB of memory, 4 threads.
- mrb 7y agoActually LUKS uses 1 second of iterations, last time I checked, and according to the code: https://gitlab.com/cryptsetup/cryptsetup/blob/master/lib/libcryptsetup.h#L323 https://gitlab.com/cryptsetup/cryptsetup/blob/master/lib/lib...
- loeg 7y agoNope. That's a comment on a tangentially related function declaration; it happens to be inaccurate. Here is where the default is actually specified (2000 ms): https://gitlab.com/cryptsetup/cryptsetup/blob/master/configure.ac#L579 https://gitlab.com/cryptsetup/cryptsetup/blob/master/configu... CS_NUM_WITH([luks1-iter-time], [PBKDF2 iteration time for LUKS1 (in ms)], [2000]) See also https://gitlab.com/cryptsetup/cryptsetup/blob/master/lib/utils_pbkdf.c#L27 https://gitlab.com/cryptsetup/cryptsetup/blob/master/lib/uti... . const struct crypt_pbkdf_type default_pbkdf2 = { .type = CRYPT_KDF_PBKDF2, .hash = DEFAULT_LUKS1_HASH, .time_ms = DEFAULT_LUKS1_ITER_TIME };
- mirimir 7y agoYes. Or people into illegal digital forensics. But for any of them, they can copy the relevant section to crack, and bruteforce massively in parallel. So I use ~50 character passphrases for LUKS. None are written or stored. All from my memory. Still, with enough fast processors working in parallel, that could probably be cracked within a few years. But then, given my age, there's a fair chance that I'd be dead before they managed it.
- bostik 7y ago> So I use ~50 character passphrases for LUKS. [...] with enough fast processors working in parallel, that could probably be cracked Let's do some napkin math. I'm going to make a blind assumption that you are a native English speaker, which gives us entropy estimate of ~1 bit per character.[0] Let's be generous and assume your passphrase has 51 bits of entropy, which makes the following numbers nice and round. To exhaustively search through half the passphrase space, the cracking rig will need to try 2^{50} =~ 10^{15} times. [50 * ln(2) =~ 50 * 0.301] The default master password hashing scheme in LUKS is PBKDF2, and for modern setups, argon2. The article throws around a few hashing speed ballparks, but depending on the setup we're talking about on the order of 1000 hashing attempts per second, per core. (Yes yes, the OP has figures with the argon2 numbers at about half that - I'm being very conservative here.) So, for a single LUKS passphrase crack we're talking, on average, of about 10^{12} core-seconds. A core-year is about 3 * 10^{7} seconds. So, with a single core the brute-force would take, on average, about 10^{5} years. As such... in order to break one of your passphrases, an attacker would need to dedicate 10k core-years of CPU time. That's a lot of hardware and cooling, but it's certainly not infeasible. You would need to be pretty attractive/dangerous/high-value target for anyone to spend that kind of money, though. Then the final step, threat modeling. For a normal techie, a passphrase like yours should be safe enough. For someone with access to material such as top hedge fund secrets, or into dangerous and politically juicy activities, attacking their passphrase is well within reach of a determined and well funded organisation. 0: https://people.seas.harvard.edu/~jones/cscie129/papers/stanford_info_paper/entropy_of_english_9.htm https://people.seas.harvard.edu/~jones/cscie129/papers/stanf...
- mirimir 7y ago