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

QA Report #11

Open
code423n4 opened this issue Jul 13, 2022 · 0 comments
Open

QA Report #11

code423n4 opened this issue Jul 13, 2022 · 0 comments
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

Assert instead require to validate user inputs

    From solidity docs: Properly functioning code should never reach a failing assert statement; if this happens there is a bug in your contract which you should fix.
    With assert the user pays the gas and with require it doesn't. The ETH network gas isn't cheap and users can see it as a scam.

Code instances:

    RRUtils.sol : reachable assert in line 21
    RRUtils.sol : reachable assert in line 51

Div by 0

Division by 0 can lead to accidentally revert,
(An example of a similar issue - code-423n4/2021-10-defiprotocol-findings#84)

Code instances:

    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/ethregistrar/StablePriceOracle.sol#L90 in some constellation in the future ethPrice might be 0 and you want to support it (instead of the current DOS)

Open TODOs

Open TODOs can hint at programming or architectural errors that still need to be fixed.
These files has open TODOs:

Code instance:

Open TODO in DNSSECImpl.sol line 237 : // TODO: Check key isn't expired, unless updating key itself

Check transfer receiver is not 0 to avoid burned money

Transferring tokens to the zero address is usually prohibited to accidentally avoid "burning" tokens by sending them to an unrecoverable zero address.

Code instances:

    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/wrapper/NameWrapper.sol#L600
    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/wrapper/NameWrapper.sol#L820
    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/wrapper/mocks/UpgradedNameWrapperMock.sol#L49
    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/wrapper/ERC1155Fuse.sol#L199
    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/wrapper/NameWrapper.sol#L230
    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/wrapper/NameWrapper.sol#L341
    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/wrapper/ERC1155Fuse.sol#L286
    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/wrapper/ERC1155Fuse.sol#L176
    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/registry/ENSRegistry.sol#L65

Add a timelock

To give more trust to users: functions that set key/critical variables should be put behind a timelock.

Code instances:

    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/registry/ENSRegistry.sol#L86
    https://github.com/code-423n4/2022-07-ens/tree/main/contracts/wrapper/ERC1155Fuse.sol#L102

Two Steps Verification before Transferring Ownership

The following contracts have a function that allows them an admin to change it to a different address. If the admin accidentally uses an invalid address for which they do not have the private key, then the system gets locked.
It is important to have two steps admin change where the first is announcing a pending new admin and the new address should then claim its ownership.
A similar issue was reported in a previous contest and was assigned a severity of medium: code-423n4/2021-06-realitycards-findings#105

Code instances:

    ENSRegistry.sol
    DNSSECImpl.sol
    Ownable.sol
    ENSRegistryWithFallback.sol

Named return issue

Users can mistakenly think that the return value is the named return, but it is actually the actualreturn statement that comes after. To know that the user needs to read the code and is confusing.
Furthermore, removing either the actual return or the named return will save gas.

Code instances:

    NameWrapper.sol, ownerOf
    AddrResolver.sol, addr
    EllipticCurve.sol, isZeroCurve
    DNSSECImpl.sol, validateSignedSet
    Multicallable.sol, multicall
    RRUtils.sol, readName

Not verified owner

    owner param should be validated to make sure the owner address is not address(0).
    Otherwise if not given the right input all only owner accessible functions will be unaccessible.

Code instances:

    NameWrapper.sol.setRecord owner
    BaseRegistrarImplementation.sol.reclaim owner

Solidity compiler versions mismatch

The project is compiled with different versions of solidity, which is not recommended because it can lead to undefined behaviors.

Not verified input

external / public functions parameters should be validated to make sure the address is not 0.
Otherwise if not given the right input it can mistakenly lead to loss of user funds.

Code instances:

    ENSRegistry.sol.setApprovalForAll operator
    ERC1155ReceiverMock.sol.onERC1155Received operator
    TestResolver.sol.setAddr addr
    ERC1155Fuse.sol.safeBatchTransferFrom to

Require with empty message

The following requires are with empty messages.
This is very important to add a message for any require. So the user has enough information to know the reason of failure.

Code instances:

    Solidity file: BaseRegistrarImplementation.sol, In line 152 with Empty Require message.
    Solidity file: BytesUtils.sol, In line 159 with Empty Require message.
    Solidity file: TestRegistrar.sol, In line 32 with Empty Require message.
@code423n4 code423n4 added bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax labels Jul 13, 2022
code423n4 added a commit that referenced this issue Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

1 participant