Security

How Kiro Agent Hooks and TrustGate Harden Agentic IDEs Against Indirect Prompt Injection

Agentic IDEs like AWS Kiro run with local shell, repository, and MCP access—making an MCP allow-list alone insufficient against untrusted content. This architectural guide pairs Kiro's December 1, 2026 deterministic Shell Command hooks with TrustGate OAuth MCP routing and CVE-2026-10591 lessons.

By 0xScorPionSon

9 min read

How Kiro Agent Hooks and TrustGate Harden Agentic IDEs Against Indirect Prompt Injection

Kiro Agentic IDE Security Architecture

Executive Summary

Agentic IDEs run directly inside the highest-privilege environment on a developer's workstation—with read/write access to source repositories, local shells, cloud credentials, and Model Context Protocol (MCP) configurations. Throughout 2026, disclosures against AWS's Kiro agentic IDE—including CVE-2026-10591 (fixed in Kiro 0.11, where crafted instructions wrote to execution-sensitive paths like .vscode/tasks.json) and Mindgard's August 2026 workspace-file exfiltration finding—demonstrated why an MCP allow-list alone cannot defend against untrusted web pages or malicious repositories (AWS Security Bulletin, NeuralTrust).

On November 30 and December 1, 2026, Kiro updated its official Hook triggers and Hook actions documentation, detailing deterministic Shell Command hooks (Prompt Submit, Pre Tool Use, Post Tool Use, and Permission Request in CLI V3 3.4.0+) where non-zero exit codes block tool execution locally without spending LLM credits. Paired with NeuralTrust's December 1, 2026 Kiro security integration (routing MCP calls through TrustGate via OAuth and inspecting shell commands, file writes, and tool outputs via TrustGuard), security teams can enforce platform-level trust boundaries around developer workstations—while accounting for documented edge cases such as prompt-hook exit-code handling.

Security Layer Native Kiro Mechanism (Nov–Dec 2026) Layered Runtime / Gateway Control Primary Source
Execution Blocking Pre Tool Use & Prompt Submit Shell Command hooks (exit != 0 blocks) TrustGuard collector policy checks commands, file writes & results Kiro Hook Actions
MCP Governance Enterprise IAM Identity Center + MCP allow-list TrustGate single OAuth MCP endpoint per application NeuralTrust
Sensitive Path Protection Patched in Kiro 0.11 (CVE-2026-10591) Deterministic regex/path guard on .kiro/, .vscode/, .github/ AWS Bulletin 2026-037-AWS
CLI & Web Parity IDE, CLI V3 (3.1.0+ / 3.4.0+), and Web (Pre/Post Tool Use) MDM-managed global ~/.kiro/hooks/*.json rollout in Observe mode Kiro Hook Triggers

Trust Model & Architecture

Why Model Judgment Fails Inside an Agentic IDE

In a traditional IDE, opening a third-party repository or fetching documentation carries low risk unless the developer manually runs an untrusted build script. In an agentic IDE like Kiro, the agent autonomously reads files, writes code, runs shell commands, and invokes MCP servers using the developer's local OS permissions (NeuralTrust). As Intezer and Kodem Security noted when disclosing CVE-2026-10591 (where a poisoned web page caused Kiro prior to 0.11 to rewrite execution-sensitive files), prompt injection cannot be solved by asking the LLM to be careful—high-risk protections must be enforced deterministically at the platform layer.

Deterministic Hook + Governed MCP Trust-Boundary Flow

Kiro's updated hook architecture separates Agent Prompt actions (which inject natural language and consume LLM credits) from Shell Command actions (which execute locally in <= 60 seconds, consume zero credits, and deterministically block Prompt Submit or Pre Tool Use invocations on any non-zero exit code):

flowchart LR
    DEV[Developer Prompt / Untrusted Repo] -->|Prompt Submit Hook| PCHK[1. Local Shell & Policy Check]
    PCHK -->|Exit != 0: Block| DENY[Blocked Locally]
    PCHK -->|Exit 0| LLM[2. Kiro Agent Loop]
    LLM -->|File Write / Shell / MCP Call| PRE[3. Pre Tool Use Deterministic Hook]
    PRE -->|Blocks .kiro/ .vscode/ & Risky Shell| DENY
    PRE -->|Approved MCP Call| TG[4. TrustGate OAuth MCP Gateway]
    TG -->|Tool Result Screened for Injection| POST[5. Post Tool Use Taint Check]
    POST -->|Sanitized Context| LLM

This model establishes three critical boundaries:

  1. Deterministic Pre-Execution Gating: Because Shell Command hooks run outside the LLM's context loop, a poisoned README or indirect prompt injection in an MCP response cannot talk its way past a non-zero exit code on Pre Tool Use (Kiro Hook Actions).
  2. Scoped OAuth MCP Endpoints: Replacing local stdio MCP commands or raw API keys in ~/.kiro/settings/mcp.json with a remote TrustGate URL authenticated via OAuth ensures Kiro only discovers and calls tools authorized for that user and application (NeuralTrust).
  3. Post-Tool Output Tainting: Inspecting Post Tool Use payloads lets runtime security flag or taint sessions when an external web fetch or ticket contains hidden prompt-injection directives.

Kiro Hook Trigger Surface Matrix (IDE vs. CLI V3 vs. Web)

When designing workstation and cloud-IDE policies, security teams must account for which Kiro hook triggers actually execute on each surface as of December 1, 2026:

Hook Trigger Kiro IDE Kiro CLI V3 Kiro Web Security Use Case
Pre Tool Use Supported Supported Supported Deterministically block risky shell, file, or MCP calls (exit != 0)
Post Tool Use Supported Supported Supported Screen tool outputs for indirect prompt injection & taint sessions
Prompt Submit Supported Supported Supported Inspect/log USER_PROMPT before LLM loop starts
Permission Request Supported V3 (3.4.0+) Not supported Enforce enterprise approval policy on elevated actions
File Create / Save / Delete Supported V3 Not supported Trigger local SAST/secret scans when files change on disk

What Researchers & Analysts Say

  • AWS & NVD Vulnerability Record (CVE-2026-10591, June 2, 2026): In Bulletin 2026-037-AWS and NVD, AWS confirmed that insufficient file-write access controls in Kiro IDE prior to 0.11 allowed crafted instructions to write to execution-sensitive paths such as .vscode/tasks.json, enabling auto-execution on folder open. Both AWS and Mindgard's August 2026 Kiro Powers findings were patched, but researchers emphasize that platform-level runtime checks remain necessary for defense-in-depth.
  • NeuralTrust Lead AI Security Researcher Alessandro Pignati (December 1, 2026): In Kiro Security: NeuralTrust Integration, Pignati highlights an important known limitation: teams should "roll it out by MDM, start in Observe, and treat the prompt gap as a known limit until Kiro honors prompt-hook exit codes." While Kiro's official Hook actions docs state that non-zero exit codes block both Pre Tool Use and Prompt Submit, enterprise deployments should independently verify Prompt Submit blocking behavior on their exact IDE/CLI version before relying on it as a hard DLP boundary.
  • Kiro Engineering Surface Matrix (December 1, 2026): Kiro's Hook triggers documentation notes that Pre Tool Use and Post Tool Use run across IDE, CLI, and Web surfaces, whereas File Create, File Save, File Delete, and Permission Request (CLI V3 3.4.0+) are limited to the IDE and CLI V3—meaning web-session workflows do not execute filesystem hooks.

Hardening & Implementation Blueprint

Security and platform engineering teams rolling out Kiro IDE or Kiro CLI V3 across developer fleets should deploy these three controls.

1. Deterministic Pre Tool Use Guardrail in .kiro/hooks/

Store a standalone JSON hook in ~/.kiro/hooks/guard-sensitive-paths.json (global CLI V3) or .kiro/hooks/guard-sensitive-paths.json (workspace) using a Shell Command action—consuming zero LLM credits and blocking writes to execution-sensitive configs or dangerous shell patterns (Kiro Hooks Docs, Kiro Hook Actions):

{
  "hooks": [
    {
      "name": "block-sensitive-path-and-shell",
      "trigger": "PreToolUse",
      "action": {
        "type": "shell",
        "command": "/usr/local/bin/kiro-pretool-guard.sh",
        "timeout": 10
      }
    }
  ]
}

Pair that hook definition with an MDM-deployed, root-owned /usr/local/bin/kiro-pretool-guard.sh script (so a compromised workspace cannot edit the guard script itself):

#!/usr/bin/env bash
set -euo pipefail
PAYLOAD=$(cat)

if echo "$PAYLOAD" | grep -Eqi '(\.kiro/settings/mcp\.json|\.vscode/tasks\.json|\.git/hooks/|curl .*\|.*bash)'; then
  echo "Blocked: attempt to modify execution-sensitive config or pipe remote script to shell." >&2
  exit 1
fi
exit 0

Operational Overhead: Local shell hooks add < 50 ms per tool invocation and zero token cost. Deploying the guard script into /usr/local/bin/ via MDM (read-only for standard users) prevents a malicious repository from overwriting its own security check.

2. Governed Remote MCP Configuration via OAuth (mcp.json)

Eliminate hardcoded bearer tokens and local unvetted npx/uvx MCP servers from ~/.kiro/settings/mcp.json. Point Kiro to a single remote OAuth-authenticated MCP gateway (TrustGate or an internal equivalent) so tool discovery (tools/list) and tools/call traffic are centrally audited and rate-limited (NeuralTrust):

{
  "mcpServers": {
    "corp-governed-gateway": {
      "url": "https://mcp-gateway.corp.internal/kiro/app-01",
      "auth": {
        "type": "oauth"
      }
    }
  }
}

Operational Overhead: Using OAuth-backed remote MCP servers requires developers to complete a one-time browser sign-in when first connecting, adding ~10 seconds at session start while removing static API keys from developer home directories.

3. MDM Rollout & Observe-First Policy Calibration

Distribute ~/.kiro/hooks/ and ~/.trustguard/kiro.json via MDM (Jamf/Intune/Kandji), start runtime inspection in Observe mode for 7 days across a pilot engineering group, and audit which legitimate build scripts or test runners trigger false positives before switching PreToolUse policies to Enforce (NeuralTrust).

4. Workspace Trust & Preventing Hook Self-Modification

Because project-level hooks live inside .kiro/hooks/*.json in the repository root (Kiro Hooks Docs), cloning an untrusted open-source repository could introduce malicious or weakened hook definitions if the developer clicks "Trust Workspace." Enforce two workstation rules:

  1. Store Security Hooks Globally via MDM: Deploy mandatory security hooks into ~/.kiro/hooks/ (for CLI V3) and root-owned binaries in /usr/local/bin/, rather than relying on per-repo .kiro/hooks/ files that a cloned repo can omit.
  2. Block Agent Edits to .kiro/hooks/: Include \.kiro/hooks/ in your Pre Tool Use regex blocklist so an untrusted prompt cannot instruct the agent to delete or disable its own guardrails mid-session.

Operational Overhead: Maintaining global MDM-managed hooks and read-only guard scripts adds minimal endpoint management effort for fleets already using Jamf or Intune, while ensuring security policies survive across every newly cloned repository.


Frequently Asked Questions (FAQ)

1. Is an MCP allow-list in Kiro Enterprise enough to stop prompt injection?

No. As NeuralTrust explains, an MCP allow-list only controls which servers the agent can reach—not what the agent does when it reads untrusted content from a web page, issue tracker, or workspace file. Runtime Pre Tool Use and Post Tool Use hooks are required to inspect commands, file writes, and tool results.

2. Do Kiro Shell Command hooks consume LLM credits?

No. According to Kiro's Hook actions documentation, Agent Prompt actions trigger a new agent loop and consume credits, whereas Shell Command actions execute locally without using an LLM and consume zero credits.

3. How does a Kiro hook block a dangerous tool call?

When a Shell Command action on a Pre Tool Use or Prompt Submit trigger returns any non-zero exit code, Kiro sends stderr to the agent and blocks the tool invocation or prompt submission (Kiro Hook Actions). Teams should still verify Prompt Submit exit-code enforcement on their exact client version (NeuralTrust).

4. What did CVE-2026-10591 teach defenders about agentic IDEs?

CVE-2026-10591 (fixed in Kiro 0.11) showed that insufficient file-write restrictions allowed crafted instructions to overwrite execution-sensitive paths like .vscode/tasks.json. Even after patching, defenders should block agent writes to .vscode/, .kiro/, and .git/hooks/ at the OS/hook layer.

5. Which Kiro hook triggers work on Kiro Web vs. IDE/CLI?

Per Kiro's December 1, 2026 trigger matrix, Prompt Submit, Agent Stop, Session Start, Pre Tool Use, and Post Tool Use run on Web sessions, while filesystem hooks (File Create, File Save, File Delete) and Permission Request (CLI 3.4.0+) require the IDE or CLI V3.


Sources

  1. Kiro Official Documentation (Primary, December 1, 2026): Hook triggers - Hooks - Features — https://kiro.dev/docs/hooks/types/
  2. Kiro Official Documentation (Primary, November 30, 2026): Hook actions - Hooks - Features — https://kiro.dev/docs/hooks/actions/
  3. AWS Security Bulletin (Primary, June 2, 2026): CVE-2026-10591 - Kiro IDE Insufficient File Write Restrictions to Execution-Sensitive Paths (2026-037-AWS) — https://aws.amazon.com/security/security-bulletins/2026-037-aws/
  4. NIST NVD (Primary, June 2, 2026): CVE-2026-10591 Detail — https://nvd.nist.gov/vuln/detail/CVE-2026-10591
  5. NeuralTrust (Secondary Integration & Research, December 1, 2026): Kiro Security: NeuralTrust Integration — https://neuraltrust.ai/blog/kiro-security

More on Security

Security

What Mend.io's 2026 AppSec Study Reveals About Securing AI-Written Code

Published December 3, 2026, Mend.io's State of AI in AppSec report surveys 500 enterprise security practitioners: 70% report AI writes or modifies at least a quarter of production code, driving 77% more security findings while AppSec owns AI feature security at only 12% of firms. This breakdown examines the Leaders-vs.-Laggards data and outlines enforceable PR, IDE-hook, and shadow-AI controls.

8 min read

Tell us what is not working

A thirty-minute call, no deck and no obligation. You will leave with a straight answer about whether this is worth building - including if that answer is no.

Start a project

Direct line

hello@codebumble.net
Dhaka, Bangladesh  :   local timeCalls in English or Bangla