This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: cilium-tetragon-ebpf-namespace-escape-guardrail

Cilium Tetragon eBPF Synchronous Namespace Escape & Privilege Escalation Enforcement

Enforces deterministic, in-kernel prevention of container breakout attempts using Cilium Tetragon TracingPolicies with synchronous SIGKILL interventions. Intercepts sensitive syscalls (setns, unshare, cap_capable, mount, commit_creds) inside ephemeral execution contexts before the kernel commits process capability transitions or boundary escapes. Guarantees immutable audit logging and instant process termination without relying on asynchronous userspace telemetry collectors.

Prohibited Anti-Pattern: Relying on Passive Post-Execution Auditing or Asynchronous SIEM Forwarders to Detect Container Breakouts

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cilium Tetragon eBPF Synchronous Namespace Escape & Privilege Escalation Enforcement - Enforces deterministic, in-kernel prevention of container breakout attempts using Cilium Tetragon TracingPolicies with synchronous SIGKILL interventions. Intercepts sensitive syscalls (setns, unshare, cap_capable, mount, commit_creds) inside ephemeral execution contexts before the kernel commits process capability transitions or boundary escapes. Guarantees immutable audit logging and instant process termination without relying on asynchronous userspace telemetry collectors.
globs: k8s/**/*.yaml, k8s/**/*.yml, deploy/tetragon/**/*.yaml, helm/**/*.yaml, crds/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cilium-tetragon-ebpf-namespace-escape-guardrail"
---

# Cilium Tetragon eBPF Synchronous Namespace Escape & Privilege Escalation Enforcement

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Relying on Passive Post-Execution Auditing or Asynchronous SIEM Forwarders to Detect Container Breakouts

## System Constraints
You are a Principal Security Architect and Systems Engineer specializing in Linux kernel isolation, eBPF telemetry, and Cilium Tetragon runtime enforcement. You must ensure all Kubernetes deployments enforce synchronous, kernel-level boundary controls via TracingPolicies. Mandate immediate SIGKILL actions for unauthorized namespace alterations (`sys_setns`, `sys_unshare`), credential overrides (`commit_creds`), and sensitive filesystem manipulation (`sys_mount`). Forbid passive-only notification configurations on high-risk production workloads.

## Strict Guidelines
- Engineers MUST ALWAYS configure Tetragon `TracingPolicy` or `TracingPolicyNamespaced` resources with synchronous `Sigkill` actions on unauthorized `setns` and `unshare` syscall invocations.
- Engineers MUST NOT rely exclusively on userspace log collectors or asynchronous SIEM agents to detect and mitigate container namespace escape vectors.
- TracingPolicies MUST filter explicitly by namespace and execution selectors, scoping strict kernel blocks to unprivileged application pods while maintaining operator break-glass profiles.
- TracingPolicies MUST intercept `commit_creds` or `cap_capable` hooks to instantly block unauthorized capability acquisition (such as `CAP_SYS_ADMIN` or `CAP_SYS_PTRACE`) before child binary execve completes.
- Engineers MUST test Tetragon policy definitions against the Tetragon CLI (`tetra`) and strictly validate that `matchActions` does not omit `action: Sigkill` on critical path enforcement rules.

## Bad vs Good Implementations
### Prevent Namespace Traversal (setns/unshare) via Tetragon TracingPolicy

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Configuring 'Post' logging without an active kernel-level termination permits the adversary to pivot namespaces, compromise the host kernel context, and tamper with userspace logging agents before remediation can occur.
```yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: audit-namespace-escape
spec:
  kprobes:
    - call: "sys_setns"
      syscall: true
      args:
        - index: 0
          type: "int"
        - index: 1
          type: "int"
      selectors:
        - matchNamespaces:
            - namespace: production
          # Flaw: Passive logging only. The escape binary executes successfully
          # while an asynchronous alert is shipped to an external SIEM.
          matchActions:
            - action: Post
```

