Open code423n4 opened 2 years ago
I believe it is a valid issue, but since no funds are at risk (can be cancelled by all parties), should be of Medium severity (disruption of service).
0xean marked the issue as duplicate
0xean marked the issue as selected for report
0xean changed the severity to 2 (Med Risk)
0xean marked the issue as satisfactory
captainmangoC4 marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2022-11-size/blob/main/src/SizeSealed.sol#L217 https://github.com/code-423n4/2022-11-size/blob/main/src/SizeSealed.sol#L269 https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol#L44
Vulnerability details
Vulnerability details
Description
There is a
finalize
function in theSizeSealed
smart contract. The function traverses the array of the bids sorted by price descending. On each iteration, it calculates thequotePerBase
. When this variable is calculated, the whole transaction may be reverted due to the internal logic of the calculation.Here is a part of the logic on the cycle iteration:
Let's
baseAmount == 0
, thenAccording to the implementation of the
FixedPointMathLib.mulDivDown
, the transaction will be reverted.Attack scenario
A mallicious user may encrypt the message with
baseAmount == 0
, then the auction is impossible tofinalize
.Impact
Any user can make a griffering attack to invalidate the auction.
PoC
Recommended Mitigation Steps
Add a special check to the
finalize
function to prevent errors in cases whenbaseAmount
is equal to zero: