Security & privacy

Railway breach exposes AI keys causing $740k in unauthorized usage

A supply-chain style attack on Railway decrypted customer environment variables, leading to significant unauthorized AI spending that the platform has pledged to cover.

Illustration of a broken server rack with leaking digital keys representing a security breach.
Illustration generated for this article

Railway, a platform-as-a-service provider, reported that stolen customer API keys led to an estimated $740,000 in unauthorized AI usage charges following a breach in October. The company has committed to covering these costs for customers when AI providers refuse refunds, marking a significant incident in cloud security and supply chain integrity.

What happened

The incident began on October 20, 2026, when an attacker exploited a previously unknown vulnerability in Railway’s build system. This flaw allowed the attacker to partially escape filesystem isolation and read files on the host virtual machine. By gaining access to a credential used by build servers, the attacker could interact with internal systems, including the Temporal system that drives parts of the build process. This access enabled the reading of build histories and cached code snapshots, effectively giving the attacker a copy of Railway’s internal monorepo.

Using insights from the stolen codebase, the attacker identified a misconfigured OIDC binding in a cloud environment. On October 21, this misconfiguration was exploited to obtain short-lived cloud credentials. These credentials allowed the attacker to access a production database containing encrypted customer environment variables and an SSH key for an orchestration machine. With these tools, the attacker decrypted variables for approximately 1.85% of workspaces, targeting names associated with AI provider keys. The attacker was fully removed from the systems later that day, but not before causing significant financial exposure for users.

How it works

The attack relied on a chain of escalating privileges rather than a single point of failure. Initially, the attacker broke out of a build container, a sandboxed environment meant to isolate user code during compilation. Once outside, they obtained a service credential that, due to overly permissive internal trust configurations, was accepted by other critical systems. This lateral movement allowed the attacker to map the internal architecture and find further weaknesses.

The core of the data theft involved decrypting environment variables. Railway stores secrets like API keys as encrypted variables, with each environment having its own encryption key protected by a root key in a cloud Key Management Service (KMS). The attacker used the compromised orchestration machine’s credentials to access the KMS and decrypt specific variables. The database queries were highly targeted, looking specifically for patterns matching AI provider keys, indicating a focused effort to monetize the breach through AI resource consumption.

Key details

  • The attacker decrypted variables in at most 1.85% of workspaces, affecting approximately 100,000 environments.
  • Estimated unauthorized spending totals $740,000, primarily from AI model usage.
  • Linked-account tokens for 1,852 users, including BYOK agent keys and GitHub OAuth tokens, were reset.
  • No customer databases were accessed, and no code repositories were downloaded by the attacker.
  • The attacker read stored histories of 353 builds, exposing variables and secrets passed during those builds.
  • Railway has filed a complaint with the FBI’s IC3 and is working with a specialist forensics firm.

Why it matters

For software engineers and technical founders, this incident highlights the risks of storing sensitive credentials in environment variables, even on trusted platforms. The attack demonstrates how a single vulnerability in a build system can cascade into a full-scale credential theft if internal trust boundaries are not strictly enforced. It underscores the importance of least-privilege access controls within infrastructure, as the attacker leveraged a build credential to access production databases and decryption keys.

Furthermore, the financial impact on users raises questions about liability in cloud services. While Railway has stepped up to cover costs where providers do not refund, the initial burden of discovery and claim filing falls on the customer. This event serves as a reminder that security is a shared responsibility, and developers must actively monitor their usage and audit logs, rather than relying solely on the platform’s defenses. The targeted nature of the attack on AI keys also reflects a growing trend where attackers seek immediate monetary gain through resource abuse rather than data ransom.

What you can do

  • Revoke and replace any sensitive variables or API keys stored on Railway before October 21, 2026.
  • Contact your AI provider directly to report unauthorized charges and follow their specific refund procedures.
  • Remove public network access to your databases and restrict inbound traffic to known IPs.
  • Check GitHub audit logs for unusual activity and review which third-party apps have access to your account.
  • Monitor audit logs in container registries like Docker Hub for unexpected image pulls or pushes.
  • Use short-lived credentials where possible and avoid storing long-lived secrets in environment variables if alternatives exist.
  • #cloud security
  • #api security
  • #data breach
  • #ai safety
  • #devops

Tools from the Bytechap store

Keep reading

All stories