Skip to content

Runtime hooks ​

vulnboxd's sensor sees every process, connection and file a service touches, straight from the kernel. What the kernel cannot tell is which request a syscall belonged to when one thread serves many requests in turn: an asyncio or Node event loop, goroutines, a JVM thread pool. A runtime hook fills exactly that gap. It reports a few small facts — "request 3 on the connection from 10.0.0.7:51234 starts now", "this request started child process 4711", "this request opened a connection from local port 39012" — and the sensor joins them with what the kernel saw, so a flow in the hub shows the shell command, the database query or the file write it caused.

Where the kernel already links requests exactly — a process or a thread per connection, PHP-FPM, CGI, forking servers — you need no hook at all; a hook there only adds request boundaries on keep-alive connections.

How a request is linked to what it did An attacker's request reaches the vulnbox on port 9100. vulnboxd's request log links it to the proxy's connection to the container, and the conntrack entry links that to the connection into the container. The gunicorn worker that accepted the socket served it. With one process serving many requests, a runtime hook says which request was running, so the shell it spawned, the flag file it read and the database query it sent are linked to this request, each by an exact fact, never by timing. linked byexternal flow10.60.7.1 → vulnbox:9100 POST /api/exportcaptured on the game interfaceproxy hopvulnboxd → 127.0.0.1:20000vulnboxd's request loginto the container172.18.0.1 → notes-app:8000conntrack entry (DNAT)processgunicorn worker, pid 812the socket it acceptedrequest 3 on itrequest_begin … request_endhook: which request is runningspawned/bin/sh -c "zip -r /tmp/x.zip /data"fork lineage + hook: spawnedread/data/flags.dbthe process + hook: openedinternal flow→ notes-db:5432 SELECT * FROM flagshook: connected (local port) needs a runtime hook only where one process serves many requests at once
Every step is joined by a fact the hub can prove. What cannot be proved stays unlinked.

You rarely add one by hand. The hub reads each service's files, recognises each container's runtime and proposes the hook as a change; a player reviews it and approves it, and vulnboxd commits and deploys it (Hook proposals). Nothing is ever added automatically. Where the hub cannot do it, the cheat sheets show the steps, and local development covers running a hook on your own machine.

Which package for my service ​

Pick the row that matches how your service runs. Every package tries the least invasive way first: zero-code (nothing changes), compose-only (a read-only mount and an environment variable; image and source untouched), config-only (a mounted config file), and only then a source change.

Your servicePackageHow it gets inStatus
Any Python service (the base every Python package builds on)P1compose-only (PYTHONPATH)ready
Python WSGI: gunicorn, waitress, CherryPy/cheroot, Werkzeug; Flask, Django, Bottle, Pyramid, Falcon (uWSGI, bjoern, meinheld, mod_wsgi: kernel)P2compose-onlyready
Python ASGI: uvicorn, hypercorn, daphne, granian; FastAPI, Starlette, Django ASGI, Quart, LitestarP3compose-onlyready
aiohttp, Sanic, Tornado, Twisted, raw asyncio servers, trio/anyioP4compose-onlyready
gevent / eventlet, gunicorn's gevent and eventlet workersP5compose-onlyready
Python socketserver, hand-rolled select loopsP6kernel (forking/threading); source change (select loops)ready
Python C-level clients: psycopg, mysqlclient, hiredis, pycurl (optional precision)P7compose-onlyready
Any Node.js serviceN1compose-only (NODE_OPTIONS)ready
Express, Koa, Fastify, Hapi, NestJS, Next.js, Nuxt, Restify, Sails, Remix, AdonisJS, http2N2compose-only (with N1)ready
ws, Socket.IO, net/tls and dgram servers (not uWebSockets.js)N3compose-only (with N1)ready
BunN4config-only (bunfig.toml) or compose-onlyready
DenoN5compose-only (--preload, Deno ≥ 2.4) or source changeready
Go services, unchanged: net/http (HTTP/1, HTTP/2), x/net/http2, gRPC, fasthttp, fiber; Go 1.17–1.26G1zero-codeready
Go services you can rebuild (any binary, stripped too): net/http, chi, gorilla/mux, echo, gin, fasthttp, fiber, gRPCG2source change (vendored module)ready
Rust on tokio: axum, hyper, actix-web, warp, rocket, poem, salvo, tonicR1source change (vendored crate)ready
Rust on async-std/tide, smol, may, std threads, glommio/monoioR2kernel (threads); source changeready
Any JVM service (Java, Kotlin, Scala, Clojure)J1compose-only (JAVA_TOOL_OPTIONS)ready
Tomcat, Jetty, Undertow, Spring MVC/Boot, Javalin, Spark, Dropwizard, Clojure RingJ2compose-onlyready
Netty, Spring WebFlux, Vert.x, Quarkus, Micronaut, Ktor (Netty, CIO), Helidon 4J3compose-onlyready
Kotlin coroutinesJ4compose-onlyready
.NET 6–10: Kestrel, ASP.NET Core minimal APIs, MVC, gRPC, SignalR; raw TcpListener and Native AOT appsD1compose-only (DOTNET_STARTUP_HOOKS); source change (TcpListener, trimmed/AOT)ready
Ruby: Puma, Unicorn, Falcon, Thin; Rails, Sinatra, Roda, Hanami, GrapeY1compose-only (RUBYOPT)ready
PHP-FPM, mod_php, php -S, CGIH1kernel (optional config-only: conf.d ini)ready
Swoole, OpenSwoole, RoadRunner, FrankenPHP, ReactPHP, Amp, WorkermanH2config-only (conf.d ini) + one-line source change (FrankenPHP classic: config-only)ready
Perl: Mojolicious, AnyEvent, Twiggy, Plack (CGI and prefork: kernel)L1compose-only (PERL5OPT)ready
OpenResty, nginx with LuaL2config-only (nginx include)ready
Standalone Lua: lua-http, Copas (Luvit: not supported)L3compose-only (LUA_INIT)ready
Erlang / Elixir: Cowboy, Phoenix, Bandit, Plug, ranchE1compose-only (ERL_AFLAGS)ready
C / C++: forking and thread-per-connection (kernel); epoll/poll loops, libevent, libev, libuv, Mongoose, CivetWeb, Boost.Asio/Beast, cpp-httplib, Crow, Drogon, Pistache, Seastar (hook)C1source change (vendored vbxhook)ready
Zig, Nim, Crystal, D, Odin, VC2source changeready
Swift, Dart, Kotlin/NativeC3source changeready
Haskell, OCaml, Scala Native, Julia, RC4source changeready
Shell scripts, CGI, socat EXEC:, ncat --execX1kernel (no hook)ready
WebAssembly hosts: wasmtime, wasmer, WasmEdge, SpinX2source change in the host (R1 / C1)ready

