Add Apport Symlink Hijacking: CVE-2020-8831#20037
Add Apport Symlink Hijacking: CVE-2020-8831#20037gardnerapp wants to merge 36 commits intorapid7:masterfrom
Conversation
|
I've accidentally committed pushes from another module. My apologizes, I am unsure of the proper way to remove these. |
No problem; git is really awesome, but not always super intuitive. It looks like the unwanted commits are all related to your previous game overlay module.
Last, if you want, let me know and I am pretty sure I can fix it for you, but you might lose some commits. The only file you need here is |
822e526 to
68de77e
Compare
|
Yes, I only want the files relevant to this module pushed. I just added the rebase let me know if it is sufficient. |
Looks good! Let us know when you'd like us to review it. |
modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb
Outdated
Show resolved
Hide resolved
modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb
Outdated
Show resolved
Hide resolved
modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb
Outdated
Show resolved
Hide resolved
modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb
Outdated
Show resolved
Hide resolved
| ) | ||
| ) | ||
| register_options [ | ||
| OptString.new('WRITABLE_DIR', [true, 'A directory we can write to.', '/tmp']), |
There was a problem hiding this comment.
For local exploit modules, this is usually registered as an advanced option:
register_advanced_options [
OptString.new('WritableDir', [true, 'A directory where we can write files', '/tmp'])
]
modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb
Outdated
Show resolved
Hide resolved
modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb
Outdated
Show resolved
Hide resolved
…esc.rb Co-authored-by: bcoles <bcoles@gmail.com>
…esc.rb Co-authored-by: bcoles <bcoles@gmail.com>
…esc.rb Co-authored-by: bcoles <bcoles@gmail.com>
…esc.rb Co-authored-by: bcoles <bcoles@gmail.com>
…esc.rb Co-authored-by: bcoles <bcoles@gmail.com>
…esc.rb Co-authored-by: bcoles <bcoles@gmail.com>
…esc.rb Co-authored-by: bcoles <bcoles@gmail.com>
gardnerapp
left a comment
There was a problem hiding this comment.
Finished review
modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb
Outdated
Show resolved
Hide resolved
modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb
Outdated
Show resolved
Hide resolved
Delete accidental module
|
I accidentally committed a file for another exploit please ignore. |
|
Pertinent failing test log entries: |
Which log files are you checking? When I run rubocop this is the result: |
|
I've checked the commit history of the Apport package and it looks like the vulnerable function Additionally, when a normal user runs |
|
Some older dependencies were tripping me up on this branch and the file name change made rebasing a pain, so I just pulled the file into the master branch, and when I ran rubocop, it found the two lint issues: Odd that it is not showing up for you. |
|
Added a tidy not sure if you saw! |
|
@gardnerapp can you let me know where you got the vulnerable deb package? |
Sorry just started new job been busy wearing a suit etc. I did this part a while ago but I think this Ubuntu page should have the download you're looking for. |
modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb
Outdated
Show resolved
Hide resolved
|
I finally got a chance to set this up. Ubuntu 22.04x64 with the application that you sent. |
modules/exploits/linux/local/cve_2020_8831_apport_symlink_privesc.rb
Outdated
Show resolved
Hide resolved
…esc.rb Co-authored-by: Brendan <bwatters@rapid7.com>
…esc.rb Co-authored-by: Brendan <bwatters@rapid7.com>
|
I've added some debugging statements to try and figure out what the file perms look like before an after the crash. Because the module runs |



This pull request is a draft for CVE-2020-8831, I originally came across this vulnerability while reading From Day Zero to Zero Day, which I highly recommend. The long story short is that certain versions of apport will follow symbolic links when writing crash dumps. This file will have a mask of 777 and be owned by root. In this module I used the command
ln -s /cron.d /var/lock/apportso that a/etc/cron.d/lockcrontab file would be created. This crontab should execute a payload every minute which was located in the/tmpdirectory.After scratching my head for several hours and combing through the log files I found that the crontab would not execute because it's file permissions were too excessive. We need to find another place for the symlink hijacking to occur. I have a few places in mind namely
/etc/init.d/or~/.bashrcwhich would trigger the payload upon startup. I am submitting this because I am unsure of which route to go or if there are other places where the symlink hijacking should occur. Thank you !