-
What is the SQL Tamper Framework? A context-aware SQL transformation framework for WAF bypass, plus SQLMap-compatible tamper scripts, that tokenizes SQL and transforms it deterministically while keeping it valid. Published on PyPI as
sqlmap-tamper-framework. -
How is it different from a normal SQLMap tamper script? Normal tamper scripts do string replacement and break on multi-character operators, shifting positions, and clause context. This framework lexes SQL into UUID-tracked tokens and tracks clause context, so output stays valid SQL.
-
How do I use it with SQLMap? Copy a script into SQLMap’s tamper directory (
cp tamper_scripts/cloudflare2025.py /path/to/sqlmap/tamper/) and runsqlmap -u "https://target.com?id=1" --tamper=cloudflare2025. -
Which WAFs are targeted? Cloudflare (
cloudflare2025.py), AWS WAF v2 (awswaf2026.py), Azure WAF (azurewaf2026.py), ModSecurity CRS (modsec_crs2026.py), Imperva (imperva2026.py), Akamai Kona (akamai2026.py), plus an auto-select combiner (meta_tamper.py). -
What database does it target? MySQL 5.7+ and MariaDB 10.x. It may not work against PostgreSQL, MSSQL, or Oracle, since techniques like
/*!50000...*/version comments are MySQL-specific. -
What transformations does it include? Core: keyword wrapping, space replacement, case alternation, operator URL encoding. Advanced (v2.1.0+): homoglyphs, function wrapping, numeric obfuscation, comment chaos, logical-operator swap, hex encoding, and version-comment variation.
-
Why is the output deterministic instead of randomized? By design: deterministic output is reproducible for research and verification, and the absence of a randomization engine is a deliberate abuse-resistance choice.
-
What is the multi-character operator fix? A naive lexer breaks
>=into>and=, encoding to the broken%3E=. The lexer checks multi-character operators first, so>=is one token and encodes atomically to%3E%3D. -
What is UUID token tracking and why does it matter? Each token gets a UUID at lex time that never changes, so transformations that alter a token’s length (like wrapping SELECT) do not desynchronize tracking the way position indices would.
-
What does “context-aware” mean here? The framework tracks which SQL clause a token is in, so a rule can, for example, URL-encode operators only in WHERE/HAVING and leave the SELECT list untouched.
-
Can I write my own transformation? Yes. Create a
TransformationRulewith atransform_func(token, context),target_types(e.g.TokenType.OPERATOR), andallowed_clauses(e.g.[ClauseType.WHERE]), and add it to aSQLTransformer. -
When should I use AST-based instead of token-based transformation? Use token-based (faster, simpler) for most queries; use AST-based (handles nesting and function calls) for complex or deeply nested queries.
-
How fast is it? Repository-reported benchmarks: ~1ms for a simple 10-token query, ~5ms for a 100-token query, ~10ms for a nested subquery.
-
How is it tested? The docs enumerate 33 tests (10 lexer, 10 transformer, 13 integration) covering operators, literals, comments, UUID tracking, context awareness, determinism, and real SQLMap payloads. (Note: the README badge says “49+ passing”; the itemized breakdown totals 33.)
-
How do I install it?
git clonethe repo and either copy a tamper script into SQLMap, orpip install -e .for framework/development use. It’s also on PyPI assqlmap-tamper-framework. -
What Python version is required? The README/PyPI badge says Python 3.8+; the PyPI metadata field says >=3.7. (The two disagree slightly.)
-
Does it guarantee a WAF bypass? No. Effectiveness varies by WAF configuration; there is no universal bypass guarantee. A bypass is always relative to a specific ruleset.
-
What is
meta_tamper.py? An auto-select combiner that chains transformations based on environment variables, letting you drive the evasion chain from configuration rather than editing code. -
What are the known limitations? MySQL/MariaDB focus, simplified (not full) SQL parsing with possible edge cases on deeply nested queries, and WAF-dependent effectiveness.
-
Is this legal to use? Only for authorized testing: systems you own, with written authorization, in authorized pentests or in-scope bug bounties, or against local vulnerable apps (DVWA, bWAPP, SQLi-labs). Unauthorized use is illegal under the CFAA, the UK Computer Misuse Act, India’s IT Act 2000 Section 66, and similar laws.
REGAAN R