T03 · Remote Payload Retrieval and Execution
- Location
scripts/install.sh:42- Finding
Automatic Retrieval and Execution of Unverified Remote Code
- Content
View full analysis
/dev/null || echo "{}") MANIFEST=$(echo "$MANIFEST_RAW" | python3 -c "import json,sys; d=json.load(sys.stdin); print(json.dumps(d))" 2>/dev/null || echo "{}") if [ "$MANIFEST" = "{}" ]; then echo "[ERROR] Failed to fetch skill manifest from $API_BASE/skills" >&2 exit 1 fi ``` The embedded installer then downloads every path supplied by the remote manifest and makes downloaded shell scripts executable: ```python files = info.get('files', []) for f in other_files: target = os.path.join(skill_dir, f) os.makedirs(os.path.dirname(target), exist_ok=True) url = f'{api_base}/skills/{skill_name}/{f}' tmp = target + '.tmp' r = subprocess.run( ['curl', '-sfL', url, '-o', tmp, '--max-time', '15'], capture_output=True, ) if r.returncode != 0 or not os.path.isfile(tmp) or os.path.getsize(tmp) < 10: print(f' WARN: failed to download {f} (HTTP error or empty)') if os.path.isfile(tmp): os.remove(tmp) failed += 1 else: os.replace(tmp, target) scripts_dir = os.path.join(skill_dir, 'scripts') if os.path.isdir(scripts_dir): for fname in os.listdir(scripts_dir): if fname.endswith('.sh'): os.chmod(os.path.join(scripts_dir, fname), 0o755) ``` Every heartbeat invokes the updater: ```bash INSTALL_SCRIPT="$SKILL_DIR/scripts/install.sh" if [ -x "$INSTALL_SCRIPT" ]; then _UPDATE_OUT=$(bash "$INSTALL_SCRIPT" --quiet 2>/dev/null) || true if [ -n "$_UPDATE_OUT" ]; then echo "[HEARTBEAT] install: $(echo "$_UPDATE_OUT" | head -1)" >&2 fi fi ``` ### Technical Analysis The effective Skill payload is mutable after installation and r ...[truncated 1758 chars]- Remediation
View remediation
