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

Vault does not conform to ERC4626. #43

Closed
c4-bot-10 opened this issue Apr 9, 2024 · 6 comments
Closed

Vault does not conform to ERC4626. #43

c4-bot-10 opened this issue Apr 9, 2024 · 6 comments
Labels
bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-501 grade-c partial-25 Incomplete articulation of vulnerability; eligible for partial credit only (25%) QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax 🤖_43_group AI based duplicate group recommendation sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@c4-bot-10
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L392-L394
https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L444-L448

Vulnerability details

Impact

Vault does not conform to ERC4626 which may break external integrations.

Proof of Concept

The ERC4626 specification states that maxDeposit MUST return the maximum amount of assets deposit would allow to be deposited for receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted.

Similarly, maxMint MUST return the maximum amount of shares mint would allow to be deposited to receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted.

CollateralTracker.sol#L392-L394

    function maxDeposit(address) external pure returns (uint256 maxAssets) {
        return type(uint104).max;
    }

CollateralTracker.sol#L444-L448

    function maxMint(address) external view returns (uint256 maxShares) {
        unchecked {
            return (convertToShares(type(uint104).max) * DECIMALS) / (DECIMALS + COMMISSION_FEE);
        }
    }

The CollateralTracker contract is an ERC4626 vault. This means that maxDeposit and maxMint of the CollateralTracker Vault must conform to the maxDeposit and maxMint of ERC4626 vaults as stated in the ERC4626 specification. The vulnerability is similar to PoolTogether M-23 where the vault does not conform to ERC4626.

Tools Used

Manual review, ERC4626 Tokenized Vaults

Recommended Mitigation Steps

Replace the implementation of the vault's maxDeposit and maxMint functions to be ERC4626 compliant.

Assessed type

ERC4626

@c4-bot-10 c4-bot-10 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 Apr 9, 2024
c4-bot-1 added a commit that referenced this issue Apr 9, 2024
@c4-bot-13 c4-bot-13 added the 🤖_43_group AI based duplicate group recommendation label Apr 22, 2024
@c4-judge c4-judge added the primary issue Highest quality submission among a set of duplicates label Apr 26, 2024
@c4-judge
Copy link
Contributor

Picodes marked the issue as primary issue

@dyedm1 dyedm1 added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Apr 29, 2024
@dyedm1
Copy link

dyedm1 commented Apr 29, 2024

This issue has no explanation of how the standard was actually contravened.

@c4-judge c4-judge closed this as completed May 6, 2024
@c4-judge c4-judge added duplicate-501 and removed primary issue Highest quality submission among a set of duplicates labels May 6, 2024
@c4-judge
Copy link
Contributor

c4-judge commented May 6, 2024

Picodes marked the issue as duplicate of #501

@c4-judge
Copy link
Contributor

c4-judge commented May 6, 2024

Picodes marked the issue as partial-25

@c4-judge c4-judge added the partial-25 Incomplete articulation of vulnerability; eligible for partial credit only (25%) label May 6, 2024
@Picodes
Copy link

Picodes commented May 6, 2024

Giving partial credit as the explanation is very evasive.

@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 May 9, 2024
@c4-judge
Copy link
Contributor

c4-judge commented May 9, 2024

Picodes 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-501 grade-c partial-25 Incomplete articulation of vulnerability; eligible for partial credit only (25%) QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax 🤖_43_group AI based duplicate group recommendation sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

6 participants