Skip to content
Please update to the latest release 0.77.4 to address Multiple CVEs.
Windows.Registry.EnabledMacro

Windows.Registry.EnabledMacro

Scans Office Trust Records registry entries for documents with macro-enabled trust flags.

That is HKEY_USERS\*\Software\Microsoft\Office\*\Security\Trusted Documents\TrustRecords reg keys with values ending in FFFFFF7F.


name: Windows.Registry.EnabledMacro
description: |
  Scans Office Trust Records registry entries for documents with
  macro-enabled trust flags.

  That is `HKEY_USERS\*\Software\Microsoft\Office\*\Security\Trusted
  Documents\TrustRecords` reg keys with values ending in `FFFFFF7F`.

reference:
  - http://az4n6.blogspot.com/2016/02/more-on-trust-records-macros-and.html

author: "@mgreen27"

precondition: SELECT OS From info() where OS = 'windows'

parameters:
 - name: KeyGlob
   default: Software\Microsoft\Office\*\*\Security\Trusted Documents\TrustRecords\*
 - name: userRegex
   default: .
   type: regex

sources:
 - query: |
        LET UserProfiles = Select Name as Username,
            {
                SELECT OSPath FROM glob(
                  root=expand(path=Directory),
                  globs="/NTUSER.DAT",
                  accessor="auto")
            } as NTUser,
            expand(path=Directory) as Directory
        FROM Artifact.Windows.Sys.Users()
        WHERE Directory and NTUser and Name =~ userRegex

        SELECT * FROM foreach(
          row={
            SELECT Username,NTUser FROM UserProfiles
          },
          query={
            SELECT Name as Document,
              Username,
              NTUser as Userhive,
              OSPath.Dirname AS Key,
              Mtime AS LastModified
            FROM glob(
              globs=KeyGlob,
              root=pathspec(DelegatePath=NTUser),
              accessor="raw_reg")
            WHERE Data.type =~ "BINARY"
              and encode(string=Data.value, type="hex") =~ "ffffff7f$"
          })