Detection: Socat Network Listener Binding an Executable
Description
The following analytic detects the execution of the socat utility with command-line arguments that configure a TCP or OpenSSL listener and bind an executable to incoming connections.
Socat is a legitimate network utility, but this behavior may be used to expose executables, establish bind shells, facilitate remote command execution, or support lateral movement.
Search
1
2| tstats `security_content_summariesonly`
3 count
4 min(_time) as firstTime
5 max(_time) as lastTime
6
7from datamodel=Endpoint.Processes where
8
9Processes.process_name="socat*"
10Processes.process="*exec:*"
11Processes.process="*-listen:*"
12
13by Processes.dest Processes.original_file_name Processes.parent_process_id
14 Processes.process Processes.process_exec Processes.process_guid
15 Processes.process_hash Processes.process_id
16 Processes.process_current_directory Processes.process_name
17 Processes.process_path Processes.user
18 Processes.user_id Processes.vendor_product
19
20
21| `drop_dm_object_name(Processes)`
22
23| `security_content_ctime(firstTime)`
24
25| `security_content_ctime(lastTime)`
26
27| `socat_network_listener_binding_an_executable_filter`
Data Source
Macros Used
| Name |
Value |
| security_content_ctime |
convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$) |
| socat_network_listener_binding_an_executable_filter |
search * |
socat_network_listener_binding_an_executable_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
| ID |
Technique |
Tactic |
| T1059 |
Command and Scripting Interpreter |
Execution |
| T1572 |
Protocol Tunneling |
Command and Control |
Command and Control
Installation
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) |
Yes |
TTP detections generate a Finding (Notable) and may generate Intermediate Findings (Risk Events) for associated entities.
Implementation
This detection uses osquery and endpoint security on MacOS. Follow the link in references, which describes how to setup process auditing in MacOS with endpoint security and osquery.
Also the TA-OSquery must be deployed across your indexers and universal forwarders in order to have the osquery data populate the data models.
Known False Positives
Developers, network engineers, and system administrators may use socat to expose benign executables for protocol testing, debugging, data transformation, or troubleshooting.
Associated Analytic Story
Finding
| Title |
Entity Field |
Entity Type |
Risk Score |
| Socat was executed with a TCP or OpenSSL listener configured to pass inbound connections to an executable via [$process$] on endpoint [$dest$] by user [$user$]. |
dest |
system |
50 |
| Message |
Entity Field |
Entity Type |
Risk Score |
| Socat was executed with a TCP or OpenSSL listener configured to pass inbound connections to an executable via [$process$] on endpoint [$dest$] by user [$user$]. |
user |
user |
50 |
Threat Objects
| Field |
Type |
| process |
process |
References
Detection Testing
| Test Type |
Status |
Dataset |
Source |
Sourcetype |
| Validation |
✅ Passing |
N/A |
N/A |
N/A |
| Unit |
✅ Passing |
Dataset |
osqueryd.results.log |
osquery:results |
| Integration |
✅ Passing |
Dataset |
osqueryd.results.log |
osquery:results |
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