Closed code423n4 closed 2 years ago
Reusing a previous private key is such a blatant user error , which would not be allowed in the UI, that labeling as High risk is overinflation.
I agree with trust here, definitely overinflated severity.
0xean marked the issue as unsatisfactory: Overinflated severity
EDIT: After some reflection and two thumbs-down emoji, I'm removing this. (The original comment is still available in the edit history). "Don't comment on your own findings" is a good rule, I think I broke it here, and I don't want to set the precedent that everyone gets to write a dissenting opinion. I still feel strongly about the issues I raised, but will take those conversations to other venues. 🫡
Lines of code
https://github.com/code-423n4/2022-11-size/blob/706a77e585d0852eae6ba0dca73dc73eb37f8fb6/src/SizeSealed.sol#L55-L110
Vulnerability details
Sellers provide both a public key (in the
AuctionParameters
struct) and an encrypted private key as arguments toSizeSealed#createAuction
. The seller's public key is saved in storage, and their encrypted private key is emitted as an event parameter:createAuction
:In order to finalize a completed auction, the seller later calls
reveal
, revealing their private key and enabling decryption of valid bids encrypted to the seller's public key:reveal
:However, there is no mechanism preventing sellers from reusing a revealed public-private keypair in future auctions, or preventing one seller from reusing the key revealed by another. If a keypair is accidentally or intentionally reused, sealed bids could be immediately decrypted as soon as they are placed. (Note that the encrypted bid and public key are both emitted in the
Bid
event).Impact:
Severity:
High impact (all bids are unintentionally revealed, defeating the purpose of a private auction), but medium likelihood, since the seller must make a mistake or be manipulated into reusing their keypair.
Recommendation:
Track revealed public keys in a mapping and revert in
createAuction
if a seller reuses a previously revealed public key.Test case: