To write an expert rule to protect your registry, you need to ensure that it follows the correct syntax. Expert rules consist of process, one or more targets, and the matching conditions that rules must examine before allowing the source to access the registry.
Note
Exploit Prevention is not supported in the ARM architecture.
Here is a sample Expert rule for registry rule type and their respective definitions:
Caution
Expert Rule commands are case-sensitive.
Rule {
Process {
Include OBJECT_NAME {
-v regedit.exe
}
}
Target {
Match KEY {
Include OBJECT_NAME {
-v "HKLMS\\test**"
}
Include -access "CREATE WRITE DELETE REPLACE_KEY RESTORE_KEY"
}
}
}For more Expert rules examples, visit the GitHub repository.
To add more commands in Expert rules, see Learn Expert Rules commands for Files, Processes, and Registry.
Sections of Expert Rule syntax in detail
The above Expert rule syntax is described here:
Rule | Formulates the execution of commands defined within | ||||||||||||||||||||||
Process | Executes the set of actions defined within the | ||||||||||||||||||||||
Include OBJECT_NAME {
-v regedit.exe
|
For example, the For more information, see Object name guidelines and Match types values. | ||||||||||||||||||||||
Target | Defines the target matches for the rule. This command takes no arguments and can contain only | ||||||||||||||||||||||
Match KEY | Defines an object, that an Expert rule is intended to protect and to match an event. This command requires at lease one match object type value. For registry rule type, | ||||||||||||||||||||||
Include OBJECT_NAME {
-v "HKLMS\\test**"
| This section defines the target object name, that is, registry key path. These root keys are recognized:
HKEY_CURRENT_CONFIG is not supported. | ||||||||||||||||||||||
Include -access "CREATE WRITE DELETE REPLACE_KEY RESTORE_KEY" | Defines the access flags. This flag applies when the protected registry key or value is accessed. The registry rule type supports these access flags:
To know more about the access flags, refer ACCESS_MASK flags. |
For more Expert Rules examples, visit the Trellix Github repository.