a Malicious User can manipulate the Auction and win all the totalTokens
for him self.
https://github.com/Cyfrin/2024-08-fjord/blob/0312fa9dca29fa7ed9fc432fdcd05545b736575d/src/FjordAuction.sol#L144
https://github.com/Cyfrin/2024-08-fjord/blob/0312fa9dca29fa7ed9fc432fdcd05545b736575d/src/FjordAuction.sol#L160
https://github.com/Cyfrin/2024-08-fjord/blob/0312fa9dca29fa7ed9fc432fdcd05545b736575d/src/FjordAuction.sol#L182
Vulnerability Details
see that in all these checks there is one seconde all the function can be called at once
whitch is: `block.timestamp == auctionEndTime`
here is a test as a POC of the vulnerability:
create a file called TestAuctionCanBeManipulated
in the following directory.
2024-08-FJORD/test/unit/TestAuctionCanBeManipulated.t.sol
and paste this test inside.
anyone who have fjord points can take all the auction tokens for him self
users who participate in the auction will louse their `fjordPoints`
Manual Review, foundry tests
first i recommend to replace the following lignes:
https://github.com/Cyfrin/2024-08-fjord/blob/0312fa9dca29fa7ed9fc432fdcd05545b736575d/src/FjordAuction.sol#L16
with the following line:
so we take away this second `block.timestamp == auctionEndTime`
The protocol doesn't properly treat the `block.timestamp == auctionEndTime` case. Impact: High - There are at least two possible impacts here: 1. By chance, user bids could land in a block after the `auctionEnd()` is called, not including them in the multiplier calculation, leading to a situation where there are insufficient funds to pay everyone's claim; 2. By malice, where someone can use a script to call `auctionEnd()` + `bid(totalBids)` + `claimTokens()`, effectively depriving all good faith bidders from tokens. Likelihood: Low – The chances of getting a `block.timestamp == auctionEndTime` are pretty slim, but it’s definitely possible.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.