Squeezing drips from a sender can be front-run and prevented by the sender
A sender can front-run a receiver's squeeze transaction by adding a new drips configuration, which changes the sender's history hash and causes the receiver's provided history to fail verification. This prevents the receiver from squeezing drips until the next cycle.
Squeezing drips from a sender requires providing the sequence of drips configurations (see NatSpec description in L337-L338):
/// It can start at an arbitrary past configuration, but must describe all the configurations /// which have been used since then including the current one, in the chronological order.
The provided history entries are hashed and verified against the sender’s dripsHistoryHash.
However, the sender can prevent a receiver from squeezing drips by front-running the squeeze transaction and adding a new configuration. Adding a new configuration updates the current dripsHistoryHash and invalidates the historyHash provided by the receiver when squeezing. The receiver will then fail the drips history verification in L461 and the squeeze will fail.
Impact
A sender can prevent its drip receivers from squeezing by front-running the squeeze transaction and adding a new configuration.
It is also related to the trust assumption between the sender an receiver. Which are anyway given in a certain form.
I am unsure about the proposed solutions. Currently, we only store the latest dripsHistory hash on-chain. For allowing to squeeze until a specific timestamp, it might be necessary to have the full list of historic hashes on-chain.
This attack is in fact possible, but it only allows postponing collecting funds until the end of the cycle. The proposed solution would probably require a lot of storage, so it’s probably not worth introducing.
In order to judge this issue I spoke with 4 other judges as well as the Sponsor.
This is a difficult decision because of the unclear expectations as to whether the sender is bening towards the receiver or not.
Because of the uncertainty, and the possibility of performing the grief, the finding is valid.
The issue is in terms of determining it’s severity.
The attacker doesn’t gain anything
One of the most interesting arguments is the idea that “the attacker doesn’t gain anything”, which can be falsified in scenarios in which squeezing would have helped reach a threshold of tokens in circulation, out of vesting or for similar purposes.
If we try hard enough, through multiple people’s effort, we can come up with a scenario in which squeezing could make a difference between having enough votes for a Governance Operation, or could offer enough collateral to avoid a liquidation or some level of risk.
Those scenarios, while unlikely, can help discredit the idea that “the attacker doesn’t gain anything”.
The grief is limited
On the other hand, we must acknowledge that the attack / griefing, is limited:
The sender is the only privileged account that can perform the grief
Squeezing is denied until the next cycle, which based on configuration, will be known, and will be between 1 week and 1 month.
These can be viewed as additional external requirements, which reduce the impact / likelihood of the finding
The Squeeze is Squoze
In spite of the external requirements, the finding is showing how the functionality of Squeezing can be denied by the sender.
I believe that if anybody could grief squeezing, we would not hesitate in awarding Medium Severity and perhaps we’d be discussing around Med / High.
However, in this case, the only account that can perform the grief is the sender.
At the same time, the goal of the system is to allow Squeezing, which per the discussion above, given the finding can be prevented until a drip has moved to a newer crycle.
Last Minute Coding
I went into the tests and wrote the following illustratory cases
function testSenderCanStopAfter() public {
uint128 amt = cycleSecs;
setDrips(sender, 0, amt, recv(receiver, 1), cycleSecs);
DripsHistory[] memory history = hist(sender);
skip(1);
squeezeDrips(receiver, sender, history, 1);
setDrips(sender, amt - 1, 0, recv(receiver, 1), 0);
// Squeeze again
DripsHistory[] memory history2 = hist(history, sender);
squeezeDrips(receiver, sender, history2, 0);
skipToCycleEnd();
receiveDrips(receiver, 0);
}
function testSenderCannotChangeTheirMind() public {
uint128 amt = cycleSecs;
setDrips(sender, 0, amt, recv(receiver, 1), cycleSecs);
DripsHistory[] memory history = hist(sender);
skip(1);
setDrips(sender, amt - 1, 0, recv(receiver, 1), 0);
// Squeeze First time
DripsHistory[] memory history2 = hist(history, sender);
squeezeDrips(receiver, sender, history2, 1);
skipToCycleEnd();
receiveDrips(receiver, 0);
}
Ultimately we can see that what is owed to the recipient can never be taken back, however the sender can, through the grief shown in the above finding, prevent the tokens from being received until the end.
Conclusion
Given the information above, being mindful of:
A potentially severe risk, with very low likelyhood
The temporary breaking of the functionality of squeezing, which was meant to allow by-the-second claims.
I agree with Medium Severity.
The original report as published on Code4rena, by berndartmueller. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
The squeeze function verifies the provided history against the sender's current history hash, which the sender can change at any time by adding a new configuration.
Impact
A sender can prevent its drip receivers from squeezing until the next cycle, but the receiver can still collect funds later.
What the attacker needed
Sender is malicious or griefing; receiver attempts to squeeze
The fix
The report suggests allowing a receiver to squeeze drips up until the current timestamp, but the team noted this would require storing the full history on-chain.
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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
In this system, a sender streams funds to a receiver over time. The receiver can 'squeeze' to collect what has accrued so far. The sender can block this by quickly adding a new setting before the squeeze happens, which makes the receiver's proof of history invalid.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.