> For the complete documentation index, see [llms.txt](https://funarchy.gitbook.io/funarchy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://funarchy.gitbook.io/funarchy/security-for-prediction-market/operation/owners-privilege-too-high.md).

# Owner's Privilege too High

#### **Description**

Most prediction market protocols maintain modifier functions with `onlyOwner` or `onlyAdmin` controls for initial operational efficiency and emergency stop. However, if this authority is excessively concentrated in the hands of a single EOA or a small umber of administrators, the key becomes a single point of failure(SPOF) that compromises the security of the entire system.

When administrators have unlimited power to freeze protocol assets, arbitrarily overturn market outcomes, or upgrade smart contract code, the very premise of a "decentralized protocol" collapses, exposing users to the risk of having to rely solely on the operator's morality.

#### **Attack Vectors**

* Arbitrary Market Resolution : Independent of the actual event outcome, an administrator uses privileged access to call `resolveMarket()` and forcefully settles specific user.
* Emergency Withdrawal Abuse : By abusing the `emergencyWithdraw()` function under the pretext of "security incident preparation", all collateral assets deposited in the contract are transferred to the administrator's wallet.
* Malicious Upgrades : When using the Proxy pattern, the implementation contract is replaced with an contract containing malicious code to secretly install a backdoor or steal funds from the user.
* Fee Manipulation : By abruptly changing the protocol fee rate from 0% to 100%, all funds are taken as fees when users realize profits.

#### **Scenario**

**Scenario A - Private Key Compromise**

* The development team leader's laptop was infected with malware, leaking the private key of the wallet with owner privileges to the hacker. The hacker immediately called the `paused()` function to block user withdrawals, then executed `setFeeTo(hackerAddress)` and `setFee(100%)` to transfer liquidity within the protocol to his own wallet.

**Scenario B - Insider Threat**

* Due to internal conflict within the project, a disgruntled core developer abuses their `onlyOwner` privileges to forcibly resolve an ongoing, high-value prediction market in favor of the opposite position. This resulted in the loss of legitimate winners and allowed an attacker in collusion with the developers to reap unfair benefits.

#### **Mitigation**

(1) Decentralization of Control

* Set up a non-EOA multi-signature wallet (e.g. Gnosis Safe) as money.
* For example, "Execute if 3 out of 5 people agree" decentralizes signing authority to entities with different ineterests, such as development team, an external security audit firm, and community representatives.

(2) Time-lock Mechanism

* Forces important admin functions(upgrades, fee changes, etc.) to be run through `TimelockController`.
* A minimum waiting period of 24-48 hours is required between the transaction proposal and its actual execution, ensuring that uers have time to exit ehir funds if malicious changes are detected.

(3) Scope Limitation

* Segment roles to prevent onlyOwner from becoming a 'Super Admin' who can do everything.
  * `Pauser` : Only pause is possible, no withdrawals are possible.
  * `Resolver` : Only market settlement is possible, no fund transfer.
  * `emergencyWithdraw` : The feature prevents operators from embezzling funds into their personal wallets by restricting the code to only send them to a pre-hardcoded 'Multisig Treasury' or 'Burn Address'


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://funarchy.gitbook.io/funarchy/security-for-prediction-market/operation/owners-privilege-too-high.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
