Incorrect selector in `FlashRolloverLoan_G5::_acceptCommitment()` does not match `SmartCommitmentForwarder::acceptCommitmentWithRecipient()`
The function FlashRolloverLoan_G5::_acceptCommitment() uses an incorrect function selector when calling SmartCommitmentForwarder, causing the call to fail for LenderCommitmentGroup_Smart. This prevents loan rollovers for that commitment type.
0x73696d616f Follow with 0xadrii, EgisSecurity and 5 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-04-teller-finance-judging/issues/135
Found by
0x73696d616f, 0xadrii, EgisSecurity, KupiaSec, dirtymic, kennedy1030, merlin, no
Summary
FlashRolloverLoan_G5::_acceptCommitment() allows picking the SmartCommitmentForwarder, but the selector is incorrect, making it unusable for LenderCommitmentGroup_Smart.
Vulnerability Detail
FlashRolloverLoan_G5::_acceptCommitment() accepts the commitment to SmartCommitmentForwarder if _commitmentArgs.smartCommitmentAddress != address(0). However, the selector used is acceptSmartCommitmentWithRecipient(), which does not match SmartCommitmentForwarder::acceptCommitmentWithRecipient(), DoSing the ability to rollover loans for LenderCommitmentGroup_Smart.
Impact
FlashRolloverLoan_G5 will not work for LenderCommitmentGroup_Smart loans.
Code Snippet
FlashRolloverLoan_G5::_acceptCommitment()
function _acceptCommitment(
address lenderCommitmentForwarder,
address borrower,
address principalToken,
AcceptCommitmentArgs memory _commitmentArgs
)
internal
virtual
returns (uint256 bidId_, uint256 acceptCommitmentAmount_)
{
uint256 fundsBeforeAcceptCommitment = IERC20Upgradeable(principalToken)
.balanceOf(address(this));
if (_commitmentArgs.smartCommitmentAddress != address(0)) {
bytes memory responseData = address(lenderCommitmentForwarder)
.functionCall(
abi.encodePacked(
abi.encodeWithSelector(
ISmartCommitmentForwarder
.acceptSmartCommitmentWithRecipient
.selector,
_commitmentArgs.smartCommitmentAddress,
_commitmentArgs.principalAmount,
_commitmentArgs.collateralAmount,
_commitmentArgs.collateralTokenId,
_commitmentArgs.collateralTokenAddress,
address(this),
_commitmentArgs.interestRate,
_commitmentArgs.loanDuration
),
borrower //cant be msg.sender because of the flash flow
)
);
(bidId_) = abi.decode(responseData, (uint256));
...
Tool used
Manual Review
Vscode
Recommendation
Insert the correct selector, SmartCommitmentForwarder::acceptCommitmentWithRecipient().
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/teller-protocol/teller-protocol-v2-audit-2024/pull/33
sherlock-admin2
The Lead Senior Watson signed off on the fix.
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 developer used an incorrect function selector when encoding the call to SmartCommitmentForwarder.
Impact
FlashRolloverLoan_G5 will not work for LenderCommitmentGroup_Smart loans, effectively denying the rollover service for that commitment type.
What the attacker needed
None
The fix
The protocol team fixed this issue by inserting the correct selector, SmartCommitmentForwarder::acceptCommitmentWithRecipient().
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.
A smart contract function call uses a selector, a short code that identifies which function to run. Here, the code used the wrong selector, so the call failed and a feature (rolling over a loan) stopped working for one type of loan.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.