| ID | Technique | Tactic |
|---|---|---|
| T1059 | Command and Scripting Interpreter | Execution |
| T1572 | Protocol Tunneling | Command and Control |
Detection: Socat Remote TCP Connection with Local Echo Disabled
Description
The following analytic detects execution of the socat utility with a remote TCP or OpenSSL connection and local terminal echo disabled. This configuration may be used for interactive terminal sessions, password handling, automation, or network debugging. When observed in an unexpected context, such as execution by an unusual parent process or connection to an untrusted endpoint, it may indicate suspicious remote access activity.
Search
1
2| tstats `security_content_summariesonly`
3 count min(_time) as firstTime
4 max(_time) as lastTime
5
6from datamodel=Endpoint.Processes where
7
8Processes.process_name="socat*"
9Processes.process="*echo=0*"
10Processes.process IN (
11 "*openssl:*",
12 "*tcp:*",
13 "*tcp4:*",
14 "*tcp6:*"
15)
16
17by Processes.dest Processes.original_file_name Processes.parent_process_id
18 Processes.process Processes.process_exec Processes.process_guid
19 Processes.process_hash Processes.process_id
20 Processes.process_current_directory Processes.process_name
21 Processes.process_path Processes.user
22 Processes.user_id Processes.vendor_product
23
24
25| `drop_dm_object_name(Processes)`
26
27| `security_content_ctime(firstTime)`
28
29| `security_content_ctime(lastTime)`
30
31| `socat_remote_tcp_connection_with_local_echo_disabled_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| Osquery Results | Other | 'osquery:results' |
'osquery' |
| Sysmon for Linux EventID 1 | 'sysmon:linux' |
'Syslog:Linux-Sysmon/Operational' |
Macros Used
| Name | Value |
|---|---|
| security_content_ctime | convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$) |
| socat_remote_tcp_connection_with_local_echo_disabled_filter | search * |
socat_remote_tcp_connection_with_local_echo_disabled_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 Finding (Notable) | No |
| Creates Intermediate Finding (Risk Event) | Yes |
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 and network engineers may use socat with local echo disabled for legitimate TCP debugging, protocol testing, terminal handling, or troubleshooting.
Associated Analytic Story
Intermediate Findings
| Message | Entity Field | Entity Type | Risk Score |
|---|---|---|---|
| Socat was executed with local terminal echo disabled and a remote TCP or OpenSSL connection via Command Line [$process$] on endpoint [$dest$] by user [$user$]. | dest | system | 20 |
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 | osquery |
osquery:results |
| Integration | ✅ Passing | Dataset | osquery |
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