Leaked n8n API Tokens Expose 321 Instances to Data Theft

A single accidental keystroke in a public code repository can quietly dismantle the digital perimeter of a global enterprise without triggering a single traditional security alarm. Recent cybersecurity investigations have uncovered a systemic failure in how developers manage authentication secrets for integration platforms, specifically targeting the popular automation tool n8n. These findings revealed that 321 live n8n instances were fully accessible to anyone with a browser and a leaked API token found on GitHub. This exposure did not originate from a complex software bug or a zero-day vulnerability but instead relied on valid, authenticated credentials left in plaintext. With a startling 36% success rate in matching leaked tokens to reachable hostnames, the ease of these potential breaches highlights a massive gap in modern secret management practices.

The discovery emphasizes the evolving nature of the “human element” in digital security. While traditional firewalls and encryption protocols remain robust, they offer no defense against a legitimate key handed over to the public. For many organizations, the push toward rapid deployment and seamless integration has inadvertently created a vast surface area for credential theft. When a developer accidentally commits a configuration file containing an API key, they are not just leaking a single password; they are often providing a direct map to the heart of their company’s internal automation infrastructure.

The researchers identified over 4,500 unique n8n API tokens, many of which remained active months after their initial exposure. This persistence suggests a widespread lack of automated secret scanning and a misunderstanding of how integration tokens function within the cloud ecosystem. The fallout from these leaks extends far beyond the n8n platform itself, as these instances often hold the keys to secondary systems ranging from customer databases to cloud storage environments. Consequently, the leak of a single automation token can trigger a cascade of data exfiltration across an entire corporate network.

The High Cost of a Single Public GitHub Commit

The financial and operational consequences of a single public commit are often underestimated until a full-scale breach occurs. In the case of n8n, the cost is tied to the platform’s role as a high-privilege orchestrator. When an API token is committed to a public repository, it becomes a beacon for automated scrapers that monitor GitHub for secrets in real time. For the 321 organizations identified in the research, this meant that their internal workflows, employee data, and connected services were effectively public property. The research pipeline extracted n8n hostnames committed alongside these tokens, confirming that in many cases, the “door” and the “key” were found in the exact same location.

Statistics gathered during the scanning process suggest a high level of vulnerability among reachable instances. Out of nearly 900 instances that were publicly accessible at the time of testing, over a third accepted the leaked credentials without any resistance. This high success rate indicates that many administrators are either unaware that their tokens have been compromised or lack the internal monitoring necessary to detect unauthorized API access. The research also highlighted a newer exposure surface in the form of Model Context Protocol (MCP) API keys, which allow artificial intelligence assistants to interact with n8n workflows, further expanding the potential blast radius.

The organizational impact of such exposures is exacerbated by the lack of rapid remediation. When the researchers attempted to notify affected companies through responsible disclosure, the responses were alarmingly limited. While one company acted swiftly by revoking the credential and paying a bug bounty, many others ignored the warnings or lacked a clear channel for receiving security reports. This delay in response gives attackers an extended window of opportunity to pivot from the initial n8n instance toward deeper parts of the infrastructure, potentially leading to long-term persistence within the target network.

Why n8n Is a High-Value Target for Modern Threat Actors

To understand why threat actors prioritize n8n, one must view the platform as the central nervous system of a modern enterprise. It functions as a low-code automation engine that connects hundreds of disparate services, including SQL databases, AI agents, internal communication tools like Slack, and cloud providers such as AWS. Because n8n requires high-level permissions to orchestrate these various systems, a single compromised token can serve as a master key. An attacker who gains control over an n8n instance is not just looking at a dashboard; they are standing at the intersection of all the organization’s automated data flows.

The platform is designed to be user-friendly, allowing non-technical staff to build complex integrations, but this accessibility sometimes comes at the cost of security oversight. An n8n instance typically runs workflows that must decrypt and use stored credentials for external services. While these credentials are encrypted at rest with a master secret, the platform’s very nature requires it to handle them in a usable format. If an attacker possesses a token with administrative privileges, they can create new “shadow” workflows to use these stored credentials, effectively masquerading as a legitimate internal process.

Furthermore, n8n has become a frequent subject of interest in the security community, with over 50 security advisories published within the last year. Many instances discovered in the research were found to be running outdated versions susceptible to known vulnerabilities, such as expression injection or sandbox escapes. When these software vulnerabilities are paired with a leaked API token, the risk profile shifts from “high” to “critical.” The platform’s ability to execute custom code—whether in JavaScript or Python—provides attackers with a native environment for running malicious scripts without needing to upload external malware, making detection significantly more difficult for standard antivirus tools.

Analyzing the Scale of the Exposure and the Persistence of API Tokens

The research data highlights a troubling trend regarding the longevity of leaked secrets. Unlike session cookies that might expire in hours, many n8n API tokens were found to be valid months after they were first pushed to GitHub. This persistence is partly a technical artifact of how older versions of the software handled token generation. Before the introduction of mandatory expiration dates in early 2025, the platform generated JSON Web Tokens (JWTs) that lacked an expiration claim. This meant that unless an administrator manually identified the leak and revoked the key in the database, the token remained a permanent back door.

The distribution of these leaks reveals a shift in developer habits and the tools they use. While standard .env files remain a common source of exposure, researchers identified a new pattern involving configuration files for AI tools like Claude Code. These tools often store permitted shell commands and API keys in settings files that developers may inadvertently commit to a repository. Unlike the widely recognized .env extension, these newer configuration formats are sometimes overlooked by standard .gitignore templates, leading to the silent exposure of both the instance URL and the sensitive API key in a single approved command.

The scale of the problem is further reflected in the sheer volume of instances visible on the public internet. With more than 100,000 n8n instances indexed by search engines like Shodan, the pool of potential targets is immense. The research confirmed that approximately 30% of the affected instances were hosted on managed services, suggesting that even organizations using cloud-native solutions are not immune to the risks of credential mismanagement. The pairing of hostnames and tokens within the same commit removes the need for an attacker to perform infrastructure discovery, streamlining the exploitation process into a simple, automated sequence.

From Passive Enumeration to Full Credential Exfiltration

The transition from finding a token to stealing data is remarkably straightforward, requiring only documented REST API functionality. Attackers typically begin with passive enumeration, using the leaked token to query the users endpoint. This initial step allows them to map out the organizational structure, identifying instance owners, active users, and even pending invitations. By analyzing the workflow definitions returned by the API, an attacker can pinpoint exactly which systems the n8n instance can access, looking for hard-coded secrets or sensitive logic that might be vulnerable to manipulation.

Once the attacker understands the landscape, they can move toward more active exploitation. One common technique involves utilizing the instance’s own credential store. Although the API does not return the raw values of stored secrets like database passwords, it does allow an authenticated user to reference those secrets in new workflows. An attacker could create a simple workflow that triggers on a schedule, uses a stored OpenAI credential to process a malicious prompt, and then records the output. By retrieving the execution data through the API, the attacker gains the benefits of the stored credential without ever needing to see the underlying key.

The most severe form of exfiltration involves tricking the n8n instance into transmitting its raw credentials to an external server. This is achieved by configuring an HTTP Request node to use a stored credential for authentication but pointing the request at an attacker-controlled listener. When the workflow executes, the platform dutifully attaches the secret—such as a Bearer token or an API key—to the outgoing header. The attacker’s listener captures the plaintext secret in seconds. Because these actions utilize legitimate platform features, they often blend in with normal administrative tasks, and an attacker can easily delete the malicious workflow and its logs to cover their tracks.

Hardening n8n Instances Against Credential Theft and Data Leaks

Defending against the theft of automation credentials required a multi-layered approach that moved beyond basic password hygiene. The security community established that the first priority for any organization using n8n was the immediate implementation of secret scanning across all code repositories. By using automated tools to detect tokens before they reached a public branch, developers could prevent the exposure at its source. Furthermore, the transition toward newer software versions was deemed non-negotiable, as these updates enforced a 30-day token expiration policy, significantly narrowing the window of opportunity for an attacker to exploit a leaked key.

Organizations also looked toward internal auditing as a primary defensive mechanism. The n8n platform’s built-in audit endpoint became a critical tool for security teams, allowing them to generate reports that identified high-risk nodes, such as those with filesystem access or those susceptible to SQL injection. By regularly reviewing these reports, administrators could identify and harden vulnerable workflows before they were targeted. This proactive stance involved removing any hard-coded secrets from node parameters and migrating them to the encrypted credential store, which, while not invincible, offered a significantly higher level of protection against casual exfiltration.

The final stage of a robust defense strategy involved a comprehensive rotation policy that extended to every downstream service connected to the n8n instance. When a token was suspected of being compromised, security teams recognized that revoking the n8n key was only the beginning of the remediation process. They had to assume that every database password, cloud API key, and SSH deployment key stored within the instance had also been compromised. Rotating these downstream credentials was the only way to ensure that the breach did not persist in other parts of the digital ecosystem. This comprehensive approach to secret management helped organizations regain control over their automation infrastructure and protected them from the cascading failures that often followed a simple credential leak.

The research conducted into these exposures served as a stark reminder of the hidden risks inherent in the modern integration landscape. As platforms like n8n continue to grow in popularity and complexity, the responsibility for securing them shifts toward a holistic model that combines technical safeguards with developer education. The discovery of 321 vulnerable instances was not just a statistic but a call to action for the industry to rethink how it handles the “keys to the kingdom.” By adopting rigorous scanning, enforcing token expiration, and maintaining a vigilant posture toward credential rotation, organizations moved toward a future where a single commit no longer equated to a catastrophic data breach.

Trending

Subscribe to Newsletter

Stay informed about the latest news, developments, and solutions in data security and management.

Invalid Email Address
Invalid Email Address

We'll Be Sending You Our Best Soon

You’re all set to receive our content directly in your inbox.

Something went wrong, please try again later

Subscribe to Newsletter

Stay informed about the latest news, developments, and solutions in data security and management.

Invalid Email Address
Invalid Email Address

We'll Be Sending You Our Best Soon

You’re all set to receive our content directly in your inbox.

Something went wrong, please try again later