LOGBOOK

HELP

Quiz Entry - updated: 2026.11.26

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:

From Quiz: ISLAB / Network Security Monitoring | Updated: Nov 26, 2026