processAuction() in VaultAdmin.sol can be called multiple times by keeper if the auction is canceled
Source: https://github.com/sherlock-audit/2022-09-knox-judging/issues/26
Found by
ctf_sec
Summary
processAuction() in VaultAdmin.sol can be called multiple times by keeper if the auction is canceled.
Vulnerability Detail
processAuction() in VaultAdmin.sol can be called multiple times by keeper, the code below would execute more than one times if the auction is canceled.
because it is the line of code inside the function processAuction in VaultAdmin.sol below that can change the auction status to PROCESSED.
this code only runs when the auction is finalized, it not finalized, the auction is in Canceled State and
bool cancelled = l.Auction.isCancelled(lastEpoch);
bool finalized = l.Auction.isFinalized(lastEpoch);
require(
(!finalized && cancelled) || (finalized && !cancelled),
"auction is not finalized nor cancelled"
);
would always pass because the auction is in cancel state.
Impact
Why the processAuction should not be called multiple times?
In the first time it is called, the withdrawal lock is released so user can withdraw fund,
// deactivates withdrawal lock
l.auctionProcessed = true;
then if we called again, the lastTotalAssets can be updated multiple times.
// stores the last total asset amount, this is effectively the amount of assets held
// in the vault at the start of the auction
l.lastTotalAssets = _totalAssets();
the total asset can be lower and lower because people are withdrawing their fund.
then when _collectPerformanceFee is called, the performance may still be collected
Code Snippet
Tool used
Manual Review
Recommendation
We recommend the project lock the epoch and make it impossible for keeper to call the processAuction again.
Discussion
0xCourtney
The Keeper is an EOA owned/controlled by the protocol team and therefore considered trusted.
Evert0x
@0xCourtney as there are require statements based on the auction state, is it a valid use case that processAuction() get's called multiple times (by the keeper)? If not I can see the argument for the missing check.
0xCourtney
No, this function should only be called once. We'll add a guard to prevent multiple calls.
0xCourtney
https://github.com/KnoxFinance/knox-contracts/pull/89
rcstanciu
Reply from @arbitrary-CodeBeholder
looks good
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity business logic bug in Knox Finance. Sherlock made it public on 13 October 2022. Found in the 4 audit contest (finding M-7).
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.