In git we trust: Defending Lovable projects from malicious code injections at scale

Marcus Hallberg (Security Engineer · Lovable), Samuel Kelemen (Security Engineer · Lovable)

SEC-T 2026 · Day 3 · Main hall

Overview

This article delves into a critical security presentation delivered by Marcus Hallberg and Samuel Kelemen, Security Engineers at Lovable, at the SEC-T conference. Titled "In git we trust: Defending Lovable projects from malicious code injections at scale," their talk exposed an ongoing, sophisticated campaign targeting Lovable's extensive user base. The speakers shared real-time insights into how malicious actors are leveraging social engineering, novel Git manipulation techniques, and even blockchain infrastructure to inject persistent, obfuscated code into user projects.

Watch on YouTube

Visual summary for In git we trust: Defending Lovable projects from malicious code injections at scale by Marcus Hallberg, Samuel Kelemen
Visual summary for In git we trust: Defending Lovable projects from malicious code injections at scale by Marcus Hallberg, Samuel Kelemen

Key moments

  1. 2:30 Initial alert: malicious JavaScript detonated in project
  2. 4:00 Attacker races Lovable agent to inject malicious code
  3. 5:50 PostCSS config file used for initial code execution
  4. 11:00 Malware uses blockchain for immutable payload persistence
  5. 16:00 “Evil merge” technique hides code in Git history
  6. 18:30 Lovable's response: scanning 100 billion lines of code
  7. 21:30 Attackers adapt, rebuild infrastructure after IOC sharing

In git we trust: Defending Lovable projects from malicious code injections at scale

Speakers: Marcus Hallberg (Security Engineer, Lovable); Samuel Kelemen (Security Engineer, Lovable)

Conference: SEC-T

YouTube: https://www.youtube.com/watch?v=RsTJwQiRm14

Overview

This article delves into a critical security presentation delivered by Marcus Hallberg and Samuel Kelemen, Security Engineers at Lovable, at the SEC-T conference. Titled "In git we trust: Defending Lovable projects from malicious code injections at scale," their talk exposed an ongoing, sophisticated campaign targeting Lovable's extensive user base. The speakers shared real-time insights into how malicious actors are leveraging social engineering, novel Git manipulation techniques, and even blockchain infrastructure to inject persistent, obfuscated code into user projects.

The significance of this talk extends beyond Lovable's platform, offering crucial lessons for any organization or developer managing code repositories and build pipelines. With Lovable hosting over 70 million projects and serving 27 million users, the scale of the threat underscores the need for robust defensive strategies. Hallberg and Kelemen meticulously detailed the attackers' methods, from initial compromise to payload delivery and persistence, emphasizing that while Lovable's core platform remained uncompromised, their customers were actively being targeted and exploited. The presentation served as a transparent, community-focused disclosure aimed at strengthening collective defenses against these evolving threats.

Background

▶ Watch: Initial alert: malicious JavaScript detonated in project (2:30)

Lovable operates a platform designed to empower creators to build and deploy web applications with ease, from e-commerce sites to personal pages. Users interact with AI agents, providing prompts to generate initial codebases, which can then be iteratively refined and ultimately deployed on Lovable's end-to-end infrastructure, complete with frontend, backend, database, and authentication. This streamlined development process, however, introduced a unique attack surface.

The genesis of the problem wasn't a direct compromise of Lovable's infrastructure but rather a sophisticated social engineering scheme targeting their customers. Malicious actors posed as legitimate developers, offering assistance to Lovable users. Once trust was established, these attackers would gain access to the users' Lovable projects and associated GitHub repositories. The campaign first came to Lovable's attention via an alert from one of their runtime sensors, indicating the detonation of malicious JavaScript within a user's project. This initial discovery prompted a deeper investigation, revealing a concerted effort by attackers to inject and conceal highly obfuscated code, ultimately aiming to gain control over user sessions and potentially exfiltrate sensitive data or credentials during the build process. The core challenge for Lovable and its customers was distinguishing legitimate developer collaboration from insidious malicious activity.

