T09 · Insecure Skill Coding Practices
- Location
scripts/suno.sh:133- Finding
Unrestricted URL Download and Arbitrary File Overwrite
- Content
View full analysis
Vulnerability Details
File Location:
scripts/suno.sh, lines 133-153
Vulnerability Type: Unvalidated URL retrieval and unrestricted output path
Risk Level: HighVulnerable Code
bash cmd_download() { local url="" out="" while [[ $# -gt 0 ]]; do case "$1" in --url) url="$2"; shift 2 ;; --out) out="$2"; shift 2 ;; *) shift ;; esac done [[ -z "$url" ]] && { echo '{"error": "Missing --url"}'; exit 1; } if [[ -z "$out" ]]; then local filename filename="suno-$(date +%Y%m%d-%H%M%S)-$(openssl rand -hex 4).mp3" out="$DOWNLOAD_DIR/$filename" fi curl -sfL "$url" -o "$out" 2>&1 echo "{\"downloaded\": \"$out\"}" }Technical Analysis
The
downloadcommand passes the user-controlled--urlvalue directly tocurland writes the response to the user-controlled--outpath. Neither value is validated.The URL is not restricted to HTTPS or to approved Suno/CDN hosts. Depending on the protocols supported by the installed
curlbuild, an attacker can use schemes such asfile://or request internal HTTP services. The-Loption also follows redirects without validating whether the final destination remains on an approved host.The output path is not canonicalized or restricted to
SUNO_DOWNLOAD_DIR. An absolute path, path traversal sequence, or symlink can therefore target any file writable by the invoking account.curl -owill overwrite an existing writable file.Shell command injection is not present in this code because the URL and output path are quoted. The vulnerability instead arises from excessive resource access granted through valid
curlfunctionality.Attack Path
- An attacker or untrusted instruction causes the skill to invoke the
downloadcommand with a crafted URL and destination. - For local file copying, the attacker supplies a readable local resource, such as `file:///path/t ...[truncated 1386 chars]
- An attacker or untrusted instruction causes the skill to invoke the
- Remediation
View remediation
Remediation Suggestions
- Accept only
https://URLs and reject all other schemes. - Allowlist the exact Suno and approved audio-CDN hostnames required by the feature.
- Resolve and validate destination addresses to block loopback, link-local, private, multicast, and cloud metadata ranges where they are not required.
- Disable redirects or validate every redirect target against the same scheme, hostname, and address restrictions.
- Do not accept arbitrary output paths. Accept only a filename and construct the destination beneath
SUNO_DOWNLOAD_DIR. - Canonicalize the destination and verify that it remains inside the approved directory.
- Reject traversal components, absolute paths, symlinks, non-regular files, and existing files.
- Create output files atomically with restrictive permissions and fail if the destination already exists.
- Apply response size and transfer time limits to reduce resource-exhaustion risk.
- Return JSON using
jqrather than string interpolation so unusual path characters cannot produce malformed output.
- Accept only
