TeamCity CVE-2026-136858: patch, then check one log line for a build agent takeover
JetBrains fixed a flaw in every TeamCity On-Premises version that lets anyone who can reach the server pose as a real build agent, with no login. That can expose build secrets and let an attacker swap build results. JetBrains also gave a log check, and this page turns it into steps.
Read the original first: https://blog.jetbrains.com/teamcity/2026/12/cve-2026-136858/
In one minute
- CVE-2026-136858 affects all TeamCity On-Premises versions. TeamCity Cloud is already fixed.
- Anyone who can reach the server over HTTP(S) may be able to pose as an existing build agent. No TeamCity account is needed.
- A fake agent can take builds meant for the real one, read the secrets passed to it, and publish tampered artifacts.
- Fixed in 2026.1.7, 2026.2.3 and 2026.3. A patch plugin covers 2021.2 and later without a restart.
- JetBrains says it knows of no attacks so far. Jiawei Guo reported the bug on November 24.
- JetBrains gives a log line to search for. A non-empty token in it may mean someone tried to take over an agent.
What broke
A build agent is the machine that runs your builds. The TeamCity server hands it jobs, plus the passwords and keys those jobs need.
JetBrains says an attacker who can reach the server over HTTP(S) could pose as an existing, approved agent. The attacker needs no TeamCity account. The real agent can be pushed aside, and its builds go to the attacker.
From there, JetBrains lists three harms: the attacker sees secrets passed to the agent, can fake build results, and can publish tampered artifacts. Later builds that use those artifacts could run the attacker's code.
JetBrains did not publish how the takeover works. The Hacker News reports a CVSS score of 9.1; the JetBrains post we read does not give a score.
Patch it
- Best: update to 2026.1.7, 2026.2.3 or 2026.3.
- Can not restart now: install the security patch plugin. It works on TeamCity 2021.2 and later and needs no restart. It fixes only this bug.
- On 2024.03 through 2026.2.1: look under Administration, Updates, Available security updates.
- On 2026.2.2 and later: under Security patches, choose Install automatically and the server should fetch the fix itself.
- TeamCity Cloud: nothing to do. JetBrains says it found no sign any Cloud server was attacked this way.
Check whether someone tried
JetBrains says to search teamcity-server.log for this text: of the existing agent, but different authorization token. Entries with an empty token are normal. A non-empty token may be a takeover attempt.
These are plain commands. We did not run them against a real TeamCity server. Run them in your TeamCity logs folder.
# All entries with the phrase JetBrains names grep -n 'of the existing agent, but different authorization token' teamcity-server.log* # Drop the normal ones with an empty token grep -n 'of the existing agent, but different authorization token' teamcity-server.log* | grep -v 'token ""'
If you get a hit, JetBrains says to use its time to look at that agent's connection history and the builds it got. Check that the host name and IP address are the ones you expect. Then compare build logs, results and artifacts.
If you think it worked: keep the logs, patch, rotate every credential passed to those builds, and treat their artifacts as untrusted until checked. Find where those artifacts were used or deployed.
Fence off the agent door
JetBrains also suggests a network rule. Let requests to /app/agents and the paths under it come only from the IP addresses your agents really use. Include cloud agents' outbound addresses and any NAT gateways.
An example for nginx in front of TeamCity. This is our sketch, not from JetBrains, and not tested:
location /app/agents {
allow 10.20.0.0/16; # your agents' addresses
allow 203.0.113.10; # a cloud agent NAT gateway
deny all;
proxy_pass http://teamcity_upstream;
}JetBrains's wider advice: keep TeamCity on trusted networks, use a VPN for outside users and agents, and run the server and agents on different hosts.
Who is affected
| Case | Status |
|---|---|
| TeamCity On-Premises, all versions before the fix | Affected. |
| 2026.1.7, 2026.2.3, 2026.3 | Fixed. |
| 2021.2 and later with the patch plugin | Fixed for this bug only. |
| TeamCity Cloud | Fixed by JetBrains. No action. |
What to do
- Update to 2026.1.7, 2026.2.3 or 2026.3, or install the patch plugin.
- On 2026.2.2 or later, set security patches to install automatically.
- Search teamcity-server.log for the takeover line with a non-empty token.
- Allow /app/agents only from your agents' IP addresses.
- If you find a hit, rotate build secrets and treat those builds' artifacts as untrusted.
What is still unknown
- How the takeover works. JetBrains has not published the details.
- Whether anyone has used it. JetBrains says it knows of no attacks so far.
- How long the log check can look back. That depends on how long you keep teamcity-server.log.
Sources
- JetBrains: Critical Security Issue Affecting TeamCity On-Premises (CVE-2026-136858) - the original report
- The Hacker News: Critical JetBrains TeamCity Flaw Lets Attackers Hijack Build Agents Without Authentication