-
Notifications
You must be signed in to change notification settings - Fork 26
Description
While reviewing mpcium’s codebase, I noticed that sensitive cryptographic material does not appear to be explicitly wiped from memory after use, even though the repository already includes utilities designed specifically for secure zeroization. This suggests that key shares and other secrets may be left to Go’s garbage collector, which is non-deterministic and not designed for security-sensitive memory handling.
The codebase already provides explicit helpers in memory.go:
security.ZeroBytes([]byte)- Overwrites the byte slice
- Calls
runtime.GC()
security.ZeroString(*string)- Clears the string reference
- Runs GC twice
SecureBytes- Wrapper that zeroes its internal byte slice when released
These utilities indicate that the project is aware of the need for memory zeroization and has already implemented primitives to support it. However, during review of the signing and resharing flows, I do not see these helpers being invoked after sensitive data is used. Based on what I can see, this implies:
- Key shares and intermediate secrets remain in memory
- Cleanup is deferred entirely to Go’s garbage collector
- There is no deterministic guarantee that sensitive buffers are wiped promptly (or at all)
Ideally, mpcium should:
- Explicitly zero sensitive buffers immediately after use
- Invoke
security.ZeroBytes,SecureBytes.Release(), or equivalent - Ensure resharing / signing sessions have clear lifecycle boundaries for cleanup
- Treat GC as a fallback, not a security mechanism
Is the absence of explicit zeroization in signing / resharing flows intentional? Or there are code paths that already wipe sensitive data that I may have missed?