Detection: Web Anomaly Followed by Server Process Execution

Description

This analytic finds a suspicious web request followed by shell or process execution on the same server within 15 minutes. It combines a web signal with an endpoint signal. Investigate the request, the child process, and whether the application normally launches that process.

 1
 2| tstats `security_content_summariesonly`
 3    min(_time) as firstTime
 4    max(_time) as lastTime
 5from datamodel=Risk.All_Risk where
 6
 7All_Risk.risk_object_type="system"
 8
 9source IN (
10    "*PHP Serialized Object in POST Body*",
11    "*PHP SOAP DTD Entity Reference in Attribute*",
12    "*PHP SOAP Malformed Array Dimensions*",
13    "*HTTP Large POST and Oversized Multipart Header Activity*",
14    "*Ruby Repeated Legacy Sharp S Bytes in POST Body*",
15    "*PostScript or EPS Upload with Image or PDF Extension*",
16    "*Large HTTP POST Request Resulting in Server Error*",
17    "*Zeek HTTP Malformed Base64 Padding*",
18    "*Windows Suspicious Child Process Spawned From WebServer*",
19    "*Web or Application Server Spawning a Shell*",
20    "*Linux Auditd Shell from Web or Application Directory*",
21    "*Inline PHP Code Execution*"
22)
23
24by All_Risk.normalized_risk_object source _time span=1s
25
26
27| `drop_dm_object_name(All_Risk)`
28
29
30| where isnotnull(normalized_risk_object)
31
32
33| lookup asset_lookup_by_str asset as normalized_risk_object OUTPUT ip as asset_ip
34
35
36| eval normalized_risk_object=coalesce(asset_ip,normalized_risk_object)
37
38
39| fields - asset_ip
40
41
42| eval web_request=if(in(source,
43      "ESCU - PHP Serialized Object in POST Body - Rule",
44      "ESCU - PHP SOAP DTD Entity Reference in Attribute - Rule",
45      "ESCU - PHP SOAP Malformed Array Dimensions - Rule",
46      "ESCU - HTTP Large POST and Oversized Multipart Header Activity - Rule",
47      "ESCU - Ruby Repeated Legacy Sharp S Bytes in POST Body - Rule",
48      "ESCU - Large HTTP POST Request Resulting in Server Error - Rule",
49      "ESCU - Zeek HTTP Malformed Base64 Padding - Rule",
50      "ESCU - PostScript or EPS Upload with Image or PDF Extension - Rule"),1,0),
51       web_time=if(web_request=1,firstTime,null()),
52       web_source=if(web_request=1,source,null())
53
54
55| sort 0 normalized_risk_object firstTime -web_request
56
57
58| streamstats max(web_time) as preceding_web_time
59              last(web_source) as web_analytic
60              by normalized_risk_object
61
62
63| where web_request=0
64    AND isnotnull(preceding_web_time)
65    AND firstTime>=preceding_web_time
66    AND firstTime-preceding_web_time<=900
67
68
69| eval endpoint_analytic=source,
70       time_delta_seconds=firstTime-preceding_web_time,
71       risk_object=normalized_risk_object,
72       lastTime=firstTime,
73       firstTime=preceding_web_time
74
75
76| fields risk_object web_analytic endpoint_analytic time_delta_seconds firstTime lastTime
77
78
79| `security_content_ctime(firstTime)`
80
81| `security_content_ctime(lastTime)`
82
83| `web_anomaly_followed_by_server_process_execution_filter`

Data Source

No data sources specified for this detection.

Macros Used

Name Value
security_content_summariesonly summariesonly=summariesonly_config allow_old_summaries=oldsummaries_config fillnull_value=fillnull_config``
web_anomaly_followed_by_server_process_execution_filter search *
web_anomaly_followed_by_server_process_execution_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

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) Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Intermediate Finding (Risk Event) No
Correlation detections generate a Finding (Notable). They do not generate Intermediate Findings (Risk Events).

Implementation

Enable at least one web analytic and one endpoint analytic named in the search, and configure them to write system risk events to Enterprise Security. Finding-only endpoint analytics need a risk action enabled before this Risk data model search can consume them. Configure ES asset identification with each web server's IP and hostname. The search uses the ES asset lookup to join web destination IPs and endpoint hostnames on the server IP. Without that mapping, the two signals cannot join. Run this search every 5 minutes over a lookback of at least 20 minutes, and throttle findings by risk_object for 15 minutes to avoid repeats from overlapping windows. Tune the 900-second interval and the source list for the applications and log sources in your environment.

Known False Positives

Large uploads, malformed requests, and legitimate application maintenance can occur close together. Review the request path, process command line, service account, and application schedule before escalating.

Associated Analytic Story

Finding

Title Entity Field Entity Type Risk Score
Web anomaly followed by server process execution on [$risk_object$] risk_object system 50

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation ✅ Passing N/A N/A N/A
Unit ✅ Passing Dataset not_applicable stash
Integration ✅ Passing Dataset not_applicable stash

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