0

I'm looking for a way locate a set of keys in memory on command.

Use case would be cold boot attack prevention: a trigger on rack open, scramble the keys in memory followed by shutdown in full disk encryption system. Let's assume that dirty shutdown (since we lost encryption keys) is preferable to physical access to hardware while keys are in memory.

I appreciate that threat of is theoretical if even that. Also, I know TPM or full memory encryption might be better at mitigating this threat.

So is it possible to locate where the keys are loaded to?

EDIT for clarity.

  • @MaartenBodewes I worded the question poorly then. What I wanted to know if it's possible to determine where the keys I've loaded are stored. – WhimsicalWombat May 21 '15 at 12:31
  • Much more clear, however I suppose the storage location rather depends on the runtime. – Maarten Bodewes May 21 '15 at 12:40
  • @MaartenBodewes I'm sure you're right. I'm hoping someone could point out if there's a way to simplify the problem. Adding a hook to kernel source would be possible (well documented, easy to read code) but it'd be less feasible to hook every crypto using program. Best solution I can think of would be a write-only device node to key's location in memory. Create a new node for every new key. – WhimsicalWombat May 21 '15 at 12:47
  • 1
    It may be easier to simply write over all of the memory in use by an application (process). If you scramble the keys then the application will become useless anyway. Overwriting kernel memory is trickier I suppose. – Maarten Bodewes May 21 '15 at 13:06
  • 1
    @NeilSmithline HSM would be a solution if very expensive one. But my endgame is to see how many different attacks I can shield against without special hardware. Think EM sidechannel or cold boots attacks, as robust a boot sequence as I can manage etc. This isn't a production environment, just a noobish hobbyist trying to learn infosec basics one small piece at a time. And keep myself busy. – WhimsicalWombat May 21 '15 at 13:35
3

It highly depends on what software you're using to manage the keys. For example, the proprietary crypto library we use here splits the key over several memory locations, flips them big-endian / little-endian, etc and only reassembles them when they're needed. Any good crypto / key management tool will have its own bag of similar obfuscation tricks. This will make it hard for you to locate keys in memory unless you know how they've been obfuscated.

As you say in your question, TPM or full memory encryption are probably better uses of your time. Unless you know exactly which crypto libraries / key management tools are running and are willing to reverse engineer them / add key destruction hooks into their source code.

Update: as you say in comments, security through obfuscation is frowned upon as the only source of security (ie it doesn't protect you from highly motivated attackers), but it does still have its uses.

Update #2: having chatted with a colleague about this, it sounds like you're trying to make your server into an HSM, these are hardware devices specifically designed to manage private keys, and to wipe them if any kind of tampering is detected. If your organization is concerned about attackers having enough physical access to pull off a cold-boot attack, then you should really be using commercially-certified HSMs and not have private keys in memory at all.

  • Thanks for the pointers. I'll look into key management tools and see where that gets me. My time is cheap and I'm doing this to get better understanding of the complex world of cryptography. I'll leave the question open for a bit in case someone else wants to chime in. – WhimsicalWombat May 21 '15 at 13:16
  • Sigh, stupid minimum 6 character change quotum. "sever" should be "server" in Update #2. – Maarten Bodewes May 21 '15 at 16:28
2

I'd recommend reading the original paper on the Cold Boot attack. Section 6 explains "Identifying keys in memory." They wrote an app called "keyfind" that you might be able to search for.

  • 1
    Great tip and why didn't I think of that? – WhimsicalWombat May 21 '15 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.