Android 移动设备adb渗透取证命令清单 - 嘶吼 RoarTalk – 网络安全行业综合服务平台,4hou.com

Android 移动设备adb渗透取证命令清单

h1apwn 资讯 2021-04-20 09:35:52
248436
收藏

导语:渗透取证移动设备时,需要遵循一个过程,其中包括从识别到报告的各个阶段。

渗透取证移动设备时,需要遵循一个过程,其中包括从识别到报告的各个阶段。此过程中的关键点之一是获取数据,我们从中提取存储在移动设备中的数据的副本。

我们的总体目标是从头到尾获得物理内存的物理转储。在大多数使用基于文件的加密(FBE)的现代智能手机设备上,完整的文件系统通常是我们的“最佳证据”。

这些提取方法通常依赖于为克服设备安全性而开发的漏洞利用。我们使用各种工具和技术,有时还使用物理方法。

在某些情况下,尤其是对于最新的芯片组或操作系统版本,没有公开的解决方案来获取物理或完整的文件系统转储。在这些情况下,我们必须依靠设备提供的通信选项。

特别是在Android设备上,我们主要依靠:

1. ADB(Android调试桥)

2. MTP(媒体传输协议)

3. 三星SmartSwitch华为HiSuite等制造商备份工具

在ADB方面,大多数商业工具都使用四种方法:

1. ADB Backup:该工具执行“ adb backup ”命令,不同工具之间可能会有一些变化。这通常不包括本机和第三方应用程序数据:每个单独的应用程序都可以在AndroidManifest文件(android:allowBackup参数)中指定其数据是否应包含在ADB备份中。Android备份通常包含sdcard内容和一些本机数据库。

2. Agent:该工具安装一个代理(基本上是一个APK文件),该代理请求读取本机应用程序数据的权限,特别是联系人,呼叫日志和SMS / MMS。在GDPR之后,Google更改了其权限政策 ,并对仅读取默认处理程序的调用日志和SMS进行了限制:这要求对大多数取证工具使用的流程进行一些更改 。

3. ADB Screenshot:该工具利用了ADB功能,该功能允许对设备进行屏幕截图。通过这种方式,还可以使用某些图像分析技术对第三方应用程序进行“截屏”,然后在该工具中进行处理,以解析内容并使之可读和可搜索。

4. APK Downgrade:该工具通过保留用户数据来卸载第三方软件包(应用程序)的实际版本,并安装android:allowBackup参数设置为“ true”的同一软件包的先前版本。该工具会创建一个包含特定应用程序的ADB备份,然后重新安装实际的应用程序版本。

实际上,Android Debug Bridge比这更强大,因为它允许我们获取没有root特权的shell。在此Shell中,可以运行命令(Linux本地和Android特定),并从设备中提取文件和文件夹(不需要root特权)。

多年来,发布了各种利用ADB的开源工具和脚本:

Andriller:https://github.com/den4uk/andriller
Android Live Info:https://github.com/Magpol/AndroidLiveInfo
Foroboto:https://github.com/chapinb/foroboto
ADB Export:https://github.com/sromku/adb-export

举一个简单的例子,通过使用本地Android命令“ dumpsys usagestats ”,可以获得有关应用程序使用情况的信息,包括已删除的应用程序。

受先前工作的启发,并阅读了有关该主题的大量文献(包括新的Android Internals书籍)后,我决定编写一个简单的bash脚本android_triage,该脚本在最大程度上利用了ADB。

https://github.com/RealityNet/android_triage

该脚本是在Tsurugi Project 创始人Giovanni Rattarto的支持下开发的 。它已经在Linux和Mac OS X上进行了测试,并且只有两个要求:特定平台ADB可执行文件dialog命令此处提供Mac OS X的说明 )。

下载完成后,需要使脚本可执行(chmod + x android_triage.sh),然后需要连接设备。

在执行脚本之前,需要通过将它们配对来允许移动设备和主机之间进行ADB通信。

有多种方法可以执行此操作:可能最简单的方法是执行adb reconnect。

