Platform: Code4rena
Start Date: 23/06/2023
Pot Size: $60,500 USDC
Total HM: 31
Participants: 132
Period: 10 days
Judge: 0xean
Total Solo HM: 10
Id: 254
League: ETH
Rank: 102/132
Findings: 2
Award: $23.95
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: alexweb3
Also found by: D_Auditor, DedOhWale, DelerRH, LuchoLeonel1, Musaka, Neon2835, Silvermist, Timenov, TorpedoPistolIXC41, adeolu, cartlex_, hals, josephdara, koo, lanrebayode77, mahyar, mladenov, mrudenko, pep7siup, zaevlad, zaggle
18.4208 USDC - $18.42
In LybraConfigurator.sol contract, all restricted functions are callable by any address, making the entire protocol vulnerable to severe manipulation by a malicious user.
Modifiers are unchecked .
modifier onlyRole(bytes32 role) { GovernanceTimelock.checkOnlyRole(role, msg.sender); _; } modifier checkRole(bytes32 role) { GovernanceTimelock.checkRole(role, msg.sender); _; }
Manual Finding.
use require
to validate.
modifier onlyRole(bytes32 role) { require(GovernanceTimelock.checkOnlyRole(role, msg.sender), "Restricted"); _; } modifier checkRole(bytes32 role) { require(GovernanceTimelock.checkRole(role, msg.sender), "Restricted"); _; }
Access Control
#0 - c4-pre-sort
2023-07-10T21:43:53Z
JeffCX marked the issue as duplicate of #704
#1 - c4-judge
2023-07-28T15:24:22Z
0xean changed the severity to 3 (High Risk)
#2 - c4-judge
2023-07-28T17:18:45Z
0xean marked the issue as satisfactory
🌟 Selected for report: hl_
Also found by: 0xRobocop, Co0nan, CrypticShepherd, DedOhWale, Iurii3, Kenshin, Musaka, OMEN, RedOneN, SpicyMeatball, Toshii, Vagner, bytes032, cccz, gs8nrv, hl_, kenta, lanrebayode77, mahdikarimi, max10afternoon, peanuts, pep7siup
5.5262 USDC - $5.53
Users will payback less than the actual borrowed amount, couple with the fact that they will be able to withdrawal slightly above what ought to be acceptable by their safeCollateralratio because borrowed[_onBehalfOf] has reduce slightly than expected.
function _repay(address _provider, address _onBehalfOf, uint256 _amount) internal virtual { try configurator.refreshMintReward(_onBehalfOf) {} catch {} _updateFee(_onBehalfOf); uint256 totalFee = feeStored[_onBehalfOf]; uint256 amount = borrowed[_onBehalfOf] + totalFee >= _amount ? _amount : borrowed[_onBehalfOf] + totalFee; if(amount >= totalFee) { feeStored[_onBehalfOf] = 0; PeUSD.transferFrom(_provider, address(configurator), totalFee); PeUSD.burn(_provider, amount - totalFee); } else { feeStored[_onBehalfOf] = totalFee - amount; PeUSD.transferFrom(_provider, address(configurator), amount); } try configurator.distributeRewards() {} catch {} borrowed[_onBehalfOf] -= amount; poolTotalPeUSDCirculation -= amount; emit Burn(_provider, _onBehalfOf, amount, block.timestamp); }
The borrowed[_onBehalfOf] is being updated without considering the amount paid as fees.
Manual review.
The amount that should be subtracted from the borrowed[_onBehalf] is the remaining balance after removing totalFees paid from the amount variable.
borrowed[_onBehalfOf] -= (amount - totalFee);
Math
#0 - c4-pre-sort
2023-07-09T14:46:35Z
JeffCX marked the issue as duplicate of #532
#1 - c4-judge
2023-07-28T15:39:37Z
0xean marked the issue as satisfactory