Join our Newsletter — 33% off our NHI Course
Home› Guides› Velociraptor VQL Cheat Sheet: Artefacts and Queries for…
Template Incident Response & Forensics

Velociraptor VQL Cheat Sheet: Artefacts and Queries for Endpoint Hunts

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 11 min read
On this page

Velociraptor can ask the same question of every enrolled endpoint at once, but only if the hunter can write the question in VQL and pick the right artefact without overloading the fleet. This cheat sheet covers VQL syntax, the plugins and functions used most in hunts, the built-in artefacts worth knowing by name, the YAML structure of a custom artefact, and the resource controls that keep hunts safe at scale. Syntax and defaults were checked against the Velociraptor documentation repository on 26 November 2026 (latest release tag v0.77.4); artefact names and parameters change between releases, so check them in your own server's artefact viewer. It is for threat hunters and DFIR analysts who already have a working server. For architecture, deployment and securing the server, see the Velociraptor Guide.

This is an independent guide from NHI Mgmt Group, based on Velociraptor's public documentation as of November 2026. It is not sponsored or reviewed by Velociraptor. Product features change, so confirm settings against Velociraptor's current documentation.

Key takeaways

  • VQL looks like SQL but has no JOIN. Rows come from plugins after FROM, every argument is passed by name, and foreach() takes the place of joins.
  • LET is lazy unless you use <=. A plain LET stores a query that runs each time it is referenced; LET with <= runs it once and keeps the result.
  • Start from built-in artefacts. Windows.System.Pslist, Windows.Network.Netstat, Windows.Search.FileFinder and Windows.EventLogs.EvtxHunter answer most first-round hunt questions with parameters, not new code.
  • Hunts are paused at creation and expire, they do not finish. By default a hunt expires after one week and keeps scheduling newly seen matching clients until then.
  • Resource limits protect endpoints, not the server. Timeout, CPU, IOPS, row and upload limits are enforced by the client on itself; they are a safety net against runaway collections, not a security boundary.

How to use this template

  1. Test every query in a notebook first. The documentation recommends notebooks as the place to write and debug VQL; type ? for context-sensitive completions of plugins and arguments.
  2. Run on one client, then a label, then the fleet. Use a label group for a pilot hunt before targeting all clients.
  3. Fill in the hunt record below for every hunt, so results can be interpreted and repeated.
  4. Save working queries as custom artefacts rather than pasting VQL into each hunt.
  5. Re-check artefact names and parameters after each server upgrade, in the artefact viewer of your own server.
RecordValue
Hunt hypothesis[ ]
Artefact name and parameters[ ]
Server version[ ]
Target (label, OS, all clients)[ ]
Resource limits set (timeout, CPU, max rows, max upload)[ ]
Expiry[default one week]
Approved by and date[ ]

VQL basics

ConstructSyntaxWhat to know
QuerySELECT Name, Pid FROM pslist() WHERE Name =~ "powershell"SELECT columns FROM plugin WHERE filter. No semicolon at the end
Named argumentsglob(globs="C:/Users/*/Downloads/*.exe")All plugin and function arguments are keyword arguments
Regex matchWHERE Exe =~ "(?i)temp"=~ is a regular expression match
Lazy variableLET procs = SELECT * FROM pslist()Stored query, evaluated each time it is referenced
Materialised variableLET procs <= SELECT * FROM pslist()Evaluated once, result held in memory as an array
Local functionLET IsWin(x) = ...A LET with parameters acts as a reusable function
Join replacementSELECT * FROM foreach(row=procs, query={ ... })Runs the inner query once per row; workers runs them in parallel
Subquery{ SELECT ... FROM ... }Braces wrap a query used as an argument or column
Dict and unpackingdict(root="c:/windows", globs="*"), then glob(`**`=args)Pass arguments as a dict; other arguments are ignored when ** is used
No-op row sourceSELECT ... FROM scope()Returns the current scope as one row; use when you need no plugin
Identifiers with symbols`**`Backticks quote names with non-alphanumeric characters
Comments-- commentLine comment

Variable names may contain letters, digits, underscores and dashes, must not start with a digit or dash, and are case-sensitive. Columns produced by a plugin mask variables of the same name from outer scopes, a common cause of confusing results.

Common plugins and functions

NeedPlugin or functionKey arguments
Host detailsinfo()None; returns OS, hostname and platform fields
Running processespslist()pid to list one process
Network socketsnetstat()Returns sockets with owning process ID
Find filesglob()globs (required), root, accessor, nosymlink
File metadatastat()filename, accessor
Hash a filehash()path, hashselect (MD5, SHA1, SHA256), max_size (default 100 MB)
Signature checkauthenticode()filename
Registryread_reg_key()globs, root, accessor
WMIwmi()query, namespace (default ROOT/CIMV2)
Event logsparse_evtx()filename, workers
Pattern scanyara()rules, files, accessor (e.g. ntfs, file), context
Collect a fileupload()file (required), name, accessor
Call another artefactArtifact.Name.Here(...)Artefact parameters as named arguments
Read hunt results on the serverhunt_results(), source()hunt_id, artifact, source
Run an external programexecve()argv (required). Use sparingly: CPU and IO limits do not apply to external programs

The ntfs accessor (Windows only) parses the NTFS filesystem directly, accepts normal Windows paths, and also lists Volume Shadow Copy devices at the top level, so a glob can reach older copies of a file.

Example hunt queries

  • Processes running from user-writable paths: SELECT Pid, Name, Exe, CommandLine FROM pslist() WHERE Exe =~ "(?i)\\\\(temp|appdata|downloads)\\\\"
  • Sockets with their process name (pattern used by the built-in Windows.Network.Netstat artefact): LET processes <= SELECT Name, Pid AS ProcPid FROM pslist() then SELECT Pid, { SELECT Name FROM processes WHERE Pid = ProcPid } AS Name, Status, Laddr.IP, Laddr.Port, Raddr.IP, Raddr.Port FROM netstat()
  • Executables in Downloads with hashes: SELECT OSPath, Size, hash(path=OSPath).SHA256 AS SHA256 FROM glob(globs="C:/Users/*/Downloads/*.exe")

Built-in artefacts for hunts

Hunt questionArtefactUseful parameters or notes
What is this client?Generic.Client.InfoCollected at enrolment; the server builds its client index from it
Which processes match an indicator?Windows.System.PslistProcessRegex, CommandLineRegex, ExePathRegex, UsernameRegex, UntrustedAuthenticode
Same on Linux and macOSLinux.Sys.PslistAlias MacOS.Sys.Pslist
Which sockets are open and who owns them?Windows.Network.Netstat, Windows.Network.NetstatEnrichedThe enriched version has KillProcess and DumpProcess options: leave them off for hunting
Where is this file or pattern?Windows.Search.FileFinderPath glob, YARA content match, hash and optional upload
Which hosts hold this YARA match?Windows.Detection.Yara.Glob, Windows.Detection.Yara.ProcessFiles by glob, or process memory
Is this indicator in any event log?Windows.EventLogs.EvtxHunterEvtxGlob and regex IOC parameters
Sigma rules over event logsWindows.Sigma.EventLogsSee the Sigma Rule Syntax Cheat Sheet
What ran, and when?Windows.Forensics.Prefetch, Windows.Registry.AppCompatCachePrefetch gives run counts and last run times
What changed on disk?Windows.Forensics.Usn, Windows.NTFS.MFTUSN journal and MFT records for file activity
What persists?Windows.System.Services, Windows.System.TaskScheduler, Windows.Sysinternals.AutorunsAutoruns runs an external tool on the client
Who logged on locally?Windows.Sys.UsersLocal profiles only; Windows.Sys.AllUsers adds more
Collect triage filesWindows.KapeFiles.Extract and related triage artefactsCheck the triage artefact names in your release

For the Windows artefacts that show lateral movement, see the Lateral Movement Artefacts Cheat Sheet.

Writing custom artefacts

An artefact is a YAML file. Only name is required; field names are case-sensitive and by convention lowercase. Names may contain letters, digits, underscores and dots, and each dot-separated part must start with a letter. The GUI editor adds a Custom. prefix by default.

1 Sample only, based on the public documentation cited. Assess it independently against the current official documentation, test outside production and back up first.

Sample 1
name: Custom.Windows.Hunt.UserPathProcesses
description: |
  Processes whose executable is in a user-writable path.
type: CLIENT
author: [Team name]
reference:
  - [internal hunt ticket link]
precondition: SELECT OS FROM info() WHERE OS = 'windows'
parameters:
  - name: PathRegex
    type: regex
    default: "(?i)\\\\(temp|appdata|downloads)\\\\"
resources:
  timeout: 600
  max_rows: 10000
sources:
  - query: |
      SELECT Pid, Name, Exe, CommandLine
      FROM pslist()
      WHERE Exe =~ PathRegex
FieldPurpose
typeCLIENT (default), CLIENT_EVENT, SERVER, SERVER_EVENT, INTERNAL or NOTEBOOK
parametersBecome VQL variables with the parameter name; types such as regex and bool shape the GUI form
preconditionA VQL SELECT (no LET, not a function). True if it returns rows; the source is skipped otherwise. Lets a Windows-only artefact be hunted safely across all clients
sourcesEach source is one table of results; several sources give several tables
resourcesDefault limits (timeout, cpu_limit, iops_limit, max_rows, max_upload_bytes and others), which the operator can still change at launch

Without source-level preconditions, sources run in serial mode and share scope; with them, or for event artefacts, they run in parallel with separate scopes. Store custom artefacts in version control and review them like code, because an artefact runs on every client it is hunted against.

Running hunts at scale

  • Hunts start paused: review the artefact, parameters and limits, then start. Stopping a hunt stops new clients being scheduled.
  • Expiry, not completion: clients that come online before expiry (default one week) are still scheduled. Set a shorter expiry when the question only matters now.
  • Target by label: labels scope a hunt to a group, and clients added to the label later join the hunt. This supports a pilot, then wider rollout.
  • Time limits: the default collection timeout is 600 seconds. Offline collections have no timeout by default. A progress timeout (max idle time) can stop a query that emits no rows.
  • Data limits: max_rows and max_upload_bytes cancel the whole collection when reached. Always set an upload limit on hunts that upload files.
  • CPU and IO: cpu_limit pauses the query when average CPU exceeds the limit and iops_limit throttles IO, which suits large YARA scans. The documentation advises against a global CPU limit.
  • Precedence: built-in defaults, then the artefact's resources, then per-artefact overrides, then the values set at launch, which win. When several artefacts are collected together, the maximum of each limit applies.
  • Results: analyse hunt results in a notebook with hunt_results() or source() rather than exporting raw rows first.
MetricWhy it matters
Clients scheduled vs completed vs erroredCoverage of the hunt question
Collections hitting timeout or row limitsResults may be incomplete on those hosts
Median and maximum collection timeEndpoint impact and whether limits need tuning
Uploaded bytes per huntServer storage and transfer cost

Common mistakes

  • Launching an untested query fleet-wide: a broad glob such as C:/** with hashing on every client can slow users and fill the server. Pilot on a label first.
  • Using = instead of <= for a lookup table: a lazy LET inside foreach() re-runs the query for every row.
  • Treating resource limits as security: they are enforced by the client and are not validated server-side.
  • Leaving response options on in hunts: artefacts such as Windows.Network.NetstatEnriched can kill or dump processes. Keep those parameters off unless response is approved.
  • Forgetting the hunt keeps running: laptops that reconnect days later still run it. Shorten expiry or stop the hunt when done.
  • Granting broad artefact rights: anyone who can launch artefacts with execve() or upload can act on every endpoint. Restrict who can create and run custom artefacts; the server credentials are high-value non-human identities, as covered in the Velociraptor Guide.

Implementation guidance

  1. Build a hunt library: keep tested custom artefacts in a repository with an owner and review date.
  2. Set default resources in each artefact so safe limits apply even when the operator forgets.
  3. Use a pilot label of representative hosts (servers, laptops, VDI) for every new artefact.
  4. Record each hunt with the template above and link it to the hypothesis in your backlog. See the Threat Hunting Guide.
  5. Review after upgrades: re-run the pilot for artefacts that depend on built-in artefact columns.

Velociraptor hunting supports NIST CSF 2.0 DE.AE (adverse event analysis) and RS.AN (incident analysis), and CIS Controls v8.1 Control 17 for incident response.

Practitioner checklist

  • Test every query in a notebook on one client first.
  • Use <= for lookup tables used inside foreach().
  • Prefer built-in artefacts with parameters over ad hoc VQL.
  • Add a precondition to every OS-specific custom artefact.
  • Set timeout, max rows and max upload bytes on every hunt.
  • Pilot on a label before targeting all clients.
  • Set an expiry that matches the question.
  • Restrict who can create artefacts and launch hunts.

Standards and references

Related NHI Mgmt Group resources: Velociraptor Guide · Threat Hunting Guide · Lateral Movement Artefacts Cheat Sheet · Memory Forensics Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.