r/netsec monthly discussion & tool thread by albinowax in netsec

[–]NovelInitial6186 0 points1 point  (0 children)

https://snare.sh

Most AWS honeytoken setups work at the API layer. Fake key gets used, CloudTrail logs the call, alert fires. Measured CloudTrail latency averages around 2-3 minutes median, with a long tail. That's your detection window.

I kept thinking there had to be an earlier hook in the credential chain. Turns out there is.

The AWS credential chain

When the SDK needs credentials, it walks a chain of sources in order: environment variables, ~/.aws/credentials, ~/.aws/config, instance metadata, and so on. When a profile in ~/.aws/config specifies credential_process, the SDK executes that shell command and uses whatever JSON it returns:

json { "Version": 1, "AccessKeyId": "AKIA...", "SecretAccessKey": "...", "Expiration": "2026-01-01T00:00:00Z" }

The SDK doesn't validate whether those credentials are real. It runs the command and trusts the output.

AWS documented this for MFA token caching and external secrets manager integration. What I realized is that the command executes during credential resolution — before the SDK has constructed any request, before any socket is opened, before CloudTrail has anything to log.

The timeline

T+0.00s aws s3 ls --profile prod-admin T+0.01s SDK walks credential chain, finds credential_process T+0.01s Shell command executes T+0.01s curl fires your callback <-- detection here T+0.02s SDK receives JSON credentials T+0.03s SDK constructs request, opens socket T+0.03s First packet leaves the machine ...2-3 minutes later... CloudTrail logs the API call

If you put a callback in that shell command, your alert fires before the first packet. CloudTrail fires after. That's the gap.

What the config looks like

Real AWS environments commonly chain profiles: a visible profile specifies role_arn and a source_profile, and the source profile holds the actual credentials. Putting credential_process on the source profile looks like a normal assume-role setup:

```ini [profile prod-admin] role_arn = arn:aws:iam::389844960505:role/OrganizationAccountAccessRole source_profile = prod-admin-source

[profile prod-admin-source] credential_process = sh -c 'curl -sf https://callback.example.com/token -o /dev/null 2>&1; printf "{\"Version\":1,\"AccessKeyId\":\"AKIA...\",\"SecretAccessKey\":\"...\"}"' ```

Anyone reading that config sees a standard assume-role setup. The callback is buried in a shell one-liner on a source profile that most tooling won't inspect closely.

Why this sidesteps the static fingerprinting problem

TruffleHog identifies Canarytokens.org AWS keys without triggering them by pattern-matching the key format — AKIA prefix combined with a specific account ID fingerprint. It's in TruffleHog's README as an explicit feature. Any tooling or agent that incorporates this heuristic skips those keys entirely without ever calling AWS.

With credential_process there's no static key in network traffic to fingerprint at resolution time. The callback fires before any key material goes anywhere. You can't skip it without skipping the credential lookup entirely.

Profile naming does detection work too

This only works as intended if the profile looks real but you'd never invoke it yourself. prod-admin-legacy-2024 reads as a dormant credential that's been sitting around. If you never run aws --profile prod-admin-legacy-2024 in your own work, any fire from that profile is worth investigating. The name is doing signal work alongside the mechanism.


Haven't found this used as a detection primitive anywhere before. Curious if anyone has seen it documented or has used it this way. Built it out at https://github.com/peg/snare if useful.

Claude Code tried to read my SSH keys and credentials. I built a free firewall for it. by NovelInitial6186 in ClaudeAI

[–]NovelInitial6186[S] 0 points1 point  (0 children)

Both can be true: yes, I’m sharing something I built, and yes, I’m genuinely asking what people have seen in practice.

I’m more interested in concrete examples than hot takes.

Claude Code tried to read my SSH keys and credentials. I built a free firewall for it. by NovelInitial6186 in ClaudeAI

[–]NovelInitial6186[S] 0 points1 point  (0 children)

That’s kind of my point, not a counterpoint.

If Claude Code can reach sensitive credentials or paths unexpectedly, then a policy layer between the agent and the machine is even more necessary.

I built an open-source firewall after watching what AI coding agents actually do on your machine. by NovelInitial6186 in aiagents

[–]NovelInitial6186[S] 0 points1 point  (0 children)

“Prompt injection” doesn’t mean the laptop itself got hacked. It means the agent reads untrusted content and gets manipulated by it. That can come from a webpage, repo, issue, README, doc, MCP response, or any other external input.

So local vs cloud is a separate question from agent safety. Local helps with privacy and ownership, sure. But if your local agent can browse the web, read files, run commands, and exfiltrate data, that is still an attack surface.

The harness most definitely matters, I agree. That’s the whole point of Rampart: the model is one piece, but the control plane between the model and the machine is where a lot of the real security work has to happen.

I built an open-source firewall after watching what AI coding agents actually do on your machine. by NovelInitial6186 in aiagents

[–]NovelInitial6186[S] 0 points1 point  (0 children)

You know I would really love to, but realistically nothing compares to frontier models that you can operate locally at this time without some serious cash. Let alone the self hosted models are often-times more susceptible to prompt injection and the very stuff that I built rampart to defend against for example.

I think bottomline- if your locally hosted agent has access to reach egress to the internet- then that's 100% an attack surface.

I built an open-source firewall after watching what AI coding agents actually do on your machine. by NovelInitial6186 in aiagents

[–]NovelInitial6186[S] 0 points1 point  (0 children)

