-
Notifications
You must be signed in to change notification settings - Fork 3
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
The balances of assets in RdpxV2Core are not being updated when adding or removing liquidity using UniV2LiquidityAMO #250
Labels
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
duplicate-269
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Comments
code423n4
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
Aug 28, 2023
bytes032 marked the issue as duplicate of #798 |
bytes032 marked the issue as duplicate of #269 |
bytes032 marked the issue as sufficient quality report |
c4-pre-sort
added
the
sufficient quality report
This report is of sufficient quality
label
Sep 11, 2023
Description is slightly better and POCs are equivalent |
GalloDaSballo marked the issue as selected for report |
c4-judge
added
primary issue
Highest quality submission among a set of duplicates
selected for report
This submission will be included/highlighted in the audit report
labels
Oct 15, 2023
This was referenced Oct 24, 2023
GalloDaSballo marked issue #269 as primary and marked this issue as a duplicate of 269 |
c4-judge
added
duplicate-269
satisfactory
satisfies C4 submission criteria; eligible for awards
and removed
primary issue
Highest quality submission among a set of duplicates
selected for report
This submission will be included/highlighted in the audit report
labels
Oct 25, 2023
GalloDaSballo marked the issue as satisfactory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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
duplicate-269
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-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/amo/UniV2LiquidityAmo.sol#L160-L178
Vulnerability details
Impact
The UniV2LiquidityAMO provides three functions, addLiquidity, removeLiquidity and swap, which the admin can use to add and remove liquidity from Uniswap, or swap assets. The addLiquidity and swap requires assets from *RdpxV2Core, and the assets obtained from removeLiquidity and swap are stored in RdpxV2Core. However, UniV2LiquidityAMO does not update the data of ReserveAssets in RdpxV2Core, which can lead to inconsistencies between the data recorded in ReserveAsset and the actual data of the stored assets.
Proof of Concept
In the following test code, there are 50 rDPX and 11 WETH in RdpxV2Core. The addLiquidity function is used to add liquidity to Uniswap by adding 5 rDPX and 1 WETH. After adding liquidity, the balances of rDPX and WETH in RdpxV2Core will decrease.
The test results indicate that after calling addLiquidity to add liquidity to Uniswap, the balances of rDPX and WETH recorded in the ReserveAsset of RdpxV2Core did not decrease.
Tools Used
Foundry
Recommended Mitigation Steps
In the function _sendTokensToRdpxV2Core(), call the sync() function of RdpxV2Core to update the data in ReserveAsset.
Performing the test again, you should observe that after adding liquidity to Uniswap, the assets balances recorded in ReserveAsset are reduced.
Assessed type
Context
The text was updated successfully, but these errors were encountered: