Skip to content
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

Unchecked Return Values of PoolManager::isAllowedAsPoolCurrency() #246

Open
c4-submissions opened this issue Sep 13, 2023 · 9 comments
Open
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue grade-b low quality report This report is of especially low quality Q-24 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@c4-submissions
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2023-09-centrifuge/blob/512e7a71ebd9ae76384f837204216f26380c9f91/src/InvestmentManager.sol#L124, https://github.com/code-423n4/2023-09-centrifuge/blob/512e7a71ebd9ae76384f837204216f26380c9f91/src/InvestmentManager.sol#L154

Vulnerability details

Impact

The interface used in src\InvestmentManager.sol

interface PoolManagerLike {
    ...
    function isAllowedAsPoolCurrency(uint64 poolId, address currencyAddress) external view returns (bool);
}

function returns bool, but the check is not executed.
Token (currency) that is not supported in Centrifuge pool will be used in InvestmentManager::requestRedeem() and InvestmentManager::requestDeposit().
In other contracts, the check is performed. In this case, it was probably forgotten to be performed.

Line 124: poolManager.isAllowedAsPoolCurrency(lPool.poolId(), currency);
Line 154: poolManager.isAllowedAsPoolCurrency(lPool.poolId(), lPool.asset());

Proof of Concept

At the moment PoolManager::isAllowedAsPoolCurrency() will always return true or revert() will occur. But if the PoolManager logic is changed so that true/false is returned and the address poolManager is updated with InvestmentManager::file(), the Token (currency) that is not supported in Centrifuge pool will be used in InvestmentManager::requestRedeem() and InvestmentManager::requestDeposit().

Tools Used

Manual analysis

Recommended Mitigation Steps

Change from
Line 124: poolManager.isAllowedAsPoolCurrency(lPool.poolId(), currency);
Line 154: poolManager.isAllowedAsPoolCurrency(lPool.poolId(), lPool.asset());
to
Line 124: requre(poolManager.isAllowedAsPoolCurrency(lPool.poolId(), currency), "PoolManager/currency-not-supported")
Line 154: requre(poolManager.isAllowedAsPoolCurrency(lPool.poolId(), lPool.asset()), "PoolManager/currency-not-supported")

Assessed type

Invalid Validation

@c4-submissions 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 Sep 13, 2023
c4-submissions added a commit that referenced this issue Sep 13, 2023
@c4-pre-sort
Copy link

raymondfam marked the issue as low quality report

@c4-pre-sort c4-pre-sort added the low quality report This report is of especially low quality label Sep 15, 2023
@c4-pre-sort
Copy link

raymondfam marked the issue as duplicate of #68

@c4-judge
Copy link

gzeon-c4 marked the issue as unsatisfactory:
Invalid

@c4-judge c4-judge added the unsatisfactory does not satisfy C4 submission criteria; not eligible for awards label Sep 25, 2023
@c4-judge
Copy link

gzeon-c4 marked the issue as not a duplicate

@c4-judge
Copy link

gzeon-c4 marked the issue as unsatisfactory:
Invalid

@c4-judge c4-judge added 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 Sep 25, 2023
@c4-judge
Copy link

gzeon-c4 changed the severity to QA (Quality Assurance)

@gzeon-c4
Copy link

isAllowedAsPoolCurrency revert if false, but as QA the bool should be checked

@c4-sponsor
Copy link

hieronx (sponsor) confirmed

@c4-sponsor c4-sponsor added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Sep 25, 2023
@c4-judge c4-judge reopened this Sep 25, 2023
@c4-judge
Copy link

gzeon-c4 marked the issue as grade-b

@c4-judge c4-judge added grade-b and removed unsatisfactory does not satisfy C4 submission criteria; not eligible for awards labels Sep 25, 2023
@C4-Staff C4-Staff added the Q-24 label Oct 2, 2023
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 grade-b low quality report This report is of especially low quality Q-24 QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

6 participants