Both RdpxV2Core and UniV2LiquidityAmo can use approveContractToSpend to approve a contract to spend a certain amount of tokens. However, it can only be used to give approval. There is no other method that can remove the given approval, leading to potential loss of funds.
Lines of code
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/core/RdpxV2Core.sol#L410 https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/amo/UniV2LiquidityAmo.sol#L133
Vulnerability details
Impact
Both
RdpxV2Core
andUniV2LiquidityAmo
can useapproveContractToSpend
to approve a contract to spend a certain amount of tokens. However, it can only be used to give approval. There is no other method that can remove the given approval, leading to potential loss of funds.Proof of Concept
approveContractToSpend
can only accept_amount > 0
, it cannot be used to cancel the given approval. It is dangerous that the contract cannot renounce the given approval. https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/core/RdpxV2Core.sol#L410 https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/amo/UniV2LiquidityAmo.sol#L133Tools Used
Manual Review
Recommended Mitigation Steps
approveContractToSpend
should accept_amount == 0
to cancel the approval.Assessed type
Error