-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asset Price and Deposit Amount Scaling Could be Different Than 1e18 #97
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-479
grade-b
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Comments
c4-submissions
added
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
labels
Nov 12, 2023
c4-pre-sort
added
the
sufficient quality report
This report is of sufficient quality
label
Nov 15, 2023
raymondfam marked the issue as sufficient quality report |
raymondfam marked the issue as primary issue |
c4-pre-sort
added
the
primary issue
Highest quality submission among a set of duplicates
label
Nov 15, 2023
Probably wouldn't apply to LST tokens, but Chainlink maybe. |
This was referenced Nov 16, 2023
Open
This was referenced Nov 16, 2023
c4-pre-sort
removed
the
primary issue
Highest quality submission among a set of duplicates
label
Nov 17, 2023
raymondfam marked the issue as duplicate of #479 |
fatherGoose1 marked the issue as satisfactory |
c4-judge
added
satisfactory
satisfies C4 submission criteria; eligible for awards
downgraded by judge
Judge downgraded the risk level of this issue
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
and removed
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
labels
Dec 1, 2023
fatherGoose1 changed the severity to QA (Quality Assurance) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-479
grade-b
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2023-11-kelp/blob/main/src/LRTDepositPool.sol#L108-L109
Vulnerability details
Impact
The vulnerability identified concerns the assumption that both deposit
amount
andlrtOracle.getAssetPrice(asset)
inLRTDepositPool.getRsETHAmountToMint()
are scaled to 1e18 (Wei standard in Ethereum).https://github.com/code-423n4/2023-11-kelp/blob/main/src/LRTDepositPool.sol#L108-L109
In scenarios involving multiple asset types, this assumption may not hold true, as different assets can have varying decimal places. For instance, many ERC-20 tokens use different scalings (e.g., 6, 8, or even above 18 decimal places).
Additionally, not all prices returned by Chainlink are 18 decimals. Apparently, asset prices returned by the following function could be 8 or 18 decimals per Chainlink documentation:
https://github.com/code-423n4/2023-11-kelp/blob/main/src/oracles/ChainlinkPriceOracle.sol#L34-L39
Incorrectly assuming a uniform scale could lead to significant discrepancies in calculations, impacting the accuracy of minted RSETH tokens and the overall economic logic of the protocol. This issue poses a risk of financial inaccuracies, potential exploits, and could undermine the trust and integrity of the system.
Proof of Concept
Scenario 1:
decimal()
equals 18 whereas token Bdecimal()
is 6.Scenario 2:
decimal()
equal 18.getAssetPrice()
returns price A with 8 decimals while returning price B with 18 decimals.Scenario 3:
Tools Used
Manual
Recommended Mitigation Steps
Consider normalizing all asset amounts and Chainlink price feeds to 18 decimals. Unnormalize the asset amount when redeeming RSETH right after burning and prior to transferring asset to the staker.
Assessed type
Decimal
The text was updated successfully, but these errors were encountered: