An analyst is building an XQL query to detect suspicious PowerShell execution. They want to exclude any command line that contains the string 'Invoke-WebRequest' and also exclude any command line that contains 'DownloadString'. Which XQL filter expression correctly applies both exclusions?
This expression uses the contains operator to check for each substring, combines them with 'or' inside a negation, and correctly excludes any command line that contains either 'Invoke-WebRequest' or 'DownloadString'. The 'not' applies to the entire parenthesized expression, so an event is kept only if it does not contain either string. This is the precise way to apply both exclusions in XQL.
Why this answer
To exclude command lines that contain either of two substrings, the correct approach is to negate a disjunction of contains conditions. The expression 'not (command_line contains "A" or command_line contains "B")' keeps only events where neither substring appears. Using inequality operators or exact-match lists would only filter exact matches and miss embedded occurrences, leaving many suspicious commands undetected.
Exam trap
The trap here is confusing substring containment with exact value matching, leading to filters that only exclude commands equal to the target strings rather than containing them.