Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 8s
CLI Tests / test-cli (push) Successful in 10s
Contract Performance Benchmarks / benchmark-gas-usage (push) Successful in 1m22s
Contract Performance Benchmarks / benchmark-execution-time (push) Successful in 1m11s
Contract Performance Benchmarks / benchmark-throughput (push) Successful in 1m13s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Failing after 5s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 5s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Failing after 3s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 5s
Deploy to Testnet / deploy-testnet (push) Successful in 1m14s
Contract Performance Benchmarks / compare-benchmarks (push) Has been cancelled
Documentation Validation / validate-docs (push) Failing after 10s
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Node Failover Simulation / failover-test (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Smart Contract Tests / test-solidity (map[name:aitbc-contracts path:contracts]) (push) Has been cancelled
Smart Contract Tests / test-solidity (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Has been cancelled
Smart Contract Tests / test-foundry (push) Has been cancelled
Smart Contract Tests / lint-solidity (push) Has been cancelled
Smart Contract Tests / deploy-contracts (push) Has been cancelled
Documentation Validation / validate-policies-strict (push) Successful in 3s
Integration Tests / test-service-integration (push) Failing after 45s
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Failing after 2s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 5s
P2P Network Verification / p2p-verification (push) Successful in 3s
Production Tests / Production Integration Tests (push) Failing after 7s
Python Tests / test-python (push) Failing after 46s
Staking Tests / test-staking-service (push) Failing after 2s
Staking Tests / test-staking-integration (push) Has been skipped
Staking Tests / test-staking-contract (push) Has been skipped
Staking Tests / run-staking-test-runner (push) Has been skipped
Systemd Sync / sync-systemd (push) Successful in 21s
API Endpoint Tests / test-api-endpoints (push) Failing after 12m19s
- Changed pytest calls to use `venv/bin/python -m pytest` with explicit config - Added `--rootdir "$PWD"` and `--import-mode=importlib` for consistent imports - Fixed PYTHONPATH to use absolute paths with $PWD prefix - Added smart contract security scanning for Solidity files - Added Circom circuit security checks for ZK proof circuits - Added ZK proof implementation security validation - Added contracts/** to security scanning workflow
175 lines
5.6 KiB
Markdown
175 lines
5.6 KiB
Markdown
# AITBC Threat Model
|
|
|
|
This document describes the threat model for the AITBC platform, identifying potential attackers, attack vectors, and security assumptions.
|
|
|
|
## System Overview
|
|
|
|
The AITBC platform consists of:
|
|
- Blockchain node (PoA consensus)
|
|
- Smart contracts (token, staking, governance)
|
|
- ZK proof circuits (Circom)
|
|
- Coordinator API (Python/FastAPI)
|
|
- Wallet daemon
|
|
- Agent services
|
|
- Marketplace service
|
|
|
|
## Assumptions
|
|
|
|
### Trust Assumptions
|
|
- Blockchain nodes are operated by trusted entities initially
|
|
- Smart contract code is immutable after deployment
|
|
- ZK proving system is cryptographically sound
|
|
- Private keys are properly secured by users
|
|
|
|
### Security Assumptions
|
|
- TLS is used for all network communication
|
|
- Authentication tokens are properly validated
|
|
- Input validation is performed on all endpoints
|
|
- Secrets are stored securely (environment variables, secret managers)
|
|
|
|
## Attackers
|
|
|
|
### External Attackers
|
|
- **Malicious Users:** Attempt to exploit vulnerabilities for financial gain
|
|
- **Network Attackers:** Intercept or manipulate network traffic
|
|
- **Smart Contract Attackers:** Exploit contract logic or reentrancy
|
|
|
|
### Internal Threats
|
|
- **Compromised Node Operators:** Malicious behavior by node operators
|
|
- **Insider Threats:** Unauthorized access by team members
|
|
- **Supply Chain Attacks:** Compromised dependencies or build processes
|
|
|
|
## Attack Vectors
|
|
|
|
### 1. Smart Contract Vulnerabilities
|
|
|
|
#### Reentrancy
|
|
- **Description:** Attacker calls back into contract before state update
|
|
- **Impact:** Drain funds from contract
|
|
- **Mitigation:** Use checks-effects-interactions pattern, reentrancy guards
|
|
|
|
#### Arithmetic Overflow/Underflow
|
|
- **Description:** Integer arithmetic exceeds bounds
|
|
- **Impact:** Incorrect calculations, potential fund loss
|
|
- **Mitigation:** Solidity 0.8+ has built-in overflow protection
|
|
|
|
#### Access Control
|
|
- **Description:** Unauthorized function execution
|
|
- **Impact:** Privilege escalation, fund theft
|
|
- **Mitigation:** Role-based access control, proper modifier usage
|
|
|
|
#### Front-running
|
|
- **Description:** Attacker sees transaction and submits competing transaction
|
|
- **Impact:** MEV extraction, transaction manipulation
|
|
- **Mitigation:** Commit-reveal schemes, batch auctions
|
|
|
|
### 2. ZK Proof Vulnerabilities
|
|
|
|
#### Circuit Vulnerabilities
|
|
- **Description:** Flaws in Circom circuit constraints
|
|
- **Impact:** False proofs accepted, privacy broken
|
|
- **Mitigation:** Formal verification, peer review, test vectors
|
|
|
|
#### Side-Channel Attacks
|
|
- **Description:** Information leaked through timing or other side channels
|
|
- **Impact:** Private information disclosure
|
|
- **Mitigation:** Constant-time operations, proper randomness
|
|
|
|
#### Trusted Setup Compromise
|
|
- **Description:** Toxic waste leaked from trusted setup
|
|
- **Impact:** False proofs can be generated
|
|
- **Mitigation:** Multi-party computation, secure destruction of waste
|
|
|
|
### 3. API Security Vulnerabilities
|
|
|
|
#### Injection Attacks
|
|
- **Description:** SQL injection, command injection
|
|
- **Impact:** Data breach, system compromise
|
|
- **Mitigation:** Parameterized queries, input validation
|
|
|
|
#### Authentication Bypass
|
|
- **Description:** Weak or missing authentication
|
|
- **Impact:** Unauthorized access
|
|
- **Mitigation:** Strong authentication, proper token validation
|
|
|
|
#### Rate Limiting Bypass
|
|
- **Description:** Attacker overwhelms API with requests
|
|
- **Impact:** DoS, resource exhaustion
|
|
- **Mitigation:** Rate limiting, circuit breakers
|
|
|
|
### 4. Network Security
|
|
|
|
#### Man-in-the-Middle
|
|
- **Description:** Attacker intercepts and modifies traffic
|
|
- **Impact:** Data manipulation, credential theft
|
|
- **Mitigation:** TLS, certificate pinning
|
|
|
|
#### DDoS Attacks
|
|
- **Description:** Overwhelm services with traffic
|
|
- **Impact:** Service unavailability
|
|
- **Mitigation:** Rate limiting, CDN, load balancing
|
|
|
|
### 5. Economic Attack Vectors
|
|
|
|
#### Sybil Attacks
|
|
- **Description:** Attacker creates multiple fake identities
|
|
- **Impact:** Manipulate consensus, rewards
|
|
- **Mitigation:** Identity verification, staking requirements
|
|
|
|
#### Pump and Dump
|
|
- **Description:** Manipulate token price
|
|
- **Impact:** Financial loss for users
|
|
- **Mitigation:** Liquidity locks, vesting periods
|
|
|
|
#### Governance Attacks
|
|
- **Description:** Manipulate governance decisions
|
|
- **Impact:** Protocol changes for malicious purposes
|
|
- **Mitigation:** Time locks, quorum requirements, delegation limits
|
|
|
|
## Security Controls
|
|
|
|
### Preventive Controls
|
|
- Code review and testing
|
|
- Static analysis (Bandit, Slither)
|
|
- Formal verification for critical components
|
|
- Access control and authentication
|
|
- Input validation and sanitization
|
|
|
|
### Detective Controls
|
|
- Logging and monitoring
|
|
- Anomaly detection
|
|
- Security scanning in CI/CD
|
|
- Audit trails
|
|
|
|
### Responsive Controls
|
|
- Incident response plan
|
|
- Emergency pause mechanisms
|
|
- Circuit breakers
|
|
- Hotfix deployment process
|
|
|
|
## Risk Assessment
|
|
|
|
| Component | Risk Level | Primary Threats |
|
|
|-----------|------------|-----------------|
|
|
| Smart Contracts | High | Reentrancy, access control, economic attacks |
|
|
| ZK Circuits | High | Circuit vulnerabilities, trusted setup |
|
|
| Coordinator API | Medium | Injection, auth bypass, DoS |
|
|
| Blockchain Node | Medium | Network attacks, consensus manipulation |
|
|
| Wallet Daemon | High | Key theft, phishing |
|
|
| Marketplace | Medium | Oracle manipulation, front-running |
|
|
|
|
## Ongoing Monitoring
|
|
|
|
- Security scanning in CI/CD pipeline
|
|
- Dependency vulnerability scanning
|
|
- Smart contract monitoring (events, balances)
|
|
- Network traffic analysis
|
|
- Anomaly detection on API endpoints
|
|
|
|
## Related Documents
|
|
|
|
- [Security Architecture](2_security-architecture.md)
|
|
- [Security Best Practices](best-practices.md)
|
|
- [Audit Findings](audit-findings.md)
|
|
- [Economic Analysis](economic-analysis.md)
|