AGENTſ.md is AGENTS.md: how one long s slipped past Hermes approval


It is 1am and your agent is doing something routine: read a web page, summarise it. Buried in that page is one sentence telling the agent to write a preference into AGENTS.md. Hermes is supposed to stop and ask you first — files like that decide how the agent behaves later, so writing them always needs a human yes, even under --yolo.

Unless the agent spells the name AGENTſ.md. On a Mac that still opens AGENTS.md, and the old check would not have asked. PR #156929, merged on November 17, is about exactly that: not policy, but whether two names count as the same name.

The four names that always ask

Hermes keeps a short list of files that permanently sit behind an approval gate:

  • AGENTS.md
  • CLAUDE.md
  • SOUL.md
  • .cursorrules

They are special because they are read as instructions. Getting the contents of an ordinary file wrong costs you a bad diff; getting one of these wrong changes what the agent does next, which makes them a persistence channel for prompt injection. The rule is blunt: these basenames, in any directory, always require human approval, and without a human channel the write fails closed instead of proceeding.

You can turn the gate off with security.protected_instruction_files (default on), and add your own name patterns with security.protected_instruction_extra_patterns.

The bug was in the comparison

The old code compared basenames with str.lower(). On Linux that is roughly fine, because filenames are case-sensitive and a different spelling is a different file. macOS APFS does not compare that way: it applies full Unicode case folding plus normalisation. Some characters survive lower() unchanged but fold into something else entirely.

Name the agent writes after lower() after casefold() Opens on APFS
AGENTſ.md (U+017F long s) agentſ.md agents.md AGENTS.md
ſoul.md ſoul.md soul.md SOUL.md
.curſorruleſ .curſorruleſ .cursorrules .cursorrules

So lower() treats it as a brand new file, while the filesystem treats it as the protected one. The approval gate checks the name and waves it through; the disk overwrites the real file. No exploit technique required — just a different spelling in a prompt injection.

This is not unique to Hermes. CERT/CC VU#604762 documents the same class of bug around ß versus ss and NFC versus NFD, which produced CVEs in go-slug, Deno and setuptools. Any code that decides “is this the same file?” by comparing strings and then hands the name to the filesystem inherits the problem.

The fix: NFC, then casefold, on both paths

The patch is small. A new _name_key() normalises to NFC, applies full case folding, and that result is what gets compared against the protected list. It applies to the four built-in names and to the operator patterns in security.protected_instruction_extra_patterns.

Two details matter:

First, the old lowercase key is kept alongside the folded one, and both are matched. A glob pattern such as ? or [ß] matches the single character ß but not its folded ss, so dropping the old key would quietly break patterns that used to work. Folding is only allowed to add matches, never to remove them.

Second, matching runs against both the path as written and its realpath. A symlink pointing at a protected file — or a protected name that is itself a symlink — cannot escape in either direction. That part already existed; this change keeps it intact.

For the record, the credential deny lists and the project .hermes/ rule go through agent.file_safety.deny_key, which already casefolds on macOS and Windows, so they were not part of this patch.

What you actually need to do

Mostly nothing; upgrade when the fix ships. Three boundaries are worth knowing:

  • It is on main only right now. v0.23.2 shipped on November 16, and the PR merged on November 17, so no release contains it yet; the next one will. If you maintain a fork or a mirror, the change is 13 added lines and 3 changed ones in tools/file_tools_write_guards.py, plus two test files.
  • Linux gets stricter too. The same odd spellings now trigger the prompt there as well. That is deliberate: when you cannot be sure how the filesystem folds a name, asking once too often is the safer failure mode.
  • The PR says it was not verified on a real Mac. The APFS folding behaviour comes from the CERT note. That does not make the fix wrong, but if you are doing a security assessment, do not record “definitely exploitable” as established — treat it as one concrete case of a comparison method that was never reliable.

The takeaway

The dangerous bug in a security gate is rarely the policy. It is the gate’s idea of identity disagreeing with the system that actually performs the action. Filenames are just the latest example: approvals, path deny lists, credential checks — anywhere a string stands in for identity, ask whether the thing on the other side of the call will read that string the same way you did.

For neighbouring failure modes, see the git-config injection RCE and the approval rule that froze on a regex; the config keys themselves are documented in the hermes config reference.

Update (2026-11-20): these changes shipped in v0.23.3 (November 20) — hermes update brings them in. The “on main only / no release contains it yet” wording above reflects publication day.