-
Notifications
You must be signed in to change notification settings - Fork 1
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
VToken.mint is vulnerable to ERC4626 inflation attack #314
Comments
0xean changed the severity to 2 (Med Risk) |
0xean marked the issue as primary issue |
chechu marked the issue as sponsor disputed |
The attack would indeed be feasible if we didn’t require initial supply |
@chechu - can you point me to this in the codebase? |
Our fault, we allow an initial supply, but we don't require it. https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Pool/PoolRegistry.sol#L321 The origin of the confusion is that we'll provide, for sure, an initial supply on every market that we'll add to the PoolRegistry, and the process to add new markets is under the control of the Governance (so, the community will have to vote for it). For that reason, we really assumed that there will be an initial supply, but now we realized we are not requiring it in the code. We'll do it, just to avoid any confusion or potential error. We won't integrate the Oracles, but the initial idea is to provide at least $10,000 as an initial supply on each new market. That "check" will be done externally, when the VIP is prepared to be proposed to the community |
0xean marked the issue as satisfactory |
0xean changed the severity to 3 (High Risk) |
0xean changed the severity to 2 (Med Risk) |
0xean marked issue #220 as primary and marked this issue as a duplicate of 220 |
Lines of code
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L743
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L756
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L1476
Vulnerability details
Impact
VToken.mint
is vulnerable to ERC4626 inflation attack.The first depositor may steal all the underlying tokens from the second one.
Proof of Concept
Copy and paste this test in
mintAndRedeemTest.ts
L248 beforemint
tests.https://github.com/code-423n4/2023-05-venus/blob/main/tests/hardhat/Tokens/mintAndRedeemTest.ts#L248
Tools Used
Manual review and hardhat tests.
Recommended Mitigation Steps
Reference: Implement or recommend mitigations for ERC4626 inflation attacks OpenZeppelin/openzeppelin-contracts#3706 (comment)
Assessed type
ERC4626
The text was updated successfully, but these errors were encountered: