Normal Behavior:
In secure smart contract design, all critical address parameters—such as those for token contracts, organizers, and withdrawal targets—should be validated to ensure they are not set to the zero address (address(0)
). The zero address is a special value in Ethereum that represents "no address" and is often used as a sentinel value for uninitialized or invalid addresses. Allowing critical roles or funds to be assigned to the zero address can break contract functionality, cause loss of funds, or make the contract irrecoverable.
Issue:
In the FestivalPass
contract, several functions and the constructor do not validate that provided addresses are nonzero:
The constructor does not check that _beatToken
or _organizer
are nonzero.
The setOrganizer
function does not check that the new organizer address is nonzero.
The withdraw
function does not check that the withdrawal target is nonzero.
This omission allows critical roles to be set to the zero address and funds to be sent to an address from which they can never be recovered.
Relevant Code Example:
Likelihood:
This will occur if a user, owner, or external system mistakenly or maliciously sets a critical address to zero.
It is a common source of bugs and exploits, especially in production deployments or when integrating with external systems.
Impact:
Loss of Funds: If withdraw
is called with the zero address, all ETH in the contract is sent to an address from which it can never be recovered.
Loss of Control: If the organizer or token contract is set to the zero address, critical functionality (such as pass configuration, performance creation, or token minting) is permanently disabled.
Irrecoverable State: There is no way to recover from these errors without redeploying the contract, leading to loss of user funds, trust, and operational continuity.
To reproduce this issue, copy and paste the following test code into your test file (e.g., test/contract.t.sol
). This test demonstrates that setting critical addresses to zero or withdrawing to the zero address results in loss of control or funds:
Explanation:
The contract can be deployed with a zero organizer, breaking all organizer-only functionality.
The organizer can be set to zero, disabling all future pass/performance configuration.
ETH can be withdrawn to the zero address, resulting in permanent loss of funds.
Add zero-address checks to all critical address parameters in the constructor and relevant functions. This ensures that roles and funds cannot be assigned to the zero address.
Summary:
Zero-address validation is a fundamental security and correctness requirement in Ethereum smart contracts. Failing to implement these checks can lead to catastrophic, irrecoverable failures. The recommended mitigations are simple, low-cost, and should be applied to all critical address parameters.
Owner/admin is trusted / Zero address check - Informational
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.