Bombini 是一个基于 eBPF 的安全代理,完全使用 Rust 编写,基于 Aya 库,并构建在 LSM(Linux 安全模块)BPF 钩子之上。 其核心采用称为 Detector 的模块化组件,每个组件负责监控和报告特定类型的系统事件。 启用沙箱模式的 Detector 还能直接在内核中阻止被禁止的操作。
EPERM 失败,而不是在已经发生后才被报告。scope/event 谓词
既可以报告事件,也可以在启用 sandbox 时拒绝该事件。Bombini 需要 Linux 6.2+ 并启用 BPF LSM。请先查看兼容性 说明。容器镜像针对 x86_64 构建。
从仓库根目录使用快速开始配置启动 Bombini:
docker run --pid=host --rm -it --privileged \
-v $PWD/examples/quickstart:/usr/local/lib/bombini/config:ro \
-v /sys/fs/bpf:/sys/fs/bpf \
ghcr.io/bombinisecurity/bombini:v1.1.0
该配置由三个 detector 文件组成。
procmon.yaml 报告 setuid 到 root,并禁止
从 /tmp 执行任何内容:
# Detect privilege escalation to root
setuid:
enabled: true
rules:
- rule: SetUidToRoot
event: euid == 0
# Block binaries executed from /tmp right in the kernel
bprm_check:
enabled: true
sandbox:
enabled: true
deny_list: true
rules:
- rule: DenyExecFromTmp
event: path_prefix == "/tmp"
filemon.yaml 报告对 /etc/shadow 的读取:
# Detect reads of password hashes
file_open:
enabled: true
rules:
- rule: ShadowRead
event: path == "/etc/shadow"
netmon.yaml 报告到云
元数据服务的连接:
# Detect access to the cloud metadata service: a common way to steal credentials
egress:
enabled: true
rules:
- rule: CloudMetadataAccess
event: ipv4_dst == "169.254.169.254" AND port_dst == 80
在另一个终端中生成事件:
$ ./examples/quickstart/trigger.sh
[1] sudo reads /etc/shadow: Setuid and FileOpen events
[2] exec a binary from /tmp: blocked by the sandbox
./examples/quickstart/trigger.sh: 10: /tmp/bombini-quickstart: Operation not permitted
blocked: exit code 126
[3] connect to the cloud metadata service: Egress event
Bombini 以 JSON 行格式将事件打印到 stdout。以下是被阻止的 exec:
{
"type": "ProcessEvent",
"process": {
"start_time": "2026-10-03T14:36:10.256Z",
"cloned": true,
"pid": 39988,
"tid": 39988,
"ppid": 39984,
"uid": 503,
"euid": 503,
"gid": 1000,
"egid": 1000,
"auid": 0,
"cap_inheritable": "",
"cap_permitted": "",
"cap_effective": "",
"secureexec": "",
"filename": "dash",
"binary_path": "/usr/bin/dash",
"args": "./examples/quickstart/trigger.sh",
"exec_id": "Mzk5ODg6MjEyNzU3NDAzMjI2MzI2",
"parent_exec_id": "Mzk5ODQ6MjEyNzU3MzgzNTY5NTc3"
},
"parent": { "...": "same fields for the parent process" },
"blocked": true,
"process_event": {
"type": "BprmCheck",
"binary": "/tmp/bombini-quickstart"
},
"timestamp": "2026-10-03T14:36:10.256Z",
"rule": "DenyExecFromTmp"
}
更多现成的策略,例如 GTFOBins shell 逃逸 和权限提升,位于 examples。
| Detector | 监控内容 | 沙箱 |
|---|---|---|
| ProcMon | 进程 exec 和退出、setuid/setgid、capabilities、prctl、用户命名空间、ptrace | ✓ |
| FileMon | 文件打开、mmap、truncate、unlink、symlink、chmod、chown、mount、ioctl | ✓ |
| NetMon | 入站和出站 TCP 连接、socket 创建和 connect | ✓ |
| KernelMon | BPF map 创建、BPF 程序加载,以及对 BPF map 和程序的访问 | |
| IOUringMon | io_uring 提交队列条目 | |
| SysEnumMon(实验性) | 系统枚举:在时间窗口内触及多个被监控的文件或二进制文件 |
完整文档见book。
请查看 CONTRIBUTING.md 了解贡献指南。