始终可以通过执行adb devices命令来检查配对状态:当看到“ device ”消息时,表示配对成功。

image-20210407172609931.pngimage-20210407172609931

正确连接设备后,即可执行脚本。

image-20210407172855956.png

如果在路径或脚本文件夹中未找到ADB命令,则脚本将提示错误消息,如图所示。

image-20210407172942014image-20210407172942014.png

如果设备未正确连接或配对,脚本将提示错误消息,如图所示。

image-20210407173008288.png

image-20210407173008288 选项1-收集基本信息

image-20210407173030645image-20210407173030645.png

该选项通过执行以下命令来收集有关设备的基本信息:

adb shell getprop
adb shell settings list system
adb shell settings list secure
adb shell settings list global

它还会生成“ device_info.txt ”文件,其中包含有关设备的相关信息:

Device Manufacturer (adb shell getprop ro.product.manufacturer)
Device Product (adb shell getprop ro.product.model)
Android ID (adb shell settings get secure android_id)
Android Serial Number (adb shell getprop ril.serialnumber)
Product Code (adb shell getprop ro.product.code)
Product Device (adb shell getprop ro.product.device)
Product Name (adb shell getprop ro.product.name)
Chipname (adb shell getprop ro.chipname)
Android Version (adb shell getprop ro.build.version.release)
Android Fingerprint (adb shell getprop ro.build.fingerprint)
Build date (adb shell getprop ro.build.date)
Build ID (adb shell ro.build.id)
Bootloader Version (adb shell ro.boot.bootloader)
Security Patch (adb shell ro.build.version.security_patch)
Bluetooth Address (adb shell settings get secure bluetooth_address)
Bluetooth Name (adb shell settings get secure bluetooth_name)
Timezone (adb shell getprop persist.sys.timezone)
USB Configuration (adb shell getprop persist.sys.usb.config)
Storage Size (adb shell getprop storage.mmc.size)
Notification Sound (adb shell getprop ro.config.notification_sound)
Alerm Alert (adb shell getprop ro.config.alarm_alert)
Ringtone (adb shell getprop ro.config.ringtone)
Media Sound (adb shell getprop rro.config.media_sound)
Device Time (adb shell date)

输出保存在以下路径(相对于脚本路径)中:“ $ {ANDROID_ID} / $ {date +”%Y%m%d%H%M_%S“} _ info”

image-20210407173128172image-20210407173128172.png

选项2-执行实时命令

image-20210407173146672.png

image-20210407173146672 该选项执行各种Linux命令。

adb shell id
adb shell uname -a
adb shell cat /proc/version
adb shell uptime
adb shell printenv
adb shell cat /proc/partitions
adb shell cat /proc/cpuinfo
adb shell cat /proc/diskstats
adb shell df
adb shell df -ah
adb shell mount
adb shell ip address show wlan0
adb shell ifconfig -a
adb shell netstat -an
adb shell lsof
adb shell ps -ef
adb shell top -n 1
adb shell cat /proc/sched_debug
adb shell vmstat
adb shell sysctl -a
adb shell ime list
adb shell service list
adb shell logcat -S -b all
adb shell logcat -d -b all V:*

输出保存在以下路径(相对于脚本路径)中: “ $ {ANDROID_ID} / $ {date +”%Y%m%d%H%M_%S“} _ live”

image-20210407173235973image-20210407173235973.png

选项3-执行程序包管理器命令

image-20210407173317866.png

image-20210407173317866 此选项执行各种Android Package Manager命令。

adb shell pm get-max-users
adb shell pm list users
adb shell pm list features
adb shell pm list instrumentation
adb shell pm list libraries -f
adb shell pm list packages -f
adb shell pm list packages -f -u
adb shell pm list permissions -f
adb shell cat /data/system/uiderrors.txt

输出保存在以下路径(相对于脚本路径)中: “ $ {ANDROID_ID} / $ {date +”%Y%m%d%H%M_%S“} _ package_manager”

