Cmd CQL implements a number of character matching patterns that can help you build more advanced triggers. This page lists and describes the patterns you can use to build trigger queries, and includes examples at the bottom.
Character matching patterns:
You can use these patterns to build Command triggers:
You can use these character classes with the character class syntax shown above:
The following examples show how these patterns can help you build precise triggers that minimize false positives and false negatives.
1. Character sequence
Objective: Create an alert for any interactive
docker exec with a shell interpreter as the entry point.
cmd_root = 'docker' AND cmd_parameters IN '*-it*,*-i*-t*' AND cmd_parameters = '*[az /]sh' `
'*[az /]sh' will match any use of a
bash , or
dash interpreter, with or without a full path.
Objective: Create an alert when
HISTIGNORE=* is set in a local environment.
cmd_root = 'export' AND cmd_parameters = '*HISTIGNORE=*[*]*'
'*HISTIGNORE=*[*]*' will match when
* is in the list of commands to be omitted from command history.
3. Character class
Objective: Alert on any curl/wget usage with an IPv4 address-based URL.
cmd_root IN 'wget,curl' AND cmd_parameters = '*://*[[:digit:]].*[[:digit:]].*[[:digit:]].*[[:digit:]][:/]*'
'*://'→ will match any URI handler (eg.
'*[[:digit']].'→ will match each of the four IP octets.
'→ will match a standard or non-standard port.