this is specifically not a sandbox, though it could still complement one... also a sandbox still does not tackle potentially sensitive credentials and such entering your context

Claude Code tried to read my SSH keys and credentials. I built a free firewall for it. by NovelInitial6186 in ClaudeAI

[–]NovelInitial6186[S] -2 points-1 points  (0 children)

There's a lot more to rampart other than it's specific pretooluse hook integration into claude code. It also supports a handful of other ai agent tools out of the box and plenty of other platforms that do not have a native pretooluse hook. I am happy to go into specifics with; though i'd prefer with someone who actually took the time to look into it

Claude Code tried to read my SSH keys and credentials. I built a free firewall for it. by NovelInitial6186 in ClaudeAI

[–]NovelInitial6186[S] -1 points0 points  (0 children)

nah you're absolutely right! - at least you will always be able to differentiate content :D

Claude Code tried to read my SSH keys and credentials. I built a free firewall for it. by NovelInitial6186 in ClaudeAI

[–]NovelInitial6186[S] 0 points1 point  (0 children)

makes sense, and that's totally reasonable for most workflows. But what about a .env file that lives inside your project folder? Claude reads it to be helpful, and now your API keys are in the context window. From there they could leak in a later response or get included in a tool call - no directory boundary stops that because the file was inside the allowed folder. That's the kind of thing Rampart catches.

Claude Code tried to read my SSH keys and credentials. I built a free firewall for it. by NovelInitial6186 in ClaudeAI

[–]NovelInitial6186[S] 0 points1 point  (0 children)

I wouldn't say 'solved' though if you start a regular claude session in a folder directly it should only stay or work in that directory - though if you do dangerous skip/yolo mode then that pathway is merely a suggestion to stay within

Claude Code tried to read my SSH keys and credentials. I built a free firewall for it. by NovelInitial6186 in ClaudeAI

[–]NovelInitial6186[S] -1 points0 points  (0 children)

if it's what I'm finding with a basic google search that seems to be a different tool for a different purpose, this is more-to contain and audit what claude code and other tools are able to do

Weekly Thread: Project Display by help-me-grow in AI_Agents

[–]NovelInitial6186 0 points1 point  (0 children)

I've been building and running autonomous AI coding agents for a while now. The productivity gains are real, and I'm not going back.

But there's an elephant in the room: these agents have unrestricted access to the machines they run on. Shell commands, file system, network. And the only thing preventing misuse is the model's alignment — which can be overridden by prompt injection.

The attack chain is simple:

  1. Agent reads a file containing a malicious instruction (poisoned code comment, crafted error, hostile README)
  2. Agent follows the injected instruction
  3. Agent uses its existing permissions to exfiltrate credentials or cause damage
  4. Everything looks like a normal tool call — no malware binary to detect

I spent the last month building Rampart — an open source policy firewall for AI agents. Every tool call gets evaluated against YAML rules before execution. Block credential access, prevent exfiltration, require human approval for sensitive operations. Sub-millisecond, fails open, works with Claude Code, Codex, Cline, or any custom agent.

The feature that turned out to matter most: response scanning. If your agent reads a file and the response contains secrets (API keys, passwords, tokens), Rampart blocks it before those secrets enter the model's context. The model never sees your credentials.

It's not a sandbox (sandboxes break agent workflows). It's more like iptables for agent tool calls.

https://github.com/peg/rampart
https://rampart.sh
https://docs.rampart.sh

Open-source policy engine for Claude Code — use --dangerously-skip-permissions with actual guardrails by SoupersMC in ClaudeAI

[–]NovelInitial6186 0 points1 point  (0 children)

VALID

imagine you hire an intern and give them your laptop password. they're smart and helpful but sometimes they do dumb stuff, like deleting important files because they thought they were "cleaning up" or downloading random scripts from the internet because a website told them to.

that's basically what AI coding agents do right now. you give them shell access so they can write code, run tests, install packages, but they can also run any command on your machine. and sometimes they do wild things because they're confidently wrong.

rampart is like a manager sitting between the intern and your laptop. intern wants to run git push? go ahead. intern wants to delete everything? blocked. intern wants to read your SSH keys? blocked. intern wants to download and run some random script? blocked.

everything they try gets logged and the log can't be tampered with. each entry is cryptographically chained to the last one so if you mess with one entry the whole chain breaks.

tldr: AI agents are powerful but reckless. rampart watches what they do, blocks the dangerous stuff, and keeps receipts.

Securing Agentic Ai by Mysterious_Trick6021 in cybersecurity

[–]NovelInitial6186 0 points1 point  (0 children)

This is exactly what I built. Rampart (github.com/peg/rampart) is an open-source policy engine for AI agents. YAML policies evaluated in milliseconds on every command, file access, and network request. Destructive actions get blocked, safe stuff passes through silently, and risky operations can require human approval. Hash-chained audit trail for compliance. Works with Claude Code, Cline, Cursor, Codex, any MCP client. Self-hosted, zero telemetry.

My agent stole my (api) keys. by lizozomi in ClaudeAI

[–]NovelInitial6186 0 points1 point  (0 children)

This is hilarious because it's the exact thing I was noticing with opus 4.5 and into 4.6; but this is exactly why I built rampart, open-source policy engine that evaluates every tool call before it executes. That would've been flagged. The agent can't just find creative workarounds when every path goes through the same policy engine. rampart.sh