Skip to content
Business logic Audit finding Intermediate

Blacklisting a protocol leads to lower allocations

Blacklisting a protocol does not decrease the totalAllocatedTokens variable, which is used to calculate new allocations. This leads to lower token allocations to protocols and lower yield.

Ch_301 Follow with Met

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-01-derby-judging/issues/94

Found by

Ch_301, Met

Summary

Blacklisting a protocol does not update (decrease) the totalAllocatedTokens. It is used to calculate the new allocations and if it is larger than it should be it will lead to lower token allocations to protocols and lower yield.

Vulnerability Detail

Blacklisting does not touch the variable (it decreases the currentAllocations[_protocolNum] but not the total) https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Vault.sol#L477-L483

totalAllocatedTokens is only modified by delta allocations, there is no fix to it. https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Vault.sol#L167-L170

The protocol allocation is calculated hereby, decreased by totalAllocatedTokens value. https://github.com/sherlock-audit/2023-01-derby/blob/main/derby-yield-optimiser/contracts/Vault.sol#L209-L218

Impact

Forever decreased token allocations to protocols and lower yield.

Code Snippet

Tool used

Manual Review

Recommendation

totalAllocatedTokens by the zeroed currentAllocations[_protocolNum]

Discussion

sjoerdsommen

duplicate with https://github.com/sherlock-audit/2023-01-derby-judging/issues/95 https://github.com/sherlock-audit/2023-01-derby-judging/issues/94

The original report as published on Sherlock, by Ch_301. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the blacklisting function fails to subtract the removed protocol's allocation from the totalAllocatedTokens variable, leaving it overstated.

Impact

Token allocations to protocols are permanently decreased, leading to lower yield.

What the attacker needed

Protocol is blacklisted

The fix

The totalAllocatedTokens should be decreased by the zeroed currentAllocations[_protocolNum] when blacklisting.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In a smart contract that manages investments, there is a running total of how many tokens are allocated across all protocols. When one protocol is removed (blacklisted), its individual allocation is set to zero, but the running total is not reduced. Because future allocations are calculated using that running total, the total appears larger than it really is, so each remaining protocol receives fewer tokens than it should, reducing overall returns.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by Ch_301

View all

39 more disclosed reports, best first.

More from Derby

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.