| ID | Technique | Tactic |
|---|---|---|
| T1046 | Network Service Discovery | Discovery |
Detection: Internal Horizontal Port Scan NMAP Top 20
Description
This analytic identifies instances where an internal host has attempted to communicate with 250 or more destination IP addresses using on of the NMAP top 20 ports. Horizontal port scans from internal hosts can indicate reconnaissance or scanning activities, potentially signaling malicious intent or misconfiguration. By monitoring network traffic logs, this detection helps detect and respond to such behavior promptly, enhancing network security and preventing potential threats.
Search
1
2| tstats `security_content_summariesonly`
3 count min(_time) as firstTime
4 max(_time) as lastTime
5 dc(All_Traffic.dest_ip) as totalDestIPCount
6 values(All_Traffic.action) as action
7 values(All_Traffic.dest_zone) as dest_zone
8 values(All_Traffic.rule) as rule
9 values(All_Traffic.src_category) as src_category
10 values(All_Traffic.src_port) as src_port
11 values(All_Traffic.src_zone) as src_zone
12
13from datamodel=Network_Traffic where
14
15All_Traffic.src_ip IN (
16 "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "100.64.0.0/10",
17 "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",
18 "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",
19 "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",
20 "198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4"
21)
22All_Traffic.dest_port IN (
23 21, 22, 23, 25, 53, 80, 110, 111,
24 135, 139, 143, 443, 445, 993, 995,
25 1723, 3306, 3389, 5900, 8080
26)
27
28by span=1h _time
29 All_Traffic.src_ip All_Traffic.dest_port
30 All_Traffic.transport
31
32
33| `drop_dm_object_name("All_Traffic")`
34
35| where totalDestIPCount>=250
36
37| eval dest_port=transport + "/" + dest_port
38
39| stats min(firstTime) as firstTime
40 max(lastTime) as lastTime
41 dc(dest_port) as num_ports_scanned
42 sum(totalDestIPCount) as totalDestIPCount
43 values(action) as action
44 values(dest_port) as dest_ports
45 values(dest_zone) as dest_zone
46 values(rule) as rule
47 values(src_category) as src_category
48 values(src_zone) as src_zone
49 by _time src_ip
50
51| fields - _time
52
53| `security_content_ctime(lastTime)`
54
55| `security_content_ctime(firstTime)`
56
57| `internal_horizontal_port_scan_nmap_top_20_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| AWS CloudWatchLogs VPCflow | '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_ctime | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$) |
| internal_horizontal_port_scan_nmap_top_20_filter | search * |
internal_horizontal_port_scan_nmap_top_20_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 |
Implementation
To properly run this search, Splunk needs to ingest data from networking telemetry sources such as firewalls like Cisco Secure Firewall, 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 for ports $dest_ports$ across $totalDestIPCount$ destination IPs
| Risk Object | Risk Object Type | Risk Score | Threat Objects |
|---|---|---|---|
| src_ip | system | 50 | No Threat Objects |
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: 9