This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: ebpf-tetragon-realtime-syscall-containment-standard

Tetragon In-Kernel Real-Time Syscall Anomaly Containment and Synchronous Sigkill Guardrails

Enforces synchronous in-kernel containment of unauthorized syscalls, binary executions, and namespace escapes using Cilium Tetragon TracingPolicies. Mandates the deployment of kernel-level Sigkill actions at probe entry to eliminate Time-of-Check to Time-of-Use (TOCTOU) race conditions and prevent user-space latency penalties during security incidents.

Prohibited Anti-Pattern: Audit-Only Logging and Asynchronous User-Space Remediation for High-Risk Runtime Exploits

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Tetragon In-Kernel Real-Time Syscall Anomaly Containment and Synchronous Sigkill Guardrails - Enforces synchronous in-kernel containment of unauthorized syscalls, binary executions, and namespace escapes using Cilium Tetragon TracingPolicies. Mandates the deployment of kernel-level Sigkill actions at probe entry to eliminate Time-of-Check to Time-of-Use (TOCTOU) race conditions and prevent user-space latency penalties during security incidents.
globs: deploy/**/*.yaml, k8s/**/*.yaml, infra/**/*.yaml, security/tetragon/**/*.yaml, charts/**/templates/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/ebpf-tetragon-realtime-syscall-containment-standard"
---

# Tetragon In-Kernel Real-Time Syscall Anomaly Containment and Synchronous Sigkill Guardrails

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Audit-Only Logging and Asynchronous User-Space Remediation for High-Risk Runtime Exploits

## System Constraints
You are a Principal Security and DevOps Architect enforcing eBPF Tetragon in-kernel runtime security standards. Enforce deterministic, synchronous containment via Tetragon TracingPolicy resources using kernel-space Sigkill actions for anomalous executions. Reject non-containment audit-only models for zero-trust workloads and ensure probe points reject unauthorized process execution at sys_enter rather than sys_exit.

## Strict Guidelines
- Engineers MUST ALWAYS specify synchronous in-kernel containment via 'action: Sigkill' for critical syscall anomalies rather than delegating termination to user-space daemons.
- Engineers MUST NOT attach enforcement hooks to sys_exit or retprobes when attempting execution prevention, as child processes will have already executed memory payloads; hooks MUST target sys_enter_execve or security_bprm_check.
- TracingPolicies SHOULD scope process execution rules to tightly defined matchArgs, matchBinaries, and namespace selectors to prevent accidental system-wide denial of service on node host processes.
- Services MUST deploy namespaced 'TracingPolicyNamespaced' manifests alongside target microservices to decouple application boundaries and limit blast radiuses.
- Components NEVER allow interactive shells (/bin/sh, /bin/bash, /usr/bin/zsh) or privilege-escalating tools (nsenter, setns) to execute without an immediate Sigkill action inside production container workloads.

## Bad vs Good Implementations
### Kernel-Level Process Execution Enforcement with Tetragon

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Hooking sys_exit_execve with action: Post allows the malicious payload to run to completion before user-space log processors read the perf ring buffer. It introduces multi-millisecond TOCTOU vulnerabilities and fails to contain active attacks.
```yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicy
metadata:
  name: audit-shell-execution
spec:
  kprobes:
    - call: "sys_exit_execve"
      syscall: true
      args:
        - index: 0
          type: "int"
      selectors:
        - matchArgs:
            - index: 0
              operator: "Equal"
              values:
                - "0"
          # ANTI-PATTERN: Merely emits an event without synchronous kernel enforcement.
          # Using sys_exit_execve means the process has already spawned and initialized.
          # Remediation is deferred to an asynchronous user-space daemon, creating a TOCTOU window.
          action: Post
```

#### Production Standard (Correct)
> **Standard**: Hooks sys_enter_execve and triggers an instantaneous eBPF-driven Sigkill directly inside the kernel execution path before the binary is mapped into user space, guaranteeing zero latency and zero TOCTOU exposure.
```yaml
apiVersion: cilium.io/v1alpha1
kind: TracingPolicyNamespaced
metadata:
  name: contain-unauthorized-exec
  namespace: production
spec:
  kprobes:
    - call: "sys_enter_execve"
      syscall: true
      args:
        - index: 0
          type: "string"
      selectors:
        - matchArgs:
            - index: 0
              operator: "Prefix"
              values:
                - "/bin/sh"
                - "/bin/bash"
                - "/usr/bin/curl"
                - "/usr/bin/wget"
          matchNamespaces:
            - "production"
          # PRODUCTION FIX: Instantaneous in-kernel SIGKILL directly from eBPF context.
          # Halts process scheduling before entry completes without relying on user space.
          action: Sigkill
```

Recommended MCP Servers (mcp-serverlist.com)

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

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Tetragon In-Kernel Real-Time Syscall Anomaly Containment and Synchronous Sigkill Guardrails

Tetragon In-Kernel Real-Time Syscall Anomaly Containment and Synchronous Sigkill Guardrails defines an industrial-grade behavioral standard for devops engineering. Enforces synchronous in-kernel containment of unauthorized syscalls, binary executions, and namespace escapes using Cilium Tetragon TracingPolicies. Mandates the deployment of kernel-level Sigkill actions at probe entry to eliminate Time-of-Check to Time-of-Use (TOCTOU) race conditions and prevent user-space latency penalties during security incidents. 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: Audit-Only Logging and Asynchronous User-Space Remediation for High-Risk Runtime Exploits 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 DriftAudit-Only Logging and Asynchronous User-Space Remediation for High-Risk Runtime ExploitsCritical
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 specify synchronous in-kernel containment via 'action

Engineers MUST ALWAYS specify synchronous in-kernel containment via 'action: Sigkill' for critical syscall anomalies rather than delegating termination to user-space daemons.

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 attach enforcement hooks to sys_exit or retprobes when attempting execution prevention, as child processes will have already executed memory payloads

Engineers MUST NOT attach enforcement hooks to sys_exit or retprobes when attempting execution prevention, as child processes will have already executed memory payloads; hooks MUST target sys_enter_execve or security_bprm_check.

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 SHOULD scope process execution rules to tightly defined matchArgs, matchBinaries, and namespace selectors to prevent accidental system-wide denial of service on node host processes.

TracingPolicies SHOULD scope process execution rules to tightly defined matchArgs, matchBinaries, and namespace selectors to prevent accidental system-wide denial of service on node host processes.

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

Services MUST deploy namespaced 'TracingPolicyNamespaced' manifests alongside target microservices to decouple application boundaries and limit blast radiuses.

Services MUST deploy namespaced 'TracingPolicyNamespaced' manifests alongside target microservices to decouple application boundaries and limit blast radiuses.

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

Components NEVER allow interactive shells (/bin/sh, /bin/bash, /usr/bin/zsh) or privilege-escalating tools (nsenter, setns) to execute without an immediate Sigkill action inside production container workloads.

Components NEVER allow interactive shells (/bin/sh, /bin/bash, /usr/bin/zsh) or privilege-escalating tools (nsenter, setns) to execute without an immediate Sigkill action inside production container workloads.

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 Tetragon In-Kernel Real-Time Syscall Anomaly Containment and Synchronous Sigkill Guardrails critical for AI coding assistants?

Enforces synchronous in-kernel containment of unauthorized syscalls, binary executions, and namespace escapes using Cilium Tetragon TracingPolicies. Mandates the deployment of kernel-level Sigkill actions at probe entry to eliminate Time-of-Check to Time-of-Use (TOCTOU) race conditions and prevent user-space latency penalties during security incidents. 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 (Audit-Only Logging and Asynchronous User-Space Remediation for High-Risk Runtime Exploits) 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

Tetragon