Submitted by evmboi32, also found by EV_om, mahdikarimi, Soul22, Infect3d, ast3ros, SECURITISE, grearlake, peter, 0xnev, PENGUN, Jorgect, btk, 3docSec, ether_sky, 0xpiken, and whitehat-boys
Anyone who holds a few wei of credit token can prolong the time for the rewards to get distributed for the rebasing users with minimal effort.
A malicious attacker only needs a few wei of tokens to execute the attack.
Lets imagine that the distribute(40e18) call to distribute 40 credit tokens has been called as a part of the successfully repaid loan. This is normal behavior.
During a distribute call the endTimestamp is calculated as follows:
This means that the 40 tokens should be distributed over the next 30 days. But each time the distribute call is invoked, the endTimestamp is prolonged. An attacker could call distribute(1) to distribute 1 wei of a credit token once per day to prolong the distribution for around 3x-ish.
Add this test to the ERC20RebaseDistributor.t.sol file and add import import "@forge-std/console.sol";
Run with forge test --match-path ./test/unit/tokens/ERC20RebaseDistributor.t.sol -vvv:
Either add a minimum amount required (chosen by governance) to invoke a distribute call, if the call is not done by the ProfitManager, or change how rewards are interpolated.
Math
eswak (Ethereum Credit Guild) acknowledged and commented via duplicate issue #1100:
