Skip to content
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

Reentrancy from _transferAndBurnFuses #293

Closed
code423n4 opened this issue Jul 19, 2022 · 3 comments
Closed

Reentrancy from _transferAndBurnFuses #293

code423n4 opened this issue Jul 19, 2022 · 3 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists old-submission-method

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-07-ens/blob/ff6e59b9415d0ead7daf31c2ed06e86d9061ae22/contracts/wrapper/NameWrapper.sol#L813-L822

Vulnerability details

Impact

Reentrancy attack

Proof of Concept

The function _transferAndBurnFuses is not performing Checks-Effects-Interactions pattern, and updates fuses after NFTs are transfered.
An attacker can reenter because _transfer is performing a _doSafeTransferAcceptanceCheck where it check the receive is able to handle NFTs.

function _transferAndBurnFuses(
        bytes32 node,
        address newOwner,
        uint32 fuses,
        uint64 expiry
    ) internal {
        (address owner, , ) = getData(uint256(node));
        _transfer(owner, newOwner, uint256(node), 1, "");  @audit here is the transfer
        _setFuses(node, newOwner, fuses, expiry);@audut here we set a storage variable
    }

Recommended Mitigation Steps

Set the variables before transferring

​ [-] transfer(owner, newOwner, uint256(node), 1, "");
​ [-]
_setFuses(node, newOwner, fuses, expiry);

    [+]_ setFuses(node, newOwner, fuses, expiry);

​ [+] _transfer(owner, newOwner, uint256(node), 1, "");

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working old-submission-method labels Jul 19, 2022
code423n4 added a commit that referenced this issue Jul 19, 2022
@sseefried
Copy link

Duplicate of #124

@jefflau
Copy link
Collaborator

jefflau commented Jul 22, 2022

Duplicate of #117

@jefflau jefflau marked this as a duplicate of #117 Jul 22, 2022
@Arachnid Arachnid added the duplicate This issue or pull request already exists label Jul 27, 2022
@dmvt
Copy link
Collaborator

dmvt commented Aug 3, 2022

Duplicate of #84

@dmvt dmvt marked this as a duplicate of #84 Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists old-submission-method
Projects
None yet
Development

No branches or pull requests

5 participants