Detection: PHP Serialized Object in POST Body

Description

This analytic finds a PHP serialized object marker in an HTTP POST body. Such input can reach unsafe deserialization paths, including session upload progress when applications share session storage but use different serializers. Review the target's session settings and subsequent process activity.

 1`zeek_http_post_body`
 2method="POST"
 3truncated=false
 4body="*
 5|O:*"
 6
 7
 8| where match(body,"\\
 9|O:[0-9]+:")
10
11
12| eval src=coalesce(src,'id.orig_h'),
13       dest=coalesce(dest,'id.resp_h'),
14       dest_port=coalesce(dest_port,'id.resp_p')
15
16
17| stats min(_time) as firstTime
18        max(_time) as lastTime
19        values(uri) as url
20        max(body_bytes) as body_bytes
21        by uid src dest dest_port
22
23
24| `security_content_ctime(firstTime)`
25
26| `security_content_ctime(lastTime)`
27
28| `php_serialized_object_in_post_body_filter`

Data Source

Name Platform Sourcetype Source
Zeek HTTP POST Body Web 'zeek:http_post_body:json' 'http_post_body.log'

Macros Used

Name Value
zeek_http_post_body sourcetype="zeek:http_post_body:json"
php_serialized_object_in_post_body_filter search *
php_serialized_object_in_post_body_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

CVE

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Finding (Notable) No
Creates Intermediate Finding (Risk Event) Yes
Anomaly detections generate Intermediate Findings (Risk Events). They do not generate a Finding (Notable) directly.

Implementation

Install the custom Zeek HTTP POST Body script from https://gist.github.com/nasbench/4cd18a938056cbfbc8a9832edb26f4c4 and forward http_post_body.log. This script is not included with ESCU or the TA for Zeek. Set KV_MODE=json for the custom sourcetype on the search head and configure zeek_http_post_body for its index and sourcetype. Confirm that body, truncated, uid, method, uri, body_bytes, id.orig_h, id.resp_h, and id.resp_p are extracted. The sensor must see plaintext HTTP traffic. Capture enough of each POST body to include the serialized object marker. Review the captured data policy because bodies may contain sensitive values. Confirm whether the target uses session upload progress and whether applications sharing a session store use different serializers. Check nearby process events before treating a match as command execution.

Known False Positives

Authorized security testing and applications that legitimately transfer serialized PHP objects can match. Confirm that the target deserializes the input before escalating.

Associated Analytic Story

Intermediate Findings

Message Entity Field Entity Type Risk Score
Serialized PHP object marker sent from [$src$] to [$dest$]. dest system 10

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation ✅ Passing N/A N/A N/A
Unit ✅ Passing Dataset not_applicable zeek:http_post_body:json
Integration ✅ Passing Dataset not_applicable zeek:http_post_body:json

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub |

Version: 1