Detection of Suspicious VScode Remote Tunnel Usage
This brief details the detection of potential command and control activity through the suspicious use of the VScode remote tunnel feature, which allows attackers to establish unauthorized remote access to systems.
This rule detects the execution of the VScode portable binary with the tunnel command line option, indicating a potential attempt to establish a remote tunnel session to GitHub or a remote VScode instance. While VScode's remote tunnel feature is designed for legitimate remote development, adversaries can abuse it to gain unauthorized access and control over systems. This detection focuses on identifying suspicious command-line arguments and process behaviors associated with VScode's tunnel functionality, flagging potential misuse indicative of command and control activities. The rule covers Windows systems and leverages process data from various sources including Elastic Endgame, Sysmon, and Microsoft Defender for Endpoint. The activity was observed starting around 2024-09-09.
Attack Chain
- The attacker gains initial access to a Windows system, potentially through phishing or exploiting a software vulnerability.
- The attacker downloads a portable version of VScode to the compromised system, avoiding typical installation procedures.
- The attacker executes VScode with the
tunnelcommand-line argument, initiating an attempt to establish a remote tunnel. - The attacker uses arguments like
--accept-server-license-termsto bypass prompts and streamline the tunnel setup. - VScode establishes a connection to a remote server, potentially GitHub or a malicious VScode instance under the attacker's control.
- The attacker uses the established tunnel to remotely execute commands, transfer files, or perform other malicious activities on the compromised system.
- The attacker maintains persistent access through the established tunnel, allowing them to remotely monitor and control the system over time.
Impact
Successful exploitation via VScode remote tunnel can lead to unauthorized remote access, data exfiltration, command execution, and persistent system compromise. This could impact any Windows system within the environment if an attacker leverages this legitimate tool for malicious purposes. If successful, the attacker gains complete control over the compromised system, potentially leading to sensitive data leaks and further propagation within the network.
Recommendation
- Deploy the Sigma rule "Detect VScode Tunnel Execution" to your SIEM and tune for your environment to identify potential malicious use of VScode's tunnel feature.
- Investigate any process executions flagged by the "Detect VScode Tunnel Execution" Sigma rule, focusing on command-line arguments and process behaviors.
- Enable Sysmon process-creation logging to enhance visibility into process executions and command-line arguments, which is crucial for the "Detect VScode Tunnel Execution" Sigma rule.
- Monitor network connections from VScode processes for unusual or unauthorized communication patterns, supplementing the process-based detections.
Detection coverage 2
Detect VScode Tunnel Execution
mediumDetects the execution of VScode with the 'tunnel' command-line argument, indicating a potential attempt to establish a remote tunnel for command and control.
Detect VScode Tunnel Executables in Suspicious Paths
highDetects VScode tunnel executables running from ProgramData, Users\Public, or Windows\Debug, which is highly unusual.
Detection queries are available on the platform. Get full rules →