Injection Shapes in APIs
SQL/command/NoSQL injection still arrive via JSON fields — parameterize.
Visual · api_injection_shapes
Injection is still concatenation. Original Cyberlium.
JSON is not magic armor against injection.
APIs pass strings into SQL, shells, or queries. Parameterize and allowlist. Local demos only — no sqlmap against shops.
1. Same bug, new costume
Body fields concatenate into SQL → injection. ORM raw strings too.
Topic 10 SQLi lessons still apply.
Command guide
Try these commands — Same bug, new costume
═══ TOOLS & WEBSITES ═══ Browse / read these (authorized learning only — stay in YOUR lab / program scope)
Injection prevention — https://cheatsheetseries.owasp.org/cheatsheets/Injection_Prevention_Cheat_Sheet.html OWASP API8 — https://owasp.org/API-Security/editions/2023/en/0xa8-security-misconfiguration/
═══ INSTALL ═══
Linux (Debian/Ubuntu):
Command — copy this
sudo apt install curl sudo apt install jq
macOS:
Command — copy this
brew install jq
Windows: Built-in (PowerShell: Invoke-WebRequest)
Command — copy this
choco install jq
═══ LINUX / macOS ═══
Command — copy this
curl -sS -X POST http://127.0.0.1:8818/search -H "Content-Type: application/json" -d '{"q":"lab"}' | jq .
curl -sS -X POST http://127.0.0.1:8818/search -H "Content-Type: application/json" -d '{"q":"" OR 1=1 --"}' -o /dev/null -w "injection shape HTTP %{http_code}
"
curl -sS -X POST "${API:-http://127.0.0.1:8818}/items" -H "Content-Type: application/json" -d '{"name":"lab-item","tags":["a","b"]}' | jq . 2>/dev/null || truePrimary tools to practice this lesson: curl, jq. Reference sites: Injection prevention (https://cheatsheetseries.owasp.org/cheatsheets/Injection_Prevention_Cheat_Sheet.html); OWASP API8 (https://owasp.org/API-Security/editions/2023/en/0xa8-security-misconfiguration/). Run every command in the box — install first, then the usage lines — only on YOUR lab / program scope.
2. Command and template injection
APIs that shell out or render templates with user strings are risky.
Avoid shelling out; use libraries.
3. Ethics
Demonstrate on YOUR lab DB. Never sqlmap strangers.
Payload packs are not homework against live services.
4. What you ship: injection reminder
Parameterize. No stranger sqlmap. Lab-only demos.
5. What you record before the next lesson
Sentence: JSON ≠ safe. Bind parameters.
6. Wrong vs right: stranger APIs vs literacy on systems you own
Worked failure — same API word, opposite target. Right never needs a live shop or classmate token.
- Wrong: sqlmap a retail /api/search.
- Right: Write parameterize rule. Next: SSRF.
Mission: injection policy
1) Write parameterize rule. 2) Write NEVER sqlmap strangers. 3) Name one risky sink (SQL/shell).
Stuck? Ask Cyberlium AI Mentor
Ask Mentor: “ORM raw query risk?”
APPLY: Fix SQL injection:
APPLY: True or False: JSON body cannot be injective.
APPLY: sqlmap strangers:
SSRF Shapes
Part of API Security with AI — Rate Limit Injection and SSRF Shapes.
Defense Lab — 429 and Policy Sheet
Part of API Security with AI — Rate Limit Injection and SSRF Shapes.
Quiz — Rate Injection SSRF
Part of API Security with AI — Rate Limit Injection and SSRF Shapes.