Key Findings

▶ Watch: PostCSS config file used for initial code execution (5:50)

The Lovable security team uncovered a multi-faceted and highly adaptive campaign characterized by several key findings:

  • Social Engineering as a Primary Vector: The initial compromise consistently relied on social engineering, with attackers posing as helpful developers to gain access to customer GitHub repositories and Lovable projects.
  • Race Condition Code Injection: Attackers employed a clever technique by "racing" Lovable's AI agent. When a user requested a code change (e.g., updating a reference), the attacker would push a commit with the same descriptive title seconds later, embedding malicious code while appearing to make the requested legitimate change.
  • Stealthy Code Obfuscation and Hiding:
  • Malicious payloads were often appended to legitimate JavaScript configuration files, such as PostCSS CSS configuration files (e.g., postcss.config.js). These files are executed during the build process, providing a potent injection point.
  • To evade detection by human reviewers, the injected code was often hidden by inserting a large number of spaces—approximately 507 spaces—pushing the malicious content far to the right, beyond typical editor viewports.
  • Novel Git Manipulation: The "Evil Merge": A particularly sophisticated technique involved crafting merge commits in Git. Attackers would take an existing commit (Parent 1, e.g., main branch HEAD) and an older commit (Parent 2, already in history). Before the final merge, they would add the malicious payload to the working tree. The resulting merge commit would then contain the malicious code, but crucially, it would not appear as part of either parent's diff when using standard git log --pickaxe commands, making it extremely difficult to trace the introduction of the malicious code through Git history.
  • Multi-Stage, Obfuscated Loader: The injected JavaScript payload was a complex, two-stage loader designed for maximum stealth:
  • Stage 1 focused on constructing an execution environment. It used deterministic decoding and de-shuffling techniques to extract JavaScript keywords (like require, module, substring) from heavily obfuscated strings mixed with random noise. It then created global aliases for these keywords to avoid direct calls that might trigger detection. Crucially, it constructed a JavaScript function compiler using Function.prototype.constructor (bypassing eval or Function keywords directly) to execute arbitrary strings.
  • Stage 2 leveraged the constructed compiler to fetch and execute the final payload from an external source.
  • Blockchain-based Command and Control (C2): The attackers utilized public, immutable blockchain infrastructure for their C2 mechanism. The second-stage loader would first query the Tron blockchain, with a fallback to the Aptos blockchain, to retrieve pointers (transaction hashes) to the ultimate payload hosted on the Binance Smart Chain. This decentralized and immutable C2 made it exceptionally difficult for defenders to take down or block the payload sources.
  • Execution and Persistence: The final payload was executed either via the venerable eval function (though easily detectable) or, more stealthily, by spawning Node.js child processes configured to detach from the parent, hide windows, and operate with no IO or no consoles. While sandboxed environments would eventually terminate these processes, local execution of compromised projects could lead to persistent infection. Persistence was achieved by exfiltrating credentials (e.g., API keys, build keys, NPM package registry keys) from trusted CI processes and maintaining Git write access to update code.
  • Campaign Scale and Adaptability:
  • After initial experimentation beginning in March 2025, the campaign scaled to an "industrial scale" in early 2025, peaking around April-May.
  • Lovable's scan of 7 million+ projects (comprising 100 billion lines of code) identified over 700 affected projects.
  • Re-infection attempts were observed as early as June, indicating the attackers' persistence.
  • The campaign involved more than 500 different payload samples and 108 distinct versions of the malware.
  • Attacker infrastructure was robust, utilizing AWS load balancers, Nginx proxies, and a range of static IP addresses.
  • Critically, the attackers demonstrated extreme agility: following Lovable's initial public disclosure and sharing of Indicators of Compromise (IOCs) at the Forward Cloud Sec conference in June, the attackers swiftly tore down their entire infrastructure and rebuilt new ones with completely different techniques and IOCs within days. The campaign remains ongoing as of the SEC-T talk.

Technical Deep Dive

▶ Watch: Malware uses blockchain for immutable payload persistence (11:00)

The technical sophistication of this attack campaign is evident in its multi-layered approach to code injection, obfuscation, and C2.

The initial entry point often involved appending malicious JavaScript to legitimate configuration files, such as a PostCSS CSS configuration file (postcss.config.js). These files, common in modern web development stacks (e.g., using Vite for building and Bun for package installation), are executed during the CI/CD pipeline to configure various tools like ESLint or Tailwind CSS. By appending to these files, the attackers ensured their code would run as part of the normal build process.

The malicious payload itself was an intricate, two-stage loader. The primary goal of the first stage was to construct a JavaScript function that could execute arbitrary strings, effectively acting as a compiler, without directly invoking easily detectable keywords like eval or Function. This was achieved through:

  1. Deterministic Decoding and Global Aliases: The payload contained a large, obfuscated string filled with random noise interspersed with fragments of JavaScript keywords. Attackers used a "de-shuffle" technique—a deterministic permutation, splitting, and joining process—to extract specific character sequences. These sequences were then used to reconstruct critical global functions like require, module, and substring. To further evade detection, these reconstructed functions were assigned to new, innocuous-looking variables, effectively creating global aliases. This allowed the malware to leverage Node.js capabilities without explicitly calling high-signal function names.
  1. Compiler Construction via Function.prototype.constructor: With the necessary primitives in place, the malware needed a way to execute arbitrary JavaScript code from a string. Instead of eval(), which is widely flagged, the attackers ingeniously exploited the Function.prototype.constructor property. In JavaScript, Function objects are themselves instances of Function. Calling Function.prototype.constructor (which has 11 characters, a length specifically targeted by the attackers by taking the first 11 characters from a string) returns the Function constructor. This constructor can then be invoked with a string argument to dynamically create and compile a new function, providing a stealthy way to achieve code execution. This newly constructed "compiler" was then used to process the next stage of the payload.

The second stage of the loader focused on fetching the actual malicious payload from a resilient Command and Control (C2) infrastructure:

  1. Blockchain-based C2: The attackers designed their C2 to be highly available and resistant to takedown. The loader first attempted to query the Tron blockchain to find a pointer (a transaction hash). If Tron was inaccessible or failed, it would fall back to the Aptos blockchain. Both of these public blockchains served as immutable, decentralized registries for the next stage's location. The retrieved pointer would then reference a specific transaction on the Binance Smart Chain (BSC).
  1. Payload Retrieval and Decoding: The transaction data on the Binance Smart Chain contained the final, heavily encoded malicious JavaScript payload. The loader would fetch this transaction, then perform a series of decoding steps, including bit shifting and interpreting bytes as UTF-8, to reconstruct the executable JavaScript source text. The immutability of blockchain transactions ensured a reliable and persistent source for the payload, making it exceptionally difficult for defenders to block or remove.

Once the final payload was decoded, its execution and persistence mechanisms were equally sophisticated:

  1. Execution Methods: While eval() could be used, the more advanced technique involved spawning Node.js child processes. These processes were configured with flags like detached: true, stdio: 'ignore', windowsHide: true, and silent: true. This allowed the malicious process to run independently of its parent, without visible I/O or windows, making it challenging to detect. In a sandboxed environment, these processes would eventually be terminated with the sandbox. However, if a user were to clone a compromised project and build/run it locally, this method could lead to persistent infection on their local machine.
  1. Persistence: The ultimate goal was durable access. By running within a trusted CI process, the malicious code could exfiltrate sensitive credentials such as API keys, build keys, or NPM package registry keys. Combined with the attackers' ability to gain Git write access through social engineering, they could maintain control over the repository, update their code, and ensure persistence across builds and deployments.

Finally, the attackers demonstrated a profound understanding of Git's internals to hide their code injections, employing the "evil merge" technique. In a standard Git merge, the resulting commit typically reflects changes clearly traceable to its parent commits. However, attackers exploited the fact that Git allows for merges where the final tree object is not a direct combination of the parents. They would take a recent commit from the main branch (Parent 1) and an older, legitimate commit from history (Parent 2). Before performing the merge, they would inject their malicious code directly into the working tree. When the merge commit was created, this injected code would be included in the final snapshot. The critical implication is that git log --pickaxe -S "malicious_string" (designed to find commits introducing a specific string) would fail to identify the merge commit as the source because the string wasn't explicitly added in the diff between the parents and the merge result, but rather present in the final state. Only by examining the full diff of the merge commit using git show <commit_hash> would the malicious string become visible, making forensic analysis significantly harder.

Demo / Proof of Concept

▶ Watch: Lovable's response: scanning 100 billion lines of code (18:30)

While the talk did not feature a live, interactive demonstration in the traditional sense, the speakers provided extensive visual evidence and de-obfuscated code snippets that served as a compelling proof of concept for the described attack chain. They showcased:

  • Screenshots of Lovable chat interfaces illustrating the "race condition" injection, where an attacker's commit with malicious code appeared seconds after a legitimate AI agent update, both sharing the same commit message.
  • Detailed breakdowns of the obfuscated JavaScript payloads, progressively de-obfuscating the code to reveal its multi-stage loader, deterministic decoding mechanisms, and the use of Function.prototype.constructor.
  • Illustrations of how the blockchain-based C2 operated, tracing the lookup path from Tron/Aptos to the Binance Smart Chain.
  • Examples of the "evil merge" technique, demonstrating how standard Git commands like git log --pickaxe would fail to detect the injected code, while git show on the merge commit would reveal it.
  • Visualizations of the malicious code hidden by hundreds of spaces in configuration files, highlighting the simple yet effective evasion tactic.

The comprehensive nature of these visual aids and code analyses effectively demonstrated the feasibility and technical intricacies of the attack, validating the key findings and providing actionable insights for the audience.

Defensive Implications

▶ Watch: Attackers adapt, rebuild infrastructure after IOC sharing (21:30)

Lovable's response to this ongoing campaign provides a blueprint for effective defense against sophisticated code injection attacks. Their initial actions involved a massive forensic effort, scanning over 7 million projects and 100 billion lines of code to identify more than 700 affected projects. Upon discovery, they immediately informed affected customers, facilitated the removal of attacker access, and bolstered their internal detection capabilities.

For defenders, several key implications and recommendations emerged:

  • Enhanced Runtime Monitoring and Egress Filtering:
  • DNS and Egress Filtering: It is crucial to monitor all outbound network connections from application and infrastructure layers. Any communication with unusual domains, particularly blockchain domains (e.g., Tron, Aptos, Binance Smart Chain), should be flagged. If an application has no legitimate reason to interact with such services, this activity is a high-fidelity indicator of compromise.
  • Static IP Communication: Similarly, outbound connections to static IP addresses without corresponding DNS lookups are highly suspicious in most cloud-native or dynamic application environments. Defenders should identify and restrict such communications where possible.
  • Advanced Runtime Sensors: Deploying and leveraging runtime sensors that can observe process trees and the nuances of code execution within sandboxed environments is paramount. These tools can detect anomalous behaviors such as Node.js processes spawning and detaching, operating without standard I/O, or attempting to hide their windows, which are indicative of stealthy execution. Lovable utilized both internal and commercial solutions for this purpose.
  • Sophisticated Git History Analysis:
  • Merge Commit Scrutiny: Traditional Git forensic tools may be insufficient. Defenders must implement or develop custom tooling to specifically analyze merge commits. This involves comparing the full diffs between parent commits, the working tree state at the time of the merge, and the resulting commit to uncover "evil merge" techniques where malicious code might appear without a clear + or - in standard diffs against parent commits.
  • Config File Analysis: Configuration files (e.g., postcss.config.js) remain a high-value target. Implement automated scanning for unusual content, appended code, or excessive whitespace that could hide malicious instructions. Lovable addressed the whitespace issue in their visual editor to make such hidden code visible to users.
  • Proactive Credential Management: Given the attackers' goal of exfiltrating credentials from CI processes, robust Secrets Management practices are essential. This includes rotating credentials frequently, using short-lived tokens, and implementing strict Least Privilege principles for CI/CD pipelines, ensuring build processes only have the absolute minimum permissions required.
  • Community Intelligence and Adaptability: The rapid adaptation of attackers, tearing down and rebuilding their infrastructure within days of IOC disclosure, highlights the need for continuous vigilance. Defenders must be prepared for IOCs to expire quickly and focus on detecting behavioral patterns and techniques rather than solely relying on static indicators. Sharing threat intelligence within the community, while acknowledging the risk of attacker adaptation, remains a vital defensive strategy.

Key Takeaways

  • Social Engineering is the Gateway: Despite the technical sophistication of the malware, the initial compromise consistently relied on social engineering to gain access to trusted developer accounts and repositories. Organizations must invest in continuous security awareness training for all personnel.
  • Attackers Innovate in Stealth: Modern adversaries are employing highly advanced techniques to evade detection, including novel Git manipulation (the "evil merge"), intricate multi-stage obfuscation, and subtle code hiding within legitimate configuration files using excessive whitespace.
  • Blockchain as a Resilient C2: The use of public, immutable blockchains (Tron, Aptos, Binance Smart Chain) for Command and Control demonstrates a significant evolution in attacker infrastructure, providing highly resilient and difficult-to-takedown payload delivery mechanisms.
  • Traditional Defenses Are Insufficient: Standard security tools and practices, such as git log --pickaxe for forensic analysis or simple eval detection, are increasingly bypassed by sophisticated attackers. A multi-layered defense incorporating advanced runtime analysis, egress filtering, and specialized Git forensics is essential.
  • Agility is Paramount: Attackers are highly adaptive, capable of rapidly changing their infrastructure and techniques in response to public disclosures. Defenders must prioritize behavioral detection, continuous monitoring, and the ability to quickly adapt their defenses.
  • Comprehensive Monitoring is Non-Negotiable: Effective defense requires a holistic approach, combining network-level monitoring (DNS, egress filtering), host-level runtime sensors (process trees, execution anomalies), and deep code/Git repository analysis to identify the full spectrum of attack vectors.

About the Speaker(s)

Samuel Kelemen is a Security Engineer at Lovable. He is an experienced speaker, having delivered his second talk at the SEC-T conference, which marked his third conference presentation overall. His insights into the technical intricacies of the malicious payloads and execution methods were a cornerstone of the presentation.

Marcus Hallberg also serves as a Security Engineer at Lovable. He emphasized the critical importance of community collaboration in cybersecurity, underscoring that collective knowledge and shared experiences are vital for success against evolving threats. Marcus provided the overarching context of the campaign, its impact on Lovable's customers, and the defensive strategies employed by the company.

Reviews

Dr. Zero (Offensive Security Researcher) — SOLID

Lovable's users got hammered by a massive campaign, and instead of hiding behind a PR firm, Hallberg and Kelemen got on stage and dumped the technicals. The JavaScript obfuscation is standard fare, but the 'evil merge' Git manipulation and the AI-agent race condition are novel operational tactics. Strong threat intel that actually shows how attackers are exploiting modern, AI-driven workflows.

Heather Calloway (CISO) — STRONG ACCEPT

This is required reading for your AppSec and engineering leadership. Lovable’s breakdown of how attackers raced AI coding agents and used 'evil merges' to bypass standard Git forensics exposes a systemic blind spot in modern CI/CD pipelines. It proves that baseline code-review tools cannot be trusted to catch sophisticated repository manipulation.

→ Top-rated talks at SEC-T 2026

All talks from SEC-T 2026