Dev.to Security 🔐 Cybersecurity 👁 2 📖 3 min read

GitHub signed the email. A stranger wrote the body.

I built HijackRewind for Agentware 2026, the 72-hour hackathon run by Hackathon Raptors. It watches a GitHub account-security alert and reverts only the unauthorised change: an unknown SSH key, a deploy key, a webhook on

I built HijackRewind for Agentware 2026, the 72-hour hackathon run by Hackathon Raptors. It watches a GitHub account-security alert and reverts only the unauthorised change: an unknown SSH key, a deploy key, a webhook on a host that should not be there. Sandbox mode is the default. Live mode was tested once, on a throwaway account.

The whole design rests on one idea. Only a real GitHub account alert should be allowed to start a plan. So I stopped trusting the Authentication-Results: dkim=pass header and verified the DKIM signature with dkimpy. The signing domain has to be github.com, and it has to align with From. A lookalike such as github.com.evil.test is quarantined. Claims come from the signed text/plain part, not from HTML that someone could tinker with.

On the official Trap Pack, all of that held. Twenty hostile files: 7 caught by the egress guardrail, 13 held, 0 mutated. No canary left in a tool request or a tool response.

The near miss was not in the hostile pack. It was in mail that really was signed by GitHub.

GitHub signs more than account-security alerts. It also signs notification mail for issue comments and pull request reviews, with d=github.com. The envelope is GitHub's. The words are written by whoever commented. My verifier did not distinguish those two facts. A message from [email protected], signed and aligned, came back as:

DKIM signature verified for github.com

That was enough to start a plan.

The regression test in PR #6 makes the path concrete. It writes a DKIM-signed message from [email protected] whose body is:

A new public key was added.
Key id: 99

Key 99 is a live object that is not on the known-good manifest. Before the fix, the agent extracted that id, matched it against the live account, and wrote a plan to delete it. After the hardening pass, auto-execute is off unless you set a flag, so this would have been a held plan, not a silent delete. That is not a comfort. The plan would have arrived as a verified GitHub account alert. An operator who trusted that label, or a run with auto-execute turned on, would have had every reason to let it through.

The fix is an allowlist of exact From addresses, defaulting to [email protected], which is the account-alert sender. Domain allowlisting is no longer enough.

channel = verify_channel(
    document,
    services.settings.allowlisted_domains(),
    dns=services.settings.dkim_mode(),
)
if channel.verified and (document.from_address or "").lower() not in services.settings.alert_sender_addresses():
    # A signed GitHub notification (an issue comment, for example) carries text
    # a stranger wrote. Only the account-alert sender can start a plan.
    channel.verified = False
    channel.reason = "sender address is not an account-alert sender"

That check landed in commit a5cfdf5, merged as 4483e26 on 28 November 2026. The test test_signed_github_notification_cannot_start_a_plan now expects a channel_rejected audit event with the reason sender address is not an account-alert sender, no mutate, and a status that is not executed. Four new regression tests were added. 87 tests passed.

The same audit turned up a smaller cousin of the same mistake. When HijackRewind contains a webhook, it saves a rewind body so the hook can be put back. GitHub does not return the hook secret. It returns config.secret as ********. The rewind path posted that mask as the new secret. The README already said a restored hook has no secret. The code still trusted the field. The fix drops secret and posts the rest of the config:

# GitHub returns a masked secret. Posting the mask would set it as the secret.
"config": {k: v for k, v in (match.get("config") or {}).items() if k != "secret"},

A valid signature tells you who mailed the message. A masked field tells you GitHub is hiding a value. Neither one tells you what the words inside mean, or what you should write back. I had already learned not to trust a dkim=pass header. I still almost trusted the wrong GitHub From address, and I almost wrote eight asterisks into a webhook secret, because both values came from GitHub and both looked finished.

This is my Near Miss write-up for Agentware 2026, run by Hackathon Raptors. The Near Miss awards are backed by FileClerk, which builds UK company filing tools for people and AI agents.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.