Detection rule
Suspicious Plink Port Forwarding
Overview
Detects suspicious Plink tunnel port forwarding to a local port
- Rule id
48a61b29-389f-4032-b317-b30de6b95314- ATT&CK techniques
- T1021.001 Remote Services: Remote Desktop Protocol, T1572 Protocol Tunneling
- Severity
- High
- Confidence
- Low
- Origin
- SigmaHQ (community)
- SigmaHQ status
test- Used in defense packs
- n0n, The Gentlemen, qilin, INC Ransom, Akira, safepay, Play, nightspire
Validation
- ExperimentalSyntax checked only. Not yet tested on events.
- Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
- SIEM-validatedRun in a real SIEM, with a recorded result.
1 of 1 positive test events matched; 1 of 1 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.
Detection logic and queries
Queries are shown exactly as generated. Test them in your environment before you deploy them.
Sigma
Sigma (YAML) · 48a61b29-389f-4032-b317-b30de6b95314
title: Suspicious Plink Port Forwarding
id: 48a61b29-389f-4032-b317-b30de6b95314
status: test
description: Detects suspicious Plink tunnel port forwarding to a local port
references:
- https://www.real-sec.com/2019/04/bypassing-network-restrictions-through-rdp-tunneling/
- https://medium.com/@informationsecurity/remote-ssh-tunneling-with-plink-exe-7831072b3d7d
author: Florian Roth (Nextron Systems)
date: 2021-01-19
modified: 2022-10-09
tags:
- attack.command-and-control
- attack.t1572
- attack.lateral-movement
- attack.t1021.001
logsource:
category: process_creation
product: windows
detection:
selection:
Description: 'Command-line SSH, Telnet, and Rlogin client'
CommandLine|contains: ' -R '
condition: selection
falsepositives:
- Administrative activity using a remote port forwarding to a local port
level: highQRadar CRE
Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.
- Rule name
OffSet7: Suspicious Plink Port Forwarding- Rule type
- Event rule (Local)
- Log source types
- Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1
Building blocks
BB:OffSet7:Suspicious Plink Port Forwarding:selection(match)All test lines must match (AND).- custom property needed:
Descriptionis equal to (case-insensitive):Command-line SSH, Telnet, and Rlogin clientNo QRadar property mapped for "Description": create a custom event property (regex or JSON) on the DSM first. Commandcontains:-R
- custom property needed:
Main rule, option A (building blocks)
- when the event(s) were detected by one or more of these log source types:
Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1 - when an event matches the condition built from these building blocks:
BB:OffSet7:Suspicious Plink Port Forwarding:selection
Main rule, option B (AQL filter test)
Not available: the AQL conversion failed for this rule.
Rule response
- Severity 7, credibility 6, relevance 7
- Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
- Respond no more than once per 30 minutes per Log Source (tune per environment)
Limitations
- AQL conversion failed (field 'Description' is not supported); only the building-block design is available.
- QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.
Splunk
Splunk SPLSearch
Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.
Description="Command-line SSH, Telnet, and Rlogin client" CommandLine="* -R *"Splunk savedsearches.conf stanzaScheduled search template
Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.
[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now
[Suspicious Plink Port Forwarding]
description = Detects suspicious Plink tunnel port forwarding to a local port
search = Description="Command-line SSH, Telnet, and Rlogin client" CommandLine="* -R *"Microsoft Sentinel
Microsoft Sentinel KQL (ASIM)Hunting query
Hunting query over ASIM-normalized tables. An analytics rule also needs a schedule, entity mapping and alert grouping.
imProcessCreate
| where TargetProcessFileDescription =~ "Command-line SSH, Telnet, and Rlogin client" and TargetProcessCommandLine contains " -R "Defender XDR
Microsoft Defender XDR KQLHunting query
Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.
DeviceProcessEvents
| where ProcessVersionInfoFileDescription =~ "Command-line SSH, Telnet, and Rlogin client" and ProcessCommandLine contains " -R "Elastic
Elastic Lucene (ECS)Hunting query
Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.
process.pe.description:"Command\-line SSH, Telnet, and Rlogin client" AND process.command_line:*\ \-R\ *Elastic EQL (ECS)Hunting query
EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.
any where process.pe.description:"Command-line SSH, Telnet, and Rlogin client" and process.command_line:"* -R *"Elastic ES|QL (ECS)Hunting query
ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.
from * metadata _id, _index, _version | where process.pe.description=="Command-line SSH, Telnet, and Rlogin client" and process.command_line like "* -R *"No working conversion: IBM QRadar AQL (hunting query) (QRadar AQL backend has no property mapping for field "Description")
Required telemetry
- Log source
product: windows · category: process_creation- Fields used
CommandLineDescription
False positives
- Administrative activity using a remote port forwarding to a local port
Investigation and response
No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.
References
Author and attribution
- Author
- Florian Roth (Nextron Systems)
- Source
- SigmaHQ ·
rules/windows/process_creation/proc_creation_win_plink_port_forwarding.yml - Upstream commit
9688134317a2- Licence
- Detection Rule License (DRL) 1.1
Version history
- Version 1Imported from SigmaHQ
- OffSet7 build · SigmaHQ
9688134317a2