Security: DecryptWithIdentity leaks plaintext in unprotected memory #5
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Security Issue
In
internal/secret/crypto.go,DecryptWithIdentity()reads decrypted data into a regular byte slice viaio.ReadAll(), then copies it into amemguard.LockedBuffer:memguard.NewBufferFromBytescopies the data into protected memory, but the originalresultbyte slice remains in regular (swappable, dumpable) memory and is never zeroed. This defeats the purpose of usingmemguardthroughout the codebase.Impact
Decrypted secrets (private keys, secret values, metadata) linger in unprotected heap memory and could be:
Fix
Zero out the
resultslice after copying into theLockedBuffer: