-
Notifications
You must be signed in to change notification settings - Fork 14
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
[M-04] LiquidityPool.requestDepositWithPermit()
: Request deposits with permit can be broken for asset tokens that do not follow ERC2612 standard permit function
#359
Comments
raymondfam marked the issue as low quality report |
N-40 from the bot. |
raymondfam marked the issue as primary issue |
gzeon-c4 marked the issue as unsatisfactory: |
My mistakes on repeating the phantom permit functions part. However, the automated bot report does not mention integration of DAI as possible currency asset for liquidity pools, so that part of the submission should still be valid. The only other report mentioning this is #462. #509 is actually invalid since it is indeed mentioning the phantom permits similar to the finding in N-40. There is a similar finding here. It is explicitly mentioned in README that stable coins are accepted. Also, here is a example RWA centrifuge pool that utilizes DAI as the underlying currency. While I understand that governance decides on the stablecoin/tokens to add, unless Centrifuge is planning to not support currencies with non-compliant permit function like DAI (which is not made known in the contest details), the first part of the finding should still be valid. |
gzeon-c4 removed the grade |
gzeon-c4 changed the severity to QA (Quality Assurance) |
Valid but QA, it is impossible to support every token if they are non-compliant. @hieronx |
Lines of code
https://github.com/code-423n4/2023-09-centrifuge/blob/main/src/LiquidityPool.sol#L220-L226
https://github.com/code-423n4/2023-09-centrifuge/blob/main/src/token/ERC20.sol#L216-L237
Vulnerability details
Impact
In the
LiquidityPool.requestDepositWithPermit()
, the implementation invokes the underlying token'spermit()
function and proceeds with the assumption that the operation was successful, without checking the outcome.LiquidityPool.sol#L220-L226
The
ERC20.permit()
implemented is almost identical to the OZ version of thepermit()
function here.ERC20.sol#L216-L237
However, it is known that certain tokens such as DAI utilizes a
permit()
function here that deviates from the reference implementation inERC20.sol
. The differences are outlined here. The lack of verification could possibly lead to unexpected behavior when interacting with non-conforming tokens.DAI Token
In addition, tokens containing phantom permits (e.g. WETH) are known to exist, which would not revert on failure. Hence, setting a precedent of explicitly reverting when calling unsupported permit functions can help ensure
requestDepositWithPermit()
do not suffer from calling phantom permits on the underlying currency assets.Tools Used
Manual Analysis
Recommendaiton
Add proper verification to the
permit()
function call. This could be done by using asafePermit()
function withinERC20.sol
similar to the one OZ implemented here instead of apermit()
function. (For more details you can check this discussion)Assessed type
Context
The text was updated successfully, but these errors were encountered: