Sturdy contest - TerrierLover's results

The first protocol for interest-free borrowing and high yield lending.

General Information

Platform: Code4rena

Start Date: 13/05/2022

Pot Size: $30,000 USDC

Total HM: 8

Participants: 65

Period: 3 days

Judge: hickuphh3

Total Solo HM: 1

Id: 125

League: ETH

Sturdy

Findings Distribution

Researcher Performance

Rank: 42/65

Findings: 2

Award: $59.83

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Awards

14.8433 USDC - $14.84

Labels

bug
duplicate
3 (High Risk)
disagree with severity

External Links

Lines of code

https://github.com/code-423n4/2022-05-sturdy/blob/main/smart-contracts/LidoVault.sol#L141-L142

Vulnerability details

Impact

It is possible that users cannot receive ETH if sending ETH to users is not successful because the require check is unreachable.

Proof of Concept

_withdrawFromYieldPool function executes the following code if user requests ETH withdrawal.

if (_asset == address(0)) { // Case of ETH withdraw request from user, so exchange stETH -> ETH via curve uint256 receivedETHAmount = CurveswapAdapter.swapExactTokensForTokens( _addressesProvider, _addressesProvider.getAddress('STETH_ETH_POOL'), LIDO, ETH, _amount, 200 ); // send ETH to the user (bool sent, bytes memory data) = address(_to).call{value: receivedETHAmount}(''); return receivedETHAmount; require(sent, Errors.VT_COLLATERAL_WITHDRAW_INVALID); } else {

Since the require check is an unreachable code, users cannot receive ETH if sending ETH to users is not successful.

Tools Used

static code analysis

Changing the order of execution like this can prevent this issue.

// send ETH to the user (bool sent, bytes memory data) = address(_to).call{value: receivedETHAmount}(''); require(sent, Errors.VT_COLLATERAL_WITHDRAW_INVALID); return receivedETHAmount;

#0 - sforman2000

2022-05-18T01:32:55Z

Here are QA reports per file.


CollateralAdapter.sol

[QA-1] address(0) checks are mising at addCollateralAsset function

addCollateralAsset function does not have any address(0) check.

https://github.com/code-423n4/2022-05-sturdy/blob/main/smart-contracts/CollateralAdapter.sol#L43-L46

function addCollateralAsset( address _externalAsset, address _internalAsset, address _acceptVault ) external onlyAdmin { _assetToVaults[_externalAsset] = _acceptVault; _collateralAssets[_externalAsset] = _internalAsset; }

addCollateralAsset function is callable only by admin, but setting proper address(0) checks would be useful.


LidoVault.sol

[QA-2] withdrawOnLiquidation function is missing

https://github.com/code-423n4/2022-05-sturdy/blob/main/smart-contracts/LidoVault.sol#L18

LidoVault.sol does not override the withdrawOnLiquidation function. If not having this functionality on LidoVault is expected, LidoVault.sol can implement the withdrawOnLiquidation function which only has revert() or other appropriate logic to specify that LidoVault does not have this functionality.

#0 - HickupHH3

2022-06-06T07:48:31Z

both NC

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Β© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter