Detection: HTTP C2 Framework User Agent

Description

This Splunk query analyzes web logs to identify and categorize user agents, detecting various types of c2 frameworks. This activity can signify malicious actors attempting to interact with hosts on the network using known default configurations of command and control tools.

1
2| tstats  `security_content_summariesonly` count min(_time) as firstTime max(_time) as lastTime from datamodel=Web where Web.http_user_agent != null by Web.http_user_agent Web.http_method, Web.url, Web.url_length Web.src, Web.dest 
3| `drop_dm_object_name("Web")` 
4| lookup suspicious_c2_user_agents c2_user_agent AS http_user_agent OUTPUT tool, description 
5| where isnotnull(tool) 
6| stats count min(firstTime) as first_seen max(lastTime) as last_seen by tool url http_user_agent src dest description 
7| `security_content_ctime(first_seen)` 
8| `security_content_ctime(last_seen)` 
9| `http_c2_framework_user_agent_filter`

Data Source

Name Platform Sourcetype Source
Suricata Other 'suricata' 'suricata'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
http_c2_framework_user_agent_filter search *
http_c2_framework_user_agent_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 Notable Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Risk Event True
This configuration file applies to all detections of type TTP. These detections will use Risk Based Alerting and generate Notable Events.

Implementation

To successfully implement this search, you need to be ingesting web or proxy logs, or ensure it is being filled by a proxy like device, into the Web Datamodel. For additional filtering, allow list private IP space or restrict by known good.

Known False Positives

Filtering may be required in some instances depending on legacy system usage, filter as needed.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message:

A known C2 Framework user agent $http_user_agent$ was performing a request from $src$ to $dest$.

Risk Object Risk Object Type Risk Score Threat Objects
src system 60 dest, http_user_agent

References

Detection Testing

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

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