Closed c4-bot-8 closed 6 months ago
JustDravee marked the issue as duplicate of #74
JustDravee marked the issue as sufficient quality report
koolexcrypto marked the issue as duplicate of #992
koolexcrypto marked the issue as satisfactory
koolexcrypto marked the issue as duplicate of #100
Lines of code
https://github.com/code-423n4/2024-04-dyad/blob/4a987e536576139793a1c04690336d06c93fca90/src/core/VaultManagerV2.sol#L172-L181 https://github.com/code-423n4/2024-04-dyad/blob/cd48c684a58158de444b24854ffd8f07d046c31b/src/core/VaultManagerV2.sol#L184-L202
Vulnerability details
Impact
Due to a wrong modifier being used in
burnDyad
, anyone can use his tokens and decrease themintedDyad
mapping of a random user. Everyone can grief other users, by burning their tokens at any given moment.Even more, it will create a discrepancy between the real
DYAD
balance of the user and the amount in themintedDyad
mapping. The result of this action will be that the user will not be able to withdraw his entireDYAD
token balance, because of the difference, the remaining funds will be locked in theDYAD
contract.VaultManagerV2.sol#L172-L181
In the scenario where the user wants to redeem all of his DYAD tokens by passing
DYAD.balanceOf(him)
ormintedDyad(him)
, anyone can burn1 wei
on his behalf, causing the next call to revert with an arithmetic underflow inDYAD.burn()
.VaultManagerV2.sol#L184-L202
Proof of Concept
This test shows that everyone can burn any user’s tokens and then user can withdraw only up to his mintedDyad and rest of his tokens will be locked in the
DYAD
contract.In order to execute the test:
virtual
to the setUp ofBaseTest
file.Tools Used
Manual Review
Recommended Mitigation Steps
Instead of using
isValidDNft
modifier inburnDyad
, consider usingisDNftOwner
.Assessed type
Context