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: 23/183
Findings: 4
Award: $463.51
๐ Selected for report: 0
๐ Solo Findings: 0
๐ Selected for report: MrPotatoMagic
Also found by: 0xtankr, ArmedGoose, Egis_Security, Giorgio, KYP, Maroutis, NentoR, OMEN, Sabit, Shubham, SpicyMeatball, T1MOH, d3e4, dimulski, peanuts
200.8376 USDC - $200.84
https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L205-L228 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L215
Accounts who have large DYAD mint balance might be immune to liquidations due to requirement stated in the docs - The liquidator burns a quantity of DYAD equal to the target Noteโs DYAD minted balance
. This may lead to bad debt in the protocol.
As per the above, The liquidator burns a quantity of DYAD equal to the target Noteโs DYAD minted balance
. That means, to liquidate an account, liquidator have to obtain at least the same amount of DYAD as target balance. If a big "whale" accumulates a DYAD mint balance large enough, there won't be a possibility to liquidate unless a group of users will cooperate to gather a significant balance under one account, burn it, and then share rewards, which is a complex activity not included in the protocol logic and might never happen due to lack of mutual trust between groups of users. It is completely possible, that there will be one user/account who has the most DYAD minted, and that user won't be liquidated unless few others cooperate against.
Manual approach
Allow partial liquidations, based on arbitrary amount of DYAD liquidated, instead of requiring to match target DYAD balance to perform a liquidation.
Other
#0 - c4-pre-sort
2024-04-28T10:05:00Z
JustDravee marked the issue as duplicate of #1097
#1 - c4-pre-sort
2024-04-29T08:34:50Z
JustDravee marked the issue as sufficient quality report
#2 - c4-judge
2024-05-11T12:21:46Z
koolexcrypto marked the issue as satisfactory
๐ Selected for report: Limbooo
Also found by: 0xabhay, 0xleadwizard, AM, ArmedGoose, Evo, HChang26, Infect3d, Jorgect, MiniGlome, SpicyMeatball, TheSchnilch, ahmedaghadi, favelanky, pontifex
238.0297 USDC - $238.03
https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L127 https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L143
A malicious user might be able to grief withdrawals of someone else by depositing 1 wei to a vault[id]
associated with victim, triggering save of idToBlockOfLastDeposit[id]
. Note, that the vault address does not have "Licensed" check so in fact, attacker doesn't really need to deposit to the victim.
In deposit, the idToBlockOfLastDeposit[id] can be triggered by anyone. On Withdraw, which is also part of a redeem logic, it's checked if deposit to corresponding vault ID happened already. The corresponding logic is attached in Links to affected code - with exact lines.
This requires a deposit per every block to be griefed, thus the DoS is not permanent.
However, there is a caveat - since deposit does not check if user is really depositing to added vault but use can specify any address, also a fake vault, which may export respective functions, and just allow calling deposit(id, amount). They key is, idToBlockOfLastDeposit
is toggled for the block.
function deposit( uint id, address vault, //@audit can be arbitrary uint amount ) external isValidDNft(id) //@audit check if ID exists { idToBlockOfLastDeposit[id] = block.number;//@audit save deposit Vault _vault = Vault(vault); //@audit can be arbitrary _vault.asset().safeTransferFrom(msg.sender, address(vault), amount); _vault.deposit(id, amount); }
Manual approach
As with QA finding 1, where similar approach is recommended to protect remove vault functionality - the owner should have possibility to disallow deposits from other users, either by pausing deposits / limiting them to owner only, so external influence on user's state wont work.
DoS
#0 - c4-pre-sort
2024-04-27T11:31:50Z
JustDravee marked the issue as duplicate of #1103
#1 - c4-pre-sort
2024-04-27T11:45:50Z
JustDravee marked the issue as duplicate of #489
#2 - c4-pre-sort
2024-04-29T09:25:42Z
JustDravee marked the issue as sufficient quality report
#3 - c4-judge
2024-05-05T20:38:11Z
koolexcrypto marked the issue as unsatisfactory: Invalid
#4 - c4-judge
2024-05-05T20:51:57Z
koolexcrypto marked the issue as nullified
#5 - c4-judge
2024-05-05T20:52:03Z
koolexcrypto marked the issue as not nullified
#6 - c4-judge
2024-05-05T20:52:12Z
koolexcrypto marked the issue as not a duplicate
#7 - c4-judge
2024-05-05T20:52:22Z
koolexcrypto marked the issue as duplicate of #1266
#8 - c4-judge
2024-05-08T15:37:48Z
koolexcrypto changed the severity to 3 (High Risk)
#9 - c4-judge
2024-05-11T12:18:44Z
koolexcrypto marked the issue as satisfactory
#10 - c4-judge
2024-05-28T19:12:54Z
koolexcrypto marked the issue as duplicate of #930
๐ Selected for report: Infect3d
Also found by: 0x486776, 0xAlix2, 0xleadwizard, 0xnilay, Abdessamed, ArmedGoose, Bauchibred, Bigsam, GalloDaSballo, HChang26, Myrault, OMEN, SBSecurity, T1MOH, ZanyBonzy, alix40, atoko, iamandreiski, jesjupyter, ke1caM, miaowu, peanuts, vahdrak1
17.2908 USDC - $17.29
https://github.com/code-423n4/2024-04-dyad/blob/main/src/core/VaultManagerV2.sol#L205-L228
Users who liquidate undercollateralized accounts make insignificant profits or even suffer loss, while liquidated accounts do not suffer significant losses. This may lead to bad debt in the protocol as hardly anyone will be willing to liquidate other users.
It might be that DYAD simply is wrongly burned off msg.sender
instead of owner(to)
in this line, however documentation confirms the code so it seems to be intended.
Therefore, below explaining what happens in current state of the protocol. Assume following scenario.
collateral
is equal to amount in the vault; since its 100% then just all Bob's collateral is moved to Alice's id.Let's change the scenario, if Bob's collateral dropped only a bit, say to 2100$. then CR = 1.4, so account is liquidatable. Then liquidationEquityShare = 0.4*0.2=0.02, which causes liquidationAssetShare to be around 77%. So Bob's collateral that will be liquidated is circa 2100 * 77% = 1617 Now Alice could do a small profit (=1617-1500-gas)assuming gas cost won't be high.
For collateral drop to 2000, where CR is circa 1.3 => 0.3 * 0.2 = 0.06 so circa 82% * 2000 = 1660.
In the same time, Bob's DYAD is still there. While he won't be able to get remaining collateral, he can just market sell DYAD and will not lose much.
It clearly seems, that when DYAD is burned off liquidator and not liquidated account, there is no significant profit, thus it is doubtful that in current state anyone should be eager to liquidate undercollateralized accounts.
Manual approach
The burned DYAD should be burned off liquidated account, not off the liquidator's.
Other
#0 - c4-pre-sort
2024-04-28T17:24:54Z
JustDravee marked the issue as duplicate of #456
#1 - c4-pre-sort
2024-04-29T09:31:26Z
JustDravee marked the issue as sufficient quality report
#2 - c4-judge
2024-05-12T08:54:38Z
koolexcrypto marked the issue as satisfactory
#3 - c4-judge
2024-05-12T09:12:29Z
koolexcrypto marked the issue as not a duplicate
#4 - c4-judge
2024-05-12T09:12:42Z
koolexcrypto marked the issue as duplicate of #456
#5 - c4-judge
2024-05-12T09:12:56Z
koolexcrypto marked the issue as unsatisfactory: Insufficient proof
#6 - c4-judge
2024-05-28T16:04:13Z
koolexcrypto marked the issue as duplicate of #977
#7 - c4-judge
2024-05-28T16:20:18Z
koolexcrypto changed the severity to 2 (Med Risk)
#8 - c4-judge
2024-05-29T07:03:13Z
koolexcrypto marked the issue as satisfactory
๐ 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
Judge has assessed an item in Issue #892 as 2 risk. The relevant finding follows:
[L-1] Griefing is possible on vault removal In VaultManagerV2.sol line 101 Since anyone can deposit into a vault, someone can deny removal of a vault if will be able to frontrun removal transaction with a 1 wei deposit. However, this is rated as low at best, since this doesnโt look like efficient and impactful attack vector.
Remediation: Either allow owner to pause deposits or implement minimum deposit to make attack more expensive.
#0 - c4-judge
2024-05-11T11:05:33Z
koolexcrypto marked the issue as duplicate of #118
#1 - c4-judge
2024-05-11T12:24:33Z
koolexcrypto marked the issue as satisfactory
๐ 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
Judge has assessed an item in Issue #892 as 2 risk. The relevant finding follows:
[L-1] Griefing is possible on vault removal In VaultManagerV2.sol line 101 Since anyone can deposit into a vault, someone can deny removal of a vault if will be able to frontrun removal transaction with a 1 wei deposit. However, this is rated as low at best, since this doesnโt look like efficient and impactful attack vector.
Remediation: Either allow owner to pause deposits or implement minimum deposit to make attack more expensive.
#0 - c4-judge
2024-05-11T11:05:19Z
koolexcrypto marked the issue as duplicate of #118
#1 - c4-judge
2024-05-11T12:24:35Z
koolexcrypto marked the issue as satisfactory