<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Er.piyush Singh</title>
    <description>The latest articles on DEV Community by Er.piyush Singh (@erpiyush_singh_4a31ff5d1).</description>
    <link>https://dev.to/erpiyush_singh_4a31ff5d1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1902093%2F9e789f09-4aaf-4db5-92a0-fbfa3b3e9ad2.png</url>
      <title>DEV Community: Er.piyush Singh</title>
      <link>https://dev.to/erpiyush_singh_4a31ff5d1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/erpiyush_singh_4a31ff5d1"/>
    <language>en</language>
    <item>
      <title>When Your AI Agent Gets Breached, Can You Prove What It Did?</title>
      <dc:creator>Er.piyush Singh</dc:creator>
      <pubDate>Tue, 01 Sep 2026 20:36:58 +0000</pubDate>
      <link>https://dev.to/erpiyush_singh_4a31ff5d1/when-your-ai-agent-gets-breached-can-you-prove-what-it-did-4lf0</link>
      <guid>https://dev.to/erpiyush_singh_4a31ff5d1/when-your-ai-agent-gets-breached-can-you-prove-what-it-did-4lf0</guid>
      <description>&lt;p&gt;&lt;em&gt;Introducing AgentTrace — an open-source, offline forensic tool for reconstructing AI-agent security incidents.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;AI agents are no longer demos. LLMs wired to tools, memory, retrieval, and other agents are running in production — reading data, calling APIs, moving money, touching customer records. And like everything else that touches production, they get caught up in security incidents.&lt;/p&gt;

&lt;p&gt;But investigating an AI-agent incident is not like traditional digital forensics. I kept running into the same wall, so I built a tool for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why AI-agent forensics is genuinely different
&lt;/h2&gt;

&lt;p&gt;Three things break the usual DFIR playbook.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The attack vector is natural language.&lt;/strong&gt; When an attacker plants a malicious instruction in a document an agent will retrieve, that instruction looks identical to a legitimate query in every log most teams collect. There is no binary payload, no CVE signature, no network packet that lights up. The exploit is a sentence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The anomaly is the sequence, not any single event.&lt;/strong&gt; Every individual tool call the agent makes is authorized and looks normal. "Read a file." "Call an API." "Make an HTTP request." Nothing is wrong on its own. The attack is the &lt;em&gt;order&lt;/em&gt; — retrieve poisoned content, then access a secret, then send data out. You cannot see it unless you have the whole chain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The evidence is scattered and short-lived.&lt;/strong&gt; The pieces live in six or seven different systems: LLM invocation logs, tool execution traces, MCP server logs, vector-store retrieval logs, OAuth records, egress logs. Different teams own each one. Different retention windows delete each one. One documented 2026 incident produced roughly 17,600 agent actions in five days; the team's own postmortem called reconstructing it by hand "impractical."&lt;/p&gt;

&lt;p&gt;The key insight: the industry has mostly solved &lt;em&gt;recording&lt;/em&gt; agent activity (OpenTelemetry's GenAI conventions, MCP logging, tamper-evident audit logs). What nobody had was an automated way to &lt;em&gt;reconstruct&lt;/em&gt; what actually happened from that recorded evidence. That gap is what AgentTrace fills.&lt;/p&gt;

&lt;h2&gt;
  
  
  What AgentTrace does
&lt;/h2&gt;

&lt;p&gt;AgentTrace is the investigation layer that sits downstream of the recorders. Point it at your evidence, and it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ingests 7 evidence sources&lt;/strong&gt; into one normalized schema.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verifies integrity + chain of custody&lt;/strong&gt; — hash-chain verification, gap and witness-anchor detection, HMAC-signed manifests, and a tamper-evident custody ledger.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reconstructs the causal attack chain&lt;/strong&gt; across fragmented logs (timeline + provenance-style causal graph).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detects 6 attack patterns&lt;/strong&gt;, each mapped to a &lt;strong&gt;MITRE ATLAS&lt;/strong&gt; technique and linked to the exact evidence: prompt injection via retrieval, exfiltration via tool chaining, OAuth/credential-theft chains, sub-agent hijack, memory poisoning, tool-permission escalation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Builds kill-chain narratives and a 0–100 risk score.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Produces reports&lt;/strong&gt; in JSON, Markdown, and self-contained offline HTML (with an SVG causal graph), including an &lt;strong&gt;EU AI Act Article 12&lt;/strong&gt; coverage section.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exports portable, signed case bundles&lt;/strong&gt; for air-gapped transfer.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Two design choices I won't compromise on
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;No AI/ML in the detection path.&lt;/strong&gt; Every finding is deterministic and traces back to concrete evidence. A forensic tool has to be explainable — a model that says "I think this is an attack" does not survive a review, an audit, or a courtroom.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local-first, zero dependencies.&lt;/strong&gt; It runs fully offline on the Python standard library alone. No cloud, no account, no API key.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it looks like in practice
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;agentdfir

&lt;span class="c"&gt;# What happened? Any known attack patterns?&lt;/span&gt;
agenttrace detect logs/&lt;span class="k"&gt;*&lt;/span&gt;.json logs/&lt;span class="k"&gt;*&lt;/span&gt;.jsonl

&lt;span class="c"&gt;# Is the evidence trustworthy — altered or missing?&lt;/span&gt;
agenttrace verify logs/&lt;span class="k"&gt;*&lt;/span&gt;.jsonl &lt;span class="nt"&gt;--signing-key&lt;/span&gt; &lt;span class="s2"&gt;"case-key"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--case-number&lt;/span&gt; &lt;span class="s2"&gt;"IR-2026-0042"&lt;/span&gt; &lt;span class="nt"&gt;--case-officer&lt;/span&gt; &lt;span class="s2"&gt;"A. Analyst"&lt;/span&gt;

&lt;span class="c"&gt;# Produce a report for management / legal / a regulator&lt;/span&gt;
agenttrace report logs/&lt;span class="k"&gt;*&lt;/span&gt;.json logs/&lt;span class="k"&gt;*&lt;/span&gt;.jsonl &lt;span class="nt"&gt;--html-out&lt;/span&gt; report.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On a synthetic multi-source incident, &lt;code&gt;detect&lt;/code&gt; surfaces things like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[CRITICAL] exfiltration_via_tool_chaining — 25 calls to 'crm_export' in 48s,
           monotonically increasing offsets  (MITRE ATLAS AML.T0057)
[CRITICAL] oauth_credential_theft_chain    — credential access -&amp;gt; rapid egress
[HIGH]     prompt_injection_via_retrieval  — poisoned chunk -&amp;gt; new sensitive tool
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each finding links to the exact events behind it, and the HTML report renders the whole story as a causal graph: poisoned document entered context → agent behavior shifted → credentials accessed → data left the building.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chain of custody, everywhere
&lt;/h2&gt;

&lt;p&gt;Forensic output is only useful if it holds up. Every stage — acquisition, verification, analysis, reporting, export, transfer — is written to a tamper-evident, hash-chained ledger attributed to a case officer, with tool version and timestamps. Reports and manifests are cryptographically bound to the exact evidence they were built from.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it / contribute
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PyPI:&lt;/strong&gt; &lt;code&gt;pip install agentdfir&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repo:&lt;/strong&gt; &lt;a href="https://github.com/piyush295/agenttrace" rel="noopener noreferrer"&gt;https://github.com/piyush295/agenttrace&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Apache-2.0, offline, dependency-free.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'd genuinely value feedback from anyone doing incident response on agentic systems — especially on the detection heuristics and which additional evidence sources are worth supporting next.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorized, defensive use only.&lt;/strong&gt; AgentTrace analyzes evidence you are authorized to investigate; it is not an attack or surveillance tool.&lt;/p&gt;

</description>
      <category>aisecurity</category>
      <category>dfir</category>
      <category>security</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
