Spying on trade policy via VS Code

About this post: Thanks to MalwareHunterTeam for flagging this sample. This analysis and write-up were produced by Claude (Opus 5.5), working as an agent in Claude Code on a REMnux analysis VM. Tools used: Malcat, Python, Ghostscript, ANY.RUN, Deception Pro, Triage (hash lookups).

TL;DR

The file is a Windows shortcut with a PDF icon. It opens a decoy, "Session abstracts" for a Bruegel workshop on EU trade policy, and quietly installs Python and a scheduled task. Right away, and every hour after that, the task has Microsoft’s own VS Code tool request a GitHub sign-in code, then sends the result, which should include the code, to the attacker. Whoever enters the code can reach the PC through Microsoft’s tunnel service until the next hourly run resets it. The remote access itself comes from legitimate, Microsoft-signed software.

  • Lure: Bruegel_Workshop_Abstracts.lnk, a shortcut with a PDF icon and an "Edge PDF Document" tooltip. The decoy talks about DG TRADE tools, ministries and public officials.
  • Hidden cargo: the decoy PDF, a batch file and a Python script are packed inside the shortcut file itself.
  • Persistence: a hidden scheduled task, MicrosoftEdgeUpdateTask, that runs straight away and then every hour, as SYSTEM if the victim has admin rights.
  • Payload: a Python script from Dropbox that drives the VS Code CLI’s tunnel feature and leaks the GitHub device code plus folder listings.
  • Exfiltration: a requestrepo.com bin and a Cloudflare quick tunnel.
  • Assessment: most likely espionage aimed at trade-policy staff, though nothing ties it to a known group.

A shortcut that carries its own luggage

A Windows shortcut (.lnk) is normally a tiny file that points at something else. This one is 425 KB, and points at cmd.exe. Its icon is borrowed from a PDF, and its description field is written to look like the tooltip Explorer shows for a PDF opened in Edge: "Type: Microsoft Edge PDF Document, Size: 425.03 KB". The window is set to start minimised, so the victim sees nothing flash up.

Left: how the shortcut appears in a folder, with the fake PDF tooltip. Right: the shortcut's actual properties.
Image: Left: how the shortcut appears in a folder, with the fake PDF tooltip. Right: the shortcut’s actual properties.

The command line uses the old more command to skip the first few thousand lines of the shortcut and save everything after that as a batch file in %TEMP%, then runs it. The shortcut reads its own tail end as a script.

That batch script writes a short JScript program and runs it with Windows Script Host. The JScript opens the shortcut again, searches it for a marker (the bytes 0D F0 AD 0B, "0x0BADF00D"), and unpacks three files stored behind it:

File What it does
Bruegel_Workshop_Abstracts.pdf The decoy, opened for the victim
install.bat Sets up Python and starts the first Python stage
stage1.py Downloads the payload and sets up persistence

If the victim opened the shortcut straight from inside a zip file, the batch script first copies it out of the archive so that the JScript can read it.

The infection chain, from the shortcut to the GitHub device code the operator needs.
Image: The infection chain, from the shortcut to the GitHub device code the operator needs.

The decoy

The PDF is a single page of "Session abstracts" for "Europe’s economic and trade policy outlook 2027-2030", a Bruegel expert workshop dated 7–8 December 2026. Its sessions cover the Single Market, trade barriers reporting and "alignment with DG TRADE tools", the Anti-Coercion Instrument and "coordination between ministries", and the next EU budget. It closes with a note that "Bruegel does not offer honoraria to public officials".

The document is written for a specialist audience. The content suggests the intended readers work on EU or national trade policy, though the file alone can’t tell us who actually received it. The page was built on top of an older genuine Bruegel publication: its text layer still contains an invisible foreword about competition policy from the original.

The decoy "Session abstracts" page shown to the victim.
Image: The decoy “Session abstracts” page shown to the victim.

Bring your own Python

Windows doesn’t ship with Python, so install.bat fetches it. It downloads the official Python 3.12.5 "embeddable" package from python.org with bitsadmin (a built-in Windows download tool) and unpacks it with the built-in tar into %LOCALAPPDATA%\Microsoft\Python. It copies stage1.py there as urllib1.py and runs it with pythonw.exe, the windowless version of Python.

stage1.py is unobfuscated and even has English comments. It does three things:

  1. Downloads the real payload, winsock.py, from a Dropbox share into the same folder.
  2. Registers a hidden scheduled task (T1053.005) called MicrosoftEdgeUpdateTask that runs pythonw.exe winsock.py. In our sandbox it fired within seconds of being registered, and then again at the top of every hour. It talks to the Task Scheduler directly through its COM interface, so no schtasks.exe process shows up, although Windows still records the task as usual. With admin rights, the code asks for the task to go under \Microsoft\Windows\WindowsUpdate and run as SYSTEM.
  3. Cleans up: it deletes the temporary files, itself and (unless it was run from inside a zip) the shortcut.

ANY.RUN’s run followed this path to the letter: bitsadmin fetched Python, pythonw.exe ran urllib1.py, and winsock.py arrived from Dropbox, byte for byte the same file we downloaded later.

A longer run in Deception Pro, where the logged-in user had admin rights, showed the rest of the chain. The task was created under the Windows Update folder and ran as SYSTEM, so code.exe was downloaded into the SYSTEM profile (C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\VSCode). Seconds after the decoy opened, stage 2 killed any running code.exe and node.exe, logged out the tunnel, started the GitHub sign-in and sent its report to the requestrepo bin. The same cycle then repeated at the top of every hour, each time with a fresh sign-in request and another report. The trycloudflare.com address no longer resolved, so the requestrepo bin was the only place the reports reached.

