Renamed Visual Studio Code Tunnel Execution

 Original Source: [Sigma source]
Title: Renamed Visual Studio Code Tunnel Execution
Status: test
Description:Detects renamed Visual Studio Code tunnel execution. Attackers can abuse this functionality to establish a C2 channel
References:
  -https://ipfyx.fr/post/visual-studio-code-tunnel/
  -https://badoption.eu/blog/2023/01/31/code_c2.html
  -https://code.visualstudio.com/docs/remote/tunnels
Author: Nasreddine Bencherchali (Nextron Systems)
Date: 2023-09-28
modified:2025-10-29
Tags:
  • -'attack.command-and-control'
  • -'attack.t1071.001'
  • -'attack.t1219'
Logsource:
  • category: process_creation
  • product: windows
Detection:
  selection_image_only_tunnel:
    OriginalFileName: 'None'
    CommandLine|endswith: '.exe tunnel'
  selection_image_tunnel_args:
    CommandLine|contains|all:
      -'.exe tunnel'
      -'--accept-server-license-terms'

  selection_image_tunnel_service:
    CommandLine|contains|all:
      -'tunnel '
      -'service'
      -'internal-run'
      -'tunnel-service.log'

  selection_parent_tunnel:
    ParentCommandLine|endswith: ' tunnel'
    Image|endswith: '\cmd.exe'
    CommandLine|contains|all:
      -'/d /c '
      -'\servers\Stable-'
      -'code-server.cmd'

  filter_main_parent_code:
    ParentImage|endswith:
      -'\code-tunnel.exe'
      -'\code.exe'

  filter_main_image_code:
    Image|endswith:
      -'\code-tunnel.exe'
      -'\code.exe'

  condition:(1 of selection_image_* and not 1 of filter_main_image_*) or (selection_parent_tunnel and not 1 of filter_main_parent_*)
Falsepositives:
  -Unknown
Level: high