I was just wondering whether performing encryption on the GPU was safer than on the CPU, with regard to the difficulty of reading the encryption key from memory and/or various other hardware attacks.

I know there exists extensive literature about how to extract information from software cryptographic implementations but they mostly assume that a standard CPU is running the code. Can such attacks be extended to a GPU-style hardware architecture? Has it been done?

This could also be useful in general-purpose key management, where an encryption key must be kept secret for some duration. Instead of having it sit in memory, it could go into GPU memory (bonus: it can't be paged out to disk nor cached), and if you are doing the encryption within the GPU you don't even need to move it back and forth. But I'm sure there are GPU memory dump programs out there.

Does anyone have any experience with GPU cryptography and any possible weaknesses?

  • 3
    I think GPU-based cryptography is primarily used for performance. I've never heard of it being a security measure. – Iszi Apr 11 '12 at 18:29
  • Yes of course the reason I use GPU is for performance, but I was concerned about the security risks it entailed. – Thomas Apr 12 '12 at 4:19

While it's true that GPU memory isn't paged out, all peripherals have addressable memory on the system and graphics cards have no special aspect about them that's designed with security in mind. It's an obscurity thing at best that somebody might not think to check there or the out-of-the-box tools don't address that space. Given proper drivers, GPU memory can be accessed via DMA, so you hard drive can write directly to the GPU if the CPU says to go for it.

Generally, all the available resources of a GPU are dedicated to graphics work. You'd have to fiddle with drivers to make them respect the space you're trying to use or it would risk being clobbered by various pixels of cats as you watch videos on YouTube.

If you're looking for a more secure use of hardware for encryption and key storage, it's best to look into dedicated units.

  • I am using OpenCL which allows for persistent buffers, so I wouldn't have to hack my way through allocating GPU memory. Good point about DMA, I guess a computer isn't the safest place for a key to be. – Thomas Apr 12 '12 at 4:22

Yes, GPU has several security vulnerabilities (weaknesses), as you can see in detail in our survey paper. Some of these are:

  1. (At least previous generations of) GPU hardware/drivers do not erase their memories and thus, in shared/local/global memory and registers, data persists after deallocation.
  2. If the encryption key is stored in shared/global memory, then the attacker can exploit timing/power-side channel to leak each byte of key and thus, recover the whole key (refer above survey to see the papers which demonstrate this)
  3. Since a sharp increase in GPU load is likely to go undetected more easily compared to that in CPU load, a GPU malware is more stealthy.
  4. Security mechanisms proposed on CPUs, such as a CPU taint-tracking scheme may not work for GPUs, and thus, an attacker can use GPU as the polymorphic malware extractor whereby the host can load the compressed/encrypted code on GPU and then call a GPU kernel to quickly unpack/decrypt the code.
  5. GPU vendors reveal very little info about about GPU microarchitecture, so designing security techniques for GPUs is challenging.

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.