Skip to content

Latest commit

 

History

History
228 lines (180 loc) · 6.33 KB

File metadata and controls

228 lines (180 loc) · 6.33 KB

🛡️ eBPF + Rust Security Monitoring Engine: Educational Project Specification v1.0

⚠️ IMPORTANT NOTICE

This specification describes an educational security monitoring system with:

  • ✅ IMPLEMENTED: Core eBPF kernel programming (3,200+ lines) and rule-based threat detection
  • 📋 CONCEPTUAL: Advanced enterprise features are theoretical designs for educational purposes
  • 🎯 PURPOSE: Demonstrating kernel programming expertise and security architecture concepts

🎯 Project Positioning

Build an educational security monitoring system with eBPF + Rust as the core, combined with rule-based threat detection capabilities, featuring:

  • Real-time behavior monitoring
  • Security event detection
  • Rule-based threat classification
  • Educational value for systems programming
  • Good architecture demonstration

📦 System Components

1. kernel_agent - ✅ IMPLEMENTED: eBPF Kernel Probe Module

Used to capture critical kernel-level behavior events and output them to userspace daemon through ringbuffer.

Features:

  • Network connection event collection (TCP/UDP)
  • File operation event collection (open/read/write/unlink)
  • Process behavior collection (execve/fork/ptrace)
  • All data structures are simple C structs, compatible with libbpf

Output Format:

struct event_net_conn {
  u64 timestamp;
  u32 pid;
  u32 uid;
  char comm[16];
  u32 saddr;
  u32 daddr;
  u16 sport;
  u16 dport;
};

2. user_agent - ✅ IMPLEMENTED: Rust Daemon Process

Responsible for loading eBPF programs, monitoring event ringbuffer, and executing rule-based threat analysis.

Submodule Breakdown:

  • ebpf_loader.rs: Load/manage eBPF programs
  • event_parser.rs: Event deserialization to Rust structs
  • rule_engine.rs: Rule-based threat detection using heuristics
  • response.rs: Security response module (alert, log, simulate blocking)
  • config.rs: Configuration management

Features:

  • Integration with libbpf-rs for eBPF loading
  • Rule-based threat classification using predefined patterns
  • Local event correlation and pattern matching
  • Threat detection triggers event output in JSON format

3. threat_detection - ✅ IMPLEMENTED: Rule-based Classification Module

Uses heuristic rules and pattern matching for threat detection, demonstrating security analysis concepts.

Input Format:

{
  "event_type": "net_conn",
  "pid": 1234,
  "process": "curl",
  "target_ip": "8.8.8.8",
  "target_port": 443,
  "timestamp": 172847183
}

Output Format:

{
  "label": "Suspicious Network Activity",
  "risk_score": 0.7,
  "detection_method": "rule_based",
  "recommendation": "monitor_process"
}

Detection Methods:

  • Heuristic pattern matching
  • File path analysis
  • Process behavior analysis
  • Network connection patterns

4. web_ui (📋 CONCEPTUAL) - Demo Dashboard

Educational dashboard for viewing behavior events, rule-based classification results, and system metrics.

Recommended Tech Stack:

  • Simple HTML/CSS/JavaScript
  • WebSocket for real-time event streaming
  • Educational purpose only

🔌 Threat Detection Interface Specification

// Rule-based threat classification
pub fn classify_threat(event: &SecurityEvent) -> ThreatAnalysis {
    let mut risk_score = 0.0;
    
    // File path analysis
    if event.file_path.contains("/tmp/") {
        risk_score += 0.3;
    }
    
    // Process analysis
    if event.process_name.contains("sh") {
        risk_score += 0.4;
    }
    
    ThreatAnalysis {
        risk_score,
        method: "rule_based".to_string(),
        confidence: 0.8,
    }
}

🛠️ Build Compatibility

Platform Status Description
Linux x86_64 ✅ Supported Ubuntu 20+ / Debian / Arch
Linux ARM64 ✅ Supported For IoT/edge devices
Windows ⛔ Not Supported eBPF not available
macOS ⛔ Not Supported eBPF doesn't support kernel hooks

🧪 Testing Plan

  • Unit testing (Rust)
  • Integration testing with simulated events
  • Rule validation testing
  • Performance benchmarking (educational metrics)

🔮 📋 CONCEPTUAL: Future Learning Extensions

  • 🔗 Integration examples with SIEM systems
  • 🔐 Plugin mechanism demonstration
  • 📊 Advanced analytics examples (as learning exercise)
  • 🌐 Multi-node deployment examples

📋 Technical Architecture Overview

IMPLEMENTED: Core Data Flow

[Kernel Space]           [User Space]            [Rule Engine]
    eBPF        Ring       Rust         Rule      Pattern
   Programs  → Buffer →   Daemon    →  Engine  →  Matching
     ↓                      ↓                        ↓
  Syscalls              Event          Rule        Threat
   Events               Parser       Evaluation   Classification

IMPLEMENTED: Event Processing Pipeline

  1. Collection: eBPF hooks capture system events
  2. Transmission: Ring buffer transfers data to userspace
  3. Parsing: Rust daemon deserializes and filters events
  4. Analysis: Rule engine classifies behavior patterns
  5. Response: Automated actions based on threat scores

IMPLEMENTED: Security Monitoring Capabilities

  • Process Monitoring: Process creation, execution, termination
  • File System Monitoring: File access, modification, deletion
  • Network Monitoring: Connection establishment, data transfer
  • System Call Monitoring: Privileged operations, anomalous calls

🔧 Configuration Management

IMPLEMENTED: Runtime Configuration

[monitoring]
enable_process = true
enable_network = true
enable_filesystem = true

[threat_detection]
provider = "rule_engine"
enable_heuristics = true
confidence_threshold = 0.6

[response]
enable_alerts = true
alert_webhook = "https://example.com/webhook"
log_level = "info"

IMPLEMENTED: Rule Engine Configuration

{
  "rules": [
    {
      "name": "suspicious_temp_execution",
      "condition": "process.path.contains('/tmp/')",
      "risk_score": 0.7,
      "action": "alert"
    }
  ]
}

This specification demonstrates advanced eBPF kernel programming combined with rule-based threat detection while maintaining clear educational value and honest technical positioning.