The Auction contract enables users to purchase ZENO tokens in exchange for USDC through its buy function. This function, after processing the bid, calls the mint function in the ZENO contract to mint tokens for the buyer. However, the ZENO contract’s mint function is restricted by an onlyOwner modifier, meaning that only its owner can mint tokens. According to the intended design and NatSpec comments, the Auction contract should be the owner of the ZENO contract so that it can mint tokens during the auction. In the current deployment, however, the ZENO contract is deployed with an external owner (ZENO_OWNER), and ownership is not transferred to the Auction contract. Consequently, when the Auction contract attempts to mint tokens, the call reverts due to an ownership check, rendering the auction inoperable and causing a denial of service (DoS) for token purchases.
Auction::buy Functionality:
The buy function in the Auction contract processes a purchase by deducting USDC, updating bid information, and then calling:
This call is intended to mint new ZENO tokens for the buyer.
ZENO::mint Function Restrictions:
The mint function in the ZENO contract is defined as:
The onlyOwner modifier restricts minting to the current owner of the ZENO contract. The NatSpec clearly indicates that only the associated auction (i.e., the Auction contract) should be allowed to mint tokens.
Ownership Mismatch:
In the deployed system, the ZENO contract is owned by ZENO_OWNER rather than the Auction contract. As a result, when the Auction contract (which is not the owner) calls zeno.mint, the call fails with an "OwnableUnauthorizedAccount" error, leading to a denial of service in the auction process.
Deployment Expectations:
The intended functionality is that the Auction contract should control token minting either by:
Having the Auction contract deploy the ZENO contract so that it is the owner from inception, or
Transferring ownership of the ZENO contract to the Auction contract immediately after deployment.
Current State:
Since neither of these steps is performed, the Auction contract cannot mint tokens, making both the Auction and ZENO contracts unusable until the ownership issue is resolved.
Auction Execution Attempt:
The Auction contract processes a purchase request via its buy function.
It attempts to mint ZENO tokens by calling zeno.mint(msg.sender, amount).
This call reverts due to the onlyOwner restriction in the ZENO contract because the Auction contract is not the owner.
Test Suite Demonstration:
Create a Foundry Project:
Place Contracts:
Ensure that Auction, ZENO, USDCMock, BusinessMock, and other related contracts are in the src directory.
Create Test Directory:
Create a test directory adjacent to src and add the test file (e.g., ZenoAuction.t.sol).
Run the Test:
Expected Outcome:
The test should revert with an "OwnableUnauthorizedAccount" error, confirming that the Auction contract is not authorized to mint ZENO tokens due to the ownership mismatch.
Auction Denial of Service:
The Auction contract is unable to mint new ZENO tokens because it is not the owner of the ZENO contract, causing all purchase transactions to revert.
Operational Breakdown:
Without the ability to mint tokens, the auction mechanism fails, preventing the sale of ZENO tokens and disrupting the protocol's revenue generation.
Economic Disruption:
The inability to complete auctions can lead to market instability, loss of participant trust, and a potential decline in token value.
Governance and Trust Erosion:
Persistent auction failures undermine confidence in the protocol, negatively impacting governance participation and overall stakeholder engagement.
Manual Review
Foundry
To resolve this critical vulnerability, it is essential to ensure that the Auction contract is authorized to mint ZENO tokens. We recommend the following corrective actions:
modify the system design so that the Auction contract deploys the ZENO contract. This ensures that the Auction contract is the owner from the outset.
Ownership Integrity:
By deploying the ZENO contract within the Auction constructor, the Auction contract immediately becomes the owner of ZENO. This resolves the critical ownership mismatch that previously prevented the Auction from minting tokens, ensuring that only authorized functions (i.e., token minting) are callable by the Auction contract.
Robust Input Validations:
The updated constructor validates that the USDC address is non-zero and that the maturity date is set to a future timestamp. This prevents invalid contract initialization and avoids potential runtime failures during auction operations.
Improved Dependency Management:
Internally deploying the ZENO contract makes the Auction contract self-contained and reduces dependency on external deployments. This encapsulation simplifies integration and ensures that the Auction contract always interacts with a correctly configured ZENO instance.
Enhanced Security:
Ensuring the Auction contract is the owner of the ZENO token limits the risk of unauthorized minting and helps enforce the intended minting logic. This reduces the attack surface and enhances the overall security of the auction process.
Simplified Deployment Process:
With the ZENO contract deployed by the Auction contract, deployment scripts become simpler. There is no need for a separate ownership transfer step, reducing the risk of human error and streamlining the deployment workflow.
Consistent Protocol Behavior:
The integrated approach guarantees that all auction-related token minting, pricing, and distribution functions operate under the same ownership context, ensuring predictable and consistent protocol behavior.
Factories Elimination:
Currently there're two factories one for Auctions creation and one for ZENO creation. By implementing this approach, ZENO factory logic would not be required anymore.
Alternatively, After deploying the ZENO contract, immediately transfer its ownership to the Auction contract so that it can call the mint function.
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.