Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seller can skip low rate bidders #104

Closed
code423n4 opened this issue Nov 7, 2022 · 3 comments
Closed

Seller can skip low rate bidders #104

code423n4 opened this issue Nov 7, 2022 · 3 comments
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-194 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-11-size/blob/706a77e585d0852eae6ba0dca73dc73eb37f8fb6/src/SizeSealed.sol#L256

Vulnerability details

Impact

Let us say k1 is the private key of a seller, and k2 is the private key of a bidder.
The sharepoint between them is G^k1^k2 = G^k2^k1, and G^k2 is the public key of the bidder, so the sharepoint = (public key of the bidder) ^ (private key of the seller).

It means that the seller can decrypt all bid prices using his private key during the bid process before reveal stage. Of course the seller's address is blocked in bid function here, but the seller can place a bid using another address with whole knowledge of other's price.

So the seller can skip low rate bidders for high income, and bidders cannot get expected base tokens because the seller knows their price.

Proof of Concept

Let us say totalBaseAmount = 2 for an auction, and there are two bids.

Alice: quoteAmount = 2, baseAmount = 1

Bob: quoteAmount = 1, baseAmount = 1

The finish rate is 1, so the seller will get 2 quote tokens from 2 base token. But the seller knows all these prices during auction, so he can place another bid for better income.

Seller(using other address): quoteAmount = 2, baseAmount = 1

In this case, the finish rate is 2, so the seller will spend 2 quote tokens for 1 base token, and then get 4 quote token from 2 base token. As a result, he will get 2 quote tokens from only 1 base token, and he can get same quote tokens from less base token.

Bob's bid cannot be filled because the seller knows his price before the auction is ended.

Tools Used

Manual Review

Recommended Mitigation Steps

Introduce a system that the seller can't know the bidder's price before the end of an auction.

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Nov 7, 2022
code423n4 added a commit that referenced this issue Nov 7, 2022
@c4-judge
Copy link
Contributor

c4-judge commented Nov 9, 2022

0xean marked the issue as duplicate

@c4-judge
Copy link
Contributor

c4-judge commented Dec 2, 2022

0xean marked the issue as duplicate of #170

@c4-judge
Copy link
Contributor

c4-judge commented Dec 6, 2022

0xean marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working duplicate-194 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

3 participants