All packages are ready: each has sample services that pass the event, chaos and baseline checks of the test harness, a proposal (or a cheat sheet where the change is in the source), and a page here. Each page lists the package's known gaps.

The shared pieces everything above builds on are the core library vbxtrace every package reports through, the sensor side that finds the probes and joins hook events with kernel events, the hub's proposals (format), and the test harness.

How it gets in ​

vulnboxd keeps the hook files on the vulnbox in /usr/local/lib/vulnboxd/trace/. Nothing is installed into your containers or images. When the hub recognises a service's runtime, it proposes a change you approve and push like a rule change:

  • for interpreted and VM runtimes, a compose change: a read-only mount of the hook directory at /opt/vbxtrace and the runtime's startup variable (PYTHONPATH, NODE_OPTIONS, JAVA_TOOL_OPTIONS, …), appended to any value it already has;
  • for Go binaries with symbols, nothing at all;
  • for compiled languages without another way in, a source diff that vendors the hook into the service directory, so the build needs no internet.

The hub proposes per container (compose service): a repository with an API, a frontend and a worker in three languages gets three proposals, approved together and committed one per container, so one container's hook can be reverted alone. Containers the kernel already covers (databases, plain nginx) get none. Where the hub cannot tell, or cannot make the change itself, the cheat sheets show how to add a hook by hand.

In the hub, a service's Runtime hooks page lists each container with its decision and lets you review and approve the change: see Hook proposals.

What a hook reports ​

Every package reports the same events, as probes in the core library:

EventWhenWhat the sensor joins it on
request_begin / request_enda request (HTTP) or session (raw TCP) starts / endsthe accepted socket's peer address and port, and the request's number on that connection (or "unknown"¹)
spawnedafter a child process startedthe child's pid
connectedafter an outgoing connection is establishedthe socket's local port
openedafter a file is openedthe process and the file descriptor
context_enter / context_exita thread picks up / puts down work the runtime does not track itselfthe thread
handoffwork moves to a task the runtime does not carry the request tothe two request ids

¹ Some servers do not tell a hook which connection or keep-alive request it is handling (Bun.serve, Deno.serve, uWebSockets.js, some PHP and .NET setups). Their hooks report the request's number as unknown (VBX_REQUEST_INDEX_UNKNOWN, 0xFFFFFFFF). vulnboxd then links such a request to a connection only through other exact facts, such as the connections the sensor saw the process accept and which only that request can own, or not at all. It never guesses.

A hook carries only these small numbers: never request contents, headers, paths, arguments or file data. Everything else comes from the kernel. Nothing is added to your traffic.

Safety promises ​

A hook runs inside your service, so every package makes the same promises:

  • Nothing to fail at run time. Each event is a USDT probe: a single no-op instruction the sensor attaches to. There is no socket, buffer, thread, allocation or I/O in the hook path. Without the sensor attached, a hook does nothing beyond checking that nobody listens.
  • Loads anywhere. The core library has no libc dependency, no constructors, no thread-local storage and no global state beyond a counter, so one file per architecture (x86_64, aarch64) loads under glibc, musl (Alpine) and in distroless images.
  • Never changes behaviour. Every wrapped call is guarded; a hook never changes arguments, return values, exceptions or timing beyond a constant. After a handful of internal errors it switches itself off for the process. Every package is tested with the core forced to fail, and its sample services' responses must stay byte-identical.
  • Cheap. A fired probe costs a few microseconds and fires per request, spawn, connection or file open — not per syscall. Each package measures its overhead on its sample services.
  • Easy to turn off. Set VBXTRACE=0 in the service's environment to switch a hook off without a rebuild, or revert the change that added it; vulnboxd's rollback covers a hook that breaks a service.

Checking the probes ​

The probes are standard SystemTap SDT probes, provider vbxtrace, so standard tools list them:

sh
readelf -n /usr/local/lib/vulnboxd/trace/libvbxtrace-x86_64.so
sudo bpftrace -l 'usdt:/usr/local/lib/vulnboxd/trace/libvbxtrace-x86_64.so:*'