r/ethdev • u/Any_Good_2682 • 18d ago
My Project Build in public: our ERC's reference implementation had a privilege-escalation bug. Post-mortem + the fix merged into ethereum/ERCs this week
We maintain ERC-8259 (on-chain identity, tiered verification and a threat registry for autonomous AI agents). During an internal audit of our reference implementation last week, we found a critical bug. Sharing the post-mortem because every ERC author will hit this eventually: your reference implementation becomes a footgun the moment the spec moves.
The bug (two parts):
- Registration accepted
verification_tierdirectly at registration time — self-assigned privilege escalation. isActivewas not checked ingetEffectiveTier,isVerified, orcalculateTrustScore. A deactivated agent kept verified status and trust-score benefits. Picture deactivating a compromised agent — and its accumulated reputation still passes aminTrustScore(700)gate on someone else's contract.
What we did, in order (all commit-dated in the repo):
- Nov 2 — incident lifecycle landed in the spec (PR #2137 merged upstream):
IncidentStatus,retractAttack/resolveAttack, T7 invariant. Threats can be retracted, not just forever-append. - Nov 3 — deprecated our own pre-#2137 Sepolia Vyper deployment, loudly: README warning banner, deprecation headers on legacy contracts, CHANGELOG + security upgrade notice. It lacks
verification_expiry,get_effective_tierand the incident lifecycle. Redeployment tracked in Issue #2. - Nov 4 — fixed the invariant in the repo (
2824257), pushed the spec change upstream as PR #2142, merged the same day. Added an adversarial attack test suite for the registry (phase C4), runnable withforge testfrom the repo root. - Nov 6–8 — implemented the trust-score Groth16 circuit (Circom), integrated a real prover into the gateway, sanitized ZK over-claims in docs/UI, published npm
erc-8259@1.3.1.
Lessons, if you're maintaining an ERC:
- Ship the spec as an npm package with versioned interfaces + NatSpec, not as a gist people copy-paste. A stale interface outlives every blog post.
- Write the deprecation warning the day you know, not the day someone asks.
- Adversarial tests belong in the repo, executable by anyone who clones it.
Repo (Sigui — the agent-security layer this ERC is part of): https://github.com/ibonon/Sigui
What we'd love review on: the T8 trust-score expiry rule and the tier-verification invariants. And if you've maintained an EIP/ERC: how did you handle "already deployed, spec changed"? Genuinely curious what the norm is.

