AI Coding Assistants Become New Attack Targets: DNS Covert Channels Used to Steal Developer Credentials

Attackers use DNS covert channels in setup scripts to steal credentials from AI coding assistant users.
Security researchers have uncovered a new attack targeting AI coding assistants like Claude Code. Malicious code hidden in repository setup scripts uses DNS queries as a covert channel to dynamically fetch attack instructions at runtime, bypassing static code scanning. Sensitive credentials including API keys can be stolen, and developers are advised to review scripts manually, apply least-privilege principles, and monitor DNS traffic.
A New Attack Targeting AI Coding Assistants Has Emerged
Security researchers have recently disclosed an alarming attack technique targeting AI coding assistants like Claude Code. Unlike traditional software supply chain attacks, this method exploits the "auto-execution" behavior of AI agents, concealing malicious activity within seemingly normal workflows — successfully bypassing virtually every static code scanning tool.
As more developers rely on AI coding tools like Claude Code and Cursor to automatically pull code, install dependencies, and run scripts, AI agents are becoming the highest-privileged — and most overlooked — attack entry points in development environments.
Background: How AI Coding Assistants Work AI coding assistants like Claude Code and Cursor are essentially LLM agents with "tool-calling" capabilities. Unlike ordinary chatbots, these tools are granted the ability to directly manipulate the file system, execute terminal commands, and install packages. When a developer asks the AI to "set up this project," the AI autonomously plans and executes a sequence of steps: clone the repo → read config files → run setup scripts → verify results — with almost no human intervention required. This "Agentic Loop" architecture delivers tremendous efficiency, but it also means that if any step contains a malicious instruction, the AI will execute it in full, with the user's identity and permissions.

How the Attack Works
A Convincing, Innocent-Looking Repository
The attack begins with a GitHub repository that appears completely legitimate — well-structured code, complete with documentation. Neither a developer nor an AI agent would detect any red flags when cloning and using it.
The real payload is hidden inside the repository's setup script. This script is automatically triggered when an AI tool performs installation or build operations, or when it attempts to "self-heal" after encountering an error.
Background: The Evolution of Software Supply Chain Attacks Software supply chain attacks are not a new concept. In the 2020 SolarWinds incident, attackers planted a backdoor in the software build pipeline, affecting tens of thousands of companies and government agencies. The 2021 Log4Shell vulnerability exposed the widespread risks of open-source dependencies. Traditional supply chain attacks focus on "poisoning the source" — tampering with upstream code or dependency packages so that downstream users unknowingly introduce malicious code. This attack against AI coding assistants represents a new evolution: attackers no longer need to modify the code itself. Instead, they exploit the auto-execution behavior of AI agents, turning the repository into a trigger while the actual malicious payload resides on a remote server under the attacker's control. This achieves a decoupled attack where the code is clean, but the execution is poisoned.
Dynamically Fetching Malicious Commands via DNS
The most sophisticated and dangerous aspect of this attack is that the malicious code never actually exists inside the repository.

Once the script is automatically executed by the AI tool, it doesn't contain any destructive code directly. Instead, it uses DNS queries — an unconventional channel — to dynamically fetch real attack instructions from an attacker-controlled server.
Background: Why DNS Can Serve as a Covert Attack Channel DNS (Domain Name System) is a foundational piece of internet infrastructure, used to resolve domain names into IP addresses. However, certain characteristics of the DNS protocol make it an ideal covert communication channel. First, DNS queries are almost never blocked by enterprise firewalls, since blocking DNS would take down the entire network. Second, traditional security tools focus on monitoring HTTP/HTTPS traffic and pay little attention to DNS traffic. Third, DNS queries can encode arbitrary data within TXT records or subdomains — by controlling an authoritative DNS server, attackers can "write" malicious instructions into the resolution response for a specific domain. Every time the compromised system queries that domain, it silently receives a command. This technique has long been documented in APT (Advanced Persistent Threat) attacks and has now been adapted for attacks against development environments, making it even more stealthy.
This means:
- The repository code itself is "clean" — conventional code reviews will find nothing;
- Malicious logic is loaded dynamically at runtime, rendering static scanning tools useless;
- DNS as a transport channel can bypass the many security controls that only monitor HTTP/HTTPS traffic.
The combination of "runtime dynamic loading + covert channel transmission" makes the entire attack chain nearly impossible to detect in advance.
The Consequences of the Attack
Once malicious commands are fetched and executed, attackers can steal various sensitive credentials from the victim's development environment. According to the researchers, the information stolen includes API keys, access tokens, and other critical secrets.

