The host sensor
vulnboxd-sensor watches what your services' processes do, from the kernel: every program a request starts, the files it opens, reads, writes and deletes, the connections it makes and the ports it opens, crashes, attempts to tamper with other processes or to get out of the container, and the probes of runtime hooks. It hands all of it to the agent, which sends it to the hub with the capture, where it is joined to the requests that caused it.
It is optional, and it only watches:
- Read-only. It never blocks, kills or changes anything — no LSM programs, no signals, no writes to any process. An RCE in a service is still yours to find and fix; the sensor shows you what it did.
- Its own service. When it is off, or has died, the services, the proxy, the capture and the agent behave exactly as before. Nothing waits for it, and it waits for nothing: when the agent is slow or away, events are dropped and counted, never queued without bound.
- Only the services. The eBPF programs filter in the kernel on the cgroups of your services' containers. The rest of the box — your own shells, the gameserver's checker, vulnboxd — is never recorded, and pays one hash lookup per watched syscall.
What it records
| Event | From | What you see |
|---|---|---|
| Processes | sched_process_exec/fork/exit | every exec with its full path (inside the container), arguments, working directory and parent; forks and threads; exits with the status or the signal, and whether it dumped core. An exec of a memfd (fileless execution) is marked. |
| File writes | openat (write flags), write (counted), rename, unlink, truncate, chmod, link, symlink, memfd_create | webshells written, files made executable, flags or databases deleted or overwritten |
| File reads | openat, read, recvfrom, recvmsg (counted); sendfile, splice, tee, copy_file_range and vmsplice count as a read of one descriptor and a write of the other | which request read the flag store, /proc/self/environ, keys — also when the bytes went straight from the file onto a socket without a read |
| Directory listings | getdents64 (counted: the calls, not the entries they return; one listing is usually two calls, the last one reaching the end) | path traversal and enumeration |
| Connections | connect, accept, bind, listen, sendto/sendmsg on UDP; on a TCP connection the process made, the first write of each burst | reverse shells, egress, new listeners (bind shells), the name asked for in every DNS query sent over UDP, and which thread sent each request over a pooled connection (below) |
| Socket onto stdio | dup2/dup3 of a socket onto 0–2, and which fds are sockets at the next exec | the reverse shell, both halves |
| Crashes | signal_deliver (SIGSEGV, SIGBUS, SIGILL, SIGABRT, SIGFPE, SIGSYS), the exit status, oom:mark_victim | a request that crashed the service: a memory-corruption attempt or a DoS |
| Tampering | ptrace, process_vm_readv/writev, kill/tgkill/pidfd_send_signal aimed at another process | debugging or reading the service's memory, killing it |
| Escapes | setuid/setgid and friends, capset, unshare, setns, mount, bpf, init_module/finit_module, pivot_root, chroot | privilege escalation and container escape attempts, failed ones included |
| Executable memory | mmap and mprotect making anonymous memory executable | shellcode. Skipped for processes that run a JIT (node, java, dotnet, …; sensor.jit) from a file that came with the container: its change time is before the container's cgroup was made. A binary a request wrote (or overwrote) and named node, or a memfd, is never exempt. |
| Seccomp | force_sig_seccomp, audit_seccomp | a seccomp filter trapping or killing a syscall, and what audit logs |
| Runtime hooks | USDT probes | request boundaries and the context of spawns, connections and opens, from hooks |
| Go services, no change | uprobes on Go's own functions (G1) | the same, for Go services nobody changed: net/http (HTTP/1, HTTP/2), gRPC, fasthttp, fiber |
| TLS plaintext | uprobes on SSL_read/SSL_write (OpenSSL, BoringSSL, LibreSSL), gnutls_record_recv/send and Go's crypto/tls | the services' own TLS reads and writes, joined to their connections: by default how much went which way; with sensor.tls_payload_bytes, the first bytes of the plaintext too |
32-bit syscalls. A 64-bit process can still make syscalls through the 32-bit entry (int 0x80), and a 32-bit binary makes all of its own there. The kernel numbers those by the 32-bit table — where 3 is read (64-bit close) and 5 is open (64-bit fstat) — and passes the arguments in other registers. The sensor tells them apart (x86's TS_COMPAT), translates the number, reads the arguments the way that entry passes them (32-bit pointers, socketcall's array of socket-call arguments, the 32-bit msghdr), and records them as what they are; vulnboxd_sensor_compat_syscalls_total counts them. x86-64 only: the x32 ABI (rarely built in) and 32-bit ARM tasks on aarch64 are not covered.
File events are metadata only: paths, flags, byte counts — never contents. A file can be pulled from the container afterwards from the hub.
Repetitive events are rolled up: the first time a process does something to an object (opens a file, connects to an address) it is sent in full; after that, one event per second stands for all the repeats, with how many there were and when the last was. Reads and writes are counted per file descriptor and reported the same way.
Every event names the process (pid, thread, parent, user, comm, executable), the container and the service, and — when the thread or process holds exactly one accepted connection at that moment — that connection, which is how the hub ties an event to the request that caused it.
Pooled connections
A runtime that pools its database connections sends the queries of many requests over one connection, often opened before any of them; the capture decodes every query on it but cannot say which request it was for. So on every TCP connection a watched process made with connect, the sensor records the first write of each burst — a write after the socket read something, or after 50 ms without writing — as a net event with op write: the connection, the thread, the bytes of that write, and when. Writes in between are only counted. That is one event per query and answer, held to the service's rate limit like every other record, and never rolled up. The hub ties each burst to the request whose runtime hook context was active on that thread (or whose connection the thread was serving), and each decoded query to the burst that sent it (the request story). Connections opened before the sensor started are not followed this way, and with disable: [io] neither are any.
TLS plaintext
When a service talks TLS — to an internal API, a database, another team — the capture only sees ciphertext. The sensor attaches to the TLS libraries the watched processes map and records each read and write of plaintext:
- OpenSSL (and BoringSSL, LibreSSL, which share the API):
SSL_read,SSL_write,SSL_read_ex,SSL_write_ex, inlibsslor statically linked into a binary that keeps those symbols. - GnuTLS:
gnutls_record_recv,gnutls_record_send. - Go:
crypto/tls.(*Conn).ReadandWrite, in any Go binary, stripped or not (Go 1.17–1.26).
Each event says the direction, the library, the plaintext byte count and the connection (local and remote address, socket cookie) — for OpenSSL and GnuTLS through the descriptor the library used (from SSL_set_fd, or the read/write the call made on the same thread), for Go from the connection itself. Repeats are rolled up like every other event.
Metadata only by default. With sensor.tls_payload_bytes: N (up to 1023) each event also carries the first N bytes of the plaintext, base64 in the JSON. That is opt-in because of volume and because it can hold secrets (the services' own credentials to their databases, for instance); events with a payload are not rolled up, so a per-process limit (sensor.tls_rate_limit, 1000 a second by default) bounds them. sensor.tls: false switches the feature off.
In the hub. TLS events are kind tls (read or write), counted with network events on the Activity screen. Each names the library, the connection and the descriptor; with payload capture on, its Plaintext button (in the event list, and in a request's story, on the event's detail) shows the captured bytes as text or as a hex dump, marked "truncated" when the read or write was longer. The plaintext is shown as captured, credentials included.
Tested in a QEMU VM (crates/sensor-go/tests/vm/run.sh): a Python ssl (OpenSSL 3.5) server and client, gnutls-cli, and a Go HTTP/2-over-TLS server each produce read and write events with the plaintext (payload capture on) and, for OpenSSL and Go, the connection they went over.
Limits: libraries that move the ciphertext through a memory BIO the application drives itself (Node, some curl builds) are recorded without a connection, since the library never touches a socket during the call; a TLS library a process loads late is attached at the next scan of its mappings (every two seconds), so its very first calls can be missed; rustls and Java's JSSE are not covered. It needs the usdt group (it runs with the Go support's eBPF object).
Turn it on
Check the kernel: the sensor needs Linux 5.8 or newer with BTF, which every current distribution kernel has:
shuname -r # 5.8 or newer ls /sys/kernel/btf/vmlinux # BTF is thereAdd the
sensorsection to/etc/vulnboxd/config.yml:yamlsensor: enabled: trueThe agent has to be on too, with
agent.sensor(on by default): the sensor sends its events to the agent's socket,<state_dir>/sensor.sock.Install and start it:
shsudo vulnboxctl installWith
sensor.enabledset,vulnboxctl installwrites/etc/systemd/system/vulnboxd-sensor.serviceand enables and starts it.
Then check it:
systemctl status vulnboxd-sensor
journalctl -fu vulnboxd-sensor # "attached 140 hooks", "watching …" per container
curl -s 127.0.0.1:9333/metrics | grep vulnboxd_sensor_To see what it records without an agent, run it by hand and print the events:
sudo vulnboxd-sensor --stdout --force # JSON lines on stdoutvulnboxd-sensor listen does the agent's part instead: it listens on the socket and prints what a running sensor sends.
Which containers
The sensor watches the containers in vulnboxd's inventory (<state_dir>/inventory.json), which names each container's cgroup. When vulnboxd is not running, it asks docker for the containers of the compose projects under services_dir itself. Sub-cgroups of a container are watched with it. sensor.cgroups adds cgroups of your own, such as a service that does not run in docker.
Privileges and the kernel
It runs as root: loading eBPF programs needs CAP_BPF and CAP_PERFMON (or CAP_SYS_ADMIN on older kernels), and reading other processes' /proc entries needs the rest. It uses only tracepoints, a few kprobes (security_file_mprotect, force_sig_seccomp, audit_seccomp), a BTF tracepoint (inet_sock_set_state, to give sockets a cookie) and uprobes for USDT; nothing it attaches can change what a process does. One exception, writing a single counter: in a binary whose .probes section shares a file page with the read-only-after-relocation data (lld without -z separate-loadable-segments can link it so), the kernel cannot switch the probes on in a process started after the sensor attached, so the sensor raises the probe's semaphore in that process's own writable mapping itself, from 0 to 1 only (vulnboxd_sensor_usdt_semaphores_raised_total); detaching lowers it again.
Files a process has mapped (its executable, libraries with probes) are opened as mapped, through /proc/<pid>/map_files, or else inside the container's root without following links, never by a path the container controls; FIFOs, devices and files that are not what the process mapped are refused (vulnboxd_sensor_usdt_files_refused_total). Only their ELF headers and probe notes are read, on a thread of their own, so a hostile mapping can neither stall the sensor nor mislead it.
Everything in those files is the attacker's to craft, so reading them is bounded and cannot take the sensor down:
- at most 64 MiB is read from any file's headers, section and symbol tables and notes, and a section that claims more is refused before anything is allocated (a sparse file of gigabytes costs its owner nothing);
- only Go binaries are read whole (for G1 and G2's probes), and only up to 192 MiB; a larger one keeps its ELF probes but is left out of G1 and G2 (counted in
vulnboxd_sensor_usdt_files_refused_total); their compressed DWARF is decompressed up to 128 MiB; - every length, pointer and count in a Go binary's
.go.buildinfoand.gopclntabis checked; - a panic while reading a file anyway leaves that file out (it is not read again) and the scanner carries on with the next; a panic anywhere else in the scanner ends only the request it was working on. Each panic reaches the hub as a
lostevent (op: scanner) of the service whose file it was, and so as a Sensor blinded alert.
Kernel struct offsets are read from the running kernel's BTF when the sensor starts, so one build works on every kernel from 5.8 on. A program the kernel refuses (a kprobe on a function this kernel does not have, a helper it is too old for) is logged, counted in vulnboxd_sensor_attach_failures_total{program}, and left out; the rest carry on. Only the process programs are required.
Overhead
Measured in a 2-vCPU KVM guest on a 7.2 kernel (the test prints these with BENCH=1):
- Unwatched processes (the proxy, the agent, your shells): no difference within the VM's noise. Syscalls go through two raw tracepoints whose first step is an array lookup by syscall number (and a second one in the 32-bit table for a number the native table does not hook), and a hash lookup of the cgroup for the hooked ones.
- Watched processes, worst case: a loop of
open+read+close+getppidon tmpfs went from about 5.0 µs to 8.4 µs a round, so roughly 0.9 µs per hooked syscall, while every one of them is recorded (the opens with their full path) or counted. A service doing a few thousand syscalls a second pays a few milliseconds of CPU a second. - Per event in the kernel: an exec about 9 µs (it walks the executable's and the working directory's paths and reads the arguments), a fork 2–4 µs, an exit 3–5 µs, a signal or an executable-memory check under 1 µs.
vulnboxd_sensor_program_run_seconds_totaldivided by…_runs_totalgives each program's cost on your box (the syscall handlers count under the two dispatch programs). - In userspace: about 5 µs per record, including the roll-up.
Memory is bounded: the ring buffer (8 MiB by default), fixed-size maps (about 10 MiB), and the roll-up and process tables (bounded by sensor.max_rollup_keys and a process limit). The unit caps the service at 512 MiB and gives it half the CPU weight of anything else.
A syscall's record waits in a table (8192 entries) from its entry to its exit, where its result is filled in. A thread blocked in a hooked syscall (accept, connect, an open of a FIFO) holds its entry until it returns, so each watched cgroup may hold at most 1024 of them: threads blocked in one container cannot fill the table for the others. What does not fit is not recorded, and is reported as a lost event of that service (op: pending_full).
When events come faster than they can be read, the ring buffer drops them and counts them (vulnboxd_sensor_kernel_dropped_total), and the agent hears how many as a lost event. Each container is held to sensor.rate_limit events a second (process starts and exits aside), so one noisy service cannot crowd out the others. The limit applies to three budgets of its own: syscall records, connects, and hook probes, so a flood of file opens cannot erase a hook's request boundaries. What it holds back reaches the hub as a lost event of that service (op: rate_limited), shown in the service's host activity.
When the sensor is blinded
What the sensor could not record still reaches the hub, as lost events with how many and the time range, and from there as Sensor blinded alerts:
op | What happened |
|---|---|
sensor | the ring buffer was full (vulnboxd_sensor_kernel_dropped_total) |
agent | the agent could not take the events fast enough |
rate_limited | a service went over sensor.rate_limit (its own event, with the service) |
pending_full | a service had too many threads inside hooked syscalls at once (its share of the in-flight table) |
scanner | the scanner that attaches runtime hooks, G1 and TLS plaintext panicked on a file (left out) or stopped: hooks in that file are not seen |
probe_limit | probe sites were left unattached at a limit: more than 512 in one file, the attach budget in all (8192, less with a low open-file limit), the probe registry, or out of file descriptors; count is the probe sites, with the process whose file it was |
The capture's own gaps and decoders that gave up on a connection are alerted on the same way.
Blind spots
What the sensor does not see, so you know where to look instead:
- io_uring. A process that reads, writes, opens or connects through io_uring submits that work without the syscalls the sensor hooks; the kernel's workers do it. Its files and connections are not recorded (the capture still has the traffic). The sensor does not hook the security layer, which would cover it.
- Other syscall ABIs: x32, and 32-bit ARM tasks on aarch64 (see 32-bit syscalls above).
- Connections opened before the sensor started: their write bursts are not recorded.
- Statically linked or unusual TLS libraries and memory-BIO TLS (see TLS plaintext).
Turning it off
sudo systemctl disable --now vulnboxd-sensorand set sensor.enabled: false so the next vulnboxctl install does not start it again. Stopping it detaches every program; nothing is left in the kernel. Parts can be left off instead with sensor.disable: disable: [io, exec_memory] keeps everything but the read/write counters and the executable-memory events.
Building it
Release builds carry the eBPF programs inside the binary. They live in crates/sensor-ebpf, built for the bpfel-unknown-none target with a pinned nightly and bpf-linker, so a plain cargo build of vulnboxd needs neither and the sensor then loads the object from sensor.object (or /usr/local/lib/vulnboxd/vulnboxd-sensor.bpf.o). To build with them:
cargo install bpf-linker --version 0.12.0 --locked --no-default-features --features llvm-22
cargo build --release -p vulnboxd --features sensor-ebpf # embeds the object
crates/sensor-ebpf/build.sh /usr/local/lib/vulnboxd/vulnboxd-sensor.bpf.o # or just the objectbpf-linker has to be built against an LLVM at least as new as the nightly's (22 for the pinned one; --features llvm-22 uses the system's LLVM 22).
Testing it
crates/sensor/tests/vm/run.sh boots the running kernel in a QEMU VM with virtme-ng, so nothing is loaded into your own kernel, and runs the real sensor there against a workload in a cgroup of its own — files written, read, renamed and deleted, a connection, a bind shell, a reverse shell, a segfault, an abort, ptrace, executable memory, setuid, a mount, a DNS query, a memfd exec, a seccomp trap and USDT probes — and the same harmless part outside it, which must not show up. It also runs hostile mappings (files replaced by a FIFO or a /dev/zero link, deleted binaries), a spawn inside a pid namespace, two sockets on one local port, a syscall flood against the rate limit, an lld-linked process started after the sensor attached, syscalls through int 0x80 (open, write, read, rename, unlink, socketcall and connect), a file sent with sendfile and splice, 1100 threads blocked in accept (past their cgroup's share of the in-flight table, while another cgroup's open is still recorded), a binary with a crafted .go.buildinfo and a 300 MB sparse one, and one connection shared by two requests the way a pool shares it (each query's burst on the thread and inside the hook context of the request that sent it). It checks the events that arrive on the agent's socket and prints a sample of each and the per-program costs; BENCH=1 also runs the benchmark above.
pip install virtme-ng
crates/sensor/tests/vm/run.sh # results in target/sensor-vm/results.txtTroubleshooting
the kernel's BTF has no …orthis kernel has no BTF: the kernel is older than the sensor supports or was built withoutCONFIG_DEBUG_INFO_BTF.vulnboxd_sensor_cgroupsis 0: the inventory has no containers yet and docker named none underservices_dir.journalctl -u vulnboxd-sensorsays which cgroups it watches.vulnboxd_sensor_agent_connectedis 0: the agent is not running,agent.sensoris off, or the socket paths differ (sensor.socketandagent.sensor_socket).vulnboxd_sensor_kernel_dropped_totalclimbing: raisesensor.ring_buffer, or leave the counters off withdisable: [io].- Hook probes do not arrive:
vulnboxd_sensor_usdt_probes_attachedsays whether the sensor found the library; the hook'svbx_v1_enabled()turns 1 once it has.