Remote access, courtesy of VS Code

winsock.py is lightly obfuscated: the names are scrambled and its strings are hidden with base64 and XOR. Once that is peeled off, the logic is short:

  1. Download the official VS Code command-line tool (code.exe) from Microsoft’s download server, if it isn’t already in %LOCALAPPDATA%\Microsoft\VSCode.
  2. Kill any running code.exe and node.exe, and log out any existing tunnel account.
  3. Run code.exe tunnel user login --provider github and code.exe tunnel --name <computer name>.
  4. Collect the tool’s output (which should hold the sign-in code), the computer name, user name, domain, language, whether it has admin rights, and listings of the Desktop, Documents, Downloads, C:\Users, Program Files and ProgramData.
  5. Send it all, base64-encoded, to a requestrepo.com bin and then to a trycloudflare.com address.

VS Code Remote Tunnels is a legitimate feature: it lets a developer reach their own machine from anywhere through Microsoft’s relay service. To set one up, the CLI asks you to prove who you are by opening github.com/login/device and typing an eight-character code, a "device code" sign-in. Whoever types the code owns the tunnel. By sending the code to themselves, the attackers can link the victim’s PC to their GitHub account and get a terminal and file access on it.

On a machine where the victim has admin rights, the tunnel runs as SYSTEM, so whoever approves the code gets the highest level of access on the PC.

This is Remote Access Software (T1219) at its simplest. The program that ends up providing remote access is Microsoft-signed, talks to Microsoft and GitHub, and is popular with developers. Every hourly run starts by force-closing code.exe (and, bluntly, every node.exe on the machine) and logging the tunnel out, before asking for a new code. So an approved tunnel only lasts until the next top of the hour. An attacker who wants to stay would need to add their own foothold during that first hour.

Why we think this is espionage

The lure is written for a narrow audience: people who work on EU trade policy, and officials in particular. The payload has no way to make money. There is no ransomware, no theft of passwords or crypto wallets, nothing to resell. What it delivers is hands-on remote access, plus a first look at each victim’s user name, domain and document folders, which is what someone picking targets for intelligence collection would want. The decoy was built with care from a genuine Bruegel page, for a workshop dated just days after the sample appeared.

Together, that points to espionage. This is our assessment; nothing in the sample ties it to a known group or country.

What we couldn’t see

The sandbox runs show everything up to the point where the attacker has to act. Over many hourly cycles, nobody entered one of the sign-in codes, so we did not see what the operator does once connected.

One detail of the code is still murky. The script writes the sign-in output to output.txt, then starts a second code.exe process that overwrites the same file a few seconds later. So what actually reaches the attacker is the second process’s output. We expect it to contain a sign-in code too, but we couldn’t see the contents of the reports, so we haven’t confirmed that.

The Dropbox file can be swapped at any time, so a later download may not match the version described here.

Advice

For everyone: a file whose name ends in .lnk is a shortcut, whatever its icon shows. If an invitation arrives as a zip containing a shortcut, don’t open it; ask the sender for the document by another channel. GitHub will never legitimately need you or anyone else to type a code you didn’t ask for.

For defenders:

  • Hunt for code.exe tunnel running from unusual folders such as %LOCALAPPDATA%\Microsoft\VSCode (including the SYSTEM profile under C:\Windows\System32\config\systemprofile), and for pythonw.exe under %LOCALAPPDATA%\Microsoft\Python.
  • Look for a scheduled task called MicrosoftEdgeUpdateTask (in C:\Windows\System32\Tasks, backdated to the year 2000) whose action is pythonw.exe; genuine Edge update tasks carry a suffix such as MachineCore or MachineUA and run MicrosoftEdgeUpdate.exe.
  • If you find an approved tunnel, assume the attacker had up to an hour of hands-on access and look for persistence they added in that window.
  • If VS Code tunnels aren’t used in your organisation, block or alert on the dev-tunnels service and on GitHub device-code logins coming from VS Code.
  • Watch for bitsadmin /transfer downloading python-*-embed-amd64.zip.

IOCs

Type Indicator
LNK (SHA256) d1b347bd3ce659a96782e869e897a808194921d9901124c79d31371da4e37a2b
stage1.py (SHA256) d5f7fffa6bd0382f0da38e631716c7f6eadbe576af88e155406e8b3f14c45350
install.bat (SHA256) 5c0367212b9286a1412a1d6205df1af3718a655df0b9b6829a47d6268203fbad
winsock.py (SHA256) ec6f300a7a2d94cb988018c648c440de31f59fec37c1156044adde3af16d6dd1
Decoy PDF (SHA256) ae8871a6305767b616f611cd6bf908bb1597656c41ae1c5071c2d9ba09004dcf
Payload URL hxxps[://]www[.]dropbox[.]com/scl/fi/i6g1e53ebt2roilm0ji5u/winsock[.]py
Exfiltration guye2u0j[.]requestrepo[.]com
Exfiltration promotions-highlights-guest-complex[.]trycloudflare[.]com (no longer resolving)
Scheduled task MicrosoftEdgeUpdateTask (root, or \Microsoft\Windows\WindowsUpdate\)
Paths %LOCALAPPDATA%\Microsoft\Python\winsock.py, urllib1.py; %LOCALAPPDATA%\Microsoft\VSCode\code.exe, output.txt (SYSTEM profile when run as admin)

Closing

The whole chain runs on a shortcut, a stock Python and a legitimate developer feature. That small footprint makes it worth watching for. The ANY.RUN run is public at app.any.run/tasks/4418d2b4-ff9c-4686-a2d1-fa23ba7c61e4. Stay safe, and be suspicious of shortcuts dressed as PDFs.