You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Impact: If the LST token is not approved for transfer to the contract, the SafeERC20.safeTransferFrom will fail, potentially preventing the liquidation process from proceeding.
Cause: The code does not explicitly verify if the contract has sufficient allowance to transfer lstAmount before calling SafeERC20.safeTransferFrom.
Proof of Concept (PoC)
// SPDX-License-Identifier: MITpragma solidity0.8.20;
import"@openzeppelin/contracts/token/ERC20/IERC20.sol";
import"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
// Mock contract to simulate the `liquidateLstBorrower` function with the missing allowance checkcontractLstLiquidation {
using SafeERC20forIERC20;
addresspublic lstToken;
constructor(address_lstToken) {
lstToken = _lstToken;
}
/** * @notice Simulate liquidateLstBorrower function * @param _borrower Borrower address * @param _lstAmount Amount of LST tokens to be liquidated */function liquidateLstBorrower(address_borrower, uint256_lstAmount) external {
// Missing allowance check (the vulnerability)
SafeERC20.safeTransferFrom(
IERC20(lstToken),
msg.sender,
address(this),
_lstAmount
);
// Proceed with liquidation logic (mocked)// This part would perform liquidation logic (mocked for PoC purposes)
}
}
A user attempts to call liquidateLstBorrower with lstAmount but has not previously approved the contract to transfer lstAmount of LST tokens.
The transaction fails at the SafeERC20.safeTransferFrom line due to insufficient allowance, halting the liquidation.
Recommendations
Add an explicit check for sufficient allowance before calling SafeERC20.safeTransferFrom.
Example:
Brave Plum Shetland
Medium
Lack of Explicit Check for LST Token Approval
Summary
https://github.com/sherlock-audit/2024-12-numa-audit/blob/main/Numa/contracts/NumaProtocol/NumaVault.sol#L1144-L1149
The liquidateLstBorrower function assumes that the lstAmount has been approved for transfer to the contract. If approval is not given, the function will fail.
Vulnerability Details
Vulnerability Type: Missing allowance check
Severity: Medium
Likelihood: Moderate
Impact: If the LST token is not approved for transfer to the contract, the SafeERC20.safeTransferFrom will fail, potentially preventing the liquidation process from proceeding.
Cause: The code does not explicitly verify if the contract has sufficient allowance to transfer lstAmount before calling SafeERC20.safeTransferFrom.
Proof of Concept (PoC)
A user attempts to call liquidateLstBorrower with lstAmount but has not previously approved the contract to transfer lstAmount of LST tokens.
The transaction fails at the SafeERC20.safeTransferFrom line due to insufficient allowance, halting the liquidation.
Recommendations
Add an explicit check for sufficient allowance before calling SafeERC20.safeTransferFrom.
Example:
The text was updated successfully, but these errors were encountered: