VS Code Tunnels Provide Persistent Access Without an Implant
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.
Detections
Possible Persistence Points [ASEPs – Software/NTUSER Hive] (via registry_event)
View in Prime Core
Possible Msiexec Executing Files In Uncommon Directory (via cmdline)
View in Prime Core
Possible Visual Studio Code Launching In Tunnel Mode (via cmdline)
View in Prime Core
Virtual Hard Disk File was Created (via file_event)
View in Prime Core
Possible Telegram Abuse As Command And Control Channel (via dns_query)
View in Prime Core
Suspicious Execution from Mounted Drive (via audit)
View in Prime Core
Possible Visual Studio Code API Abuse As C2 Channel (via proxy)
View in Prime Core
IOCs (HashSha256) to detect: VS Code tunnels, no implant needed
View in Prime Core
Detection of GekkoSpy Malware Communication [Windows Network Connection]
View in Prime Core
Detection of AdobeAcrobatGerberHelper.exe DLL Sideloading and VS Code Tunnel Abuse [Windows Process Creation]
View in Prime Core
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 onrailway.appto 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