Join our Newsletter — 33% off our NHI Course
Home› FAQ› Threats, Abuse & Incident Response› What is an example of Rules File Backdoor:…
Threats, Abuse & Incident Response

What is an example of Rules File Backdoor: Supply Chain Attack on AI Coding Assistants in practice?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated October 18, 2026 Domain: Threats, Abuse & Incident Response

An example of Rules File Backdoor: Supply Chain Attack on AI Coding Assistants is a poisoned instruction file in a repository that silently changes how the assistant generates code, reviews pull requests or handles secrets. Defenders should review repository rules files like code, restrict write access, and test assistants against malicious instruction changes.

What the backdoor looks like in a real code-assistant workflow

A practical Rules File Backdoor is usually a repository file that the assistant treats as instructions, so a small text change can redirect coding behavior without changing any application code. That makes it useful for attackers because the modification can look like normal project housekeeping while silently influencing generation, review, and secret-handling decisions. One concrete pattern is a poisoned instruction file that tells the assistant to prefer unsafe dependencies, skip certain checks, or expose context that should stay private.

The attack works best when teams let the assistant trust repository instructions by default and do not review those files with the same discipline as source code. In that setting, the backdoor is not a binary exploit, it is a governance failure over an execution-adjacent control plane. The closest real-world lesson is the category of AI coding assistant compromise described in Amazon Q Developer extension compromise 2025, where injected instructions altered how an AI coding agent behaved.

Why the repository file is such an effective supply chain vector

The supply chain angle matters because the malicious change lives upstream of the assistant’s output. If the file is committed into a repo, synced through a template, or inherited from a shared project scaffold, the poisoned instruction can spread wherever that codebase is cloned or reused. That makes the compromise scalable: a single change can affect many developers, many pull requests, and sometimes multiple environments if the assistant has access beyond the local editor.

This is also why the threat is broader than prompt injection in a chat window. The attacker is not trying to win one conversation, but to alter the assistant’s standing instructions and therefore its default behavior. In practice, that can turn the assistant into a delivery mechanism for hidden policy changes, unsafe refactors, misleading code review comments, or secret exposure. For teams building or using AI coding assistants, the AI Coding Agents Security Guide is a useful reference point because it treats agent instructions, secrets in context, and sandboxing as one connected risk surface.

How defenders should handle rules files and assistant trust

The practical control is to treat rules files as security-sensitive configuration, not as casual documentation. That means write access should be limited, changes should be code reviewed, and the assistant should not be allowed to consume untrusted instruction sources without guardrails. If a repository uses shared assistant rules, those files should be versioned, diffed, and tested the same way you would test a build script or deployment policy.

Teams also need to verify what the assistant can actually see and do after a rules change. If the assistant can read secrets, open pull requests, suggest dependency updates, or call tools, then a malicious instruction file can become an authorization bypass in practice. The right response is to reduce standing trust, narrow write permissions, and test the assistant against hostile rule edits before they reach production workflows.

Risk and Threat Considerations

A poisoned rules file can create both integrity risk and secret-exposure risk at the same time. The dangerous part is not only that the assistant may generate bad code, but that it may follow attacker-chosen instructions with legitimate project access, which makes the abuse harder to spot in normal review.

Failure mechanism: An attacker lands a malicious instruction file or modifies an existing one so the assistant silently changes behavior for code generation, review, or secret handling, while appearing to follow normal repository guidance.

Impact: The assistant can introduce unsafe changes, leak credentials or tokens from context, weaken reviews, or normalize attacker-controlled behavior across repeated developer workflows.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10, MITRE ATT&CK and OWASP API Security Top 10 define the specific risk controls and attack patterns relevant to this topic.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-02 — Secret LeakagePoisoned rules can steer assistants into exposing secrets from context.
NHI-05 — Overprivileged NHIAssistant behavior changes matter most when it has broad repo or tool access.
NHI-10 — Human Use of NHIThis attack relies on humans trusting machine instructions as operational authority.
Recommendation — Restrict assistant exposure to secrets and test for instruction-driven leakage paths. Limit assistant permissions to the minimum needed for its workflow. Separate human review from assistant-generated instructions and require approval for rule changes.
MITRE ATT&CKT1195 — Supply Chain CompromiseA poisoned rules file is a supply-chain entry point into assistant behavior.
Recommendation — Hunt for tampered repository instructions and validate upstream file integrity.
OWASP API Security Top 10API5 — Broken Function Level AuthorizationThe assistant can perform actions it should not be allowed to initiate from repo instructions.
Recommendation — Enforce function-level authorization on assistant-triggered actions and tool calls.

Practitioner Guidance

What to verify: Confirm which repository files the assistant treats as authoritative instructions, who can change them, and whether those changes are reviewed with the same rigor as application code. If the answer is “any contributor can edit them,” treat that as a security weakness, not a convenience.

Decision rule: If a rules file can influence tool use, secret handling, dependency selection, or pull request review, place it under protected ownership and test it with malicious edits before trusting it in day-to-day development.

Practitioner takeaway: The key control is not just detecting malicious instructions, it is preventing repository text from becoming an unreviewed authority over an assistant that can act on real code and real secrets.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org