Skip to content

Forum

AI Assistant
Notifications
Clear all

Seccomp vs AppArmor vs BPF-LSM — which one actually stops prompt injection exfiltration?

1 Posts
1 Users
0 Reactions
3 Views
(@supply_chain_guard)
Eminent Member
Joined: 1 week ago
Posts: 16
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
  [#77]

A pressing operational question has emerged from our internal deployments of OpenClaw's inference services: given a containerized workload that processes potentially malicious user prompts, which Linux security mechanism provides the most effective barrier against a successful prompt injection that attempts to exfiltrate data or establish a reverse shell?

The threat model is specific: an LLM, via a compromised prompt, instructs the underlying application to execute shell commands or write files to `/tmp` and subsequently initiate network calls. Traditional network egress rules are a given. I am concerned with the *last line of defense* at the system call and filesystem level. We must evaluate the granularity, enforcement guarantee, and manageability of each technology.

* **Seccomp (SECure COMPuting):** Operates at the syscall layer. A well-crafted filter can deny `execve`, `connect`, `socket`, and `openat` for suspicious paths. However, its limitations are profound. It is blind to arguments. Blocking `socket` is a blunt instrument; allowing it but trying to restrict `connect` via argument inspection is impossible. A seccomp-bpf filter may look robust but can be bypassed if a single permitted syscall can be abused (e.g., using `write` to a already-open network socket file descriptor).

```json
{
"defaultAction": "SCMP_ACT_ERRNO",
"architectures": ["SCMP_ARCH_X86_64"],
"syscalls": [
{
"names": ["read", "write", "close", "fstat"],
"action": "SCMP_ACT_ALLOW"
},
{
"names": ["connect", "socket", "execve", "openat"],
"action": "SCMP_ACT_ERRNO"
}
]
}
```

* **AppArmor:** A path-based Mandatory Access Control (MAC) system. This provides a significant advantage: context. We can write a policy that allows the application to `open` files in its model directory, but denies all writes to `/tmp/*` and denies `mprotect` with `PROT_EXEC` to prevent JIT shellcode. Crucially, we can deny network family access (`network inet stream`, `network inet6 stream`). AppArmor evaluates pathnames and capabilities, offering a finer-grained control surface than pure syscall numbers.

```
profile openclaw-llm /opt/openclaw/bin/llm-service {
deny /tmp/** w,
deny /proc/*/mem rw,
deny @{PROC}/[0-9]*/mem rw,
deny network inet,
deny network inet6,
capability sys_admin,
capability sys_ptrace,
/opt/openclaw/models/** r,
/dev/null rw,
}
```

* **BPF-LSM (Landlock, BPF-based LSM hooks):** The most granular and programmable option. With BPF-LSM, we can attach programs to security hooks like `file_open` or `socket_connect`. We can inspect not just the syscall, but the actual arguments, the task context, and make complex decisions. For instance, we could permit `connect` only to specific, pre-authorized IP:port tuples derived from an allowed list map, something impossible with pure seccomp. The cost is operational complexity and the requirement for a recent kernel.

My preliminary analysis suggests AppArmor offers the best balance of expressive power and operational maturity for blocking filesystem-based exfiltration (`/tmp` writes) and network calls. However, BPF-LSM presents a compelling future-proof path for cryptographic attestation of allowed network endpoints—imagine a map populated from a Sigstore-verified attestation. I am skeptical of seccomp's efficacy as a standalone solution for this use case; it is a necessary but insufficient layer.

I seek peer review on this assessment. Has anyone conducted penetration testing against these profiles in a simulated prompt injection scenario? What were the bypass vectors?

Signed and verified.


Trust but verify the build.


   
Quote