Prevent encryption operations to use swap files

Open
#63 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
haskell

Research direction

Start by reading the affected functions in Wallet.hs and Encrypted.hs, then review how Unix mlock and Win32 VirtualLock could apply to their memory operations. Determine the platform-specific scope and verify that passphrases and private keys used by the listed encryption functions cannot reach swap files.

Written by the indexing model from the issue text.

Description

audit :mag:

I believe many of the encryption operations that are being done in memory could reach the disk if any wallet/node uses any encryption function whilst having a full memory. This would result in passphrases and private keys reaching swap files on disk, making it possible to access them.

Some of the affected functions include: generateNew , xPrvChangePass in Wallet.hs and encryptedKey,encryptedCreate,encryptedCreateDirectWithTweak,encryptedChangePass,encryptedSign in Encrypted.hs

In summary ensuring that encryption functions are done in memory will avoid the posibility of passphrases/keys being leaked into the disk and therefore susceptible to be stolen. A possible solution would be using mlock in unix and VirtualLock in Win32, which locks some memory space and ensures that some operations will always be executed in memory.

Dominant language
C
Stars
68
Forks
45
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from IntersectMBO/cardano-crypto

All issues in IntersectMBO/cardano-crypto

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.