Detection: Kubernetes Anomalous Inbound Outbound Network IO

EXPERIMENTAL DETECTION

This detection status is set to experimental. The Splunk Threat Research team has not yet fully tested, simulated, or built comprehensive datasets for this detection. As such, this analytic is not officially supported. If you have any questions or concerns, please reach out to us at research@splunk.com.

Description

The following analytic identifies high inbound or outbound network I/O anomalies in Kubernetes containers. It leverages process metrics from an OTEL collector and Kubelet Stats Receiver, along with data from Splunk Observability Cloud. A lookup table with average and standard deviation values for network I/O is used to detect anomalies persisting over a 1-hour period. This activity is significant as it may indicate data exfiltration, command and control communication, or unauthorized data transfers. If confirmed malicious, it could lead to data breaches, service outages, financial losses, and reputational damage.

 1
 2| mstats avg(k8s.pod.network.io) as io where `kubernetes_metrics` by k8s.cluster.name k8s.pod.name k8s.node.name direction span=10s 
 3| eval service = replace('k8s.pod.name', "-\w{5}$$
 4|-[abcdef0-9]{8,10}-\w{5}$$", "") 
 5| stats avg(eval(if(direction="transmit", io,null()))) as outbound_network_io avg(eval(if(direction="receive", io,null()))) as inbound_network_io by k8s.cluster.name k8s.node.name k8s.pod.name service _time 
 6| eval key = 'k8s.cluster.name' + ":" + 'service' 
 7| lookup k8s_container_network_io_baseline key 
 8| eval anomalies = "" 
 9| foreach stdev_* [ eval anomalies =if( '<<MATCHSTR>>' > ('avg_<<MATCHSTR>>' + 4 * 'stdev_<<MATCHSTR>>'), anomalies + "<<MATCHSTR>> higher than average by " + tostring(round(('<<MATCHSTR>>' - 'avg_<<MATCHSTR>>')/'stdev_<<MATCHSTR>>' ,2)) + " Standard Deviations. <<MATCHSTR>>=" + tostring('<<MATCHSTR>>') + " avg_<<MATCHSTR>>=" + tostring('avg_<<MATCHSTR>>') + " 'stdev_<<MATCHSTR>>'=" + tostring('stdev_<<MATCHSTR>>') + ", " , anomalies) ] 
10| eval anomalies = replace(anomalies, ",\s$$", "") 
11| where anomalies!="" 
12| stats count values(anomalies) as anomalies by k8s.cluster.name k8s.node.name k8s.pod.name service 
13| rename service as k8s.service 
14| where count > 5 
15| rename k8s.node.name as host 
16| `kubernetes_anomalous_inbound_outbound_network_io_filter`

Data Source

Name Platform Sourcetype Source Supported App
N/A N/A N/A N/A N/A

Macros Used

Name Value
kubernetes_metrics index=kubernetes_metrics
kubernetes_anomalous_inbound_outbound_network_io_filter search *
kubernetes_anomalous_inbound_outbound_network_io_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1204 User Execution Execution
KillChainPhase.INSTALLATION
NistCategory.DE_AE
Cis18Value.CIS_13
LAPSUS$
Scattered Spider

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 Risk Event True
This configuration file applies to all detections of type anomaly. These detections will use Risk Based Alerting.

Implementation

To implement this detection, follow these steps:

  • Deploy the OpenTelemetry Collector (OTEL) to your Kubernetes cluster.
  • Enable the hostmetrics/process receiver in the OTEL configuration.
  • Ensure that the process metrics, specifically Process.cpu.utilization and process.memory.utilization, are enabled.
  • Install the Splunk Infrastructure Monitoring (SIM) add-on. (ref: https://splunkbase.splunk.com/app/5247)
  • Configure the SIM add-on with your Observability Cloud Organization ID and Access Token.
  • Set up the SIM modular input to ingest Process Metrics. Name this input "sim_process_metrics_to_metrics_index".
  • In the SIM configuration, set the Organization ID to your Observability Cloud Organization ID.
  • Set the Signal Flow Program to the following: data('process.threads').publish(label='A'); data('process.cpu.utilization').publish(label='B'); data('process.cpu.time').publish(label='C'); data('process.disk.io').publish(label='D'); data('process.memory.usage').publish(label='E'); data('process.memory.virtual').publish(label='F'); data('process.memory.utilization').publish(label='G'); data('process.cpu.utilization').publish(label='H'); data('process.disk.operations').publish(label='I'); data('process.handles').publish(label='J'); data('process.threads').publish(label='K')
  • Set the Metric Resolution to 10000.
  • Leave all other settings at their default values.
  • Run the Search Baseline Of Kubernetes Container Network IO Ratio

Known False Positives

unknown

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
Kubernetes Anomalous Inbound Outbound Network IO from container on host $host$ 25 50 50
The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Not Applicable N/A N/A N/A
Unit ❌ Failing N/A N/A N/A
Integration ❌ Failing N/A N/A N/A

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: 3