79% vs 51%: independent neobanks lag on app security. Read the report

Deep Dive

Deep Dive

TeamCity Build Agent Auth Bypass (CVE-2026-136858)

TeamCity On-Premises before 2026.1.7, 2026.2.3 and 2026.3 lets an unauthenticated attacker impersonate a build agent and read its secrets.

TL;DR

  • A flaw in TeamCity On-Premises lets an unauthenticated attacker who can reach the server impersonate an authorized build agent and intercept its builds and secrets. JetBrains published the advisory on 2026-12-02.
  • Every TeamCity On-Premises version is affected. TeamCity Cloud is patched by the vendor. The fix is in 2026.1.7, 2026.2.3 and 2026.3, and a patch plugin covers 2021.2 and later.
  • The CVE record carries CVSS v3.1 9.1 Critical. No public proof of concept and no in-the-wild exploitation are reported, and the CVE is not in CISA KEV as of 2026-12-03.
  • Upgrade to 2026.1.7, 2026.2.3 or 2026.3, or install the patch plugin. "How do I fix it?" has the /app/agents allowlist for servers that cannot do either yet.

Am I affected?

You are affected if the server is TeamCity On-Premises, reachable over HTTP(S), and not on a fixed release or the patch plugin. All of these must hold:

  • The server is TeamCity On-Premises, not TeamCity Cloud.
  • The server is reachable over HTTP(S) by the attacker, directly or through a reverse proxy.
  • The server runs a version before 2026.1.7, before 2026.2.3, or before 2026.3, and the CVE-2026-136858 patch plugin is not installed.
  • The attacker can reach the /app/agents endpoint and its subpaths.

The advisory covers every on-premises version. A server behind a network allowlist is still affected if an attacker can reach the endpoint from an allowed network or through a compromised host.

Branch Affected versions Fixed version
2026.3 every version before 2026.3 2026.3
2026.2 every version before 2026.2.3 2026.2.3
2026.1 every version before 2026.1.7 2026.1.7
2025.11 and earlier every version; the patch plugin covers 2021.2 and later upgrade to 2026.3, or install the patch plugin on 2021.2 and later
TeamCity Cloud not affected vendor-patched

The version is shown under Administration > About, or in the server log at startup. For a package installation, read the first version line from the log:

grep -m1 -iE 'TeamCity (server )?version|TeamCity Server [0-9]' /opt/teamcity/logs/teamcity-server.log

For a container, run the same check inside the running container. Do not pull a fresh image to test it, because the running container is the one that matters:

docker exec <container> grep -m1 -iE 'TeamCity (server )?version|TeamCity Server [0-9]' /opt/teamcity/logs/teamcity-server.log

Check the installed plugins under Administration > Plugins. A server with the patch plugin shows CVE-2026-136858-patch in that list. The plugin does not change the server version, so a version check alone does not prove that the server is protected.

How do I fix it?

Upgrade to 2026.1.7, 2026.2.3 or 2026.3. JetBrains recommends the upgrade over the patch plugin because the releases carry other fixes.

  1. Back up the TeamCity data directory and the database.
  2. Use Administration > Updates to install the matching maintenance release, or download the distribution from the TeamCity download page.
  3. Stop the server, replace the installation with the patched distribution, and start it.
  4. Confirm the new version under Administration > About.

For a container, pull the matching image and recreate the container with the same volumes, ports and environment. The container must be recreated, not only the image pulled:

docker pull jetbrains/teamcity-server:2026.3
docker stop <container>
docker rm <container>
docker run -d --name <container> \
  -v <path-to-data-directory>:/data/teamcity_server/datadir \
  -v <path-to-logs-directory>:/opt/teamcity/logs \
  -p <port-on-host>:8111 \
  jetbrains/teamcity-server:2026.3

Reuse the old container's data and logs paths, host port and any -e environment options. The image tag must match the branch you run, for example 2026.2.3 or 2026.1.7.

If you cannot upgrade, install the security patch plugin. It supports TeamCity 2021.2 and later and fixes only CVE-2026-136858.

  1. Download the plugin ZIP.
  2. Open Administration > Plugins and upload the ZIP, or place it in the TeamCity data directory under plugins.
  3. Apply the plugin. The vendor says the patch can be installed without restarting the server.
  4. Confirm that CVE-2026-136858-patch appears under Administration > Plugins.

