Cyberlium
Cyberlium
Cyberlium on Android·Google Play Store

Learn cybersecurity with hands-on labs and AI mentor support on your phone.

Mod 9 · Les 2/5
In progress
Module 9•Lesson 2 of 5•⏱️ 15 min read•Beginner+39 XP

Injection Shapes in APIs

SQL/command/NoSQL injection still arrive via JSON fields — parameterize.

Injection Shapes in APIs
00:00/02:23

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 || true

Primary 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.
Hands-on Exercise

Mission: injection policy

1) Write parameterize rule. 2) Write NEVER sqlmap strangers. 3) Name one risky sink (SQL/shell).

Pro Tip

Stuck? Ask Cyberlium AI Mentor

Ask Mentor: “ORM raw query risk?”

Practice QuizQuestion 1
Multiple choice
Q1

APPLY: Fix SQL injection:

Practice QuizQuestion 2
True or False
Q2

APPLY: True or False: JSON body cannot be injective.

Practice QuizQuestion 3
Multiple choice
Q3

APPLY: sqlmap strangers:

←Previous: Rate Limiting
Answer 3 practice quiz questions to unlock XP reward. (0/3 answered)
Skip quiz & read next →