Got Incident? Investigate 60 million events per analysis

LogTotal for Incident Response, Complete Enterprise Platform Access is Live

Buy 7-day IR Retainer Pass for $799

SOC Prime Bias: High

03 Dec 2026 13:18 UTC

VS Code Tunnels Provide Persistent Access Without an Implant

Author Photo
SOC Prime Team linkedin icon Follow
VS Code Tunnels Provide Persistent Access Without an Implant
shield icon

Detection stack

  • AIDR
  • Alert
  • ETL
  • Query

Summary

An attacker abuses DLL sideloading with a legitimate Adobe application to execute a malicious Rust DLL. The payload uses the Microsoft VS Code CLI to establish a Remote Tunnel, providing the attacker with terminal and file access through legitimate services. After gaining remote access, the attacker deploys a secondary Rust-based remote access tool called GekkoSpy.

Investigation

The investigation analyzed a VHDX disk image containing a fake product specs lure. Researchers observed the sideloading of msi.dll, followed by use of the VS Code tunnel user login feature and exfiltration of device codes through Telegram. Sandbox analysis later revealed GekkoSpy being installed via msiexec after the attacker obtained access through the tunnel.

Mitigation

Organizations should consider blocking VS Code Remote Tunnel relay hosts (*.rel.tunnels.api.visualstudio.com) when the functionality is not required. Users should be trained not to enter GitHub or Microsoft device codes supplied by unknown parties. Monitoring for unauthorized execution of code.exe or code-tunnel.exe from temporary directories or mounted images is also recommended.

Response

When malicious activity is detected, remove the Visual Studio Code Tunnel Run key and delete the %USERPROFILE%\.vscode\cli directory. Stop and remove the GekkoSpy service along with associated binaries. The affected machine should be considered fully compromised and undergo comprehensive remediation before being returned to service.

Attack Flow

We are still updating this part.

Simulation Execution

  • Attack Narrative & Commands: The simulated adversary has successfully bypassed initial defenses using DLL sideloading (T1574.001) to execute a malicious payload. To maintain control and exfiltrate data, the malware is programmed to communicate with its Command and Control (C2) infrastructure. In this specific simulation, we mimic the GekkoSpy behavior by initiating a connection to the Telegram API (api.telegram.org) to simulate a bot-based C2 channel, and a secondary connection to a dynamically hosted service on railway.app to simulate a WebSocket-based C2. This mimics the “living-off-the-cloud” approach often used by modern malware to blend in with legitimate web traffic.

  • Regression Test Script:

    # GekkoSpy Communication Simulation Script
    # Purpose: Generate telemetry matching the Sigma rule for detection validation.
    
    Write-Host "[+] Starting GekkoSpy C2 Simulation..." -ForegroundColor Cyan
    
    # 1. Simulate connection to Telegram API
    Write-Host "[*] Attempting connection to api.telegram.org..." -ForegroundColor Yellow
    try {
        $telegram = New-Object System.Net.WebClient
        $telegram.DownloadString("https://api.telegram.org") | Out-Null
    } catch {
        Write-Host "[!] Connection to Telegram failed (Expected if no internet/API access), but telemetry should be generated." -ForegroundColor Gray
    }
    
    # 2. Simulate connection to a Railway-hosted WebSocket/API endpoint
    # Note: We use a valid-looking dummy subdomain to trigger the '.up.railway.app' logic
    Write-Host "[*] Attempting connection to a dummy railway.app endpoint..." -ForegroundColor Yellow
    try {
        $railway = New-Object System.Net.WebClient
        $railway.DownloadString("https://test-service-production.up.railway.app") | Out-Null
    } catch {
        Write-Host "[!] Connection to Railway failed (Expected), but telemetry should be generated." -ForegroundColor Gray
    }
    
    Write-Host "[+] Simulation complete." -ForegroundColor Cyan
  • Cleanup Commands:

    # No persistent changes were made by the simulation script. 
    # Only temporary network connections were attempted.
    Write-Host "[+] Cleanup complete. No artifacts left on system." -ForegroundColor Green