Skip to content

Commit 20cb440

Browse files
committed
Haag Story 3: Attack Analytics to the Rescue
"There's a snake in my Tomcat!" When malicious serialized objects started showing up at Sunnyside Server Farm, Security Sheriff Haag rounded up a posse of new detections to keep the web applications safe. This PR delivers: - Two new best friends: tomcat_session_file_upload_attempt and tomcat_session_deserialization_attempt - A brand new playset: "Apache Tomcat Session Deserialization Attacks" analytic story - No more crying when the bad toys try to upload .session files - The claw of justice comes down when suspicious JSESSIONID cookies appear Remember what Security Ranger Haag always says: "To HTTP response codes and beyond!"
1 parent b186cc9 commit 20cb440

3 files changed

Lines changed: 178 additions & 0 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Tomcat Session Deserialization Attempt
2+
id: e28b4fd4-8f5a-41cd-8222-2f1ccca53ef1
3+
version: 1
4+
date: '2025-03-25'
5+
author: Michael Haag, Splunk
6+
status: production
7+
type: Anomaly
8+
description: This detection identifies potential exploitation of CVE-2025-24813 in Apache Tomcat through the second stage of the attack. This phase occurs when an attacker attempts to trigger deserialization of a previously uploaded malicious session file by sending a GET request with a specially crafted JSESSIONID cookie. These requests typically have specific characteristics, including a JSESSIONID cookie with a leading dot that matches a previously uploaded filename, and typically result in a HTTP 500 error when the exploitation succeeds.
9+
data_source:
10+
- Nginx Access
11+
search: '| tstats count min(_time) as firstTime max(_time) as lastTime from datamodel=Web
12+
where Web.http_method=GET AND Web.cookie="*JSESSIONID=.*" AND Web.status=500
13+
by Web.src, Web.dest, Web.http_user_agent, Web.uri_path, Web.cookie, Web.status
14+
| `drop_dm_object_name("Web")`
15+
| where match(cookie, "^JSESSIONID=\.")
16+
| rex field=cookie "JSESSIONID=\.(?<cookie_path>[^;]+)"
17+
| eval severity="High"
18+
| `security_content_ctime(firstTime)`
19+
| `security_content_ctime(lastTime)`
20+
| `tomcat_session_deserialization_attempt_filter`'
21+
how_to_implement: To successfully implement this search, you need to be ingesting logs from your web servers, proxies, or WAFs that process web traffic to Tomcat instances. The data must be mapped to the Web datamodel in the Web node. Ensure your web servers are logging requests that include HTTP methods, status codes, URI paths, and cookie information. Particularly important is capturing the JSESSIONID cookie values. The detection specifically looks for GET requests with a JSESSIONID cookie that starts with a dot (.) and results in a 500 status code, which is characteristic of successful deserialization attempts.
22+
known_false_positives: Limited false positives should occur as this pattern is highly specific to CVE-2025-24813 exploitation. However, legitimate application errors that use similar cookie patterns and result in 500 status codes might trigger false positives. Review the JSESSIONID cookie format and the associated request context to confirm exploitation attempts.
23+
references:
24+
- https://lists.apache.org/thread/j5fkjv2k477os90nczf2v9l61fb0kkgq
25+
- https://nvd.nist.gov/vuln/detail/CVE-2025-24813
26+
- https://github.com/vulhub/vulhub/tree/master/tomcat/CVE-2025-24813
27+
- https://www.rapid7.com/db/vulnerabilities/apache-tomcat-cve-2025-24813/
28+
- https://gist.github.com/MHaggis/e106367f6649fbb09ab27e7b4a01cf73
29+
drilldown_searches:
30+
- name: View the detection results for - "$src$"
31+
search: '%original_detection_search% | search src = "$src$"'
32+
earliest_offset: $info_min_time$
33+
latest_offset: $info_max_time$
34+
- name: View risk events for the last 7 days for - "$src$"
35+
search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$src$")
36+
starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime
37+
values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories)
38+
as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic)
39+
as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)`
40+
| `security_content_ctime(lastTime)`'
41+
earliest_offset: $info_min_time$
42+
latest_offset: $info_max_time$
43+
- name: View suspicious JSESSIONID cookies
44+
search: '%original_detection_search% | fields + uri_path, cookie, status'
45+
earliest_offset: $info_min_time$
46+
latest_offset: $info_max_time$
47+
rba:
48+
message: A Tomcat session deserialization attempt has been detected from IP $src$ targeting $dest$ with a suspicious JSESSIONID cookie. This could indicate exploitation of CVE-2025-24813.
49+
risk_objects:
50+
- field: src
51+
type: system
52+
score: 80
53+
- field: dest
54+
type: system
55+
score: 80
56+
threat_objects:
57+
- field: src
58+
type: ip_address
59+
tags:
60+
analytic_story:
61+
- Apache Tomcat Session Deserialization Attacks
62+
asset_type: Web Application
63+
mitre_attack_id:
64+
- T1190
65+
- T1505.003
66+
product:
67+
- Splunk Enterprise
68+
- Splunk Enterprise Security
69+
- Splunk Cloud
70+
security_domain: network
71+
cve:
72+
- CVE-2025-24813
73+
tests:
74+
- name: True Positive Test
75+
attack_data:
76+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1190/tomcat/tomcat_nginx_access.log
77+
sourcetype: nginx:plus:kv
78+
source: nginx
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Tomcat Session File Upload Attempt
2+
id: a1d8f5c3-9b7e-4f2d-8c51-3bca5e672410
3+
version: 1
4+
date: '2025-03-25'
5+
author: Michael Haag, Splunk
6+
status: production
7+
type: Anomaly
8+
description: This detection identifies potential exploitation of CVE-2025-24813 in Apache Tomcat through the initial stage of the attack. This first phase occurs when an attacker attempts to upload a malicious serialized Java object with a .session file extension via an HTTP PUT request. When successful, these uploads typically result in HTTP status codes 201 (Created) or 409 (Conflict) and create the foundation for subsequent deserialization attacks by placing malicious content in a location where Tomcat's session management can access it.
9+
data_source:
10+
- Nginx Access
11+
search: '| tstats count min(_time) as firstTime max(_time) as lastTime from datamodel=Web
12+
where Web.http_method=PUT AND Web.uri_path="*.session" AND (Web.status=201 OR Web.status=409)
13+
by Web.src, Web.dest, Web.http_user_agent, Web.uri_path, Web.status
14+
| `drop_dm_object_name("Web")`
15+
| rex field=uri_path "/(?<filename>[^/]+)\.session$"
16+
| eval severity="High"
17+
| `security_content_ctime(firstTime)`
18+
| `security_content_ctime(lastTime)`
19+
| `tomcat_session_file_upload_attempt_filter`'
20+
how_to_implement: To successfully implement this search, you need to be ingesting logs from your web servers, proxies, or WAFs that process web traffic to Tomcat instances. The data must be mapped to the Web datamodel in the Web node. Ensure your web servers are logging HTTP PUT requests, including status codes and URI paths. This detection specifically looks for PUT requests targeting files with a .session extension that result in HTTP status codes 201 or 409, which indicate successful creation of files - a pattern consistent with the first stage of CVE-2025-24813 exploitation.
21+
known_false_positives: Some legitimate applications might use PUT requests to create .session files, especially in custom implementations that leverage Tomcat's session persistence mechanism. Verify if the detected activity is part of a normal application flow or if it correlates with other suspicious behavior, such as subsequent GET requests with manipulated JSESSIONID cookies.
22+
references:
23+
- https://lists.apache.org/thread/j5fkjv2k477os90nczf2v9l61fb0kkgq
24+
- https://nvd.nist.gov/vuln/detail/CVE-2025-24813
25+
- https://github.com/vulhub/vulhub/tree/master/tomcat/CVE-2025-24813
26+
- https://www.rapid7.com/db/vulnerabilities/apache-tomcat-cve-2025-24813/
27+
- https://gist.github.com/MHaggis/e106367f6649fbb09ab27e7b4a01cf73
28+
drilldown_searches:
29+
- name: View the detection results for - "$src$"
30+
search: '%original_detection_search% | search src = "$src$"'
31+
earliest_offset: $info_min_time$
32+
latest_offset: $info_max_time$
33+
- name: View risk events for the last 7 days for - "$src$"
34+
search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$src$")
35+
starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime
36+
values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories)
37+
as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic)
38+
as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)`
39+
| `security_content_ctime(lastTime)`'
40+
earliest_offset: $info_min_time$
41+
latest_offset: $info_max_time$
42+
- name: View all PUT requests to .session files
43+
search: '%original_detection_search% | fields + uri_path, status, dest'
44+
earliest_offset: $info_min_time$
45+
latest_offset: $info_max_time$
46+
rba:
47+
message: A Tomcat session file upload attempt has been detected from IP $src$ targeting $dest$ with a suspicious .session file. This could indicate the first stage of CVE-2025-24813 exploitation.
48+
risk_objects:
49+
- field: src
50+
type: system
51+
score: 70
52+
- field: dest
53+
type: system
54+
score: 70
55+
threat_objects:
56+
- field: src
57+
type: ip_address
58+
tags:
59+
analytic_story:
60+
- Apache Tomcat Session Deserialization Attacks
61+
asset_type: Web Application
62+
mitre_attack_id:
63+
- T1190
64+
- T1505.003
65+
product:
66+
- Splunk Enterprise
67+
- Splunk Enterprise Security
68+
- Splunk Cloud
69+
security_domain: network
70+
cve:
71+
- CVE-2025-24813
72+
tests:
73+
- name: True Positive Test
74+
attack_data:
75+
- data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1190/tomcat/tomcat_nginx_access.log
76+
sourcetype: nginx:plus:kv
77+
source: nginx
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Apache Tomcat Session Deserialization Attacks
2+
id: 1a0f125a-0f65-44fc-a96f-576d53d69478
3+
version: 1
4+
status: production
5+
date: '2025-03-25'
6+
author: Michael Haag, Splunk
7+
description: This analytic story addresses critical vulnerabilities in Apache Tomcat that allow attackers to achieve remote code execution through session deserialization attacks. These attacks exploit path equivalence issues in Tomcat's session handling mechanisms, particularly when configured with writable DefaultServlet and file-based session persistence, enabling attackers to upload and execute malicious serialized objects through manipulated session files.
8+
narrative: 'Apache Tomcat''s session management functionality can be exploited when specific configurations are present, particularly involving the DefaultServlet and file-based session persistence. Attackers leverage this by first uploading a malicious serialized object disguised as a session file through an HTTP PUT request. Once the file is uploaded, they manipulate the JSESSIONID cookie to reference this malicious file, forcing Tomcat to deserialize the content and potentially execute arbitrary code. The attack typically manifests in two stages: an initial PUT request that successfully creates a .session file, followed by a GET request with a specially crafted JSESSIONID cookie that triggers the deserialization. This technique has been observed in real-world attacks where threat actors exploit vulnerable Tomcat installations to establish persistent access and execute malicious code on the target system. The detections in this story focus on identifying both stages of this attack pattern, allowing defenders to detect and respond to exploitation attempts before they succeed.'
9+
references:
10+
- https://lists.apache.org/thread/j5fkjv2k477os90nczf2v9l61fb0kkgq
11+
- https://nvd.nist.gov/vuln/detail/CVE-2025-24813
12+
- https://github.com/vulhub/vulhub/tree/master/tomcat/CVE-2025-24813
13+
- https://www.rapid7.com/db/vulnerabilities/apache-tomcat-cve-2025-24813/
14+
tags:
15+
category:
16+
- Adversary Tactics
17+
product:
18+
- Splunk Enterprise
19+
- Splunk Enterprise Security
20+
- Splunk Cloud
21+
usecase: Advanced Threat Detection
22+
cve:
23+
- CVE-2025-24813

0 commit comments

Comments
 (0)