While it is certainly an interesting bug, I kinda feel that the title is click bait? Because this `cryptsetup luksSuspend` from what I understood is not really officially supported but an extension done in Debian, so if anything this regression only affected Debian? I am not sure if you can blame the kernel for something that is not supported or even widely tested.<p>I still find this impressive, and it is nice that we now have a test (NixOSTests BTW are awesome, I agree with OP) to avoid this regression from coming back. But from the title it seems to be a widespread issue, not something that affects only one Distro.
Sorry, aimed for a technically precise title and didn't want to bait clicks.<p>Yes, this does not affect people on stock configurations for the plain reason that they wouldn't expect the volume key to be safe during suspend anyway.<p>Debian's solution was ported to several (most?) other distributions and I guess quite a few people maintained private ports.<p>The thread-keyring(7) manpage promises: "A thread keyring is destroyed when the thread that refers to it terminates." For their key upload (from userspace to kernelspace) mechanism, the cryptsetup project relied on this property; but kernel 6.9 introduced a regression invalidating this property.
Thanks for the explanation, I am really not that familiar with `cryptsetup luksSuspend` and it is the first time I ever heard it exists.<p>Like other people in this thread I first got confused "wait, how would this work since if you cleanup the keys from the disk during suspend you couldn't access the disk anymore after resuming", but after reading your thread in Mastodon plus other comments here it eventually became clear that this is a special case that you need both the correct patches plus the correct setup to use `cryptsetup luksSuspend` in place of the normal suspend.<p>Can I ask one question? Why not use hibernation at that point? The reason I generally suspend to RAM is exactly because my password is long and annoying to type enough that if I know I am going to use the device soon I prefer to suspend instead of hibernation. Yes, technically resuming from suspend is faster, but it is also less secure (there are other interesting things in memory besides the LUKS keys) and also it uses more power.
> Can I ask one question? Why not use hibernation at that point?<p>The sibling post by cyphar gives a good reason; while UEFI Secure Boot has its own share of issues, it can be a valuable ingredient in defending against evil maid attacks.<p>But another reason is... convenience. Resuming from RAM is faster than resuming from disk, especially so if your "disk" is actually just a USB flash drive. I know that it might be a bit weird to ask for convenience when the motivation is security. But I argue that there are use cases where the tradeoff is sound.<p>With hibernation, all your data is safe but the inconvenience might seduce you not to use it.<p>With suspend to RAM and your distro's version of cryptsetup-suspend (and the kernel patch or alternatively the cryptsetup workaround), only your volume key (and hence the bulk of your data, potentially terabytes worth of sensitive information) is safe, but sensitive data in memory (recent files, recent chat messages, session cookies, ...) is not. But on the other hand it's quick.<p>Some people use a combination: suspend to RAM for short breaks, where they expect to remain physically able to fully switch off the laptop when something happens; and suspend to disk for longer breaks.<p>It all depends on your threat model.
<i>> Can I ask one question? Why not use hibernation at that point?</i><p>Not GP but hibernation is completely disabled for lockdown kernels[1], which is always enabled when booting under secure boot for kernels trusted by the Microsoft secure boot keys (it is considered a requirement to get you shim signed by rhboot[2] as it is believed that Microsoft considers it a hard requirement, as otherwise you could chain-load a patched version of Windows under secure boot).<p>This doesn't matter for custom kernels but most official distro kernels are built this way to be signed, as otherwise they won't Just Work (TM) on modern laptops. If you disable secure boot then hibernation works again, though I must admit I'm a little surprised how many people seem to disable secure boot.<p>[1]: <a href="https://www.man7.org/linux/man-pages/man7/kernel_lockdown.7.html" rel="nofollow">https://www.man7.org/linux/man-pages/man7/kernel_lockdown.7....</a>
[2]: <a href="https://github.com/rhboot/shim-review#how-does-your-signed-kernel-enforce-lockdown-when-your-system-runs-with-secure-boot-enabled" rel="nofollow">https://github.com/rhboot/shim-review#how-does-your-signed-k...</a>
> I must admit I'm a little surprised how many people seem to disable secure boot.<p>To me, secure boot is the setting that I need to remember to turn off before installing the OS, but I would be willing to be convinced otherwise
I'm confused why you're saying this is a Debian-specific thing -- luksSuspend is upstream and was added back in 2009[1] in release v1.1.0[2]. I've used it (though somewhat sparingly) on Arch and openSUSE in the past and it definitely exists on non-Debian distributions. Maybe you're thinking of the automatic integration with system suspend? If so, that's kind of besides the point -- luksSuspend documents itself as clearing the keys from system memory, which stopped happening in Linux 6.9 due to the referenced refactor patch.<p>Though it should be noted that it seems that this is actually a bug in cryptsetup in that it was depending on very specific lifetime behaviour of kernel keyring keys, when it arguably should've been more explicitly cleared by userspace[3].<p>[1]: <a href="https://gitlab.com/cryptsetup/cryptsetup/-/commit/3cea5dcc7b80571d705f922ac112b0577b4fae47" rel="nofollow">https://gitlab.com/cryptsetup/cryptsetup/-/commit/3cea5dcc7b...</a>
[2]: <a href="https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/docs/v1.1.0-ReleaseNotes#L44" rel="nofollow">https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/docs/v1...</a>
[3]: <a href="https://gitlab.com/cryptsetup/cryptsetup/-/merge_requests/937" rel="nofollow">https://gitlab.com/cryptsetup/cryptsetup/-/merge_requests/93...</a>
Hmm, the subcommand is in the official cryptsetup repository and the description matches? <a href="https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/man/cryptsetup-luksSuspend.8.adoc" rel="nofollow">https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/man/cry...</a>
I've used this feature on arch its available on bog standard luks but as far as I know it's not used by default when you suspend.<p>You are thinking of the machinery to actually actuate suspend to ram after a luks suspend in a way that is actually useful which was first a Debian targeted thing then arch and used by default by neither.
what debian version first shipped 6.9?
I don't see any other way? When you sleep (suspend to RAM), everything is stored in RAM and is encrypted but the master key is present in kernel memory (if I recall correctly).<p>However, if you hibernate (suspend to disk) the entire contents of RAM (including the master key) is written/encrypted to disk and the RAM is cleared.<p>When you wake the machine up you have to re-enter the passphrase to decrypt the master key to re-load disk contents back to memory.
Yes, if you simply suspend your laptop on most stock Linux distributions, then everything including the master key is still kept in memory. But Debian pioneered the (optional) cryptsetup-suspend addon. This issues a luksSuspend command which is supposed to wipe the key from memory, and on resume asks you to resupply your passphrase.<p>Up to kernel 6.8, this worked as described; starting with kernel 6.9, it silently didn't.
So you would still be asked for a passphrase, even though it's already available?
Exactly. Cryptsetup wouldn't know about the extra copy of the volume key in kernel memory. Which is why, dramatically, it <i>appeared</i> secure ("surely I wouldn't be asked to resupply the passphrase if the volume key is still in memory, right?").
It was still more secure than the default if I understand this correctly. On resume from suspend the laptop would still be locked by the encryption key and without access to the disk even if you can somehow circumvent the lock. The only insecurity was that somewhere in the kernel memory the key still exists so if you can somehow extract that from the live system you can unlock it.
Yes, you are right: LUKS encryption protests your data at rest. An attacker which steals your disk can only gain little, like the information that you have used LUKS (unless you put your LUKS headers elsewhere, separated from the disk) and perhaps disk and disk sector usage statistics.
You need to get quite specific on actual attacks to call this insecure to be clear.<p>Having access to the raw RAM of a machine suspended but demanding the key to resume is certainly possible but the number of attacks where you don't need this bug is "almost all of them" given at that point if the machine ever unlocks you won in this hypothetical attack even with a bug fix.
I don’t know about “almost all”.<p>If the key has been purged but you can read RAM, then you can do two things:<p>1. You can extract whatever user data happens to be in RAM.<p>2. If you can either write RAM or reboot into your own OS, and then return the device to the unsuspecting user who will put in their password, then you can run a fake password dialog and get everything.<p>1 is bad, since there may be quite a lot of user data in RAM. But it’s not quite as bad as having the disk key, which gives the attacker <i>all</i> the data plus the future ability to decrypt or modify user data given only the physical disk. (Still, a better solution would be encrypting the hibernation image, preventing this attack entirely.)<p>2 is fully bad, but in many plausible scenarios (e.g. seized device) the attacker cannot just return the device to the user without them knowing something happened. Or even if they can, the method of RAM access may be one where reads are much more practical than writes, such as cold boot attacks involving physically swapping out the RAM.
You need to only have the ability to execute code after the hibernation not before and the machine needs to be permanently unavailable to the user after.<p>As I said quite rare situations.<p>If you can read this kind of data you have the ability to run code which means you already owned the entire operating system making capturing the key next entry beyond trivial.<p>You don't need to spoof anything, we assume here you can read the key from RAM remember.<p>If you could execute code before hibernation you similarly already had the key.
The seized device scenario is starting to get very specific though: in the actual cases it's relevant like the Silk Road take down the device was intercepted while open.<p>It's of some frustration to me that more security devices don't have a "pull pin to destroy" function available in them for this reason if you have any type of threat model where this applies: e.g. when I thought about using a Yubikey to secure remote access, a core problem is you can't quickly wipe a Yubikey in your possession - and while they're fragile in daily use, they're also surprisingly hard to intentionally destroy quickly.
I mean, isn't the threat model here that the attacker has stolen your device? That is about the only thing full disk encryption is good for.
I've been wondering why hibernate didn't work with encryption, because this seems like the extremely obvious way to handle it, but I have struggled to find anything about it for years - glad to hear it does exist!<p>But yeah, also rather obviously it's inherently a bit leak-prone. Though it seems probably pretty simple to test, just hibernate and scan all stored data. They could probably even do it on shutdown, as a hash of the key data would be sufficient to detect the key.
makes me wonder if there is potential for a more "main stream"/by default friendly version of this, where the key during suspend is encrypted using the TPM even if the TPM isn't a possible unlock from cold boot (i.e. no TMP encrypted volume key in the LECS headers/meta only temporary in memory during suspend)<p>or the alternative (for more convenient usage) for single user systems auto login on boot + use disc password for doas/sudo?
FYI: VeraCrypt is not the defacto encryption software for Windows.
The luks feature is not Debian specific
Both Intel/AMD CPUs produced in the last 5 years or so support full transparent (to the OS) memory encryption. So cold boot attacks are a thing of the past if you enable this feature (it's typically disabled because it reduces RAM speed by about 0.5%).
The impact on performance is more along the lines of 1-2% on AMD (though it likely varies by generation (I did extensive benchmarking on Renoir wrt throughput/latency/gpu). But yes small enough to be insignificant unless you run LLMs or game on the iGPU. I imagine that it also uses marginally more power.<p>AMD also has a second encryption mode where the OS decides what gets transparently encrypted, it doesn't have to be everything. But that mode is poorly documented (or at least the documentation isn't accessible to peasants like me)
Recent news is that this isn't shipping on some consumer-grade CPUs from AMD. There, made it explicit enough there's no room for conversation. Here's the link:<p><a href="https://arstechnica.com/security/2026/06/users-cry-foul-after-amd-stripped-memory-crypto-from-its-consumer-cpus/" rel="nofollow">https://arstechnica.com/security/2026/06/users-cry-foul-afte...</a>
[dead]
I don't have to re-enter my boot password after Sleep, so obviously the encryption key is still in memory.
I don't think this bothers me.<p>The only reason that I do the disk encryption is so that I don't have to worry about people going through my laptop to steal tax documents and/or credit card stuff when I sell the laptop. I of course also wipe the laptop too, but I figure that if the data is encrypted at the drive level then there's very little risk of anyone being able to use some kind of forensics tool and recover data.
You can just wipe the luks header as a nice middle ground.<p>Luks uses an anti-forensics algorithm that requires the entire volume key being available to unlock the disk at all (it combines the blocks of the key with some diffuse algorithm and xors stuff together to form the actual master key), so in theory you can just clear one sector of the volume key and the whole thing should be unrecoverable.<p>What I mean is that if even one block of the key is missing you can't guess the rest easily.
Assuming the encryption key is strong, the wiping is theoretically redundant.
And assuming the crypto algorithm has no fundamental flaws, it's applied correctly, and the software implementation has no bugs.<p>All of which are things people have on occasion believed to be true and found out later they were wrong about.
I mean I don't think it's unfair to say that most of the battle-tested encryption is "uncrackable enough" for the consumer.<p>If you're working for the NSA you need to worry about these things being cracked, obviously, but for the "I don't want a scammer to buy my laptop and get my social security number" situation, I think that you really can just assume that LUKS is uncrackable.<p>That said, it takes like five minutes to boot a live Linux flash drive and run fdisk to delete the partitions and/or install Mint or something over the existing data, so I don't really see any reason <i>not</i> to do it, even if it's not strictly necessary.
Agreed. It's also very low effort and as such I'm ok with the redundancy.
I am far from a security expert, but from the number of "we missed a single line C check across files during refactoring" critical security bugs discovered on a regular basis these days, the whole premise of a "giant secure open source C codebase" seems questionable. It is not specific to C of course, but invariants are arguably even harder to enforce and track consistently (esp under changes to code) in C. Unsure if FP with invariants encoded in types is a practically feasible scalable solution either. Model checking? [LLM] fuzzing? Fewer primitives with clear boundaries? Is that how seLinux was "checked"?
While I can see the shortcomings of C and generally don't recommend it for new projects I don't see this particular bug as a good example of something Rust's borrow checker or some other language's type system will catch. I don't think even static analyzers can catch this.<p>It's basically something like this:<p>original: DoTheThing()<p>new: DoTheThingSlightlyDifferentButKeepMyCredentialsAlive()<p>fix: DoTheThingSlightlyDifferentButDoInFactNOTKeepMyCredentialsAlive()<p>In my experience a substantial portion of gnarly bugs come down to a violation of a high-level system invariant and those do not strike me as something that can be automated. Even with something like Lean you can prove your program satisfies certain properties but you need to have thought about those properties in the first place. The proof doesn't discover the invariant for you.<p>If you'd had thought about the relevant security property you could have written a regression test for it which is not hard. IMO the really hard part isn't expressing the implementation safely, but it's the realization that this was a property the implementation needed to preserve.
I agree re Rust vs C - this is not (only) a language issue. What would (roughly) the invariant be here?<p>In another thread comment below i argue that maybe the system (OS) itself is so complex that it lacks clear contract / the contract evolves too quickly over time (as other parts of the code need to change the given piece of code to extend it to their use case) and that defies clear encoding?<p>Or we lack easy enough means to describe specs? I tried reading jepsen spec earlier today and despite it being an "integration test" of sorts, it is far from "simple".<p>Can an entire OS or a system of comparable complexity be decomposed into objects simple enough that their entire intended behavior (with all edge cases) can be explained in a paragraph of human text + half a screen of dense behavioral "spec" - if i do X and do Y, Z should come out / hold _no matter what happens in-between_. Or that's what asserts + fuzzing is effectively supposed to do? Is there a clear distinction between invalid input and failed invariant in typical C code? I guess error code vs seg fault?
This is in effect a state machine, and when you have a type system more complex than C's you can encode state transitions in the type system (either by having state transitions explicitly return a new return type or by using sum types). You still need to architect the system to encode the invariants in types. No language will fix all logic bugs for free. But you <i>can</i> leverage language features to reduce their number.
> You still need to architect the system to encode the invariants in types.<p>That's the problem though, right? If it's pointed out we all agree the "do not keep credentials alive" is a property that should hold and we can leverage whatever the environment offers to help preserve it. I fully agree modern languages have amazing support for this, but in C you can still run tests. Let's just say I don't think the <i>language's inability</i> to express logic of this kind held all those involved back from testing for it. I personally find "we just didn't think of it" much more likely.<p>That said, I am not a fan of C and recommend leveraging whatever fantastic modern tooling is available to you.
Like set an generic marker struct IsEncrypted<T> where T is yes or now and only allow its state to change when proven and then write the shutdown function to only take the yes variant?
Yes, that would be one way of doing it. You can model off of the Typed Builder pattern:<p><pre><code> struct Builder<const A: bool, const B: bool> {
a: Option<u32>,
b: Option<u32>,
}
struct Val {
a: u32,
b: u32,
}
impl<const B: bool> Builder<false, B> {
fn set_a(self, a: u32) -> Builder<true, B> {
Builder {
a: Some(a),
b: self.b,
}
}
}
impl<const A: bool> Builder<A, false> {
fn set_b(self, b: u32) -> Builder<A, true> {
Builder {
a: self.a,
b: Some(b),
}
}
}
impl Builder<true, true> {
fn build(self) -> Val {
Val {
a: self.a.unwrap(),
b: self.b.unwrap(),
}
}
}
</code></pre>
This won't work for <i>everything</i>, but it is a pattern that I find useful to ensure that things <i>can't</i> happen out of order.
The premise of a secure open codebase is fine.<p>The problem is being more auditable does not automatically make it more audited.<p>There have to be enough people with skill taking enough time to work on it.
To translate to Rust, it would have been "we missed a single line Rust check"...<p>This is a bug involving intersecting concerns and a deficit of cross-domain knowledge. It probably would have been the same in Lisp or assembly language.
I think <a href="https://news.ycombinator.com/item?id=48766436">https://news.ycombinator.com/item?id=48766436</a> is a practical answer. A marker that can't be forged (without explicitly malicious code being written), which is needed by the "yield to suspend/shutdown" function.<p>Missing the "wipe key from memory" means you don't have the marker, and trying to continue the suspend/shutdown will fail to compile, because you don't have the marker.
The lesson here is that if a feature (at a minimum) does not have a associated test case, it is not actually a feature.
Yes, I agree. I find the addition of the regression test the true long-term fix. The code is just an opaque incantation that may or may not preserve some property we find worth preserving and we have no way of knowing it keeps preserving it over time as other parts of the system change.<p>The test actually proves it and while it too can change it has more staying power because it's expressed at a higher level of abstraction ("random arcane weird C shit" in the case of code versus "does this property hold" in the case of a regression test).
I have not looked into this specific issue, but are we sure that a regression here could have been avoided via a localized test? Maybe issues seem to arise from A implementing a feature with tests. B seeing that A lacks some functionality and adding it (potentially with tests), C seeing this (extra) functionality in A, and using in unintended ways not covered by tests (or in an unintended environment) + multiply by many layers of this A-B-C story up and down the stack.
The whole premise of a "giant secure open source C codebase" seems questionable<p>Because code review is sometimes not much different from an idealized version of the halting problem, where you would have access to a formalized version of a specification.<p>In other words, there is no strict definition of what is a security issue.
On the other hand, it is (both halting and spec adherence) are checkable under compute and space constraints though? :) I'd say the biggest hurdle are means to describe the spec in way that is easy enough for a human to produce to make it feasible.<p>Not a DB person either, but things like TLA+ seem very hard to write even with LLMs. Behavioral tests with an enumerable number of random paths to take (aka model checking - eg jepsen) seem more feasible. Although you can't check internal properties of the system (string `pass` or any of it's copies or parts are not held anywhere in memory at any point between lines A and B) unless we can check that two memory dumps are indistinguishable with different pass strings (assuming we abstracted away storage devices in a test environment).. Also not sure if it's "easy enough" to write such tests either.<p>Maybe the reason is that OS domain objects / primitives are too complex and not "isolatable" enough / lack a clear contract at all? (Hence multi file refactorings that break invariants.)
In open source, someone (many, many) someone’s can at least check.<p>Closed source…..
Not sure why you're getting downvoted, this is the entire point of open source.<p>Does such a bug exist in Windows? OSX? Who checks? If someone finds the key in memory, can they tell what conditions might be causing it and where?<p>Their only recourse under those situations is to hand it off to the OS Vendor and trust that what they implement does solve the problem, and trust that it wasn't a deliberate back-door that is now being replaced by another back-door.
"Million eyeballs" argument was always kinda meh.
Maybe but still a little better than closed source like Windows. Everytime whem someone asked me if I could hack my way into his Windows PC I always told "After all it's Windows, how bad can it be?" Doing that since 25 years still waiting for a Windows machine that doesn't open... On the other hand I failed to open about 50% of Apple Devices I was asked to open and about 10% of Linux machines. (Not because Linux is insecure by itself but because most Linux distros install with insecure defaults and users don't care.)
Did the Feds desperately need a way of getting the key? is this a bugdoor? Has the commits been traced?
Recently I’ve been seeing this pattern a lot and I’m starting to be a little bit suspicious. Maybe it’s because people are more sensible to this and post more on it?
it is a regression. the user space application also would silently fail, it is a chain of oversights.
also having the encryption keys in memory does not mean you can extract them, it is more of unnecessarily letting it there indefinitely, not having it where it shouldn't be.
This is one of those regressions that's easy to miss because everything still "works." Security bugs often don't announce themselves.
Right! Which is why integration tests for these kinds of features are all the more important.<p>It was also fun to write, and enabled git-bisecting to isolate the specific kernel refactoring which introduced this bug: <a href="https://github.com/NixOS/nixpkgs/pull/532499" rel="nofollow">https://github.com/NixOS/nixpkgs/pull/532499</a>
AI reply, triggered my spidey senses
On my laptop with Fedora I just configured Linux to hibernate to disk after 15 minutes of suspend. Powering memory off ensures that bugs like this Debian-specific would not matter.<p>Plus what Debian extension to Linux tooling does although nice in theory, but in practice if one really worries about cold-boot attacks, then all keys and important documents has to be wiped out from memory, not only LUKS keys.<p>So hibernating is really the only proper way to protect against cold boot.
> So hibernating is really the only proper way to protect against cold boot.<p>I agree; or resurrecting FridgeLock: <a href="https://www.sec.in.tum.de/i20/publications/fridgelock-preventing-data-theft-on-suspended-linux-with-usable-memory-encryption" rel="nofollow">https://www.sec.in.tum.de/i20/publications/fridgelock-preven...</a>
Hmm, where does it get a key to decrypt memory on resume?<p>AFAIK it's practical only if you make use of TPM. And if you do, you're basically at mercy of TPM.
Imagine how this HN thread would have looked like if this vulnerability existed in a proprietary OS.<p>The top-level comment would surely have been about how Applosoft doesn't care about software quality any more and "that's what you get if you allow vibe-coded slop into your OS". The one below it would have been a crazy (everywhere else, not crazy for HN) conspiracy theory about the surveillance industrial complex and the NSA.
LUKS still keeps unencrypted header on the harddrive; real men use plain dm-crypt instead! Plausible deniability compatible.
Why is something this important not tested with every build?
> Except that, for more than two years, the encryption key remained resident in memory across suspend, leaving it there for the taking by anyone who seized the still-powered laptop.<p>I don't get it. Obviously, the laptop is locked when it resumes, how is that key "for the taking by anyone"? I'm not saying it is impossible to read out RAM from a locked laptop, but surely not by "anyone".
There are attacks that allow dumping RAM if the device is powered on though and you have physical access. Depending on config it may be very easy (just plug in a dumper over Thunderbolt on USB C and do direct memory access) or hard (freeze and swap physical RAM to an unlocked machine).. but the idea was defense-in-depth here; a well configured device should both be hard to dump RAM on <i>and</i> it should not give encryption keys if an attacker succeeds.
Anyone with physical access. I think it is understandable from the phrase.<p>There is a common misconception about how lock-screens in general work - they usually just prevents using the current hardware and software as it is to access the current OS. But the disk encryption is the main thing that prevents modification and other kind of access to actual data. And if the disk encryption key is lying in the memory, then effectively, the disk encryption is bypassed if someone can access the machine physically and assuming that there are no sufficient tampering protections in place for that machine.
Anyone with physical access, significant tools, and experience. The FBI has people who can pull data out of memory after freezing the RAM but the average laptop thief doesn’t so how serious this is depends significantly on your threat model. If you’re not a major criminal, bitcoin whale, or intelligence target this is almost certainly academic.
> If you’re not a major criminal, bitcoin whale, or intelligence target this is almost certainly academic.<p>Thanks, that's what I thought.
While that is true, the fact is that encryption is technically useless for anyone who is not constantly powering off and on, which is surely a bunch of people. That this is not widely understood is IMO a problem. And excellent reason for Debian's feature.<p><i>PS: Downvoting is not a rebuttal. Disk encryption is not effective security on a suspended (sleeping) system. That is a fact.</i>
You’re being downvoted because you’re taking a narrow edge case and saying it invalidates all usage. Disk encryption is not “technically useless” when it works for 99.999+% of the people using it who aren’t targeted by professional attackers. Most people expect it to protect them against an unskilled thief or when they resell the device, and it works for that.<p>People in those high risk categories already need more than disk encryption anyway, so this isn’t even the critical piece for them! (Consider how likely it is that I would have the resources and access to freeze and extract your RAM but not, say, the ability to record you entering your password using the same access. Yes, you can come up with scenarios where that makes a difference but it really underscores that you have many additional things to worry about if this is your threat model.)
Yes I understand all that. I don't have secure boot, so I'm not protected against the evil-maid attack either. I know that too.<p>It's why I used the word "technically", by which I meant "in the absolute". What word do you propose instead? Encryption that can be worked around by anyone with skills and commonly available equipment is <i>technically</i> useless. It offers some protection (the thief will probably reboot or unplug) but ultimately it's null and void.<p>>Most people expect<p>This would need to be sourced. I say most people expect "encryption" to be as secure as the encryption password. In the case of an unattended sleeping computer using Linux <i>with FDE enabled and the screen locked</i>, it's not. I'm not sure most people know that. I believe things are different on, say, iOS. All of this was the rationale for Debian's (buggy) feature.
> Anyone with physical access. I think it is understandable from the phrase.<p>Sorry, I'm probably dense, I still don't get it. You steal a laptop, you open it, the screen is locked with a password/fingerprint whatever. How do you read out the RAM from that laptop?
Several options. One is you restart and boot from a live system where you are root, and then dump all memory. This is described in the paper with the witty title "Lest We Remember: Cold Boot Attacks on Encryption Keys":<p><a href="https://www.usenix.org/legacy/event/sec08/tech/full_papers/halderman/halderman.pdf" rel="nofollow">https://www.usenix.org/legacy/event/sec08/tech/full_papers/h...</a><p>Other options: DMA attacks. Also you never know what the Intel Management Engine hidden in your computer is doing. It's running a version of Minix you don't have any control over, and it has full access to memory.
><i>How do you read out the RAM from that laptop?</i><p>the term to look up is "cold boot attack" (<a href="https://en.wikipedia.org/wiki/Cold_boot_attack" rel="nofollow">https://en.wikipedia.org/wiki/Cold_boot_attack</a>).<p>tons of cool live demonstrations of how it works on youtube if you've got the 20-40 minutes to spare
you dump the physical memory, then decrypt the disk offline
on the subject of encryption keys and memory there is something you can do:<p>- if your CPU supports it, enable memory encryption.<p>- if your TPM module supports this look for MemoryOverwriteRequestControl & MemoryOverwriteRequestControlLock (/sys/firmware/efi/efivars/) and toggle them. make sure that your computer always reboots and never powers off. memory will always be wiped on boot.
<a href="https://trustedcomputinggroup.org/wp-content/uploads/TCG-PC-Client-Platform-Reset-Attack-Mitigation-Specification-Version-1.2-Revision-10_1April24.pdf" rel="nofollow">https://trustedcomputinggroup.org/wp-content/uploads/TCG-PC-...</a>
Proper capitalization makes English easier to read.
But if you do this, don't you have to enter two passwords each time you wake? One for LUKS, one for the system login?
The other big problem is that all your processes continue running, but your disk is unmounted. I can't imagine how you'd avoid everything crashing horribly.<p>I mean, I can imagine an implementation where the system pauses all processes related to the user session _except_ the screenlocker, and have a custom screen-locker which can supply the credentials to luks…<p>But that the screen locker is a desktop application, so the compositor itself needs to stay alive too, but then compositor might try to talk to other applications, and those are frozen. So wouldn't it consider them crashed and disconnect them? Now your compositor needs to understand that the system is in a "disk unmounted and processes frozen" state too.<p>Not even sure how you'd deal with logs from its stdout, since the file descriptor to the log files is invalidated too.<p>If anyone is actually using such a setup, I have so many questions. I know that <i>theoretically</i> all this is feasible, but all the existing components don't seem to be ready for just unmounting the encrypted disk at runtime like that.
Well yes and I don't see how this can be avoided.
Do you mean with with current software? How to avoid it in general is straightforward.<p>If you're the only one with the disk password then the simple answer is make both passwords the same and make the different parts of the system communicate better.<p>If you want multiple users, give them each a different boot password and encrypt a separate copy of the disk key with each one. That password can be their login password too, or it can encrypt their login.
I have always been thinking LUKS was supposed to be enrolled in TPM, so you should not have to enter this key manually; this is just to prevent someone from unplugging the hard drive and reading on another machine. Of course, this depends on one's threat model.
<a href="https://xkcd.com/538/" rel="nofollow">https://xkcd.com/538/</a><p>(No, no, I take this stuff seriously too, but it had to be said)
To me the bigger problem is that the linux kernel does not seem to have
a thorough test suite. Such things should be easily testable and
verifiable. Apparently since 2024 nobody had that; humans are only so
good for some tasks. Automatism should be done programmatically by
machines serving humans.<p>Edit: Wait, so this was a debian patch? Now, this does not nullify my prior statements, but they should have said so clearly that debian screwed up here rather than the linux kernel devs.
No, it is indeed a kernel bug in the code path responsible for luksOpen.<p>Debian (and the distributions which ported cryptsetup-suspend) relied on cryptsetup luksSuspend doing its thing correctly, and cryptsetup luksSuspend relied on cryptsetup luksOpen doing its thing correctly, and cryptsetup luksOpen relied on the thread keyring being purged from memory on process exit, which is promised in the tread-keyring(7) manpage.
It's because of vulnerabilities like this that I enable Intel's "total memory encryption" feature. No plaintext leaves the CPU package. DIMM swap attacks become useless. Moreover, it's basically free: the cryptography happens directly in the memory controller, in hardware, inline with the bus transactions the CPU is doing <i>anyway</i>.
I don't see how that solves this problem. there is a string in memory that gets saved on suspend. that string when read by the CPU has the same properties it had before. if the CPU is using rot-13, the string is still rot-13 and the attacker doesn't need to spend the compute needed to crack rot-13, the CPU will simply do that as normal.
[flagged]
[flagged]
[dead]
[flagged]
And I don't use GUIs, but it doesn't mean I have to be a jerk to people who are happy when their GUI gets better :-).
> That's a you problem. I shutdown my machine when I'm not using it.<p>"We designed the antennas correctly, <i>you're</i> holding the phone the wrong way."
It's not a good analogy. Something is still on in suspend. Good you can control Linux kernel, but what about all other chips which may be an attack vector?
Except shutting down and hibernate are two actions the user can literally select from the same menu.
I shutdown mine too but only because suspend is still a crapshoot on linux
There will always be more suspend/resume bugs to work through. It varies a lot per device. I feel it's necessary to paint the picture for people who are curious what it means for it to be a crapshoot, so indulge me while I share my experiences.<p>For work I have a ThinkPad T16 Gen 4 with the newer AMD gfx1151 iGPU. Works great. I have yet to witness any issues with suspend/resume. I suspect this is the case because it is running Ubuntu with Lenovo's own support package. Theoretically, from firmware to kernel, this is all tested and validated by Lenovo, like what certainly happens with every Windows laptop and all of the components that go into them.<p>I also have a gen 1 Framework 16. I have seen it crash on suspend, but it is pretty rare, so I've just shrugged it off for now. It would be hard to debug, I don't see it every month despite using the thing every day.<p>All of my desktops currently have perfectly reliable suspend resume, you can slam it all day and all night. The last time I ran into issues was a use-after-free issue in AMDGPU. Pretty alarming, although to be clear it never hit any LTS or vendor kernels that I am aware of. I hit it because I prefer to run the latest kernel on my personal machines.<p>I have certainly owned laptops where suspend basically didn't work, or it would not stay suspended. I think this mainly went away when I started specifically picking laptops for Linux support.<p>For Intel iGPUs and dGPUs, the track record has been flawless for me. I have a few of the new Battlemage cards that default to the xe kernel driver and those have been working very well as expected. So that's nice.<p>I don't think this situation will be fixed until more hardware vendors are taking part in validating their stuff on desktop Linux and keeping track of the kernels. The current Linux model seems to be just dealing with whatever the vendors crap out for Windows, often full of weird ACPI behaviors and buggy firmware. It's not to say that the fault of the problems don't often lie with code in the Linux kernel, but they do not seem to wish to be bug-compatible with Windows and I think that is perfectly reasonable, so for problems that come from essentially broken firmware, it simply is going to need vendors to actually fix their shit.<p>(And that includes AMD. The drivers are good in some regards, but it's hard to ignore AMD's stability issues even still. At this rate, more of the long outstanding AMD driver issues will get resolved by Claude than AMD engineers... Like with Panel Self Refresh on 7040 iGPU, apparently.)
I am too lazy for that, and I hate that after boot you need to launch everything again.
Suspend to (encrypted) swap might be a good middle ground between you and grandparent. Suspend to memory will (at best) protect your LUKS volume key, but other sensitive data remains.<p>A couple of years ago, three security researchers from the TU Munich implemented a prototype for also encrypting (most) parts of the memory just before suspend, to address this limitation; but as far as I know, it was not upstreamed or developed further: <a href="https://www.sec.in.tum.de/i20/publications/fridgelock-preventing-data-theft-on-suspended-linux-with-usable-memory-encryption" rel="nofollow">https://www.sec.in.tum.de/i20/publications/fridgelock-preven...</a>
You can usually change that in the settings of the Desktop environment.
There is no universal support for restoring state between the apps. For example, Terminal won't run the scripts that were running, the browser will not automatically restore the pages etc, some apps might not launch or launch with wrong state.<p>Gnome desktop environment cannot even remember the position and size of console windows, you are expecting too much.
Definitely not a symptom of Linux being a hodgepodge of code thrown together from a thousand different sources and no one person could tell you how it all fits.
Bugs happen in all code. The difference is, anyone can fix stuff in open source. Closed source bugs are out of control and must be worked around. Usually by switching to OSS
Of course it's (indirectly) a symptom of that.<p>What's the alternative? Proprietary closed-source operating systems owned by corps who can be compelled to insert covert backdoors?<p>If BSD was as popular as Linux it would have the exact same problems.
I wonder if you think other OSes are any different?<p>TempleOS is the only thing that comes to mind that doesn't fit your description and it's not practically useful.<p>Any sufficiently large codebase is a mix of ideas and concepts implemented by different people with different priorities over a large timespan and if you can fit the entire thing in your head it's not very interesting or complex.
Qubes OS, the Linux distribution aspiring to offer a reasonably secure operating system, pioneering a "every app runs in a virtual machine" approach in the Linux laptop/desktop space, tracks this at the following issue:<p><a href="https://github.com/QubesOS/qubes-issues/issues/2890" rel="nofollow">https://github.com/QubesOS/qubes-issues/issues/2890</a>
The *BSDs, Mac, and Windows all keep critical code in the same tree as the OS.<p>Something like disk encryption would be immediately visible.<p>So you don't have this mess of 80 different distros with 60 different versions of systemd, 20 that don't use it, a million kernel versions and it's all thrown together in a Costco-sized trash bag and we call the output "Linux".
In my experience any software system (not just operating system) after crossing a certain limit on complexity and age looks exactly as hodgepodge of code pieces thrown together, sometimes from different sources even if developed by one org. All major OSs have long crossed those limits, I believe.
Windows for ages did not really keep all the code in one repo. There were like a dozen parallel repos for e.g. the shell, kernel, IE, etc. Also every feature was developed on team-level branches; integrating all those branches often caused unexpected bugs.
"Mythos, find me a bug in LUKS. I know there is one in there".