Writing · Apr 10, 2026 · 12 min read

What 561 Repositories Taught Us About AI Agent Security

We scanned 561 open-source AI agent repositories, reviewed the riskiest findings by hand, and later re-checked our own disclosures. Here is what we learned — methodology, top patterns, and the raw numbers.

By Inkog Team

Over the last several months we ran the Inkog scanner against a curated benchmark of 561 open-source AI agent repositories — everything from the household-name frameworks (LangChain, CrewAI, AutoGen, LangGraph, pydantic-ai) to research projects and demo agents. We used the findings to cut the CLI's false positives, build the framework adapter catalog, and start responsible disclosure. This post shares what we learned.

It's also the most honest picture we can give of the state of AI agent security in April 2026: not a fear-mongering survey, not a vendor case study, just the raw numbers from a large-scale scan, what they mean, and what you can do about them.


Methodology

We built a benchmark of 561 repositories from the AI agent ecosystem. Selection criteria:

  • Framework coverage: every major code-first framework (LangChain, LangGraph, CrewAI, AutoGen/AG2, pydantic-ai, OpenAI Agents, Google ADK, Semantic Kernel, Smolagents, DSPy, Haystack, LlamaIndex) and every major no-code tool (n8n, Flowise, Langflow, Dify, Copilot Studio, Agentforce).
  • Diversity: library code, reference agents, production SaaS agents, research projects, and deliberately vulnerable training targets.
  • Staleness filter: only repositories with a commit in the last 12 months.

For each repo we ran the Inkog CLI at main on the comprehensive policy (every detector, no confidence filter). That produced 11,705 findings, far too many to review one by one, so we reviewed the critical and high-severity findings by hand, prioritising agent-specific patterns, and classified each as:

  • DISCLOSE — true positive with a concrete exploit path, eligible for responsible disclosure
  • DOWNGRADE — real architectural issue but low confidence or low practical impact; reported as best-practice feedback
  • SKIP — false positive, test fixture, or duplicate

We then used the SKIP set to drive detector improvements. One fix cycle alone eliminated 356 unsafe_env_access false positives, 25 SQLAlchemy ORM false positives, and 126 missing_oversight false positives. Afterwards, on a 24-repo set we had tuned the detectors against, all 73 findings checked out as true positives. That is a regression check, not an independent accuracy measure; a later run on a wider set turned up a new false positive, which we fixed.


The headline number

Of the 561 repositories scanned, our review classified 9 repositories as DISCLOSE.

Update, October 2026. Before sending, we re-checked the six disclosure drafts against the current code. None held up well enough to send. Two had been fixed or removed upstream (CAMEL deleted the module; OpenHands fixed the token logging). Two were already public through someone else's report (MetaGPT's eval() in ActionNode.xml_fill is CVE-2026-5971; Agent-S has open issues and a fix in review). In the rest, our drafts overclaimed: the input wasn't attacker-reachable, or the behaviour was the product's documented design. That is a useful lesson about static findings in research code: a dangerous call is not the same as an exploitable one. We're leaving the original numbers below as they were measured, with this correction on top.

The other 552 repositories? Most had findings — Inkog flagged something in roughly 68% of them — but the overwhelming majority were architectural risk patterns (missing rate limits, missing human oversight, unbounded loops on development paths) rather than exploitable vulnerabilities with a proof of concept. That distinction is the whole reason we built the three-tier risk classification: vulnerability (exploitable), risk pattern (structural), hardening (best practice).

Treating all three as equivalent is how you end up with a scanner nobody runs.


The top 5 patterns we actually found

Across the 9 DISCLOSE repositories, the same handful of patterns kept showing up:

1. eval() or exec() on LLM output

The oldest anti-pattern in the book, but still the single most common high-impact finding. A tool or agent takes the LLM's response and passes it to eval(), exec(), or a shell. An attacker with any prompt-injection vector — direct or indirect — gets code execution.

Inkog detects this via the unvalidated_exec_eval pattern, which walks the data-flow graph from LLM output nodes to code-execution sinks. With V14's sanitization wiring, a validate_sql() or sanitize_python() call upstream now correctly suppresses the finding.

2. SQL injection via agent-to-agent delegation

Multi-agent systems build SQL queries from LLM-generated intent. One agent plans the query, another executes it, and neither validates the result. When the planning agent's output is influenced by untrusted input, the executing agent runs tainted SQL.

