Open code423n4 opened 1 year ago
0xSorryNotSorry marked the issue as high quality report
0xSorryNotSorry marked the issue as primary issue
outdoteth marked the issue as sponsor acknowledged
The report boils down to whether approval farming on the router is a vulnerability or not.
I believe we don't have enough evidence to demonstrate that this is a vulnerability, but rather a gotcha
Would ask the Warden to follow up during Post-Judging with additional evidence, but I think farming approvals on a empty contract is QA Low with the info available
L
GalloDaSballo changed the severity to QA (Quality Assurance)
Lines of code
https://github.com/code-423n4/2023-04-caviar/blob/main/src/EthRouter.sol#L166
Vulnerability details
Impact
The
EthRouter.sell
function looks like this:https://github.com/code-423n4/2023-04-caviar/blob/main/src/EthRouter.sol#L166 Here the EthRouter performs a
setApprovalForAll
call for a user controlled nft address and pool address. So essentially the EthRouter contract gives the approval of 'any' NFT to 'any' address.This can be used by attackers to steal any NFT that is held by the EthRouter contract.
It should be noted that the probability of users sending NFTs directly to the EthRouter contract or the EthRouter contract receiving NFT airdrops is never zero, so this bug will surely attract MEV searchers to keep monitoring the EthRouter contract and steal the NFTs.
The detailed PoC is provided below.
Proof of Concept
This test case was added to
test/EthRouter/Buy.t.sol
and was ran usingforge test --ffi --mp test/EthRouter/Buy.t.sol --mt test_audit
.Additional temporary contract added in the same file:
Tools Used
Foundry
Recommended Mitigation Steps
While resolving the issue completely is tricky but a few things can be done: