Platform: Code4rena
Start Date: 10/11/2023
Pot Size: $28,000 USDC
Total HM: 5
Participants: 185
Period: 5 days
Judge: 0xDjango
Id: 305
League: ETH
Rank: 34/185
Findings: 1
Award: $140.25
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: max10afternoon
Also found by: 0xMilenov, 0xbrett8571, 0xhacksmithh, 0xmystery, Aymen0909, Bauer, Daniel526, PENGUN, Pechenite, Shaheen, adriro, anarcheuz, btk, ck, ge6a, glcanvas, hals, turvy_fuzz
140.2525 USDC - $140.25
Users could suffer financial losses due to sandwich attacks, where attacker manipulate market price for profit.
The depositAsset and _mintRsETH functions lack slippage protection. This allows attackers to use sandwich attacks, where they buy and sell assets before and after a user's transaction, affecting prices and profiting at the user's expense.
/// @notice helps user stake LST to the protocol /// @param asset LST asset address to stake /// @param depositAmount LST asset amount to stake function depositAsset( address asset, uint256 depositAmount ) external whenNotPaused nonReentrant onlySupportedAsset(asset) { // checks if (depositAmount == 0) { revert InvalidAmount(); } if (depositAmount > getAssetCurrentLimit(asset)) { revert MaximumDepositLimitReached(); } if (!IERC20(asset).transferFrom(msg.sender, address(this), depositAmount)) { revert TokenTransferFailed(); } // interactions uint256 rsethAmountMinted = _mintRsETH(asset, depositAmount); emit AssetDeposit(asset, depositAmount, rsethAmountMinted); } /// @dev private function to mint rseth. It calculates rseth amount to mint based on asset amount and asset exchange /// rates from oracle /// @param _asset Asset address /// @param _amount Asset amount to mint rseth /// @return rsethAmountToMint Amount of rseth minted function _mintRsETH(address _asset, uint256 _amount) private returns (uint256 rsethAmountToMint) { (rsethAmountToMint) = getRsETHAmountToMint(_asset, _amount); address rsethToken = lrtConfig.rsETH(); // mint rseth for user IRSETH(rsethToken).mint(msg.sender, rsethAmountToMint); }
Manual review
Add slippage protection to depositAsset.
Other
#0 - c4-pre-sort
2023-11-16T20:33:50Z
raymondfam marked the issue as sufficient quality report
#1 - c4-pre-sort
2023-11-16T20:33:58Z
raymondfam marked the issue as duplicate of #39
#2 - c4-pre-sort
2023-11-17T06:43:16Z
raymondfam marked the issue as duplicate of #148
#3 - c4-judge
2023-11-29T19:10:52Z
fatherGoose1 marked the issue as satisfactory