TeamCity Exploited Within 24 Hours: How to Check and Protect the Server

TeamCity Exploited Within 24 Hours: How to Check and Protect the Server

WatchTowr observed attempts to exploit CVE-2026-136858 one day after disclosure: the flaw allows an attacker to impersonate an authorized TeamCity On-Premises build agent and intercept jobs. JetBrains says all on-premises versions are affected; TeamCity Cloud has already been patched, and its customers do not need to take action.

The issue allows someone without a TeamCity account who can reach the server over HTTP(S) to impersonate an existing agent. Attackers may receive builds assigned to that agent and expose secrets, falsify results, or modify artifacts that could execute code in subsequent builds.

Check whether your installation is affected

On-premises, not cloud, is the scope of this alert. JetBrains says all TeamCity On-Premises versions are affected. If your organization uses TeamCity Cloud, JetBrains has already applied corrective measures and says it found no signs of exploitation in those environments.

Check which edition and version your team manages, and prioritize servers accessible from the Internet. SecurityWeek reports WatchTowr's recommendation to address those systems first, followed by systems that run builds with sensitive credentials. The risk is not limited to the server: an impersonated agent can capture secrets it receives while running jobs.

The vulnerability requires guessing the identifier of an existing agent. WatchTowr said this is not a significant barrier when identifiers are predictable; they often start with “1.” Do not assume the environment is safe just because an attacker needs to guess this detail.

Steps to patch and look for signs

  1. Update to a patched version: JetBrains recommends installing 2026.1.7, 2026.2.3, or 2026.3. You can download and install one of these versions or use TeamCity's automatic update option. The table summarizes the alternatives published by JetBrains.

    SituationRecommended action
    TeamCity On-PremisesUpdate to 2026.1.7, 2026.2.3, or 2026.3.
    Cannot update and using 2021.2 or laterInstall the security patch plugin.
    TeamCity CloudNo customer action is required.
  2. If you cannot update, apply the plugin. JetBrains offers it for TeamCity 2021.2 and later; it fixes this specific vulnerability and does not require a server restart. It is not a substitute for an update: JetBrains warns that the plugin only addresses CVE-2026-136858.

    For versions 2024.03 through 2026.2.1, JetBrains says pending patches can be reviewed under Administration | Updates, in Available security updates. In 2026.2.2 and later, automatic installation is configured under Administration | Updates, in Security patches, by selecting Install automatically. If Download and notify is selected, review and apply the downloaded patches on the Updates page.

  3. Look for the indicator in teamcity-server.log. JetBrains asks users to find entries containing this fragment:

    of the existing agent, but different authorization token

    Check whether the associated token is empty or contains a value. According to JetBrains, a non-empty token may indicate an impersonation attempt; entries with an empty token ("") are expected and can be disregarded for this check. The log alone does not confirm that the attempt succeeded.

  4. Investigate around the recorded time. If you find a non-empty token, use its timestamp to review the agent's connection history and the jobs it received during that period. Compare the hostname and source IP address with the expected values. Also check build logs, results, and published artifacts to determine whether a takeover occurred.

  5. Restrict who can reach /app/agents. As an additional measure, configure the reverse proxy or another path-based access control to allow requests to /app/agents and its subpaths only from the expected IPs of legitimate agents. JetBrains notes that you should include the egress addresses of cloud agents and the NAT gateways they connect through.

  6. If you suspect an intrusion, preserve evidence before changing the environment: save relevant logs and build results. Then update or apply the patch, rotate credentials provided to potentially affected jobs, and treat their artifacts as untrusted until verified. Track where those artifacts were used or deployed.

TeamCity explotado en 24 horas: cómo revisar y proteger el servidor
© The JetBrains Blog

Mistakes that can leave the risk unaddressed

Do not confuse cloud with on-premises: TeamCity Cloud has already been patched, but that does not apply to TeamCity On-Premises. For the on-premises edition, running a version older than the published fixes means you need to update or apply the patch available for your supported version.

Do not interpret every entry as a confirmed intrusion. JetBrains distinguishes non-empty tokens, which may indicate an attempt, from empty tokens, which it considers expected for this review. Investigate the time, agent, IP, and related builds before concluding whether access was successful.

Do not stop at installing the patch if you find suspicious signs. The fix prevents this vulnerability from remaining open, but it does not by itself determine whether anyone previously obtained secrets or altered artifacts. Preserve evidence, rotate credentials that may have passed through affected jobs, and verify build outputs before trusting them again.

Do not leave the endpoint accessible while preparing the fix if you can restrict it correctly. JetBrains recommends limiting /app/agents and its subpaths to legitimate agent IPs; a rule that omits the egress addresses or NAT gateways in use may prevent valid connections.

Sources: BleepingComputer, SecurityWeek, The JetBrains Blog, Security Affairs