Trained to betray: How post-training supply chain attacks hijack coding agents
Microsoft researchers found that specialized AI agents can be hijacked by post-training supply chain attacks, requiring independent controls outside the model.
Overview
Microsoft Defender Research and the Microsoft AI Red TeamAn exercise where security specialists mimic a real adversary to test an organization's people, networks, and detection published two studies showing that coding agents can be compromised through the post-training supply chain. These agents are designed to inspect repositories, read files, and execute commands, which gives them significant access to sensitive development environments. The researchers demonstrated that attackers can hide malicious behavior in the training data or model weights, causing the agent to misuse its tools when it sees a specific trigger. In one scenario involving dataset poisoning, the attack reached approximately 78% success on in-distribution harnessesA small wrapper program written to feed test inputs into a software library and watch for crashes. In a second scenario involving model poisoning, the average success on unseen repositories ranged from 84.1% to 94.8%. Organizations that deploy these specialized AI agentsArtificial intelligence software that can plan steps, call tools, and take actions on its own are affected because the compromised models can execute unsafe actions while appearing to complete benign tasks.
Terms in this story
- Red Team
- An exercise where security specialists mimic a real adversary to test an organization's people, networks, and detection. Unlike a standard scan that checks one app for bugs, red teaming simulates a full campaign with phishing, lateral movement, and privilege escalation to see how the defending team responds. Security+ objective 5.5 lists the term
- harnesses
- A small wrapper program written to feed test inputs into a software library and watch for crashes. Security researchers write a test harness around a file parser or network library so a fuzzing tool can feed it millions of mutated inputs per hour.
- AI agents
- Artificial intelligence software that can plan steps, call tools, and take actions on its own. Many stories cover agentic AI when companies connect language models to email, browsers, and databases, creating new risks if a hidden prompt tricks the agent into leaking data.
- supply chain attacks
- Breaking into a software maker or vendor so their trusted product or update infects their customers. Instead of attacking a hundred companies one by one, an intruder compromises a single software library or update server that all of those companies already trust. Security+ objective 2.2 lists the term
- remote code execution
- A flaw that lets an attacker run their own code on someone else's computer over a network. This is one of the most dangerous bug classes in the news because an attacker across the internet can send a crafted request and take control of a server.
- observability
- How well a team can see what is happening inside a system from its logs and metrics. Engineering and security teams invest in observability tools so that when a cloud service slows down or behaves strangely, they can trace every request across servers. Security+ objective 4.4 lists the term
- backdoor
- A hidden way into a computer or program that skips the normal login check. Attackers plant a backdoor on a compromised server so they can return later even if the administrator changes passwords or fixes the original flaw. Security+ objective 2.4 lists the term
- tool call
- A structured request from an AI model asking its host program to run an external function. When an AI assistant checks your calendar, runs a shell script, or queries a database, it emits a tool call that the surrounding software executes.
- open-weight
- An AI model whose trained numerical parameters are publicly downloadable so anyone can run it locally. Security researchers debate open-weight models because anyone can inspect and fine-tune them on their own hardware, but users can also strip out built-in safety filters.
- reinforcement learning
- Training an AI model by rewarding good actions and penalizing mistakes across many trial runs. New language and coding models use reinforcement learning after initial training to get better at solving multi-step problems and refusing harmful requests.
- pipelines
- The automated pipeline that tests, builds, and deploys software whenever developers push new code. Attackers love to compromise a company's CI/CD pipeline because that build server holds cloud keys and can inject malicious code directly into official software releases. Security+ objective 4.7 lists the term
- APIs
- A structured interface that lets one software program request data or actions from another program. Mobile apps, websites, and cloud services talk to backend servers through an API, and a poorly protected API can let attackers pull customer records in bulk. Security+ objective 4.7 lists the term
This page is a short description made for this site. The article itself, with its author's name and its own link, is on the Microsoft Security Blog website. Cite the article, not this page.
Read the full article on Microsoft Security Blog (opens in a new tab)
Course connections
Each line below connects this story to a Security+ objective (a skill on CompTIA's Security+ exam, a common first cybersecurity certification), a CYBR 101 week, or a cybersecurity job, and quotes the words that made the connection.
- Kind of story: Research and reports
"Two studies of the post-training supply chain..." Found by reading the article; these exact words are in it - Who is affected: "...organizations..." Organizations using the product
Copied word for word from the article - Security+ 2.2 Explain common threat vectors and attack surfaces.
"Trained to betray: How post-training supply chain attacks hijack coding agents..." Found in the headline - Security+ 2.3 Explain various types of vulnerabilities.
"Trained to betray: How post-training supply chain attacks hijack coding agents..." Found in the headline - Security+ 5.3 Explain the processes associated with third-party risk assessment and management.
"Trained to betray: How post-training supply chain attacks hijack coding agents..." Found in the headline - Security+ 5.5 Explain types and purposes of audits and assessments.
"Microsoft Defender Research and the AI Red Team discuss how poisoned datasets and poisoned model..." Found in the opening sentences - CYBR 101 week 1: the course, logins and two-factor sign in, cyber roles and jobs
"Microsoft Defender Research and the AI Red Team discuss how poisoned datasets and poisoned model..." Found in the opening sentences - CYBR 101 week 11: penetration testing, OSINT, MITRE ATT&CK and hacking back
"Microsoft Defender Research and the AI Red Team discuss how poisoned datasets and poisoned model..." Found in the opening sentences - CYBR 101 week 6: AI, how it is attacked, and what it does for attackers and defenders
"Microsoft Defender Research and the AI Red Team discuss how poisoned datasets and..." Found in the opening sentences - CYBR 101 week 7: Linux, Windows, permissions and firewalls
"Microsoft Defender Research and the AI Red Team discuss..." Found in the opening sentences - CYBR 101 week 9: malware, indicators and how detection works
"Microsoft Defender Research and the AI Red Team discuss..." Found in the opening sentences
How a story is connected to the course, and every objective, week and job role