Most agent security write-ups end with "add a guardrail." The four cases below are more useful than that, because every one of them already had a guardrail. The guard ran. It just compared the wrong thing: a string instead of a path, a URL instead of what the URL would do, a file someone else wrote instead of the facts, an instruction instead of a rule in code.
That's a fixable class of bug, and you can test your own setup for it in about twenty minutes. The checks are at the end.
As usual, I only use details I could confirm on the primary source, with links next to each item.
1. A trailing dot got Copilot past its own config guard
Embrace The Red published on October 13 that Copilot in Visual Studio (and SQL Server Management Studio, which shares the same Copilot DLL) could write to its own settings and configuration files, including .mcp.json. The check that was meant to stop that compared file names as strings. Ask to write .mcp.json. with a trailing dot and the strings don't match, so the write is allowed. Then Windows drops the trailing dot when it creates the file, and the write lands on .mcp.json anyway. Once an agent can edit its MCP config, it can add a server that runs a command.
Microsoft tracks it as CVE-2026-103572, rated Important, and the patch shipped on October 13.
The lesson isn't "Windows is weird." It's that a guard which compares text can be beaten by any text the file system treats as the same file: trailing dots and spaces on Windows, case differences, .. segments, symlinks.
Source: https://embracethered.com/blog/posts/2026/visual-studio-copilot-remote-code-execution/
2. An OAuth URL from an MCP server became a shell command
Pillar Security reported on October 19 that opencode versions 1.0.137 through 1.18.32, on Windows and WSL, could run code supplied by a malicious remote MCP server. During OAuth, the server returns an authorization_endpoint. opencode passed that value to a helper that opens URLs, and on Windows that helper goes through PowerShell. A $(...) inside an otherwise valid-looking https URL was executed. macOS and Linux were not affected, per the post. It was fixed in 1.18.33.
The URL "looked like" a URL, so it was treated as safe to open. What mattered was what the opener would do with it.
Source: https://www.pillar.security/blog/open-and-shut-remote-code-execution-in-opencode-via-mcp-oauth
3. An official skill taught agents a domain the vendor didn't own
AIR published on October 14 that OpenAI's render-deploy skill told agents that private Render services live under [service-name].render-internal.com. Per AIR, that wasn't Render's internal domain. Codex then wrote it into generated application code and deployment settings. After AIR registered the domain as a sinkhole, live calls carrying tokens arrived from real applications. Render removed the references in August, OpenAI removed the plugin from its plugin repository later that month, and the domain is now held by Render.
Nobody's guard was bypassed here. The skill was trusted because of where it came from, and nothing checked the hostnames it put into code.
Source: https://www.air.security/blog-posts/render-openai
4. Customer scope lived in the prompt, so a web page could move it
Arize ran a controlled experiment, published October 26: a customer-support agent with tools to fetch a URL and look up customer records, tested against 100 poisoned order-status pages built from synthetic customer data. With no defense, 28 of 100 runs pulled another customer's record. With each customer tool bound to the logged-in session in code, out-of-scope lookups were still attempted, but none returned data.
The instruction "only look at this customer" was a request to the model. The session check in code was a rule.
Source: https://arize.com/blog/indirect-prompt-injection-ai-agents
The pattern
Each guard checked a label:
a file name, instead of the file the OS will actually write
a URL string, instead of what opening it will execute
a trusted source, instead of the hostnames that source put into code
an instruction, instead of a scope enforced outside the model
The fix in every case is the same move: resolve the thing first, then compare. And put the comparison somewhere the agent can't talk its way past.
The 20-minute check
1. Resolve paths before you compare them (5 min). If you have any hook or wrapper that blocks writes to agent config, test it with a trailing dot, a trailing space, a different case and a .. path. If any of those gets through, compare resolved paths instead:
import os
PROTECTED = [".mcp.json", ".claude/settings.json", "~/.claude.json", "~/.codex/config.toml"]
def resolved(p: str) -> str:
p = os.path.expanduser(p)
if os.name == "nt":
p = p.rstrip(" .") # Windows drops trailing dots and spaces on write
return os.path.normcase(os.path.realpath(p))
PROTECTED_SET = {resolved(p) for p in PROTECTED}
def is_protected(path: str) -> bool:
return resolved(path) in PROTECTED_SET
assert is_protected(".mcp.json.") if os.name == "nt" else True
assert is_protected("./sub/../.mcp.json")Paths are relative to where the agent starts, so run it from the project root.
2. Never hand a server-supplied URL to a shell (5 min). Search your agent tooling for anything that opens URLs (open, xdg-open, start, webbrowser, a child_process call). For URLs that come from an MCP server or a web page, check the scheme is https, the host is one you expect, and that it has no shell metacharacters ($, backticks, ;, |) before you open it. Better: don't open it automatically at all.
3. Check the hostnames in generated code (5 min). After an agent writes code or config from a skill or plugin, list every hostname it contains and compare against a short allowlist:
import pathlib, re, sys
ALLOWED = {"api.github.com", "api.render.com"} # replace with your own list
HOST = re.compile(r"\b((?:[a-z0-9-]+.)+(?:com|net|org|io|dev|app|cloud))\b", re.I)
EXT = {".py", ".js", ".ts", ".json", ".yaml", ".yml", ".toml", ".env", ".md"}
for f in pathlib.Path(sys.argv[1] if len(sys.argv) > 1 else ".").rglob("*"):
if f.is_file() and f.suffix in EXT and "node_modules" not in f.parts:
for host in sorted({h.lower() for h in HOST.findall(f.read_text(errors="ignore"))}):
if host not in ALLOWED and not any(host.endswith("." + a) for a in ALLOWED):
print(f"{f}: {host}")Anything you don't recognize gets looked up before it ships. Also pin skill and plugin versions and read the diff when they update. A skill is code you didn't review.
4. Move scope out of the prompt (5 min). List every tool that takes an ID (customer, account, repo, channel). For each one, ask: if the model passes a different ID, does code refuse? If the answer is "the prompt tells it not to," that's the next thing to fix.
What this looks like in my own setup
My setup is small: a scheduled job posts to X through the official API, and the checks that matter live in the script, not in the prompt.
Before posting, the script asks X which account the token belongs to and refuses if it isn't the expected one. That result is cached once a day, so it is not checked on every single post.
The daily cap and allowed hours are read from a file by the script before every send. Outside those hours it does nothing, whatever the instructions say.
Every write is recorded as "attempt" in a ledger before the API call, then "sent". An attempt with no result blocks the queue instead of retrying. From October 9 to November 8 that ledger shows 55 attempts and 55 sent, with no unknown results.
One gap I've mentioned before and still haven't closed: the hooks file in my public Claude Code plugin doesn't set onFailure yet, so a hook that crashes may not block the action. Fixing that is on my list, and this week's cases are a good reminder why a guard's failure mode matters as much as its rule.
Short version
Compare resolved paths, not file names.
Don't let a server's URL reach a shell.
List the hostnames in code an agent wrote from a skill.
If scope is only in the prompt, it isn't scope.
If you want the one-page version of the checks I run before an agent acts on its own, it's free (Agent Ops Pre-Flight Checklist): https://neuralalpha.gumroad.com/l/agent-ops-preflight?utm_source=substack&utm_medium=article
Originally published on NeuralAlpha. I write weekly about running AI agents in production.
The operating kit I use for this (guide, skills, templates, tested scripts): AI Staff Operating Kit for Claude Code.

