-
Notifications
You must be signed in to change notification settings - Fork 0
Unauthorized Access to setCurves Function #4
Copy link
Copy link
Open
Labels
3 (High Risk)Assets can be stolen/lost/compromised directlyAssets can be stolen/lost/compromised directlyH-04bugSomething isn't workingSomething isn't workingprimary issueHighest quality submission among a set of duplicatesHighest quality submission among a set of duplicatessatisfactorysatisfies C4 submission criteria; eligible for awardssatisfies C4 submission criteria; eligible for awardsselected for reportThis submission will be included/highlighted in the audit reportThis submission will be included/highlighted in the audit reportsponsor confirmedSponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")sufficient quality reportThis report is of sufficient qualityThis report is of sufficient qualityupgraded by judgeOriginal issue severity upgraded from QA/Gas by judgeOriginal issue severity upgraded from QA/Gas by judge
Description
Activity
Metadata
Metadata
Assignees
Labels
3 (High Risk)Assets can be stolen/lost/compromised directlyAssets can be stolen/lost/compromised directlyH-04bugSomething isn't workingSomething isn't workingprimary issueHighest quality submission among a set of duplicatesHighest quality submission among a set of duplicatessatisfactorysatisfies C4 submission criteria; eligible for awardssatisfies C4 submission criteria; eligible for awardsselected for reportThis submission will be included/highlighted in the audit reportThis submission will be included/highlighted in the audit reportsponsor confirmedSponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")sufficient quality reportThis report is of sufficient qualityThis report is of sufficient qualityupgraded by judgeOriginal issue severity upgraded from QA/Gas by judgeOriginal issue severity upgraded from QA/Gas by judge
Lines of code
https://github.com/code-423n4/2024-01-curves/blob/main/contracts/FeeSplitter.sol#L35
Vulnerability details
Impact
The
FeeSplitter.solcontract, which is responsible for fee distribution and claiming, contains a significant security vulnerability related to thesetCurvesfunction. This function allows updating the reference to theCurvescontract. However, as it currently stands, any user, including a malicious actor, can callsetCurves. This vulnerability can be exploited to redirect the contract's reference to a fake or maliciousCurvescontract (FakeCurves.sol), enabling manipulation of critical calculations used in fee distribution.The exploit allows an attacker to set arbitrary values for
curvesTokenBalanceandcurvesTokenSupplyin the fakeCurvescontract. By manipulating these values, the attacker can falsely inflate their claimable fees, leading to unauthorized profit at the expense of legitimate token holders.Proof of Concept
Steps:
FeeSplitterandFakeCurvescontracts.setCurvesonFeeSplitterto update thecurvesreference to the deployedFakeCurvescontract.curvesTokenBalanceandcurvesTokenSupplyinFakeCurvesto create false balances and supplies.getClaimableFeesinFeeSplitterto calculate inflated claimable fees based on the manipulated values.Code:
Tools Used
Manual pentest
Recommended Mitigation Steps
To mitigate this vulnerability, the
setCurvesfunction inFeeSplitter.solshould be restricted to be callable only by the owner or a trusted manager. This can be achieved by using theonlyOwneroronlyManagermodifier (from the inheritedSecurity.solcontract) in thesetCurvesfunction.The modified
setCurvesfunction should look like this:or, if managers are also trusted to perform this action,
Assessed type
Access Control