> For the complete documentation index, see [llms.txt](https://onex-3.gitbook.io/onex-document/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onex-3.gitbook.io/onex-document/security.md).

# Security

## 14.1 Security Philosophy

ONEx operates on the principle that security must prevent loss before it occurs. Every layer is designed with adversarial conditions in mind — including adversaries with quantum computers.

Security is not a feature. It is the foundation.

## 14.2 Pre-Transaction Security Engine (6 Layers)

| Layer                  | Protection                        | What It Catches                                     |
| ---------------------- | --------------------------------- | --------------------------------------------------- |
| 1. Contract Screening  | Known malicious contract database | Rugpulls, exploit contracts, phishing deployments   |
| 2. Full Simulation     | Sandboxed transaction execution   | Unexpected token movements, hidden approvals        |
| 3. Phishing Detection  | AI pattern analysis               | Fake DEX frontends, social engineering transactions |
| 4. Approval Analysis   | Permission audit                  | Unlimited approvals, suspicious permission patterns |
| 5. MEV Risk Scoring    | Sandwich attack probability       | Front-running risk, estimated extractable value     |
| 6. Sanctions Screening | OFAC/EU/UN real-time check        | Blacklisted addresses, sanctioned entities          |

## 14.3 Post-Quantum Security Layer

| Algorithm          | Role                             | Standard               |
| ------------------ | -------------------------------- | ---------------------- |
| CRYSTALS-Kyber     | Key encapsulation / key exchange | NIST FIPS 203 (2024)   |
| CRYSTALS-Dilithium | Digital signatures               | NIST FIPS 204 (2024)   |
| SHA-3 / BLAKE3     | Hash functions                   | Quantum-resistant      |
| SPHINCS+           | Stateless hash-based signatures  | NIST FIPS 205 (backup) |

**Hybrid approach:** Both classical (ECDSA/ECDH) and post-quantum algorithms are required. The system remains secure even if either algorithm is broken.

**Key refresh:** MPC shares are refreshed every 30 days. Old shares become mathematically invalid — even if an attacker captured a share, it expires before they can use it.

## 14.4 Smart Contract Security Standards

* Two independent external audits (Certik, Trail of Bits, OpenZeppelin, Consensys Diligence)
* Formal verification using Certora Prover and K Framework for critical invariants
* $1,000,000+ maximum bug bounty reward (Immunefi platform)
* 48-hour minimum timelock between deployment and activation
* Multi-sig governance for upgrades: M-of-N core team + timelock
* ERC-4337 specific audit: paymaster contracts, bundler interaction, session key bounds
* Third-party audit specifically for PQC hybrid signature scheme

## 14.5 AI Phishing & Social Engineering Defense

| Attack Vector                      | AI Defense                                                              |
| ---------------------------------- | ----------------------------------------------------------------------- |
| Fake website (pixel-perfect clone) | Domain verification + certificate pinning + visual AI comparison        |
| Malicious QR code                  | QR content analysis before camera permission granted                    |
| Social engineering call            | Voice analysis for known social engineering patterns                    |
| Deepfake video KYC bypass          | 3D liveness detection + neural deepfake classifier                      |
| Clipboard hijacking                | Clipboard content validation before any copy-paste into address field   |
| Fake support agent                 | All ONEx support communication is in-app only — never external channels |
