A critical remote prompt injection vulnerability was uncovered in GitLab Duo, the AI-powered coding assistant integrated into GitLab’s DevSecOps platform.
The vulnerability, disclosed in February 2025, allowed attackers to manipulate the AI assistant into leaking private source code and injecting untrusted HTML content into responses, potentially redirecting users to malicious websites.
GitLab has since patched the security flaw, but the discovery highlights significant risks associated with AI assistants in development environments.
Hidden Prompts Enable Sophisticated AI Manipulation
Legit research team reports that the vulnerability exploited GitLab Duo’s context-aware nature, which analyzes entire project contexts, including comments, descriptions, and source code, to provide helpful responses.
The hidden prompts could be embedded in multiple locations within GitLab projects, including merge request descriptions, commit messages, issue comments, and source code itself.
These malicious instructions were virtually undetectable to users, as attackers employed sophisticated encoding techniques such as Unicode smuggling, Base16-encoded payloads, and KaTeX rendering in white text.
The attack demonstrated several vulnerabilities from the 2025 OWASP Top 10 for LLMs, specifically LLM01 (Prompt Injection), LLM02 (Sensitive Information Disclosure), LLM05 (Improper Output Handling), LLM08 (Vector and Embedding Weaknesses), and LLM09 (Misinformation).
By placing hidden instructions within seemingly harmless project content, attackers could manipulate Duo’s behavior to suggest malicious JavaScript packages, present dangerous URLs as safe, or mislead code reviewers about merge request security.
HTML Injection Through Streaming
The most concerning aspect of the vulnerability involved HTML injection capabilities enabled by GitLab Duo’s real-time response rendering.
The AI assistant uses streaming markdown parsing, interpreting and rendering content into HTML before the complete response structure is known.
This asynchronous processing created a window where malicious HTML tags could be executed before proper sanitization occurred.
While GitLab implemented DOMPurify for HTML sanitization, certain tags like ,