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: 37/132
Findings: 1
Award: $281.19
🌟 Selected for report: 0
🚀 Solo Findings: 0
281.1877 USDC - $281.19
https://github.com/code-423n4/2023-06-lybra/blob/main/contracts/lybra/token/EUSD.sol#L415-L418
EUSD's exchange rate (from shares to amounts) should never decrease, as each share should keep accruing value. However, it's possible that the exchange rate can go down via malicious mint
function as follows:
getSharesByMintedEUSD
will round the share down to 0.mint
function will trigger:uint256 sharesAmount = getSharesByMintedEUSD(_mintAmount); if (sharesAmount == 0) { //EUSD totalSupply is 0: assume that shares correspond to EUSD 1-to-1 sharesAmount = _mintAmount; }
This means the sharesAmount
will be overwritten with _mintAmount
, which is 1 instead --> allowing an attacker to mint eusd at the exchange rate of 1 instead of 0.9 --> diluting the shares
Described above.
Manual Review
sharesAmount == 0
, check for totalSupply == 0
for initial rate.Math
#0 - c4-pre-sort
2023-07-10T12:05:35Z
JeffCX marked the issue as duplicate of #106
#1 - c4-judge
2023-07-28T15:32:21Z
0xean marked the issue as satisfactory
#2 - c4-judge
2023-07-28T19:44:38Z
0xean changed the severity to 3 (High Risk)