For developers, these credentials are often tied to cloud service accounts, code repository permissions, and even production environments. Once leaked, attackers can move laterally and cause cascading damage far beyond a single machine. This is precisely why the attack surface presented by AI agents is taken so seriously — they inherently have elevated privileges to read environment variables and execute commands.
The Trust Dilemma of AI Agents
"Auto-Execution" Is a Double-Edged Sword
This incident exposes a fundamental tension in AI coding assistants: the greater the automation, the greater the security risk.
The core appeal of tools like Claude Code is that they automatically handle tedious environment setup, dependency installation, and error resolution. But the convenience of "execute without human confirmation" is exactly what attackers exploit — the moment when an AI encounters a problem and attempts to auto-troubleshoot is precisely when malicious scripts are most likely to be triggered.

Why Traditional Security Defenses Fall Short
We have traditionally relied on code reviews and static scanning to detect supply chain risks, but this attack demonstrates that against malicious code dynamically loaded at runtime, these measures are almost entirely ineffective. The security perimeter must shift from "reviewing code content" to "controlling execution behavior."
How Developers Can Protect Themselves
Researchers have offered several practical recommendations for defending against this new class of AI coding assistant attacks:
Manually Review Script Content Before Execution
Before allowing an AI agent to run any setup script or installation command, have it display the full script content first and manually confirm there are no anomalies before proceeding. Do not blindly rely on "auto-run."
Restrict the Agent's Execution Permissions
Apply the principle of least privilege when configuring AI coding tools, especially when handling third-party repositories of unknown origin. It is recommended to run them in isolated sandbox or container environments to avoid directly exposing sensitive credentials on the host machine.
Background: Principle of Least Privilege and Sandbox Isolation The Principle of Least Privilege (PoLP) is one of the core tenets of information security, requiring that any program or user should only have the minimum permissions necessary to complete their task. In the context of AI coding assistants, this means avoiding running AI tools as root or administrator, and restricting their access to environment variables. Sandbox technology uses OS-level isolation to limit a process's access to host resources. Common implementations include Docker containers, Linux's seccomp/namespaces mechanisms, and gVisor, which is designed specifically for AI workloads. Running an AI agent inside a container means that even if a malicious script executes successfully, any credentials it reads are temporary and isolated — unable to reach the real keys on the host machine — dramatically limiting the attacker's ability to move laterally.
Strengthen Credential Management Practices
- Avoid storing high-privilege API keys in development environments long-term;
- Use short-lived tokens and implement regular rotation;
- Monitor for anomalous DNS query activity — this is often an early signal of covert channel attacks.
Exercise Caution with Third-Party Repositories
Even if a GitHub repository looks completely legitimate, that doesn't mean its automation scripts are safe. Before introducing any external dependency, always evaluate its trustworthiness and origin.
Conclusion
As AI agents play an increasingly central role in software development, the attack techniques targeting them are evolving rapidly. "Hiding malicious code + dynamic DNS fetching" is just the beginning — it serves as a clear reminder that a new balance must be found between convenience and security.
It's time to treat AI agents as a new, high-privileged "team member" — one that requires appropriate security guardrails alongside its efficiency gains. Taking a moment to review a script before it runs could be all it takes to prevent a credential breach disaster.
Key Takeaways
Related articles

Vimgolf.ai: Learn Vim Through a Level-Based Game
Vimgolf.ai is a gamified Vim learning tool that helps users progressively master Vim commands through level-based challenges. We analyze its approach and compare it with VIM Adventures and similar tools.

Korean Stocks Plunge 16% in Two Days: Why Retail Selling Triggered a Market Stampede
Korean stocks plunged ~16% in two trading days as concentrated retail selling triggered a market stampede. Analysis of structural vulnerabilities, leverage effects, and investment lessons.

Instagram Head Reveals: Hiring Standards Have Quietly Shifted — Judgment Over Coding Ability
Instagram head Adam Mosseri admits being a mediocre engineer and reveals his team has abandoned full technical interviews. Judgment is replacing coding as the core hiring standard.