T03 · Remote Payload Retrieval and Execution
- Location
- docking_professional_stack/setup_mamba.sh:9
- Finding
- Unverified Remote Micromamba Retrieval and Execution<![CDATA[ ## Vulnerability Details **File Locations**: - `docking_professional_stack/setup_mamba.sh:9-15` - `docking_professional_stack/setup_full_stack.sh:14-19` - `scripts/kaggle_dock.py:197-205` **Vulnerability Type**: Remote payload retrieval and execution without artifact verification **Risk Level**: High ### Vulnerable Code ```bash if ! command -v micromamba >/dev/null 2>&1 && ! command -v mamba >/dev/null 2>&1 && ! command -v conda >/dev/null 2>&1; then echo "No conda/mamba found. Installing micromamba locally into $HOME/micromamba ..." mkdir -p "$HOME/micromamba" curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj -C "$HOME/micromamba" bin/micromamba export PATH="$HOME/micromamba/bin:$PATH" eval "$(micromamba shell hook -s bash)" micromamba create -y -n base -c conda-forge ``` ```bash if ! command -v micromamba >/dev/null 2>&1 && ! command -v mamba >/dev/null 2>&1 && ! command -v conda >/dev/null 2>&1; then echo "No conda/mamba found. Installing micromamba locally into $HOME/micromamba ..." mkdir -p "$HOME/micromamba" curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj -C "$HOME/micromamba" bin/micromamba export PATH="$HOME/micromamba/bin:$PATH" eval "$(micromamba shell hook -s bash)" fi ``` ```python print("== installing toolchain (micromamba) ==", flush=True) r = sh("curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest " "| tar -xvj -C /kaggle/working bin/micromamba") MM = "/kaggle/working/bin/micromamba" if not Path(MM).exists(): print("FATAL: micromamba download failed — is internet enabled on this kernel?") print(r.stdout[-2000:], r.stderr[-2000:]) sys.exit(4) ``` ### Technical Analysis These installation paths download a mutable `latest` Micromamba archive and immediately extract the included executable. No cryptographic checksum, signature, release version, or expected archive size is verified. The local installers subsequently execute the download ...[truncated 1860 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin a specific Micromamba release instead of using the mutable `latest` endpoint. 2. Download the archive to a temporary file before extraction. 3. Verify a project-maintained SHA-256 or SHA-512 digest and abort on any mismatch. 4. Where supported, verify the upstream release signature using a pinned trusted public key. 5. Validate the archive member list before extraction and reject absolute paths, symbolic-link escapes, and traversal components. 6. Execute the verified binary directly and avoid `eval` where possible. If the shell hook is necessary, document why and only evaluate output from a cryptographically verified binary. 7. Apply the same verification controls to the generated Kaggle kernel. 8. Prefer an already installed, trusted package manager or a prebuilt image with a locked environment. ]]>
