Detection: Internal Vertical Port Scan

Description

This analytic detects instances where an internal host attempts to communicate with over 500 ports on a single destination IP address. It includes filtering criteria to exclude applications performing scans over ephemeral port ranges, focusing on potential reconnaissance or scanning activities. Monitoring network traffic logs allows for timely detection and response to such behavior, enhancing network security by identifying and mitigating potential threats promptly.

 1
 2| tstats `security_content_summariesonly`
 3  count min(_time) as firstTime
 4        max(_time) as lastTime
 5        values(All_Traffic.action) as action
 6        values(All_Traffic.src_category) as src_category
 7        values(All_Traffic.dest_zone) as dest_zone
 8        values(All_Traffic.src_zone) as src_zone
 9
10from datamodel=Network_Traffic where
11
12All_Traffic.src_ip IN (
13  "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "100.64.0.0/10",
14  "127.0.0.0/8", "169.254.0.0/16", "192.0.0.0/24", "192.0.0.0/29", "192.0.0.8/32",
15  "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24",
16  "192.31.196.0/24", "192.52.193.0/24", "192.88.99.0/24", "224.0.0.0/4", "192.175.48.0/24",
17  "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4"
18)
19
20by span=1s _time
21   All_Traffic.src_ip All_Traffic.dest_port
22   All_Traffic.dest_ip All_Traffic.transport
23   All_Traffic.rule
24
25
26| `drop_dm_object_name("All_Traffic")`
27
28| eval gtime=_time
29
30| bin span=1h gtime
31
32
33| stats min(_time) as _time
34        values(action) as action
35        dc(eval(if(dest_port<1024 AND transport="tcp",dest_port,null))) as privilegedDestTcpPortCount
36        dc(eval(if(transport="tcp",dest_port,null))) as totalDestTcpPortCount
37        dc(eval(if(dest_port<1024 AND transport="udp",dest_port,null))) as privilegedDestUdpPortCount
38        dc(eval(if(transport="udp",dest_port,null))) as totalDestUdpPortCount
39        values(src_category) as src_category
40        values(dest_zone) as dest_zone
41        values(src_zone) as src_zone
42  by src_ip dest_ip transport gtime
43
44| eval totalDestPortCount=totalDestUdpPortCount+totalDestTcpPortCount,
45       privilegedDestPortCount=privilegedDestTcpPortCount+privilegedDestUdpPortCount
46
47| where (totalDestPortCount>=500 AND privilegedDestPortCount>=20)
48
49| fields - gtime
50
51| `internal_vertical_port_scan_filter`

Data Source

Name Platform Sourcetype Source
AWS CloudWatchLogs VPCflow AWS icon AWS 'aws:cloudwatchlogs:vpcflow' 'aws_cloudwatchlogs_vpcflow'
Cisco Secure Firewall Threat Defense Connection Event Other 'cisco:sfw:estreamer' 'not_applicable'

Macros Used

Name Value
security_content_summariesonly summariesonly=summariesonly_config allow_old_summaries=oldsummaries_config fillnull_value=fillnull_config``
internal_vertical_port_scan_filter search *
internal_vertical_port_scan_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 properly run this search, Splunk needs to ingest data from networking telemetry sources such as firewalls, NetFlow, or host-based networking events. Ensure that the Network_Traffic data model is populated to enable this search effectively.

Known False Positives

No false positives have been identified at this time.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message:

$src_ip$ has scanned $totalDestPortCount$ ports on $dest_ip$

Risk Object Risk Object Type Risk Score Threat Objects
src_ip system 60 dest_ip

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset aws:cloudwatchlogs:vpcflow aws:cloudwatchlogs:vpcflow
Integration ✅ Passing Dataset aws:cloudwatchlogs:vpcflow aws:cloudwatchlogs:vpcflow

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