This is different from SQLAlchemy ORM patterns that look similar to regex scanners but are actually safe — ORM query builders parameterize by construction. V14's callTextHasSQLAlchemySession() check eliminated the 25 false positives this previously caused.

3. Missing human oversight on dangerous tools

EU AI Act Article 14 requires human oversight for agent actions with real-world effects. We found production-shipping multi-agent systems where the "send email," "transfer funds," and "commit code" tools had no approval callback — the LLM decided, and the tool executed.

Inkog's missing_human_oversight pattern uses EffectCategory (Financial / Destructive / Communication / DataMutation) inferred from tool descriptions to decide which tools need oversight. Logging tools, cache writes, and serialization are excluded — those aren't the Article 14 concern.

4. Hardcoded LLM API keys

Unsurprising but ubiquitous. We found Anthropic, OpenAI, Gemini, Groq, and HuggingFace keys embedded in source code across the benchmark. The CLI v1.2.0 release added detection for 11 modern AI provider key formats specifically because of the gap we measured: before v1.2.0, Inkog detected AWS/GitHub/Slack/Stripe keys but missed the keys that AI agent developers actually leak.

The fix is trivial — move them to environment variables, add a .env.example — but the finding matters because leaked provider keys are scraped from public repos and abused quickly.

5. Token bombing via unbounded loops

The agent retries on failure. The retry has no cap. The failure mode generates a longer failure. The loop generates a longer loop. Your OpenAI bill buys someone a car.

This is Inkog's headline detection pattern — token_bombing — and it was the highest-volume true-positive category across the benchmark.


Framework breakdown (anonymized)

How the 9 DISCLOSE-classified findings were spread at the time of the review (see the update above for how they held up):

  • CrewAI ecosystem: 3 findings.
  • LangGraph / LangChain ecosystem: 2 findings, both on the delegation/interrupt path.
  • Multi-agent research frameworks (CAMEL, MetaGPT, SuperAGI, Agent-S): 3 findings.
  • MCP/tool ecosystem: 1 finding on a popular MCP server.

The shape of the distribution matches what you'd expect: the more autonomous the agent, the more ways to hurt yourself. No framework is "safe" and no framework is "broken" — they all have sharp edges, and they all deserve better defaults.


Why conventional scanners miss the agent part

A conventional SAST tool can flag subprocess.run with a dynamic argument. What it can't tell you is that the argument came from a model that just read a web page, which is the part that makes it an agent vulnerability and decides how urgent it is. Nor can it see that one agent delegates to another without authenticating the message, because it doesn't model agent topology.

It's not that they're bad scanners. They were built for a world where untrusted input arrives through a request handler, not through a model's output.

This is the Universal IR argument in a nutshell: AI agent security isn't a plugin for existing scanners — it needs its own representation of the code. Inkog's IR has 18 node types specifically for agent behavior: LoopNode, LLMCallNode, ToolCallNode, DelegationNode, HumanApprovalNode, AuthorizationCheckNode, and so on. Detection rules query those nodes. The framework adapters are the only piece that knows about LangChain or CrewAI — once the code hits the IR, the rules are framework-agnostic.

That's also why V14 could eliminate 356 unsafe-env-access false positives with a single new handler: the rule operates on UserInputNode nodes coming out of os.getenv() calls, and the new IsStandardConfigEnvVarHandler classifies the variable name. No per-framework special case. No regex fragility.


What this means for your project

If you ship AI agents — as a product, a library, or a research tool — here's what the data says you should do:

  1. Cap every loop the model controls. An iteration limit, a timeout and a token budget. Never let model output be the only exit condition.
  2. Put a person or a hard rule between the model and anything irreversible. Payments, deletes, outbound email, shell. If the model can call it, assume untrusted text can too.
  3. Keep provider keys out of source. Environment variables, a .env.example, and a secret scanner on your git history.
  4. Write an AGENTS.md, then check it against the code. Governance that doesn't match reality is governance theater.
  5. Authenticate handoffs in multi-agent systems. Delegation loops and unsigned handoffs are the 2026 equivalent of the 2018 SSRF era of cloud security — everywhere, under-reported, and overdue for a reckoning.

A closing note

If you're building agents and none of the patterns above felt familiar, that's the best possible outcome and you should keep doing what you're doing. Most teams we talked to during this research had no process for catching any of these issues. The goal of Inkog — and of this post — is to make that the exception, not the rule.