Query Details
# Rule Documentation: VS Code Folder Open Task Execution ## Description Detects malicious VS Code tasks configured with runOn: folderOpen for automatic execution. ## Detection Logic - File events on .vscode/tasks.json ## MITRE ATT&CK - T1053 – Scheduled Task / Job - T1204 – User Execution ## Tags Persistence, VSCode, Supply Chain ## Search Query ```kql DeviceFileEvents | where FolderPath has ".vscode" | where FileName =~ "tasks.json" ``` ## References - VS Code Tasks Abuse - PolinRider Attack
This query is designed to detect potentially malicious configurations in Visual Studio Code (VS Code) that could automatically execute tasks when a folder is opened. Here's a simple breakdown of what the query does:
Purpose: The query aims to identify suspicious or malicious tasks in VS Code that are set to run automatically when a folder is opened. This is a potential security risk as it can be exploited for unauthorized code execution.
Detection Logic:
.vscode directory.tasks.json file, which is where VS Code tasks are configured.MITRE ATT&CK Techniques:
Tags: The query is associated with persistence (indicating a method to maintain access to a system), VSCode (the environment being monitored), and supply chain (potentially indicating a broader risk if such tasks are distributed through shared code).
Search Query:
.vscode and the file name is tasks.json, indicating a focus on task configurations within VS Code projects.References: The query is informed by known methods of abusing VS Code tasks and specific attacks like the PolinRider attack, which may exploit such configurations.
In summary, this query helps in identifying potentially harmful configurations in VS Code that could be used to execute tasks automatically, posing a security risk.

Ali Hussein
Released: March 29, 2026
Tables
Keywords
Operators