image-20210407173358388.png

image-20210407173358388 选项4-执行Bugreport和Dumpsys

image-20210407173422149.png

image-20210407173422149 此选项执行Android Bugreport和Android Dumpsys命令。

adb bugreport
adb shell dumpsys 
adb shell dumpsys account
adb shell dumpsys activity
adb shell dumpsys alarm
adb shell dumpsys appops
adb shell dumpsys audio
adb shell dumpsys autofill
adb shell dumpsys backup
adb shell dumpsys battery
adb shell dumpsys batteryproperties
adb shell dumpsys batterystats
adb shell dumpsys bluetooth_manager
adb shell dumpsys carrier_config
adb shell dumpsys clipboard
adb shell dumpsys connectivity
adb shell dumpsys content
adb shell dumpsys cpuinfo
adb shell dumpsys dbinfo
adb shell dumpsys device_policy
adb shell dumpsys devicestoragemonitor
adb shell dumpsys diskstats
adb shell dumpsys display
adb shell dumpsys dropbox
adb shell dumpsys gfxinfo
adb shell dumpsys iphonesubinfo
adb shell dumpsys jobscheduler
adb shell dumpsys location
adb shell dumpsys meminfo -a
adb shell dumpsys mount
adb shell dumpsys netpolicy
adb shell dumpsys netstats
adb shell dumpsys network_management
adb shell dumpsys network_score
adb shell dumpsys notification
adb shell dumpsys package
adb shell dumpsys password_policy
adb shell dumpsys permission
adb shell dumpsys phone
adb shell dumpsys power
adb shell dumpsys procstats --full-details
adb shell dumpsys restriction_policy
adb shell dumpsys sdhms
adb shell dumpsys sec_location
adb shell dumpsys secims
adb shell dumpsys search
adb shell dumpsys sensorservice
adb shell dumpsys settings
adb shell dumpsys shortcut
adb shell dumpsys stats
adb shell dumpsys statusbar
adb shell dumpsys storaged
adb shell dumpsys telecom
adb shell dumpsys usagestats
adb shell dumpsys user
adb shell dumpsys usb
adb shell dumpsys vibrator
adb shell dumpsys wallpaper
adb shell dumpsys wifi
adb shell dumpsys window

输出保存在以下路径(相对于脚本路径)中: “ $ {ANDROID_ID} / $ {date +”%Y%m%d%H%M_%S“} _ dumpsys”。

image-20210407173540604image-20210407173540604.png

选项5-获取ADB备份

image-20210407173610799.png

image-20210407173610799 该选项通过执行以下命令来创建ADB备份

adb backup -all -shared -system -apk -f "$BACKUP_DIR"/backup.ab

该命令需要与设备进行交互

image-20210407174056685image-20210407174056685.png

输出保存在以下路径(相对于脚本路径): “ $ {ANDROID_ID} / $ {date +”%Y%m%d%H%M_%S“} _ backup”

image-20210407174123518image-20210407174123518.png

选项6-获取“ / system”文件夹

image-20210407174143052.png

image-20210407174143052 此选项获取“ / system”文件夹并将其保存为本地文件,也保存为tar文件。

adb pull /system/
adb pull /system/app
adb pull /system/camerdata
adb pull /system/container
adb pull /system/etc
adb pull /system/fake-libs
adb pull /system/fonts
adb pull /system/framework
adb pull /system/hidden
adb pull /system/lib
adb pull /system/lib64
adb pull /system/media
adb pull /system/priv-app
adb pull /system/saiv
adb pull /system/tts
adb pull /system/usr
adb pull /system/vendor
adb pull /system/xbin

image-20210407174210635.pngimage-20210407174210635

输出保存在以下路径(相对于脚本路径)中:“ $ {ANDROID_ID} / $ {date +”%Y%m%d%H%M_%S“} _ system ”

image-20210407174229220.pngimage-20210407174229220

选项7-获取“ / sdcard”文件夹

image-20210407174444172.png

image-20210407174444172 此选项获取“ / sdcard”文件夹并将其保存为本地文件,也保存为tar文件。

adb pull /scard

输出保存在以下路径(相对于脚本路径)中:“ $ {ANDROID_ID} / $ {date +”%Y%m%d%H%M_%S“} _ sdcard ”

image-20210407174427023image-20210407174427023.png

选项8-从“ / data”文件夹中提取APK文件

image-20210407174404818.png

image-20210407174404818 此选项从“ / data”和“ / vendor”文件夹中提取APK文件,并将其另存为tar文件。

 $SHELL_COMMAND pm list packages -f -u > ${APK_DIR}/${ANDROID_ID}_apk_list.txt

 SELECTED_FILE=${APK_DIR}/${ANDROID_ID}_apk_list.txt

 echo "[*] Pulling APK files"
 while read -r line
 do
  line=${line#"package:"}
  target_file=${line%%".apk="*}
  target_file=$target_file".apk"
  IFS='/' read -ra tokens <<<"$target_file"
  apk_type=${tokens[1]}
  app_folder=${tokens[2]}
  app_path=${tokens[3]}
  apk_name=${tokens[4]}

  if [[ ${apk_type} != "system" ]]; then
      mkdir -p ${APK_DIR}/${apk_type}/${app_folder}/${app_path}
      $PULL_COMMAND $target_file ${APK_DIR}/${apk_type}/${app_folder}/${app_path}/${apk_name}
  fi
 continue
 done < "$SELECTED_FILE"

输出保存在以下路径(相对于脚本路径):“ $ {ANDROID_ID} / $ {date +”%Y%m%d%H%M_%S“} _ apk ”

image-20210407174350632image-20210407174350632.png

选项9-从内容提供商提取数据

image-20210407174337411.png

image-20210407174337411 此选项从Android Content Providers中提取数据。

adb shell content query --uri content://com.android.calendar/calendar_entities
adb shell content query --uri content://com.android.calendar/calendars
adb shell content query --uri content://com.android.calendar/attendees
adb shell content query --uri content://com.android.calendar/event_entities
adb shell content query --uri content://com.android.calendar/events
adb shell content query --uri content://com.android.calendar/properties
adb shell content query --uri content://com.android.calendar/reminders
adb shell content query --uri content://com.android.calendar/calendar_alerts
adb shell content query --uri content://com.android.calendar/colors
adb shell content query --uri content://com.android.calendar/extendedproperties
adb shell content query --uri content://com.android.calendar/syncstate
adb shell content query --uri content://com.android.contacts/raw_contacts
adb shell content query --uri content://com.android.contacts/directories
adb shell content query --uri content://com.android.contacts/syncstate
adb shell content query --uri content://com.android.contacts/profile/syncstate
adb shell content query --uri content://com.android.contacts/contacts
adb shell content query --uri content://com.android.contacts/profile/raw_contacts
adb shell content query --uri content://com.android.contacts/profile
adb shell content query --uri content://com.android.contacts/profile/as_vcard
adb shell content query --uri content://com.android.contacts/stream_items
adb shell content query --uri content://com.android.contacts/stream_items/photo
adb shell content query --uri content://com.android.contacts/stream_items_limit
adb shell content query --uri content://com.android.contacts/data
adb shell content query --uri content://com.android.contacts/raw_contact_entities
adb shell content query --uri content://com.android.contacts/profile/raw_contact_entities
adb shell content query --uri content://com.android.contacts/status_updates
adb shell content query --uri content://com.android.contacts/data/phones
adb shell content query --uri content://com.android.contacts/data/phones/filter
adb shell content query --uri content://com.android.contacts/data/emails/lookup
adb shell content query --uri content://com.android.contacts/data/emails/filter
adb shell content query --uri content://com.android.contacts/data/emails
adb shell content query --uri content://com.android.contacts/data/postals
adb shell content query --uri content://com.android.contacts/groups
adb shell content query --uri content://com.android.contacts/groups_summary
adb shell content query --uri content://com.android.contacts/aggregation_exceptions
adb shell content query --uri content://com.android.contacts/settings
adb shell content query --uri content://com.android.contacts/provider_status
adb shell content query --uri content://com.android.contacts/photo_dimensions
adb shell content query --uri content://com.android.contacts/deleted_contacts
adb shell content query --uri content://downloads/my_downloads
adb shell content query --uri content://downloads/download
adb shell content query --uri content://media/external/file
adb shell content query --uri content://media/external/images/media
adb shell content query --uri content://media/external/images/thumbnails
adb shell content query --uri content://media/external/audio/media
adb shell content query --uri content://media/external/audio/genres
adb shell content query --uri content://media/external/audio/playlists
adb shell content query --uri content://media/external/audio/artists
adb shell content query --uri content://media/external/audio/albums
adb shell content query --uri content://media/external/video/media
adb shell content query --uri content://media/external/video/thumbnails
adb shell content query --uri content://media/internal/file
adb shell content query --uri content://media/internal/images/media
adb shell content query --uri content://media/internal/images/thumbnails
adb shell content query --uri content://media/internal/audio/media
adb shell content query --uri content://media/internal/audio/genres
adb shell content query --uri content://media/internal/audio/playlists
adb shell content query --uri content://media/internal/audio/artists
adb shell content query --uri content://media/internal/audio/albums
adb shell content query --uri content://media/internal/video/media
adb shell content query --uri content://media/internal/video/thumbnails
adb shell content query --uri content://settings/system
adb shell content query --uri content://settings/system/ringtone
adb shell content query --uri content://settings/system/alarm_alert
adb shell content query --uri content://settings/system/notification_sound
adb shell content query --uri content://settings/secure
adb shell content query --uri content://settings/global
adb shell content query --uri content://settings/bookmarks
adb shell content query --uri content://com.google.settings/partner
adb shell content query --uri content://nwkinfo/nwkinfo/carriers
adb shell content query --uri content://com.android.settings.personalvibration.PersonalVibrationProvider/
adb shell content query --uri content://settings/system/bluetooth_devices
adb shell content query --uri content://settings/system/powersavings_appsettings
adb shell content query --uri content://user_dictionary/words
adb shell content query --uri content://browser/bookmarks
adb shell content query --uri content://browser/searches
adb shell content query --uri content://com.android.browser
adb shell content query --uri content://com.android.browser/accounts
adb shell content query --uri content://com.android.browser/accounts/account_name
adb shell content query --uri content://com.android.browser/accounts/account_type
adb shell content query --uri content://com.android.browser/accounts/sourceid
adb shell content query --uri content://com.android.browser/settings
adb shell content query --uri content://com.android.browser/syncstate
adb shell content query --uri content://com.android.browser/images
adb shell content query --uri content://com.android.browser/image_mappings
adb shell content query --uri content://com.android.browser/bookmarks
adb shell content query --uri content://com.android.browser/bookmarks/folder
adb shell content query --uri content://com.android.browser/history
adb shell content query --uri content://com.android.browser/bookmarks/search_suggest_query
adb shell content query --uri content://com.android.browser/searches
adb shell content query --uri  content://com.android.browser/combined

输出保存在以下路径(相对于脚本路径)中:“ $ {ANDROID_ID} / $ {date +”%Y%m%d%H%M_%S“} _ contentprovider ”

image-20210407174320430.png

本文翻译自:https://blog.digital-forensics.it/2021/03/triaging-modern-android-devices-aka.html如若转载,请注明原文地址:
  • 分享至
取消

感谢您的支持,我会继续努力的!

扫码支持

打开微信扫一扫后点击右上角即可分享哟

发表评论

 
本站4hou.com,所使用的字体和图片文字等素材部分来源于原作者或互联网共享平台。如使用任何字体和图片文字有侵犯其版权所有方的,嘶吼将配合联系原作者核实,并做出删除处理。
©2022 北京嘶吼文化传媒有限公司 京ICP备16063439号-1 本站由 提供云计算服务