40 lines
2.2 KiB
Markdown

{{#include ../../banners/hacktricks-training.md}}
# React Native 应用程序分析
要确认应用程序是否基于 React Native 框架构建,请按照以下步骤操作:
1. 将 APK 文件重命名为 zip 扩展名,并使用命令 `cp com.example.apk example-apk.zip``unzip -qq example-apk.zip -d ReactNative` 将其提取到新文件夹中。
2. 导航到新创建的 ReactNative 文件夹,找到 assets 文件夹。在此文件夹中,您应该找到文件 `index.android.bundle`,该文件包含以压缩格式编写的 React JavaScript。
3. 使用命令 `find . -print | grep -i ".bundle$"` 搜索 JavaScript 文件。
要进一步分析 JavaScript 代码,请在同一目录中创建一个名为 `index.html` 的文件,内容如下:
```html
<script src="./index.android.bundle"></script>
```
您可以将文件上传到 [https://spaceraccoon.github.io/webpack-exploder/](https://spaceraccoon.github.io/webpack-exploder/) 或按照以下步骤操作:
1. 在 Google Chrome 中打开 `index.html` 文件。
2. 通过按 **Command+Option+J for OS X****Control+Shift+J for Windows** 打开开发者工具栏。
3. 在开发者工具栏中点击“Sources”。您应该会看到一个分成文件夹和文件的 JavaScript 文件,构成了主包。
如果您找到一个名为 `index.android.bundle.map` 的文件,您将能够以未压缩格式分析源代码。映射文件包含源映射,这使您能够映射压缩的标识符。
要搜索敏感凭证和端点,请按照以下步骤操作:
1. 确定敏感关键字以分析 JavaScript 代码。React Native 应用程序通常使用第三方服务,如 Firebase、AWS S3 服务端点、私钥等。
2. 在这种特定情况下,观察到该应用程序使用了 Dialogflow 服务。搜索与其配置相关的模式。
3. 幸运的是,在侦查过程中在 JavaScript 代码中发现了敏感的硬编码凭证。
## 参考文献
- [https://medium.com/bugbountywriteup/lets-know-how-i-have-explored-the-buried-secrets-in-react-native-application-6236728198f7](https://medium.com/bugbountywriteup/lets-know-how-i-have-explored-the-buried-secrets-in-react-native-application-6236728198f7)
{{#include ../../banners/hacktricks-training.md}}