Security Overview
Security is paramount in Oak Network. This section covers our security model, audit processes, and best practices for secure integration.
Security Model
Zero Key Storage Policy
Oak Network never stores private keys. We leverage industry-leading security providers to ensure maximum security:
- Privy: Embedded wallet management and social authentication
- Turnkey: Enterprise-grade hardware security modules
- User Wallets: Direct blockchain interactions with user-controlled keys
Multi-Layer Security
Oak Network implements a comprehensive security model with multiple layers of protection:
Key Management Security
Privy Integration
Oak Network integrates with Privy to provide secure, user-friendly wallet management:
// Privy integration example
import { PrivyProvider } from '@privy-io/react-auth';
function OakNetworkApp() {
return (
<PrivyProvider
appId="your-privy-app-id"
config={{
embeddedWallets: {
createOnLogin: 'users-without-wallets',
requireUserPasswordOnCreate: true
},
loginMethods: ['email', 'google', 'apple'],
appearance: {
theme: 'dark',
accentColor: '#10b981'
}
}}
>
<App />
</PrivyProvider>
);
}
Privy Security Features:
- Embedded Wallets: Seamless wallet creation without seed phrases
- Social Authentication: Email, Google, Apple, and social media login
- Multi-Factor Authentication: Enhanced security for all users
- Recovery Mechanisms: Secure account recovery without private keys
- Hardware Security: Integration with device security features
Turnkey Integration
For enterprise and platform integrations, Oak Network uses Turnkey for hardware-grade security:
// Turnkey integration example
import { TurnkeyClient } from '@turnkey/turnkey-sdk';
const turnkeyClient = new TurnkeyClient({
apiBaseUrl: 'https://api.turnkey.com',
apiKey: process.env.TURNKEY_API_KEY,
privateKey: process.env.TURNKEY_PRIVATE_KEY
});
// Create secure key for platform
const keyResponse = await turnkeyClient.createKeys({
organizationId: 'your-org-id',
keyName: 'oak-platform-key',
curve: 'CURVE_SECP256K1',
addressFormats: ['ADDRESS_FORMAT_ETHEREUM']
});
Turnkey Security Features:
- Hardware Security Modules: Enterprise-grade key storage
- Multi-Signature Support: Advanced transaction signing
- Audit Trails: Complete transaction and key usage logging
- Compliance: SOC 2 Type II and other security certifications
- Zero-Knowledge Proofs: Cryptographic proofs without key exposure
Security Architecture
Access Control
Role-Based Permissions
// Protocol Admin - Highest level access
modifier onlyProtocolAdmin() {
require(msg.sender == GLOBAL_PARAMS.getProtocolAdminAddress(), "Not protocol admin");
_;
}
// Platform Admin - Platform-specific access
modifier onlyPlatformAdmin(bytes32 platformHash) {
require(msg.sender == s_platforms[platformHash].adminAddress, "Not platform admin");
_;
}
// Campaign Owner - Campaign-specific access
modifier onlyCampaignOwner() {
require(msg.sender == owner(), "Not campaign owner");
_;
}
Permission Hierarchy
- Protocol Admin: Global protocol control
- Platform Admin: Platform-specific control
- Campaign Owner: Campaign-specific control
- Public: Read-only access
Input Validation
Parameter Validation
// Comprehensive input validation
function createCampaign(
address creator,
bytes32 identifierHash,
bytes32[] calldata selectedPlatformHash,
CampaignData calldata campaignData
) external {
// Validate creator
require(creator != address(0), "Invalid creator");
// Validate identifier
require(identifierHash != bytes32(0), "Invalid identifier");
// Validate campaign data
require(campaignData.launchTime > block.timestamp, "Invalid launch time");
require(campaignData.deadline > campaignData.launchTime, "Invalid deadline");
require(campaignData.goalAmount > 0, "Invalid goal amount");
// Validate platforms
for (uint256 i = 0; i < selectedPlatformHash.length; i++) {
require(
GLOBAL_PARAMS.checkIfPlatformIsListed(selectedPlatformHash[i]),
"Platform not listed"
);
}
}
Bounds Checking
// Fee percentage bounds
uint256 public constant MAX_PLATFORM_FEE = 10; // 10% maximum
function setPlatformFee(bytes32 platformHash, uint256 feePercent) external {
require(feePercent <= MAX_PLATFORM_FEE, "Fee too high");
require(feePercent >= 0, "Fee cannot be negative");
// ...
}
Reentrancy Protection
Checks-Effects-Interactions Pattern
function contribute(address backer, uint256 amount) external {
// 1. Checks
require(amount > 0, "Invalid amount");
require(!paused(), "Contract paused");
// 2. Effects
s_pledgedAmount += amount;
s_contributions[backer] += amount;
// 3. Interactions
TOKEN.safeTransferFrom(backer, address(this), amount);
emit Contribution(backer, amount);
}
Reentrancy Guards
// Reentrancy guard for critical functions
bool private locked;
modifier noReentrancy() {
require(!locked, "Reentrancy detected");
locked = true;
_;
locked = false;
}
Audit Process
Our Commitment to Security
Oak Network takes security extremely seriously. We believe that for a decentralized crowdfunding protocol handling real funds, comprehensive security audits are not optional—they are essential. That's why we've invested in multiple professional security audits from industry-leading firms.
Professional Security Audits
Oak Network contracts have been audited by three of the most respected security firms in blockchain:
OpenZeppelin
Industry Leader in Smart Contract Security
OpenZeppelin conducted a comprehensive audit of Oak Network's smart contracts:
- Audit Date: November 2025
- Scope: All core contracts and utilities
- Focus Areas:
- Access control mechanisms
- Reentrancy protection
- Economic security
- Integration patterns
- Status: ✅ Completed - All findings addressed
Key Findings:
- Robust access control implementation
- Proper use of established security patterns
- Strong input validation throughout
- Efficient gas optimization
PeckShield
Leading Blockchain Security Firm
PeckShield performed an independent security audit:
- Audit Date: May 2025
- Scope: Full protocol security review
- Focus Areas:
- Smart contract vulnerabilities
- Economic exploits
- Upgrade mechanism security
- Cross-contract interactions
- Status: ✅ Completed - Critical issues resolved
Key Findings:
- No critical vulnerabilities
- 2 medium-severity issues (fixed)
- 5 low-severity issues (fixed)
- Strong security architecture overall
Immunefi
Bug Bounty Platform Partner
Oak Network is part of Immunefi's bug bounty program:
- Platform: Immunefi (premier Web3 bug bounty platform)
- Program Status: Active
- Rewards: Up to $50,000 for critical vulnerabilities
- Scope: All smart contracts and integrations
Reward Structure:
- Critical: Up to $50,000
- High: Up to $20,000
- Medium: Up to $5,000
- Low: None
This ongoing program allows security researchers worldwide to help us maintain the highest security standards.
Why Multiple Audits?
We believe in defense in depth:
- Different Perspectives: Each auditor brings unique expertise and perspective
- Comprehensive Coverage: Multiple audits catch different types of vulnerabilities
- Industry Standards: Aligns with best practices for DeFi protocols
- Community Confidence: Demonstrates our commitment to security
Audit Scope
Our audits covered:
- Smart Contract Security: Comprehensive code review
- Economic Security: Tokenomics and incentive analysis
- Integration Security: Cross-contract interaction analysis
- Upgrade Security: Upgrade mechanism review
- Access Control: Multi-level permission systems
- Reentrancy Protection: State management and external calls
- Input Validation: Parameter bounds and type checking
Audit Reports
- PeckShield: PeckShield Audit Report
Continuous Security
Our commitment to security doesn't end with audits:
- Ongoing Monitoring: Real-time security monitoring
- Bug Bounty: Active Immunefi program
- Regular Reviews: Periodic security assessments
- Community Input: Open source security reviews
- Rapid Response: Dedicated incident response team
Bug Bounty Program
Oak Network participates in Immunefi's bug bounty program—the leading Web3 bug bounty platform used by major DeFi protocols like Synthetix, Chainlink, and MakerDAO.
Program Details
Scope:
- All Oak Network smart contracts
- Integration security issues
- Economic exploits
- Access control vulnerabilities
- Upgradability mechanisms
- Treasury contract interactions
Rewards:
| Severity | Reward Range | Examples |
|---|---|---|
| Critical | $10,000 - $50,000 | Loss of funds, contract destruction |
| High | $5,000 - $20,000 | Permanent freezing of funds |
| Medium | $1,000 - $5,000 | Temporary freezing, access control bypass |
| Low | None |
Submission Process
- Report: Submit detailed vulnerability report through Immunefi
- Review: Oak Network security team reviews within 24 hours
- Validation: Reproduce and validate the issue
- Fix: Implement security fix
- Reward: Issue reward for valid submissions
- Disclosure: Coordinate public disclosure
Eligibility
- First valid submission of a vulnerability
- Detailed reproduction steps and impact analysis
- Responsible disclosure
- No public disclosure before Oak Network approval
How to Participate
Soon
Security Best Practices
For Developers
Smart Contract Development
// 1. Use established patterns
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// 2. Implement proper access control
modifier onlyAuthorized() {
require(authorized[msg.sender], "Not authorized");
_;
}
// 3. Validate all inputs
function updateParameter(uint256 newValue) external {
require(newValue > 0, "Invalid value");
require(newValue <= MAX_VALUE, "Value too high");
parameter = newValue;
}
// 4. Use safe math operations
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
using SafeMath for uint256;
function calculateFee(uint256 amount) public pure returns (uint256) {
return amount.mul(FEE_PERCENT).div(100);
}
Integration Security
// 1. Validate all inputs
function validateCampaignData(data) {
if (!data.creator || !ethers.utils.isAddress(data.creator)) {
throw new Error('Invalid creator address');
}
if (data.goalAmount <= 0) {
throw new Error('Invalid goal amount');
}
if (data.deadline <= data.launchTime) {
throw new Error('Invalid deadline');
}
}
// 2. Handle errors gracefully
try {
await contract.createCampaign(campaignData);
} catch (error) {
if (error.message.includes('INVALID_INPUT')) {
// Handle invalid input
} else if (error.message.includes('UNAUTHORIZED')) {
// Handle unauthorized access
} else {
// Handle unexpected errors
}
}
// 3. Implement proper error handling
class SecureIntegration {
async createCampaign(data) {
try {
this.validateInput(data);
return await this.contract.createCampaign(data);
} catch (error) {
this.logError(error);
throw new Error(`Campaign creation failed: ${error.message}`);
}
}
}
For Platform Integrators
Access Control
// 1. Secure admin keys
const adminWallet = new ethers.Wallet(process.env.ADMIN_PRIVATE_KEY);
// 2. Implement role-based access
class PlatformSecurity {
constructor(adminWallet) {
this.adminWallet = adminWallet;
this.authorizedUsers = new Set();
}
async authorizeUser(userAddress) {
// Implement authorization logic
this.authorizedUsers.add(userAddress);
}
async createCampaign(userAddress, campaignData) {
if (!this.authorizedUsers.has(userAddress)) {
throw new Error('User not authorized');
}
return await this.createCampaignInternal(campaignData);
}
}
Data Validation
// 1. Validate all platform data
function validatePlatformData(data) {
const requiredFields = ['name', 'description', 'goalAmount'];
for (const field of requiredFields) {
if (!data[field]) {
throw new Error(`Missing required field: ${field}`);
}
}
// Validate specific fields
if (data.goalAmount <= 0) {
throw new Error('Goal amount must be positive');
}
if (data.deadline <= Date.now() / 1000) {
throw new Error('Deadline must be in the future');
}
}
// 2. Sanitize user inputs
function sanitizeInput(input) {
return input
.trim()
.replace(/[<>]/g, '') // Remove potential HTML tags
.substring(0, 1000); // Limit length
}
For Users
Wallet Security
- Use Hardware Wallets: Store private keys in hardware wallets
- Secure Backup: Create secure backups of seed phrases
- Regular Updates: Keep wallet software updated
- Phishing Protection: Verify website URLs and contracts
Transaction Security
- Verify Contracts: Always verify contract addresses
- Check Gas Limits: Set appropriate gas limits
- Review Transactions: Review all transaction details
- Use Testnets: Test on testnets before mainnet
Emergency Procedures
Pause Mechanism
// Emergency pause functionality
function emergencyPause(string calldata reason) external onlyProtocolAdmin {
_pause(reason);
emit EmergencyPause(reason);
}
function emergencyUnpause(string calldata reason) external onlyProtocolAdmin {
_unpause(reason);
emit EmergencyUnpause(reason);
}
Upgrade Mechanism
// Upgradeable implementation
contract CampaignInfoFactory is Initializable, Ownable {
address public implementation;
function updateImplementation(address newImplementation) external onlyOwner {
require(newImplementation != address(0), "Invalid implementation");
implementation = newImplementation;
emit ImplementationUpdated(newImplementation);
}
}
Incident Response
Response Team
- Protocol Team: Core development team
- Security Team: Dedicated security experts
- Community Moderators: Community support team
Response Process
- Detection: Identify and assess security incident
- Containment: Implement immediate containment measures
- Investigation: Conduct thorough investigation
- Remediation: Implement fixes and improvements
- Communication: Communicate with community
- Prevention: Update security measures
Security Monitoring
On-Chain Monitoring
// Monitor for suspicious activities
class SecurityMonitor {
async monitorTransactions() {
const filter = contract.filters.Contribution();
const events = await contract.queryFilter(filter);
for (const event of events) {
await this.analyzeContribution(event);
}
}
async analyzeContribution(event) {
const { contributor, amount } = event.args;
// Check for unusual patterns
if (amount.gt(ethers.utils.parseEther('100000'))) {
await this.alertLargeContribution(contributor, amount);
}
// Check for rapid contributions
const recentContributions = await this.getRecentContributions(contributor);
if (recentContributions.length > 10) {
await this.alertRapidContributions(contributor);
}
}
}
Off-Chain Monitoring
- Transaction Monitoring: Monitor all protocol transactions
- Anomaly Detection: Detect unusual patterns and behaviors
- Community Reports: Process security reports from community
- Regular Audits: Conduct regular security assessments
Security Resources
Documentation
Tools
Community
Next Steps
- Audit Reports - Review security audits
- Best Practices - Security guidelines
- Bug Bounty - Participate in bug bounty
- Incident Response - Emergency procedures