The domain separator is not calculated properly #313
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-146
edited-by-warden
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-09-centrifuge/blob/512e7a71ebd9ae76384f837204216f26380c9f91/src/token/ERC20.sol#L42-L49
Vulnerability details
Impact
The domain separator is not properly calculated in the
constructor
- as it does not take into calculationname
- which is not yet initialized.The similar issue had been evaluated as Medium during the previous Code4rena audits:
Moreover, please notice, that this issue is not the same as my other report: #306
The current issue is about incorrectly setting the domain separator on contract deployment. The root cause of this issue lies inside
constructor()
, as domain separator is being initialized beforename
.While the other issue (#306) is about not updating domain separator, when
name
is changed. The root cause of that issue lies insidefile()
- whenever we call to change thename
, the domain separator should be updated too.The remediation for this issue is to update
constructor()
, while remediation for issue #306 is to update code insidefile()
.Proof of Concept
File: src/token/ERC20.sol
The
constructor()
calculates the domain separator, before initializingname
.Tools Used
Manual code review
Recommended Mitigation Steps
Initialize
name
before calculating domain separatorAssessed type
Other
The text was updated successfully, but these errors were encountered: