In recent weeks, the tech world has been intensely discussing the growing threat of targeted attacks on infrastructure providers, often leveraging sophisticated tools, including artificial intelligence. The Railway cloud platform became one of the victims of these attacks, facing a complex security breach that resulted in the exfiltration of customer secrets. The company subsequently published a detailed analysis of the incident, offering unique insight into the dynamics of such attacks and the speed with which attackers can adapt.
The attack began on October 18 with several unsuccessful attempts where the attacker created fictitious accounts and tried to penetrate Railway's systems. Although these attempts were blocked, the attacker persisted and, within eleven hours, managed to gain access to the company's monorepo. This was achieved by exploiting a vulnerability in the build system, thereby stealing credentials that were subsequently used to access internal systems and download the entire source code.
With access to the source code, the attacker subsequently gained SSH access to Railway's cloud environment within ten hours. This was accomplished by scanning the downloaded code, leveraging a misconfigured OpenID Connect binding, and obtaining long-term cloud credentials that led to the discovery of an SSH key. The ultimate goal was keys to AI providers, which the attacker acquired within three hours by querying the production database, accessing encrypted environment variables, and utilizing a key management service to decrypt them.
What distinguishes this attack is its incredible speed, likely amplified by advanced autonomous tools. While a human attacker would take days or weeks to analyze a monorepo and find weaknesses, in this case, the attacker formulated a plan to acquire AI keys just six hours after downloading the code. The attacker's persistence was also remarkable – even after initial expulsion and invalidation of access paths, they attempted to find new weaknesses that very evening.
From the defenders' perspective, the deployment of customer key hashes to AI providers immediately after the incident's discovery was very prudent. This allowed for the invalidation of keys without Railway needing to know their full content, thereby minimizing financial damage. The incident also highlighted the limitations of current defensive AI models, which often hesitate to engage in cybersecurity, unlike offensive variants. Railway faced difficult decisions, such as whether to immediately inform AI providers and risk service disruption for unaffected customers, or only affected customers. It chose the former option to limit overall damage.
Several key lessons for developer teams emerge from the Railway attack. First and foremost, it is essential that builds do not run on shared machines; each build should have its own isolated virtual machine, strengthening isolation boundaries. Furthermore, it is critical to implement fine-grained access control for all internal secrets. At Railway, sensitive components of the CI system were rebuilt to require multi-factor authentication, and even biometrics, for access to crucial credentials.
Another important principle is to assume that attackers have full access to the source code. The security architecture should be designed to withstand compromise, even if the code is breached. Furthermore, it is necessary to decommission old and unused systems that represent an unnecessary attack vector. Increasing the level of logging and alerts for unusual behavior patterns is crucial for early detection. Finally, response speed is now more critical than ever – suspicious activities must be reacted to within minutes, not hours, given the pace at which attackers operate.

Got an idea for a website or app?
Let's talk it through — non-binding, with no pressure, and a concrete next step.
It is interesting to observe how some competitors behaved during this incident. While an unwritten rule in the software industry suggests that one should not capitalize on rivals' difficulties, one of Railway's competitors published an article instructing users how to migrate from Railway, boasting about their own security. Ironically, nine days after the attack on Railway, this competitor was attacked in an almost identical manner. Their response to the incident was objectively worse, with a longer detection time and no proactive key invalidation with providers. This situation underscores that, in the face of major security threats, it is more beneficial for all infrastructure providers to collaborate and strengthen collective security rather than trying to gain quick profit from others' problems.
