Flow

Sablier
FoundryDeFi
20,000 USDC
View results
Submission Details
Severity: low
Invalid

SablierFlow::depositViaBroker function will revert if brokerFee is set to zero

Summary

SablierFlow::depositViaBroker function will revert if brokerFee is set to zero because tokens like LEND will revert the transfer if the value is set to 0.

Vulnerability Details

Source: https://github.com/Cyfrin/2024-10-sablier/blob/8a2eac7a916080f2022527408b004578b21c51d0/src/libraries/Helpers.sol#L50

Source: https://github.com/Cyfrin/2024-10-sablier/blob/8a2eac7a916080f2022527408b004578b21c51d0/src/SablierFlow.sol#L657

The Broker struct contains two properties, the account (address of the broker, on which broker commission will be transferred) and the fee(%) of the broker. The brokerfeeAmount is calculated using Broker.fee. If the broker fee is set to 0, the resultant brokerFeeAmount will also be 0. In SablierFlow::_depositViaBroker function, the token transfer will fail if value is 0.

_streams[streamId].token.safeTransferFrom({ from: msg.sender, to: broker.account, value: brokerFeeAmount });

In Helpers::checkAndCalculateBrokerFee function, there is a check that validates the broker address must not be 0

if (broker.account == address(0)) {
revert Errors.SablierFlow_BrokerAddressZero();
}

But there is no check that Broker.fee must not be zero. Because this check is not implemented, that is why I assume that Broker.fee is expected to be zero in certain situations and here is the bug, in case of tokens like LEND, the function will revert.

Impact

One of the core deposit functions of the protocol will revert unexpectedly because of a missing require statement.

Tools Used

Manual review

Recommendations

In Helpers::checkAndCalculateBrokerFee function, a check must be implemented to validate the Broker.fee is not set to 0.

++ require(broker.fee != 0, "Zero broker fee");
Updates

Lead Judging Commences

inallhonesty Lead Judge
8 months ago
inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

[INVALID] Some token revert on 0 transfer and the broker fee might be 0

Appeal created

0xe4669da Submitter
8 months ago
inallhonesty Lead Judge
8 months ago
inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

[INVALID] Some token revert on 0 transfer and the broker fee might be 0

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.