Categories: Cyber Security News

Code Assistants Turned Weapons, Attackers Plant Backdoors and Generate Harmful Code

As developers increasingly incorporate AI-driven coding assistants into their IDEs, adversaries are exploiting features such as chat, auto-completion, and context attachment to inject backdoors, exfiltrate sensitive data, and generate malicious code.

A recent Unit 42 analysis demonstrates that indirect prompt injection and auto-completion bypasses pose critical risks to software integrity.

Indirect Prompt Injection via Context Attachment

Coding assistants often allow users to attach files, folders, or URLs to provide context for code generation.

These context attachments are processed as preceding messages, making it impossible for the model to distinguish between benign data and malicious instructions.

In one simulated attack, threat actors contaminated a public data source (a scraped dataset of social media posts) with a crafted prompt instructing the assistant to insert a hidden backdoor function that retrieves and executes remote commands from an attacker-controlled C2 server.

Flow chart of direct and indirect prompt injections.

When a developer asked for code to analyze post metadata, the assistant obediently embedded the backdoor under the guise of fetching additional information. If executed, this backdoor would have granted the attacker full control of the developer’s environment.

Indirect prompt injections exploit the LLM’s indiscriminate processing of instructions and user inputs. Since system prompts and user inputs are both natural language, a malicious prompt buried in external data can override safety measures and manipulate the assistant to generate harmful code.

This vulnerability mirrors classic injection flaws in traditional computing, such as SQL injection, but operates at the level of natural language understanding.

Auto-Completion Bypasses and Direct Model Invocation

Auto-completion features, designed to speed coding workflows, can also be misused to generate harmful content.

While LLMs use Reinforcement Learning from Human Feedback (RLHF) to refuse unsafe requests in chat interfaces, adversaries can prefill a conforming prefix (e.g., “Step 1:”) and then let auto-completion produce the destructive payload.

In tests, the assistant completed multi-step instructions for creating malware and data exfiltration scripts when given only a partial harmful prompt via auto-complete.

A typical chat session places context as a preceding message.

Moreover, several coding assistants expose model endpoints directly through client-side invocations. Threat actors can craft custom clients or steal session tokens to bypass IDE-level safeguards entirely, a technique known as LLMJacking.

By submitting their own system prompts and parameters, attackers can coerce the base model into generating illicit content, from zero-day exploit code to spear-phishing templates.

Mitigations and Best Practices

To defend against these threats, organizations should implement robust security processes around AI coding assistants. First, enforce rigorous review controls: developers must manually inspect all AI-generated code before execution.

Second, restrict context attachments to trusted sources only, and sanitize any external data before feeding it to the assistant.

Third, disable or tightly control direct model invocation features in client applications. Where available, leverage manual execution control features to require explicit user approval for running shell commands or incorporating generated code into codebases.

As AI coding assistants become more integrated and autonomous, adversaries will devise novel prompt manipulation techniques.

Maintaining vigilant code review practices, controlling context inputs, and limiting model access are essential steps to ensure these powerful tools remain assets rather than weapons.

Find this Story Interesting! Follow us on Google News , LinkedIn and X to Get More Instant Updates

The post Code Assistants Turned Weapons, Attackers Plant Backdoors and Generate Harmful Code appeared first on Cyber Security News.

rssfeeds-admin

Recent Posts

Directive 8020 Review

Making the leap to space feels like a big departure from the usually grounded horror…

18 minutes ago

Xbox Game Pass for Discord Nitro Subscribers Officially Announced

Xbox and Discord have now officially unveiled the new starter edition of Xbox Game Pass…

18 minutes ago

ShinyHunters Breaches Instructure Canvas LMS Through Free-For-Teacher Account Program

The infamous hacking group ShinyHunters has struck again, this time targeting Instructure, the company behind…

37 minutes ago

Crimenetwork Takedown Exposes 22,000 Users and Over 100 Illegal Sellers

In a massive, internationally coordinated operation, the Frankfurt am Main Public Prosecutor’s Office – Central…

37 minutes ago

Trending Hugging Face Repo With 200k Downloads Executes Malware on Windows Machines

A popular artificial intelligence repository on Hugging Face was recently found hiding dangerous malware that…

37 minutes ago

GhostLock Attack Leverages Windows file-sharing to Lock Files Access Like Ransomware

Traditional ransomware disrupts organizations by encrypting data and demanding payment for decryption keys. However, a…

38 minutes ago

This website uses cookies.