Why is content:"1'or'1'='1" a poor way to detect SQL injection, and what is used instead?
Because it is only one of countless variants and is easily disguised by encoding, case changes or spacing; instead you use a regular expression (PCRE) that matches the essential structure in its common encodings.
1'or'1'='1 is the classic test input: it closes a string with ' and adds a condition that is always true. But an attacker can write it in many equivalent ways:
' OR 1=1--,' or 'a'='a,") or ("x"="x- URL-encoded:
%27%20OR%201%3D1 - mixed case:
oR,Or - extra spaces, comments in place of spaces (
'/**/or/**/1=1)
A fixed content string matches exactly one of them.
PCRE (Perl Compatible Regular Expressions) lets the rule describe the pattern: "a quote, in literal or %27 form, followed by or in any case or encoding". One regex covers a whole family of payloads.
The costs are that regex evaluation is slower than plain content matching, and broad patterns produce more false positives. So in production a pcre is paired with a cheap content prefilter and scoped to the relevant HTTP buffer.
Go deeper:
Mookhey: Detection of SQL Injection and Cross-site Scripting Attacks (Black Hat USA 2004) — the paper that argues for regex signatures over fixed strings and builds them step by step.
Suricata: Payload Keywords (content, nocase, pcre) — how
contentandpcrework, and why a regex should be paired with a content prefilter.OWASP: SQL Injection — payload variants that show why one fixed string can never cover them.