Open code423n4 opened 2 years ago
Valid R
Disagree because the relation being 1-1 means that the only pre-requisite to change implementation is that the new one covers the same slots, adding new slots is not an issue and doesn't need a gap
NC
Am also confused by the fact that anyone can call this - Valid Low
L
In lack of POC i dispute as the example given is not logically possible (e.g. Pending and Expired), please add a POC / example for reports in the future
L
NC
L (for now)
Disputed (check assembly below)
R
Disagree, hardcode is fine
3L 2R 2NC
Titles for Report (Adding the downgraded findings)
L01 - Call to external contract without authentication L02 - Lack of checks L03 - Use of transfer instead of call L04 - Owner can deny the service L05 - CNote.noReentrant backdoor L06 - It is allowed to modify a previously created proposal
NC 01 - Outdated compiler NC 02 - TreasuryDelegator don't allow to change receive() logic NC 03 - Lack of ACK during owner change NC 04 - Use abstract for base contracts
Low
1. Outdated compiler
The pragma version used are:
But recently solidity released a new version with important Bugfixes:
The first one is related to ABI-encoding nested arrays directly from calldata. You can find more information here.
The second bug is triggered in certain inheritance structures and can cause a memory pointer to be interpreted as a calldata pointer or vice-versa. We also have a dedicated blog post about this bug.
Apart from these, there are several minor bug fixes and improvements.
The minimum required version should be 0.8.14
Examples:
2. Upgradable contracts without GAP can lead a upgrade disaster
Some contract does not implement a good upgradeable logic.
Proxied contracts MUST include an empty reserved space in storage, usually named
__gap
, in all the inherited contracts.For example, if it is an interface, you have to use the
interface
keyword, otherwise it is a contract that requires your GAP to be correctly updated, so if a new variable is created it could lead in storage collisions that will produce a contract dissaster, including loss of funds.Reference:
Affected source code:
3.
TreasuryDelegator
don't allow to changereceive()
logicThe contract does not send the call to the
implementation
and therefore cannot be updated by animplementation
change.Affected source code:
4. Call to external contract without authentication
It is allowed to call the
redeem
method without authentication control or whitelist, so the contract could call an external contract on behalf of thetreasury
, something that is not recommended.Affected source code:
5. Lack of checks
The following methods have a lack checks if the received argument is an address, it's good practice in order to reduce human error to check that the address specified in the constructor or initialize is different than
address(0)
.Affected source code:
There are also integer variables that must be in a certain range that are not checked.
Affected source code:
6. Unsecure state order
Negative states must be processed before positive states, otherwise, a proposal that is
Expired
orExecuted
, but isActive
orPending
will be returned asActive
orPending
, this makes it necessary to check that the state is correct from outside this method. I mean, changing outside the variables that alter this state in the correct way.Affected source code:
7. Use of
transfer
instead ofcall
To transfer ether, the
transfer
method (which is capped at 2300 gas) is used instead ofcall
which is limited to the gas provided by the user.If a contract that has a
fallback
method more expensive than 2300 gas, it will be impossible for a contract receive funds fromBasket
contract.Reference:
Affected source code:
8. Lack of ACK during owner change
It's possible to lose the ownership under specific circumstances.
Because an human error it's possible to set a new invalid owner. When you want to change the owner's address it's better to propose a new owner, and then accept this ownership with the new wallet.
Affected source code:
9. Owner can deny the service
adjusterCoefficient
is casted toint
and the owner can set a value in_setAdjusterCoefficient
that can produce an overflow.Affected source code:
10. Unsafe ERC20 calls
The following code doesn't check the result of the ERC20 calls. ERC20 standard specify that the token can return false if these calls fails, so it's mandatory to check the result of these ERC20 methods.
Reference:
EIP-20
Affected source code for
transferFrom
:Non-Critical
11. Use
abstract
for base contractsAbstract contracts are contracts that have at least one function without its implementation. An instance of an abstract cannot be created.
Reference:
Affected source code:
12. Use hardcoded values
It is not good practice to hardcode values, but if you are dealing with addresses much less, these can change between implementations, networks or projects, so it is convenient to remove these addresses from the source code.
Affected source code: