14 min to read
TeamCity CVE-2026-136858: Hunting Build Agent Hijacks
Attackers began guessing agent IDs a day after disclosure. Here is how to check your server.
Your CI/CD server holds the keys to almost everything: source code, cloud credentials, package registry tokens, signing keys and the binaries your customers install. On 2 December 2026, JetBrains disclosed a critical flaw in TeamCity On-Premises that lets an attacker with no account pose as one of your trusted build agents. Within about a day, watchTowr said attackers were already trying to exploit it on its honeypot network.
This tutorial covers what the flaw does, where the evidence ends up, and how to search your logs, SIEM and reverse proxy for it. It ends with a cleanup plan for when you find a hit.
TL;DR / Key takeaways
- CVE-2026-136858 (CVSS 9.1) is an authentication bypass in TeamCity On-Premises agent registration. An unauthenticated attacker who can reach the server over HTTP(S) can impersonate an existing build agent, receive its builds and read the secrets passed to it.
- All On-Premises versions are affected. The fixed versions are 2026.1.7, 2026.2.3 and 2026.3. If you cannot upgrade yet, a security patch plugin covers 2021.2 and later and installs without a restart. TeamCity Cloud is already fixed.
- watchTowr saw exploitation attempts on 3 December, with attackers guessing agent IDs. Agent IDs start at “1”, so guessing is easy.
- What to look for:
teamcity-server.loglines that containof the existing agent, but different authorization tokenwith a non-empty token.- Upgrading does not undo a compromise that already happened. If you find a hit, rotate the build credentials and treat the artifacts from that period as untrusted until you have checked them.
What happened: a short timeline
| Date (2026) | Event |
|---|---|
| 24 Nov | Security researcher Jiawei Guo privately reports the issue to JetBrains. |
| 2 Dec | JetBrains publishes its advisory and fixed versions 2026.1.7, 2026.2.3 and 2026.3, plus a security patch plugin for 2021.2 and later. JetBrains says it is “not aware of any active exploitation” at that point. |
| 3 Dec | watchTowr sees exploitation attempts on its Attacker Eye honeypot network. The Hacker News covers the flaw. |
| 4 Dec | watchTowr publishes its analysis. SecurityWeek reports the flaw was “reverse engineered, reproduced, and exploited in the wild”. |
| 5 Dec | At the time of writing, sources we checked do not show CVE-2026-136858 in CISA’s KEV catalog, and no confirmed victims have been named. |
Be careful how you read the evidence. watchTowr has seen attempts against honeypots. That does not confirm that real organisations were breached. The attempts still matter because they tell you attackers can reproduce the exploit and are scanning for it now.
This is also not the first serious TeamCity flaw this year. The Hacker News notes that CVE-2026-63077 (CVSS 9.8), disclosed about four months ago, was used in real-world attacks according to CISA. Attackers are clearly interested in CI servers.
How the attack works (conceptually)
A TeamCity server sends build jobs to build agents. Each agent registers with the server and is identified by an agent ID and an authorization token. The flaw is in that registration step. According to JetBrains, an attacker can present themselves as an existing authorised agent without holding its real credentials. watchTowr says the only real requirement is guessing a valid agent ID, and IDs start at 1. The Hacker News, quoting watchTowr, says a successful attack can take as little as two HTTP requests.
After the attacker takes the agent’s place:
- Builds go to the attacker. The fake agent can replace the real one and receive the builds assigned to it.
- Secrets leak. Credentials and parameters sent to the agent during a build reach the attacker, such as VCS tokens, cloud keys, registry passwords and deployment credentials.
- Results and artifacts can be forged. The attacker can report false build results or publish tampered artifacts. JetBrains warns that “downstream builds that consume those artifacts could execute attacker-supplied code”.
Point 3 is why this is a supply-chain issue and not just a server bug. A single forged artifact can spread into your releases, containers or customer downloads.
We are not publishing exploit details. The defensive picture above is all you need for the hunt.
Am I affected?
Answer these four questions:
- Do you run TeamCity On-Premises? If you use TeamCity Cloud only, JetBrains says you do not need to do anything.
- Is your version older than 2026.1.7, 2026.2.3 or 2026.3, and is the security patch plugin missing? If so, the server is vulnerable.
- Can untrusted networks reach the server over HTTP(S)? That includes the internet, partner VPNs and flat corporate networks. Servers reachable from the internet are the most urgent.
- Do your builds handle secrets or publish artifacts that other builds or customers use? If so, the impact of a hijack is much larger.
| To check the version, use the footer of the TeamCity web UI or the *Administration | Server Administration* area. To check patch status, go to **Administration | Updates. On 2024.03 through 2026.2.1, review Available security updates. On 2026.2.2 and later, check the Security patches setting. If it is set to **Install automatically, JetBrains says the server should already have fetched this patch. Confirm that it did, and do not assume. |
Step 1: Preserve evidence before you change anything
watchTowr and JetBrains both recommend preserving server logs and build results before you patch or restart. Copy these somewhere outside the TeamCity host:
~|#| Run on the TeamCity server (adjust paths to your installation)
TC_LOGS~|=|/opt/teamcity/logs ~|#| ~|<|TeamCity Home>/logs
CASE~|=|/srv/ir/teamcity~|-|$(date +%Y%m%d)
mkdir ~|-|p "$CASE"
cp ~|-|a "$TC_LOGS"/teamcity~|-|server.log* "$CASE"/
cp ~|-|a "$TC_LOGS"/teamcity~|-|auth.log* "$CASE"/ 2>/dev/null || true
~|#| Also copy the reverse proxy / load balancer access logs covering 24 Nov onwards
sha256sum "$CASE"/* > "$CASE"/SHA256SUMS
Make sure your log retention reaches back to at least 24 November, the date the bug was reported. Older is better.
Step 2: Search the server log for the takeover message
JetBrains gives one high-value indicator. In teamcity-server.log, search for:
of the existing agent, but different authorization token "~|<|token>"
The key detail is the token value:
- Empty token (
""): JetBrains says this is expected and you can ignore it. - Non-empty token: this “may indicate an attempt to take over an existing build agent”. Investigate it.
A quick first pass on the host:
~|#| All candidate lines, including rotated logs
grep ~|-|h 'of the existing agent, but different authorization token' \
/opt/teamcity/logs/teamcity~|-|server.log* \
| grep ~|-|v 'authorization token ""' \
| sed ~|-|E 's/(authorization token ")[^"]{4}[^"]*"/****REDACTED"/' \
| sort | tee /srv/ir/teamcity~|-|takeover~|-|candidates.txt
The sed replaces the token with ****REDACTED so you don’t copy a live credential into tickets and chat. The original is still in the preserved logs.
Splunk
If you already send TeamCity server logs to Splunk:
index~|=|cicd sourcetype~|=|teamcity:server "of the existing agent, but different authorization token"
| rex field~|=|_raw "authorization token \"(?~|<|presented_token>[^\"]*)\""
| where len(presented_token) > 0
| eval token_hint ~|=| substr(presented_token, 1, 4) . "..."
| table _time host token_hint _raw
| sort _time
Microsoft Sentinel / KQL
The query below assumes a custom table, TeamCityServer_CL, ingested through the Azure Monitor Agent from a text log. Change the table and column names to match your setup.
TeamCityServer_CL
| where TimeGenerated > datetime(2026~|-|11~|-|24)
| where RawData has "of the existing agent, but different authorization token"
| extend PresentedToken ~|=| extract(@"authorization token ""([^""]*)""", 1, RawData)
| where isnotempty(PresentedToken)
| project TimeGenerated, Computer, TokenHint ~|=| strcat(substring(PresentedToken, 0, 4), "..."), RawData
| order by TimeGenerated asc
Sigma (generic)
title: TeamCity Agent Takeover Attempt (CVE~|-|2026~|-|136858)
id: 0b7d3c2e~|-|5f0a~|-|4a61~|-|9a77~|-|2f3c1d4e6b10
status: experimental
description: Detects TeamCity server log entries where an existing agent presented a different, non~|-|empty authorization token, per JetBrains guidance for CVE~|-|2026~|-|136858.
references:
~|-| https://blog.jetbrains.com/teamcity/2026/12/cve~|-|2026~|-|136858/
author: OffensioX
date: 2026~|-|12~|-|05
logsource:
product: teamcity
service: server
detection:
keywords:
~|-| 'of the existing agent, but different authorization token'
filter_empty:
~|-| 'authorization token ""'
condition: keywords and not filter_empty
falsepositives:
~|-| Legitimate agent re~|-|registration after token reset (verify with the agent owner)
level: high
tags:
~|-| attack.initial~|-|access
~|-| attack.t1190
~|-| attack.credential~|-|access
~|-| cve.2026~|-|136858
Step 3: Check every hit against the agent’s normal behaviour
For each non-empty-token hit, JetBrains says to use the timestamp to review the agent’s connection history and the builds assigned to it at that time, and to confirm that the hostname and source IP match what you expect. Work through the following questions for each hit.
- Who connected? Find the source IP in the reverse proxy logs at the same timestamp. Is it one of your agent hosts, cloud agent ranges or NAT gateways?
- Did the real agent drop off? In Agents, look for the legitimate agent going disconnected or reconnecting around the event.
- Which builds ran on that agent during the window? List them, then note which ones use password-type parameters, connections to cloud or registry services, or deployment steps.
- Do the artifacts look right? Compare artifact hashes and sizes with earlier builds of the same commit, or rebuild the commit on a clean, trusted agent and compare. Check whether build logs are unusually short or are missing expected steps.
- Where did the artifacts end up? Trace them into dependent builds, container registries, package feeds, update servers and production.
Step 4: Search the reverse proxy logs for agent-ID guessing
watchTowr observed attackers guessing agent ID numbers. Even if you are fully patched, your proxy or WAF logs can show whether someone probed you. Search for requests to /app/agents and its subpaths from source IPs that are not on your list of agent addresses.
~|#| nginx combined log format: field 1 ~|=| client IP, field 7 ~|=| path
KNOWN~|=|'^(10\.20\.0\.|10\.20\.1\.|203\.0\.113\.10$)' ~|#| your agent subnets / NAT IPs
zcat ~|-|f /var/log/nginx/teamcity~|-|access.log* \
| awk '$7 ~ "^/app/agents" {print $1}' \
| grep ~|-|Ev "$KNOWN" | sort | uniq ~|-|c | sort ~|-|rn | head ~|-|50
index~|=|proxy uri_path~|=|"/app/agents*" NOT [| inputlookup teamcity_agent_ips.csv | fields src_ip]
| stats count dc(uri_path) as distinct_paths min(_time) as first max(_time) as last by src_ip http_user_agent
| where count > 5
| convert ctime(first) ctime(last)
Pay closest attention to sources that hit many distinct agent paths in a short burst, and to any that appear just before a non-empty-token log line.
Step 5: Patch, then restrict agent traffic
Patch first. Upgrade to 2026.1.7, 2026.2.3 or 2026.3. If you can’t, install the security patch plugin, which works on 2021.2 and later without a restart. JetBrains notes that the plugin fixes only this CVE, so still plan a full upgrade.
Then add path-based access control. JetBrains recommends allowing /app/agents and its subpaths only from IPs where you expect legitimate build agents to originate, including cloud agents’ outbound addresses and NAT gateways. An example for nginx:
~|#| Inside the server {} block that fronts TeamCity
location ^~ /app/agents {
allow 10.20.0.0/23; ~|#| on~|-|prem agent subnet
allow 203.0.113.10; ~|#| NAT gateway used by cloud agents
deny all;
proxy_pass http://127.0.0.1:8111;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X~|-|Forwarded~|-|For $proxy_add_x_forwarded_for;
proxy_set_header X~|-|Forwarded~|-|Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Test it safely. From a host that is not on the allowlist, request a harmless agent path and confirm you get a 403:
curl ~|-|s ~|-|o /dev/null ~|-|w '%{http_code}\n' https://teamcity.example.internal/app/agents/
~|#| Expect: 403 from a non~|-|agent host; agents themselves should keep connecting normally
Then watch the Agents page for 15 to 30 minutes to make sure your real agents (including any auto-scaling cloud agents) stay connected. Test this in staging first if you have it.
Prioritised action checklist
Immediately (today)
- Find every TeamCity On-Premises server you run, including any a team set up without telling IT.
- Preserve
teamcity-server.log*and proxy logs back to 24 November. - Upgrade to 2026.1.7 / 2026.2.3 / 2026.3, or apply the security patch plugin.
- Run the non-empty-token search (Step 2).
- Take internet-exposed servers off the open internet or put them behind a VPN.
This week
- Deploy the
/app/agentsIP allowlist at the reverse proxy or WAF. - Add the Sigma, Splunk or KQL detection as a standing alert.
- For any hit: rotate every credential passed to affected builds (VCS, cloud, registry, signing, deployment), and quarantine and rebuild the artifacts from that window.
- Turn on automatic security patch installation (2026.2.2+) or Download and notify.
Longer term
- Follow JetBrains’ guidance to run the server and agents on separate hosts.
- Replace long-lived secrets in build parameters with short-lived credentials (OIDC federation to your cloud, a secrets vault).
- Sign release artifacts and verify signatures in downstream builds and deployments, so a forged artifact fails the check.
- Add CI/CD servers to your attack surface monitoring and penetration testing scope.
OffensioX perspective
Build systems have become one of the main targets in supply-chain attacks, because breaking into one gives an attacker both your secrets and a way to deliver code to everyone who trusts your releases. This flaw shows the pattern clearly. Attackers did not need code execution on the server. Pretending to be a worker the server already trusts was enough. In assessments we often see CI servers exposed “temporarily” for a contractor or a cloud runner and never locked down again, with dozens of long-lived credentials in build parameters. Patching closes this particular hole. Network-level allowlisting, short-lived credentials and artifact signing are what reduce the damage the next time a CI flaw appears.
If you’d like an independent review, OffensioX offers penetration testing and CI/CD security assessments that cover how exposed your build pipeline is and how far an attacker could get from it.
References
- JetBrains: Critical Security Issue Affecting TeamCity On-Premises (CVE-2026-136858)
- watchTowr: CVE-2026-136858, Exploited Auth Bypass in JetBrains TeamCity
- watchTowr: JetBrains TeamCity CVE-2026-136858 FAQ
- SecurityWeek: JetBrains TeamCity Vulnerability Exploited One Day After Disclosure
- The Hacker News: Critical JetBrains TeamCity Flaw Lets Attackers Hijack Build Agents Without Authentication
- Security Affairs: Hackers exploit critical JetBrains TeamCity flaw one day after disclosure
- CVE Record: CVE-2026-136858
- NVD: CVE-2026-136858