MSI custom actions: what runs, when, and as whom
The CustomAction Type field is a bit-field. Decode it and you know whether an installer runs an EXE, loads a DLL, executes a script — and whether it does so as SYSTEM.
Most of an MSI is declarative: copy these files, write these keys, create these
shortcuts. The exception — and the place attackers live — is the
CustomAction table, where a package runs
arbitrary code. Reading it well is the core of MSI triage.
The Type bit-field
Each custom action has a Type integer. It is not an enum; it is a bit-field
you decode in three parts:
- What runs (low 3 bits):
1a DLL entry point,2an EXE,5JScript,6VBScript,7a nested install. - Source (bits
0x30):0x00the embeddedBinarytable,0x10an installed file,0x20a directory or inline script text,0x30a property. - Scheduling:
0x400deferred (runs in the install script, in the service context),0x800no-impersonate → runs as LocalSystem, plus async, rollback/commit and ignore-exit-code bits.
So 0x02 is "run an EXE from the Binary table, immediately, as the user", while
0xC02 is "run an EXE from the Binary table, deferred, as SYSTEM". That
second one deserves a second look.
What to flag
- Any action that runs an EXE, loads a DLL, or executes a script.
- Deferred + no-impersonate actions — code running as SYSTEM during install.
- Nested installs, which pull in another package.
- Scripts whose body sits inline in the
Targetcolumn, or that reference theBinarytable — then check what that binary actually is.
Custom actions are ordered by the InstallExecuteSequence table, so you can see
when each runs and under what condition. MSI Parser decodes every Type into
plain language and joins it to the sequence, so "runs an EXE as SYSTEM" is one
glance, not a hex-decoding exercise. Next:
a full triage checklist.