Closed sherlock-admin4 closed 6 months ago
Not relevant, or of concern
1 comment(s) were left on this issue during the judging contest.
panprog commented:
invalid, there is no loss of funds, assets are simply transferred to DAO. If distributedAsset is changed, admins are trusted to do this correctly, like changing distributedAsset and only then pushing new token. Even if the token ends up in DAO, there is no problem to push it back.
Timenov
medium
User can send
distributedAsset
to DAO.Summary
The
ZivoeYDL
contract is used to manage the accounting for distributing yield across multiple contracts. ThedistributeYield
function can be called by anyone, but the contract must beunlocked
and theblock.timestamp
must be >=lastDistribution + daysBetweenDistributions * 86400
. This will send thedistributedAsset
to addresses that are inprotocolRecipients
andresidualRecipients
. However there is a functionreturnAsset
which accepts anasset
parameter(must not be thedistributedAsset
) and sends it to the DAO. User can take benefit of the current implementation and send thedistributedAsset
by frontrunning.Vulnerability Detail
Consider the following scenario:
ZivoeYDL
has a balance ofDAI
100k dollars andUSDC
50k dollars.distributedAsset
is DAI anddistributeYield
function is called.distributedAsset
is updated to USDC.returnAsset
.distributeYield
will not send any tokens to recipients.Another problem is that DAO can move tokens only to a locker. This means that recipients will not receive their USDC that they should.
Impact
Users not receiving yield and tokens "locked" in DAO.
Code Snippet
https://github.com/sherlock-audit/2024-03-zivoe/blob/main/zivoe-core-foundry/src/ZivoeYDL.sol#L213-L311
https://github.com/sherlock-audit/2024-03-zivoe/blob/main/zivoe-core-foundry/src/ZivoeYDL.sol#L314-L318
Tool used
Manual Review
Recommendation
Restrict
returnAsset
to be called only by trusted entity.