-
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
DoS when add liquidity #35
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-1782
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
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 23, 2023
bytes032 marked the issue as duplicate of #928 |
c4-pre-sort
added
duplicate-928
low quality report
This report is of especially low quality
labels
Sep 8, 2023
bytes032 marked the issue as low quality report |
bytes032 marked the issue as not a duplicate |
bytes032 marked the issue as duplicate of #1455 |
bytes032 marked the issue as duplicate of #1782 |
c4-pre-sort
added
sufficient quality report
This report is of sufficient quality
and removed
low quality report
This report is of especially low quality
labels
Sep 11, 2023
bytes032 marked the issue as sufficient quality report |
GalloDaSballo marked the issue as unsatisfactory: |
c4-judge
added
the
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
label
Oct 12, 2023
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-1782
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/amo/UniV2LiquidityAmo.sol#L200-L204
Vulnerability details
Impact
Currently, in
addLiquidity
function ofUniV2LiquidityAMO
contract, it will first approvetokenA
andtokenB
to correspondingAMMRouter
then add liquidity. But as we know, some ERC20 token has a trick in itsapprove
function, it don't allow user to approve again when there is already an allowance. As we can see in the implementation ofUniswapV2Router
contract, theaddLiquidity
function does not always transfer all tokens specify inamountADesired
andamountADesired
. Instead, it will only transfer tokenA amount which calculated byamountBOptimal
or tokenB amount which is calculated byamountAOptimal
. So in most of cases, the allowance of tokenA and tokenB will not be fully used, whcih leads to user may not able to add liquidity because some “tricks” in ERC20 tokensProof of Concept
UniswapV2Router related functions
dopex related
Tools Used
VS code
Recommended Mitigation Steps
Approve allowance to 0 first before approve again
Assessed type
DoS
The text was updated successfully, but these errors were encountered: