Quiz Entry - updated: 2026.11.26
What does the regular expression /\w*((\%27)|(\'))((\%6F)|o|(\%4F))((\%72)|r|(\%52))/ix match?
A single quote (literal or URL-encoded %27) immediately followed by the word "or" in any case or encoding: the core of a ' or … SQL injection.
* Each step accepts the literal character or its URL-encoded forms, so many spellings reach the same match. *
Reading it piece by piece:
\w*: zero or more word characters (letters, digits, underscore). Because it can be empty, it adds nothing to the match.((\%27)|(\')): the single quote, either encoded as%27or literal'.((\%6F)|o|(\%4F)): the letter o aso,%6F(lowercase) or%4F(uppercase).((\%72)|r|(\%52)): the letter r asr,%72or%52.( … )groups alternatives;|means OR.- Modifiers:
iignores case,xignores whitespace in the pattern (so it can be written readably).
So it fires on 'or, 'OR, %27or, %27%4F%52 and so on. It detects the injection shape rather than one fixed string, which is why it is in a pcre option instead of a content. It comes from a well-known 2004 Black Hat paper on detecting SQL injection and XSS with Snort, whose rules carry over to Suricata almost unchanged.
Go deeper:
Mookhey: Detection of SQL Injection and Cross-site Scripting Attacks (Black Hat USA 2004) — the paper this exact regex comes from, with the author's breakdown of each group.
Suricata: Payload Keywords (content, nocase, pcre) —
pcresyntax and modifiers as Suricata implements them.