Platform: Code4rena
Start Date: 24/10/2023
Pot Size: $149,725 USDC
Total HM: 7
Participants: 52
Period: 21 days
Judge: ronnyx2017
Total Solo HM: 2
Id: 300
League: ETH
Rank: 47/52
Findings: 1
Award: $19.71
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: SpicyMeatball
Also found by: 0xBeirao, 7ashraf, LokiThe5th, OMEN, TrungOre, alexzoid, alpha, bdmcbri, ether_sky, fatherOfBlocks, ge6a, hihen, hunter_w3b, jasonxiale, ladboy233, lsaudit, niroh, nobody2018, nonseodion, peanuts, prapandey031, shaka, twcctop, twicek, wangxx2026
19.712 USDC - $19.71
Total of 1 issue:
ID | Issue |
---|---|
[L-01] | Missing Zero Address Check for _authorityAddress in EBTCToken Constructor |
_authorityAddress
in EBTCToken
ConstructorThe lack of a zero address check for the _authorityAddress
parameter in the EBTCToken
constructor was identified as a vulnerability through a formal verification contest using the authNoOwnerInitializedAndAddressSetInConstructor()
rule. This rule is designed to ensure that _authorityInitialized
is true
only when _authority
is set to a non-zero address in AuthNoOwner
contract.
invariant authNoOwnerInitializedAndAddressSetInConstructor() ghostAuthorityInitialized == (ghostAuthority != 0) filtered { f -> f.selector == 0 } { preserved { require(false); } }
In the initial EBTCToken
contract, this rule was violated, suggesting that _authority
could be set to the zero address while _authorityInitialized
was true
. This issue was not found in other contracts such as ActivePool.sol
and CollSurplusPool.sol
.
An additional point of concern is the setAuthority()
function in the AuthNoOwner
contract. This function is intended to set a new _authority
address. However, if _authority
is initially set to the zero address due to the absence of a zero address check in the constructor, it would be impossible to change the _authority
later, as the setAuthority()
function requires the current _authority
to authorize the change. This limitation poses a significant risk to the contract's flexibility and security.
Recommendation: It is advised to implement a zero address check for _authorityAddress
in the EBTCToken
constructor or within the _initializeAuthority
function. The proposed fix involves adding the following check before initializing the authority:
require(_authorityAddress != address(0), "EBTCToken: zero authority!"); _initializeAuthority(_authorityAddress);
#0 - c4-pre-sort
2023-11-17T14:47:33Z
bytes032 marked the issue as insufficient quality report