-
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
Cached DOMAIN_SEPARATOR
is incorrect for tranche tokens potentially breaking permit integrations
#146
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
edited-by-warden
high quality report
This report is of especially high quality
M-04
primary issue
Highest quality submission among a set of duplicates
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Comments
c4-submissions
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
Sep 13, 2023
c4-pre-sort
added
the
primary issue
Highest quality submission among a set of duplicates
label
Sep 15, 2023
raymondfam marked the issue as primary issue |
raymondfam marked the issue as sufficient quality report |
c4-pre-sort
added
the
sufficient quality report
This report is of sufficient quality
label
Sep 15, 2023
This was referenced Sep 15, 2023
request to deposit or redeem with permit may not work as expected if ERC20 token name is updated
#52
Closed
ERC20.permit() could be failed due to an incoming call
PoolManager#UpdateTrancheTokenMetadata()
#539
Closed
Closed
raymondfam marked the issue as high quality report |
c4-pre-sort
added
high quality report
This report is of especially high quality
and removed
sufficient quality report
This report is of sufficient quality
labels
Sep 17, 2023
c4-sponsor
added
the
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
label
Sep 18, 2023
hieronx (sponsor) confirmed |
c4-judge
added
the
satisfactory
satisfies C4 submission criteria; eligible for awards
label
Sep 26, 2023
gzeon-c4 marked the issue as satisfactory |
gzeon-c4 marked the issue as selected for report |
c4-judge
added
the
selected for report
This submission will be included/highlighted in the audit report
label
Sep 26, 2023
Closed
Mitigated in centrifuge/liquidity-pools#142 |
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
edited-by-warden
high quality report
This report is of especially high quality
M-04
primary issue
Highest quality submission among a set of duplicates
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2023-09-centrifuge/blob/512e7a71ebd9ae76384f837204216f26380c9f91/src/util/Factory.sol#L81-L109
https://github.com/code-423n4/2023-09-centrifuge/blob/512e7a71ebd9ae76384f837204216f26380c9f91/src/token/ERC20.sol#L42-L49
https://github.com/code-423n4/2023-09-centrifuge/blob/512e7a71ebd9ae76384f837204216f26380c9f91/src/token/ERC20.sol#L225-L231
Vulnerability details
Impact
Attempts to interact with tranche tokens via
permit
may always revert.Proof of Concept
When new tranche tokens are deployed, the initial
DOMAIN_SEPARATOR
is calculated and cached in the constructor.https://github.com/code-423n4/2023-09-centrifuge/blob/512e7a71ebd9ae76384f837204216f26380c9f91/src/token/ERC20.sol#L42-L49
This uses an empty string since
name
is only set after deployment.https://github.com/code-423n4/2023-09-centrifuge/blob/512e7a71ebd9ae76384f837204216f26380c9f91/src/util/Factory.sol#L81-L109
Consequently, the domain separator is incorrect (when
block.chainid == deploymentChainId
where the domain separator is not recalculated) and will cause reverts when signatures forpermit
are attempted to be constructed using the tranche token'sname
(which will not be empty).It should also be noted that the tranche token
name
could be changed by a call toupdateTranchTokenMetadata
which may also introduce complications with the domain separator.Tools Used
Manual Review
Recommended Mitigation Steps
Consider setting the name in the constructor before the cached domain separator is calculated.
Assessed type
Other
The text was updated successfully, but these errors were encountered: