Open sherlock-admin2 opened 7 months ago
The protocol team fixed this issue in the following PRs/commits: https://github.com/Axis-Fi/moonraker/pull/140
The protocol team fixed this issue in the following PRs/commits: Axis-Fi/moonraker#140
Fixed
The partial bid amount for quote fees is now calculated as bidClaim.paid - bidClaim.refund
The Lead Senior Watson signed off on the fix.
hash
medium
Inaccurate value is used for partial fill quote amount when calculating fees
Summary
Inaccurate value is used for partial fill quote amount when calculating fees which can cause reward claiming / payment withdrawal to revert
Vulnerability Detail
The fees of an auction is managed as follows:
Here bidClaim.paid is the amount of quote tokens that was transferred in by the bidder for the purchase
Here purchased is the total quote token amount that was collected for this auction.
In case the fees calculated in claimProceeds is less than the sum of fees allocated to the protocol / referrer via claimBids, there will be a mismatch causing the sum of (fees allocated + seller purchased quote tokens) to be greater than the total quote token amount that was transferred in for the auction. This could cause either the protocol/referrer to not obtain their rewards or the seller to not be able to claim the purchased tokens in case there are no excess quote token present in the auction house contract.
In case, totalPurchased is >= sum of all individual bid quote token amounts (as it is supposed to be), the fee allocation would be correct. But due to the inaccurate computation of the input quote token amount associated with a partial fill, it is possible for the above scenario (ie.
fees calculated in claimProceeds is less than the sum of fees allocated to the protocol / referrer via claimBids
) to occurThe above method of calculating the input token amount associated with a partial fill can cause this value to be higher than the acutal value and hence the fees allocated will be less than what the fees that will be captured from the seller will be
POC
Apply the following diff to
test/AuctionHouse/AuctionHouseTest.sol
and runforge test --mt testHash_SpecificPartialRounding -vv
It is asserted that the tokens allocated as fees is greater than the tokens that will be captured from a seller for fees
Impact
Rewards might not be collectible or seller might not be able to claim the proceeds due to lack of tokens
Code Snippet
inaccurate computation of the input quote token value for allocating fees https://github.com/sherlock-audit/2024-03-axis-finance/blob/cadf331f12b485bac184111cdc9ba1344d9fbf01/moonraker/src/AuctionHouse.sol#L512-L515
Tool used
Manual Review
Recommendation
Use
bidAmount - pfRefund
as the quote token input amount value instead of computing the current way