-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't workingsecurityA possible security vulnerability.A possible security vulnerability.
Description
pkcs11::pool::PoolConnection::ensure_logged_in() does not check the provided PIN if the PKCS#11 session has already been logged into. This is a security vulnerability; once a KMIP client provides the right PIN, no future clients need to provide it again.
Regarding the fix:
- It is probably not possible to repeat the PKCS#11 login operation safely. The spec allows it in one particular case, but we can't depend on that. It may also impose a performance burden. Instead, we should store the PIN in memory ourselves and verify it.
- We could store a salted hash of the PIN, or store the raw value ourselves. If an attacker knows the format of the PIN (e.g. 6-digit code), they could probably derive it from the hash. We should take care to secure the containing memory in either case.
- There are some OS-specific mechanisms for securing that memory; on Linux, I know of:
memfd_secret(2)(protect from most kernel access, and being swapped to disk)mlock(2)(protect from being swapped to disk)mprotect(2)(for establishing guard pages)
- Ideally, we would erase the stored PIN from memory when the system suspends, then log out and log back into PKCS#11. But AFAICT, there's no good (portable or even Linux-specific) way to detect when a suspend is occurring.
The simplest achievable solution would be to hash the password and do our best to store it in memory securely, wiping it periodically (after 5s idle or just every 5s) and on Drop.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingsecurityA possible security vulnerability.A possible security vulnerability.