Servers on 2026.2.2 or later can install security patches automatically under Administration > Updates. Set Security patches to "Install automatically" to receive this and later patches.

If you can do neither yet, restrict /app/agents and its subpaths at the reverse proxy to the addresses where legitimate agents connect. Include the outbound addresses of cloud agents and their NAT gateways. This blocks the published path, but it does not fix the server, and an attacker who can send from an allowed address is not stopped.

What is the root cause?

The flaw is that TeamCity did not bind a claimed build-agent identity to the authorization token stored for that agent before accepting the registration. An unauthenticated client that reached /app/agents could present an existing agent's identifier with a different token and be treated as that agent.

TeamCity agents connect to the server over HTTP(S) and identify themselves with an agent identifier and an authorization token. The server keeps a token for each authorized agent. The advisory's detection guidance shows a warning for a client that presents an existing agent's identity with a different token:

of the existing agent, but different authorization token "<token>"

JetBrains tells administrators to treat a non-empty token in that line as a possible takeover attempt and an empty token as expected. The patch plugin turns the same check into a hard stop.

The plugin is public, but its classes are compiled, and JetBrains has not published the server source. The compiled plugin references a servlet filter that reads the registration body. The filter resolves the claimed agent with BuildAgentManager.findAgentById, reads the stored token with SBuildAgent.getAuthorizationToken(), and compares the two with MessageDigest.isEqual.

The check that was missing is therefore a token comparison on the registration path. The agent identifier alone is not a secret, and the token is the value that proves the client is the agent it claims to be. Without that comparison, the identifier is enough to displace the real agent.

How is it exploited?

The attacker claims an existing agent's identity at /app/agents and supplies a different authorization token. No public proof of concept is known, so these steps follow the advisory's description of the attack.

  1. The attacker connects to the TeamCity server over HTTP(S) and reaches /app/agents.
  2. The attacker sends an agent registration request that claims the identifier of an existing authorized agent.
  3. The request carries a token that does not match the token the server stored for that agent.
  4. The server logs the mismatch, but the connection is not stopped.
  5. The server treats the attacker's client as the agent and can assign that agent's builds to it.
  6. The attacker receives the build jobs and the secrets passed to them, and can return falsified results or artifacts.

The attacker needs no TeamCity account. The advisory says the vulnerability is exploitable by an unauthenticated attacker who can reach the server over HTTP(S).

How does the attack flow?

An unauthenticated client claims an existing agent's identity at /app/agents, the token mismatch is logged but not enforced, and the client receives the agent's builds and secrets.

flowchart LR A["Attacker reaches
/app/agents"] --> B["Claims an existing
agent identifier"] B --> C["Presents a different
authorization token"] C --> D["Token mismatch logged,
not enforced"] D --> E["Builds and secrets
sent to the attacker"] E --> F["Tampered results or
artifacts published"]

What can an attacker do?

An attacker can impersonate an authorized build agent, intercept the builds assigned to it, and read the credentials and other secrets passed to those builds. The attacker can also falsify build results and publish tampered artifacts.

JetBrains says downstream builds that consume tampered artifacts could execute attacker-supplied code. That is a consequence of the tampered artifact, not a separate flaw in TeamCity.

The conditions are network reach to the server's HTTP(S) endpoint and to /app/agents, an affected on-premises version, and no patch plugin or fixed release. The attacker needs no TeamCity account and no user interaction. TeamCity Cloud customers are not affected.

No in-the-wild exploitation is reported. JetBrains says it found no evidence that any TeamCity Cloud environment was exploited through this vulnerability.

Why does the fix work?

The fix checks the authorization token before the server accepts an agent registration. The patch plugin's filter resolves the claimed agent, compares the presented token with the stored token in constant time, and rejects the request when the token is missing or different.

The compiled filter's check is equivalent to this pseudocode:

agent = BuildAgentManager.findAgentById(claimedAgentId)
if agent == null or !MessageDigest.isEqual(presentedToken, agent.getAuthorizationToken()):
    reject the request

The constant-time comparison prevents an attacker from learning the stored token through timing differences.

The fix is complete for the /app/agents path when the filter covers the endpoint and its subpaths. The advisory's additional mitigation names /app/agents and its subpaths; the patch plugin fixes the token check in the server itself. The plugin fixes only this CVE, so upgrading remains the better option because the fixed releases include other security changes.

How do I check if I was compromised?

Search teamcity-server.log for the token-mismatch line. A non-empty token in a hit is a lead; an empty token is expected and can be ignored.

grep -F 'of the existing agent, but different authorization token' /opt/teamcity/logs/teamcity-server.log

For a container, run the same search inside the running container:

docker exec <container> grep -F 'of the existing agent, but different authorization token' /opt/teamcity/logs/teamcity-server.log

For every hit with a non-empty token, note the timestamp and review that agent's connection history and the builds assigned to it around that time. Verify that the hostname and source IP address match what you expect for the agent. Compare the build logs, results and published artifacts for signs of tampering.

If you suspect exploitation, preserve the logs and build results, update or patch the server, and rotate every credential passed to the affected builds. Treat artifacts from those builds as untrusted until you verify them, and trace where they were used or deployed.

No public indicators of compromise are published beyond the log line. An attempt that failed may leave no trace, and the log line is a lead, not proof of a successful takeover.

Timeline

  • 2026-11-24: Jiawei Guo reports the flaw privately to JetBrains.
  • 2026-12-02: JetBrains publishes the advisory and releases 2026.1.7, 2026.2.3 and 2026.3, plus the patch plugin.
  • 2026-12-02: The CVE-2026-136858 record is published.

From private report to fixed release in 8 days
Figure 1: TeamCity CVE-2026-136858 from the private report on 2026-11-24 to the fixed releases and CVE record on 2026-12-02. Source: JetBrains advisory and CVE record, checked December 3, 2026

FAQ

Is TeamCity Cloud affected?

No. JetBrains applied the fix to TeamCity Cloud and says it found no evidence that any Cloud environment was exploited through this vulnerability. Cloud customers do not need to act.

Does the attacker need a TeamCity account?

No. The advisory says an unauthenticated attacker who can reach the server over HTTP(S) can impersonate an existing authorized agent. The attacker does not need a user account.

Is there a public exploit?

No public proof of concept is known, and the advisory says JetBrains was not aware of active exploitation when it published on 2026-12-02. The CVE is not in CISA KEV as of 2026-12-03.

What if I cannot upgrade?

Install the patch plugin, which supports TeamCity 2021.2 and later, or restrict /app/agents and its subpaths to the addresses where your agents connect. The allowlist is a mitigation, not a fix, and it does not stop an attacker on an allowed address.

Which versions are affected?

Every TeamCity On-Premises version is affected. The fixed releases are 2026.1.7, 2026.2.3 and 2026.3. The patch plugin covers 2021.2 and later.

How do I know which agent was targeted?

Search the server log for the token-mismatch line and use its timestamp to review that agent's connection history and builds. A non-empty token is suspicious; an empty token is expected.

Find exposed TeamCity servers with Ostorlab

Ostorlab's attack surface discovery inventories the internet-facing servers and services you expose. Use it to see which TeamCity instances are reachable from outside your network and to prioritize the ones that still need 2026.1.7, 2026.2.3 or 2026.3.

References

  • JetBrains advisory, "Critical Security Issue Affecting TeamCity On-Premises (CVE-2026-136858)", 2026-12-02: https://blog.jetbrains.com/teamcity/2026/12/cve-2026-136858/ (checked December 3, 2026)
  • CVE-2026-136858 record: https://www.cve.org/CVERecord?id=CVE-2026-136858 (checked December 3, 2026)
  • JetBrains security patch plugin for CVE-2026-136858: https://download.jetbrains.com/teamcity/plugins/internal/CVE-2026-136858-patch.zip (checked December 3, 2026)
  • TeamCity download page: https://www.jetbrains.com/teamcity/download/ (checked December 3, 2026)
  • CISA Known Exploited Vulnerabilities catalog: https://www.cisa.gov/known-exploited-vulnerabilities-catalog (checked December 3, 2026)

Free scan

Scan your own app for free

or book a demo

Keep reading

Related articles

Browse the blog