The MarketMakingEngine contract inherits from RootProxy and passes InitParams memory initParams to its constructor. However, the structure and contents of InitParams are not validated, leading to potential security risks, such as:
Unauthorized Execution – If InitParams allows arbitrary function calls, attackers might execute unintended transactions.
Malicious Contract Injection – If InitParams contains unverified addresses, they could point to malicious contracts that hijack execution.
Delegatecall Exploitation – If InitParams allows delegatecalls to untrusted addresses, attackers could exploit it to execute arbitrary code.
To mitigate these risks, InitParams must be validated before use.
The constructor of MarketMakingEngine.sol initializes RootProxy as follows:
However, the contents of InitParams are unknown at the contract level. If InitParams is manipulated to include:
External contract addresses (which may be malicious).
delegatecall operations (which can lead to contract takeover).
Improperly initialized storage structures (causing unexpected behavior).
This could lead to loss of control over the contract, loss of user funds, or unintended function executions.
Lack of explicit validation on InitParams before passing it to RootProxy.
Possible external dependencies (RootProxy, UpgradeBranch) that could introduce delegatecall or untrusted execution flows.
No access control checks or sanitization of InitParams.
https://github.com/Cyfrin/2025-01-zaros-part-2/blob/35deb3e92b2a32cd304bf61d27e6071ef36e446d/src/market-making/MarketMakingEngine.sol#L25
| Severity | Impact |
|---|---|
| ** Medium** | Potential contract takeover if InitParams allows delegatecalls to attacker-controlled addresses. |
| ** Medium** | Malicious contract injection if InitParams includes unverified contract addresses. |
| ** Low** | Unexpected execution paths, leading to unexpected state changes. |
Hardhat (for testing the vulnerability)
Slither (for static analysis)
Mythril (for symbolic execution)
Manual code review
Ensure you have Hardhat installed in your project. If not, run:
Create a test file inside test/MarketMakingEngine.js
a malicious contract (MaliciousInitParams.sol) that exploits the InitParams vulnerability.
test case in test/MarketMakingEngine.js to simulate an attack.
If the test fails, it means InitParams is being properly validated.
If the test passes, it means an attacker can inject malicious contracts into InitParams and execute arbitrary code.
InitParams Before Use**Modify the constructor to check for untrusted addresses before passing InitParams to RootProxy:
Ensure InitParams contracts are from trusted sources only:
delegatecall**If InitParams includes function calls, ensure they are restricted to specific functions and not arbitrary calls.
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.