Anyone can call ETHRegistrarController.register
for already existing commitments and set a reverse record to the caller instead of the owner of a record
#81
Labels
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Lines of code
https://github.com/code-423n4/2022-07-ens/blob/ff6e59b9415d0ead7daf31c2ed06e86d9061ae22/contracts/ethregistrar/ETHRegistrarController.sol#L170
https://github.com/code-423n4/2022-07-ens/blob/ff6e59b9415d0ead7daf31c2ed06e86d9061ae22/contracts/ethregistrar/ETHRegistrarController.sol#L270-L281
Vulnerability details
Impact
To prevent front running, the
ETHRegistrarController
contract uses a two-step process to register names. First one has to callETHRegistrarController.commit
with the desired configuration parameters and wait forminCommitmentAge
to pass by. Then a call toETHRegistrarController.register
with the same parameters as in the previous step to finally register the name. ThisETHRegistrarController.register
can be front-run without any consequences by anyone else. At least that's the case for registering the name.If
reverseRecord
is set totrue
and theETHRegistrarController.register
function is called by anyone else than theowner
, a reverse record withname
is set for the caller addressmsg.sender
instead of theowner
.Proof of Concept
ETHRegistrarController.sol#L170
ETHRegistrarController._setReverseRecord
Example
foo.eth
and callsETHRegistrarController.commit
with the appropriate parameters andreverseRecord = true
minCommitmentAge
, Bob callsETHRegistrarController.register
with the same parameters as in the step beforefoo.eth
is successfully registered (with Bob as the owner), however, Alice has now her address associated with a reverse record set tofoo.eth
and Bob is missing the reverse record for his address.Copy-paste the following test into the
TestEthRegistrarController.js
file and run the tests:Tools Used
Manual review
Recommended mitigation steps
Consider using the
owner
instead ofmsg.sender
:ETHRegistrarController.sol#L170
ETHRegistrarController._setReverseRecord
The text was updated successfully, but these errors were encountered: