CrabTrap: An LLM-as-a-judge HTTP proxy to secure agents in production
TL;DR Highlight
Brex’s CrabTrap intercepts all HTTP requests from AI agents, using an LLM judge to allow or deny access based on policy, sparking debate over the fundamental limits of LLM-based security layers.
Who Should Read
Backend/infrastructure developers operating AI agents in production and seeking to control unauthorized API calls or sensitive data exfiltration.
Core Mechanics
- CrabTrap functions as an HTTP proxy positioned between AI agents and the open internet, intercepting all outgoing requests, evaluating them against defined policies, and either allowing or blocking them in real-time.
- It combines two judgment methods: fast 'static rules' for initial filtering, and an LLM called as an additional judge for ambiguous requests that rules alone cannot resolve, logging each decision’s method.
- Brex claims automatically generated policies, tested on days of real traffic, aligned with human judgment in ‘the vast majority’ of cases, but the community argues ‘99% safe’ is a failing grade for security.
- To prevent prompt injection attacks, policy content is serialized as JSON (using json.Marshal) and embedded in the prompt, escaping special characters and command-like text.
- Brex started from the premise that agent security is currently stuck in a binary ‘all or nothing’ paradigm, attempting to balance the trade-off between powerful but risky access and restrictive but useless lockdown.
- Installation requires installing a self-signed certificate system-wide to perform HTTPS traffic MITM (man-in-the-middle) interception, a process some commenters found inconvenient.
- The project is open-source and available on GitHub, with Brex advertising a ‘30-second setup’.
Evidence
- "The probabilistic nature of the LLM-as-a-judge approach was the biggest point of contention. One commenter questioned the risk of basing a security system on probability rather than hard limits, with others agreeing that ‘deterministic ACLs are needed’ or it’s ‘just a non-deterministic business rules engine.’\n\nThe potential for shared vulnerabilities when the agent and judge use the same model family was raised. For example, if both use Claude, a prompt injection pattern that fools the agent could also fool the judge, leading to calls for ‘defense in depth’ using at least different providers, ideally different architectures.\n\nConcerns were raised that because the judge only sees the HTTP body, attackers manipulating agent inputs can also manipulate the judge’s context window, representing a fundamental failure mode where the judge is ‘deprived of the signals needed to detect the trick.’\n\nSome argued CrabTrap can only be a detection layer, not a prevention layer, reasoning that ‘credentials are already read when the LLM makes an external POST request,’ making kernel-level control suitable for auditing what an agent did, not preventing it.\n\nA commenter introduced EvalView as an alternative approach, using full execution trajectory snapshots and diffs to track changes, with a lightweight zero-judge model check to determine drift level (NONE/WEAK/MEDIUM/STRONG), criticizing the idea of solving LLM security problems by adding more LLM layers."
How to Apply
- "If you’re running AI agents in production that automatically call external services like Slack, GitHub, or internal APIs, deploy CrabTrap as a proxy between the agent and the internet, defining immediate guardrails like ‘block external calls to specific domains’ or ‘block large data transfers.’\n\nIf you recognize the probabilistic limitations of the LLM-as-judge, position CrabTrap as an audit layer rather than a sole defense. Handle actual blocking with network policies or IAM permissions, and use CrabTrap for visibility, logging what the agent attempted.\n\nWhen selecting a judge model, consider using an LLM from a different provider or with a different architecture than the agent’s model. Using the same model family reduces the effectiveness of defense in depth.\n\nIf the MITM structure with system-wide self-signed certificate installation is concerning, minimize the impact by running the agent in an isolated container or sandbox environment and deploying CrabTrap as the gateway for that environment."
Code Example
// CrabTrap’s prompt injection prevention method (Go code, from GitHub source)
// The policy is embedded as a JSON-escaped value inside a structured JSON object.
// This prevents prompt injection via policy content — any special characters,
// delimiters, or instruction-like text in the policy are safely escaped by
// json.Marshal rather than concatenated as raw text.
policyJSON, err := json.Marshal(policyContent)
// policyJSON is now a safely escaped string that can be inserted into the promptTerminology
Related Papers
Meta confirms 1000s of Instagram accounts were hacked by abusing its AI chatbot
Meta의 AI 챗봇에 있던 이메일 검증 버그로 인해 2FA(2단계 인증)를 사용하지 않던 Instagram 계정 2만 개 이상이 약 2개월간 해킹됐다. AI를 계정 복구 시스템에 통합할 때 발생할 수 있는 보안 취약점의 실제 사례다.
Anthropic's open-source framework for AI-powered vulnerability discovery
Anthropic이 Claude를 활용해 코드 취약점을 자율적으로 탐지·트리아지·패치하는 오픈소스 레퍼런스 구현체를 공개했다. 실제 보안팀과의 협업 경험을 바탕으로 만들어진 파이프라인이라 실전 적용성이 높다.
Will the Agent Recuse Itself? Measuring LLM-Agent Compliance with In-Band Access-Deny Signals
서버가 SSH 배너나 DB NOTICE로 'AI 에이전트는 접근하지 마세요' 신호를 보내면 GPT-4o, Claude Code 같은 LLM 에이전트가 실제로 물러나는지 실험으로 측정했다.
ToolChoiceConfusion: Causal Minimal Tool Filtering for Reliable LLM Agents
LLM 에이전트에 도구를 100개 다 보여주지 말고, 지금 당장 필요한 것 1개만 보여주면 성공률은 그대로에 토큰은 90% 절약된다.
My Agent Skill for Test-Driven Development
AI 에이전트가 형편없는 테스트를 작성하는 문제를 해결하기 위해, Kent Beck의 Canon TDD 원칙을 'Skill'로 만들어 에이전트에게 주입하는 방법을 공유한다. 에이전트 코딩에서 테스트 품질을 높이고 싶은 개발자에게 실용적인 접근법을 제시한다.
Show HN: Paseo – Beautiful open-source coding agent interface
Claude Code, Codex, GitHub Copilot 등 여러 코딩 에이전트를 하나의 UI로 제어하는 오픈소스 프로젝트로, 로컬 데몬 방식으로 자기 머신에서 실행하면서 모바일에서도 접근할 수 있다.