Atlantiraptor Docs

Windows.Detection.YaraX.Glob

Type: Client · Author: Matt Green - @mgreen27

Deploys YARA-X and scans files matching a glob pattern. Supports URL-based or inline rule deployment.

There are 2 kinds of YARA rules that can be deployed:

  1. URL link to a YARA rule.
  2. or a Standard YARA rule attached as a parameter.

Only one YARA rule option will be applied and search order is as listed above.

The artifact uses Glob for search so relevant filters can be applied including Glob, Size and date. Date filters will target files with a timestamp before LatestTime and after EarliestTime. The artifact also has an option to upload any files with YARA hits.

Some examples of path glob may include:

  • Specific binary: /usr/bin/ls
  • Wildcards: /var/www/*.js
  • More wildcards: /var/www/**/*.js
  • Multiple extensions: /var/www/*\.{php,aspx,js,html}
  • Windows: C:/Users/**/*.{exe,dll,ps1,bat}
  • Windows: C:\Users\**\*.{exe,dll,ps1,bat}

NOTE: this artifact runs the glob plugin with the nosymlink switch turned on. This will NOT follow any symlinks and may cause unexpected results if unknowingly targeting a folder with symlinks. If upload is selected NumberOfHits is redundant and not advised as hits are grouped by path to ensure files only downloaded once.

Implied permissions: EXECVE

Parameters

Name Type Default Description
PathGlob string /usr/bin/ls Only file names that match this glob will be scanned.
SizeMax int64 maximum size of target file.
SizeMin int64 minimum size of target file.
UploadHits bool
DateAfter timestamp search for events after this date. YYYY-MM-DDTmm:hh:ssZ
DateBefore timestamp search for events before this date. YYYY-MM-DDTmm:hh:ssZ
YaraUrl upload If configured will attempt to download Yara rules form Url
YaraRule yara (see the artifact source) Final Yara option and the default if no other options provided.
NumberOfHits int 1 This artifact will stop by default at one hit. This setting allows additional hits
ContextBytes int 0 Include this amount of bytes around hit as context.

Tools

This artifact uses these external tools, managed by the server’s tool inventory (see Managing external tools):

References

Source

Defined in artifacts/definitions/Windows/Detection/YaraX/Glob.yaml.

name: Windows.Detection.YaraX.Glob
author: Matt Green - @mgreen27
description: |
  Deploys YARA-X and scans files matching a glob pattern. Supports
  URL-based or inline rule deployment.

  There are 2 kinds of YARA rules that can be deployed:

  1. URL link to a YARA rule.
  2. or a Standard YARA rule attached as a parameter.

  Only one YARA rule option will be applied and search order is as
  listed above.

  The artifact uses Glob for search so relevant filters can be applied
  including Glob, Size and date. Date filters will target files with a
  timestamp before LatestTime and after EarliestTime. The artifact
  also has an option to upload any files with YARA hits.

  Some examples of path glob may include:

  * Specific binary: `/usr/bin/ls`
  * Wildcards: `/var/www/*.js`
  * More wildcards: `/var/www/**/*.js`
  * Multiple extensions: `/var/www/*\.{php,aspx,js,html}`
  * Windows: `C:/Users/**/*.{exe,dll,ps1,bat}`
  * Windows: `C:\Users\**\*.{exe,dll,ps1,bat}`

  NOTE: this artifact runs the glob plugin with the `nosymlink` switch
  turned on. This will NOT follow any symlinks and may cause
  unexpected results if unknowingly targeting a folder with symlinks.
  If upload is selected NumberOfHits is redundant and not advised as
  hits are grouped by path to ensure files only downloaded once.

reference:
  - https://github.com/Velocidex/yara-x-go/
tools:
  - name: YaraXWindowsDLL
    url: https://github.com/Velocidex/yara-x-go/releases/download/0.1/yara_x_capi.dll
    expected_hash: 98af253ec3477fe2b899d3500a2da8289782fef2aab8fa201865f35cba7d2089

type: CLIENT
parameters:
  - name: PathGlob
    description: Only file names that match this glob will be scanned.
    default: /usr/bin/ls
  - name: SizeMax
    description: maximum size of target file.
    type: int64
  - name: SizeMin
    description: minimum size of target file.
    type: int64
  - name: UploadHits
    type: bool
  - name: DateAfter
    type: timestamp
    description: "search for events after this date. YYYY-MM-DDTmm:hh:ssZ"
  - name: DateBefore
    type: timestamp
    description: "search for events before this date. YYYY-MM-DDTmm:hh:ssZ"
  - name: YaraUrl
    description: If configured will attempt to download Yara rules form Url
    type: upload
  - name: YaraRule
    type: yara
    description: Final Yara option and the default if no other options provided.
    default: |
        rule IsELF:TestRule {
           meta:
              author = "the internet"
              date = "2021-05-03"
              description = "A simple ELF rule to test yara features"
          condition:
             uint32(0) == 0x464c457f
        }
  - name: NumberOfHits
    description: This artifact will stop by default at one hit. This setting allows additional hits
    default: 1
    type: int
  - name: ContextBytes
    description: Include this amount of bytes around hit as context.
    default: 0
    type: int

implied_permissions:
  - EXECVE

sources:
  - query: |
      LET _BinPath = SELECT * FROM Artifact.Generic.Utils.FetchBinary(
        ToolName="YaraXWindowsDLL", IsExecutable=FALSE)

      -- check which Yara to use
      LET yara_rules <= YaraUrl || YaraRule

      -- time testing
      LET time_test(stamp) =
            if(condition= DateBefore AND DateAfter,
                then= stamp < DateBefore AND stamp > DateAfter,
                else=
            if(condition=DateBefore,
                then= stamp < DateBefore,
                else=
            if(condition= DateAfter,
                then= stamp > DateAfter,
                else= True
            )))

      -- first find all matching glob
      LET files = SELECT OSPath, Name, Size, Mtime, Atime, Ctime, Btime
        FROM glob(globs=PathGlob,nosymlink='True')
        WHERE
          NOT IsDir AND NOT IsLink
          AND if(condition=SizeMin,
            then= SizeMin < Size,
            else= True)
          AND if(condition=SizeMax,
            then=SizeMax > Size,
            else= True)
          AND
             ( time_test(stamp=Mtime)
            OR time_test(stamp=Atime)
            OR time_test(stamp=Ctime)
            OR time_test(stamp=Btime))

      -- scan files and prepare hit metadata
      LET hits = SELECT * FROM foreach(row=files,
            query={
                SELECT
                    OSPath,
                    File.Size as Size,
                    Mtime, Atime, Ctime, Btime,
                    Rule, Tags, Meta,
                    String.Name as YaraString,
                    String.Offset as HitOffset,
                    upload( accessor='scope',
                            file='String.Data',
                            name=format(format="%v-%v-%v",
                            args=[
                                OSPath,
                                if(condition= String.Offset - ContextBytes < 0,
                                    then= 0,
                                    else= String.Offset - ContextBytes),
                                if(condition= String.Offset + ContextBytes > Size,
                                    then= Size,
                                    else= String.Offset + ContextBytes) ]
                            )) as HitContext
                FROM yarax(rules=yara_rules,files=OSPath,
                           dll_path="x=>x._BinPath[0].OSPath",
                           context=ContextBytes,number=NumberOfHits)
            })

      -- upload files if selected
      LET upload_hits = SELECT *, upload(file=OSPath,name=OSPath) as Upload FROM hits

      -- return rows
      SELECT * FROM if(condition= UploadHits,
                        then= upload_hits,
                        else= hits )

column_types:
  - name: HitContext
    type: preview_upload

Edit this page on GitHub

© 2026 Atlant Security EOOD. Atlantiraptor is free software under the GNU Affero General Public License v3. It is based on Velociraptor by Velocidex, and keeps its copyright notices. Velociraptor is a trademark of its owner; Atlantiraptor is not affiliated with or endorsed by it.