Offensive Security

Your Build Server Is a Production System

Tomas FerreiraTomas FerreiraHead of Offensive Security19 Mar 20245 min read1098 views
Editorial cover for “Your Build Server Is a Production System”

On March 4 JetBrains shipped TeamCity 2023.11.4, fixing two authentication bypass flaws in its on-premises build server: CVE-2024-27198, rated 9.8, and CVE-2024-27199. Rapid7, which reported them, published its full analysis the same day, objecting that the fix had shipped without being coordinated with it. By March 5 GreyNoise was recording a sharp rise in exploitation attempts. By March 6 LeakIX counted more than 1,440 instances carrying rogue user accounts. CISA added CVE-2024-27198 to its Known Exploited Vulnerabilities catalogue on March 7.

This is the second time in six months the same product has been in this position. In December, CISA, the FBI, the NSA and international partners warned that Russia's foreign intelligence service was exploiting an earlier TeamCity flaw, CVE-2023-42793, against servers whose only common factor was being unpatched and reachable from the internet. On red team engagements the build server is one of the first systems we ask about, because it is usually the most powerful machine in the building that nobody treats that way.

Why attackers want the build server

Think about what a continuous integration server holds and can do:

  • Source code, for everything it builds.
  • Secrets, because builds need them: cloud deployment keys, container registry credentials, database passwords embedded in a build configuration years ago.
  • Signing material, if releases are signed in the pipeline.
  • The ability to change what ships. Whoever controls the build controls the artifact your customers install.
  • Agents, often running on many machines with network reach into staging and production.

Rapid7 described a compromise of this kind as full control over projects, builds, agents and artifacts. The December advisory put the same point in supply-chain terms: source code, signing certificates and the ability to subvert how software is compiled and deployed. We wrote in 2020 about a signed update turning out to be the attack. The build pipeline is where that kind of attack is born.

Why it is on the internet in the first place

Almost nobody decides to expose a build server. It happens through reasonable shortcuts:

  • Webhooks. A cloud-hosted source repository needs to notify the server of new commits, so someone opens an inbound port.
  • Contractors. An outside team needs to see build results, and a VPN account felt like more work than a firewall rule.
  • The quick-start. The server was stood up for a proof of concept, worked, and became permanent without ever being re-architected.

And the server is usually owned by engineering rather than IT, which means it sits outside the patch tiers that cover the firewall and the email gateway. We have seen the same pattern with file transfer platforms and VPN concentrators: internet-facing, authenticating, holding the keys to something important, and patched whenever someone gets round to it. In our assessments over the past year we found build servers or artifact repositories reachable from the internet more often than we would like, frequently protected by nothing but their own login page.

The disclosure argument is not your problem

Researchers and vendors will keep arguing about how long to wait between a fix and the technical details. Rapid7 objected to what it saw as silent patching; JetBrains has its own account. Both positions have a history. For defenders the practical lesson is narrower and more uncomfortable: for a widely deployed product with an authentication bypass, the gap between the patch and mass exploitation is now about a day.

That changes how you have to measure your patch window. The clock starts when the vendor ships, not when the news reaches your team, and not at the next maintenance window. If a vendor publishes a critical fix for an internet-facing system on a Monday, assume someone is scanning for it by Tuesday.

If you run TeamCity, or anything shaped like it

Upgrade, or take it off the internet today. If upgrading to 2023.11.4 or later cannot happen immediately, remove internet exposure until it can. This applies equally to Jenkins, GitLab, artifact repositories and anything else in the pipeline.

Assume compromise if it was exposed and unpatched after March 4. Review the audit log for new user accounts, especially administrators with random-looking names, and for token changes and plugin uploads or deletions. Rapid7's guidance notes that a new-user entry alone does not prove malice, so investigate rather than conclude, but investigate everything.

Rotate what the server could see if anything looks wrong: repository tokens, cloud keys, registry credentials, signing keys. A compromised build server leaks every secret it has ever been handed, not only the ones in use this week.

Check what it built. For anything released during the exposure window, rebuild from a known-good commit on a clean machine and compare. Where the outputs differ unexpectedly, stop and escalate.

Making the next one boring

The vulnerabilities will keep coming. The goal is architecture in which the next one is an inconvenience:

  • No inbound internet. Put the server behind your VPN or zero-trust access layer. If repository webhooks need a path in, give them a narrowly scoped relay, not the whole application.
  • No long-lived secrets in the server. Use short-lived credentials issued per build through identity federation with your cloud provider, pulled from a secrets manager at run time.
  • Signing somewhere else. Move release signing to a separate service or hardware module with its own approval step, so owning the build server does not mean owning your signature.
  • Ephemeral, segmented agents. Build agents should be created per job and thrown away, without standing access to production networks.
  • Tier one, with an owner. The build server belongs in the same patch group as the edge devices, with a named owner who knows that.

None of this is exotic. It is the same discipline you already apply to production, extended to the system that produces production.

Whoever owns your build server owns your next release.

Sources

#CI/CD#TeamCity#supply chain#patching#secrets
Tomas Ferreira

About the author

Tomas FerreiraHead of Offensive Security

Tomas cut his teeth doing penetration testing for banks across Brazil and the US, and has a wall of CVE credits from responsibly disclosed findings in enterprise software. OSCP, OSEP, and a stubborn belief that a pentest report nobody acts on is just expensive fiction. He runs our Analysis arm engagements from scoping through the readout call.

Penetration testingApplication securityVulnerability researchPurple team exercises

Discussion(0)

No comments yet — the floor is yours.

Join the discussion

Your email stays private; we only use it to distinguish real readers from bots.

open a channel

The best time to harden your defenses was yesterday.

The second-best time is right now. Tell us what keeps you up at night — we answer within one business day.