#### Production Standard (Correct)
> **Standard**: Explicitly binds the in-kernel Tetragon bpf program to issue a SIGKILL via `matchActions: [action: Sigkill]` whenever `sys_setns` or `sys_unshare` is evaluated within the target namespace, instantly neutralizing escape attempts in kernel space.
```yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: block-namespace-escape
spec:
  kprobes:
    - call: "sys_setns"
      syscall: true
      args:
        - index: 0
          type: "int"
        - index: 1
          type: "int"
      selectors:
        - matchNamespaces:
            - namespace: production
          matchArgs:
            - index: 1
              operator: "Mask"
              values:
                - "0"
          matchActions:
            # Production Standard: Enforce in-kernel SIGKILL prior to syscall return
            - action: Sigkill
            - action: Post
    - call: "sys_unshare"
      syscall: true
      args:
        - index: 0
          type: "int"
      selectors:
        - matchNamespaces:
            - namespace: production
          matchActions:
            - action: Sigkill
            - action: Post
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Cilium Tetragon eBPF Synchronous Namespace Escape & Privilege Escalation Enforcement

Cilium Tetragon eBPF Synchronous Namespace Escape & Privilege Escalation Enforcement defines an industrial-grade behavioral standard for devops engineering. Enforces deterministic, in-kernel prevention of container breakout attempts using Cilium Tetragon TracingPolicies with synchronous SIGKILL interventions. Intercepts sensitive syscalls (setns, unshare, cap_capable, mount, commit_creds) inside ephemeral execution contexts before the kernel commits process capability transitions or boundary escapes. Guarantees immutable audit logging and instant process termination without relying on asynchronous userspace telemetry collectors. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Relying on Passive Post-Execution Auditing or Asynchronous SIEM Forwarders to Detect Container Breakouts Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftRelying on Passive Post-Execution Auditing or Asynchronous SIEM Forwarders to Detect Container BreakoutsCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS configure Tetragon `TracingPolicy` or `TracingPolicyNamespaced` resources with synchronous `Sigkill` actions on unauthorized `setns` and `unshare` syscall invocations.

Engineers MUST ALWAYS configure Tetragon `TracingPolicy` or `TracingPolicyNamespaced` resources with synchronous `Sigkill` actions on unauthorized `setns` and `unshare` syscall invocations.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT rely exclusively on userspace log collectors or asynchronous SIEM agents to detect and mitigate container namespace escape vectors.

Engineers MUST NOT rely exclusively on userspace log collectors or asynchronous SIEM agents to detect and mitigate container namespace escape vectors.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

TracingPolicies MUST filter explicitly by namespace and execution selectors, scoping strict kernel blocks to unprivileged application pods while maintaining operator break-glass profiles.

TracingPolicies MUST filter explicitly by namespace and execution selectors, scoping strict kernel blocks to unprivileged application pods while maintaining operator break-glass profiles.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

TracingPolicies MUST intercept `commit_creds` or `cap_capable` hooks to instantly block unauthorized capability acquisition (such as `CAP_SYS_ADMIN` or `CAP_SYS_PTRACE`) before child binary execve completes.

TracingPolicies MUST intercept `commit_creds` or `cap_capable` hooks to instantly block unauthorized capability acquisition (such as `CAP_SYS_ADMIN` or `CAP_SYS_PTRACE`) before child binary execve completes.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Engineers MUST test Tetragon policy definitions against the Tetragon CLI (`tetra`) and strictly validate that `matchActions` does not omit `action

Engineers MUST test Tetragon policy definitions against the Tetragon CLI (`tetra`) and strictly validate that `matchActions` does not omit `action: Sigkill` on critical path enforcement rules.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Cilium Tetragon eBPF Synchronous Namespace Escape & Privilege Escalation Enforcement critical for AI coding assistants?

Enforces deterministic, in-kernel prevention of container breakout attempts using Cilium Tetragon TracingPolicies with synchronous SIGKILL interventions. Intercepts sensitive syscalls (setns, unshare, cap_capable, mount, commit_creds) inside ephemeral execution contexts before the kernel commits process capability transitions or boundary escapes. Guarantees immutable audit logging and instant process termination without relying on asynchronous userspace telemetry collectors. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Relying on Passive Post-Execution Auditing or Asynchronous SIEM Forwarders to Detect Container Breakouts) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Cilium