How douglasmakey/poc-rust-https-sniffer works
Main Components
a) Core System Components:
• User Space Application (https-sniffer)
• Kernel Space eBPF Programs (https-sniffer-ebpf)
• Common Components (https-sniffer-common)
• Target Application (e.g., curl)
• OpenSSL Library
• Linux Kernel
b) Data Structures and Maps:
• PerCpuArray (STORAGE)
• PerfEventArray (EVENTS)
• HashMap (BUFFERS)
• Data Structure (shared between user and kernel space)
Section 1: High-Level Architecture
• Target Application | | HTTPS Sniffer |
• (e.g., curl) | | User Space App |
• v |
• OpenSSL Library |<------------+
• (SSL_read/SSL_write) | Uprobes
• v
• Linux Kernel |
• eBPF Programs | | eBPF Maps | |
• SSL Operation | | eBPF Program | | User Space App |
• 1. SSL_read |---->| 2. Uprobe | | 5. Process |
• SSL_write | | Handler | | Events |
• 4. Return |<----| 3. Uretprobe |---->| 6. Display |
• Values | | Handler | | Data |
Section 3: Map Interaction Detail
• PerCpuArray | | HashMap | | PerfEventArray |
• (STORAGE) | | (BUFFERS) | | (EVENTS) |
• Data struct | | | | Thread ID | | | | Event Data | |
• per CPU | | | | Buffer Ptr | | | | Queue | |
Important Elements to Highlight
• Uprobe attachment points (SSL_read and SSL_write)
• Data flow through eBPF maps
• Communication between user and kernel space
• Buffer management and size limitations
• Per-CPU processing paths
Additional Details
• Maximum buffer sizes (16384 bytes)
• Task communication length (16 bytes)
• CPU core handling
• Error handling paths
• Performance event processing loops
Symbol Key:
→ Data Flow Direction
⟲ Circular Buffer (PerfEventArray)
⚡ Probe Points
□ Storage Components
○ Processing Components