T03 · Remote Payload Retrieval and Execution
- Location
scripts/setup_tools.sh:20- Finding
Unverified Remote Tool Downloads Enable Supply-Chain Code Execution
- Content
View full analysis
Vulnerability Details
File Location:
scripts/setup_tools.sh, lines 20-55
Vulnerability Type: Unverified remote executable dependency retrieval
Risk Level: HighVulnerable Code
bash # 下载 baksmali (DEX -> Smali) if [ ! -f "$TOOLS_DIR/baksmali.jar" ]; then echo "📥 下载 baksmali..." curl -L -o "$TOOLS_DIR/baksmali.jar" \ "https://bitbucket.org/JesusFreke/smali/downloads/baksmali-2.5.2.jar" fi # 下载 smali (Smali -> DEX) if [ ! -f "$TOOLS_DIR/smali.jar" ]; then echo "📥 下载 smali..." curl -L -o "$TOOLS_DIR/smali.jar" \ "https://bitbucket.org/JesusFreke/smali/downloads/smali-2.5.2.jar" fi # 下载 apktool (资源解码) if [ ! -f "$TOOLS_DIR/apktool.jar" ]; then echo "📥 下载 apktool..." curl -L -o "$TOOLS_DIR/apktool.jar" \ "https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.10.0.jar" fi # 下载 dex2jar (DEX -> JAR) if [ ! -f "$TOOLS_DIR/dex2jar.zip" ]; then echo "📥 下载 dex2jar..." curl -L -o "$TOOLS_DIR/dex2jar.zip" \ "https://github.com/pxb1988/dex2jar/releases/download/v2.4/dex-tools-v2.4.zip" cd "$TOOLS_DIR" unzip -o dex2jar.zip mv dex-tools-v2.4 dex2jar chmod +x dex2jar/*.sh fi # 下载 uber-apk-signer (APK 签名) if [ ! -f "$TOOLS_DIR/uber-apk-signer.jar" ]; then echo "📥 下载 uber-apk-signer..." curl -L -o "$TOOLS_DIR/uber-apk-signer.jar" \ "https://github.com/patrickfav/uber-apk-signer/releases/download/v1.3.0/uber-apk-signer-1.3.0.jar" fiTechnical Analysis
The setup script retrieves JAR files and an archive containing executable shell scripts from third-party hosting services. Although the URLs use HTTPS and pin release versions, the script does not validate cryptographic hashes or publisher signatures before storing, extracting, marking executable, and subsequently using these artifacts.
The flagged dex2jar URL is a GitHub release associated with the decla ...[truncated 2319 chars]
- Remediation
View remediation
Remediation Suggestions
-
Publish a trusted SHA-256 or stronger digest for every exact dependency version.
-
Download each artifact into a newly created temporary directory and verify its digest before moving it into
TOOLS_DIR. -
When upstream projects provide signed releases, verify signatures against pinned publisher keys.
-
Use strict curl behavior, such as:
bash curl --fail --show-error --silent --location \ --proto '=https' --tlsv1.2 \ -o "$temporary_file" "$url" -
Restrict redirects to HTTPS and, where practical, to an approved host set.
-
Reject archive entries containing absolute paths or parent-directory traversal before extraction.
-
Extract archives into a temporary directory and validate the expected directory structure before installation.
-
Do not mark downloaded files executable until all integrity and structure checks have passed.
-
Prefer trusted operating-system packages or vendored, reviewed artifacts where licensing and maintenance permit.
-
Execute reverse-engineering tools in a sandbox or container with no unnecessary network access, secrets, or writable host directories.
-
