T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/upload_video_file.sh:63
- Finding
- API Credentials Exposed Through Process Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/upload_video_file.sh:63-70, 94-101, 108-112, 120-123`; the same header construction is used throughout the API scripts, including `scripts/analytic_data.sh:47-58, 81-106`, `scripts/create_livestream_key.sh:14-17`, `scripts/get_aggregate_metric.sh:34-57`, `scripts/get_balance.sh:14-16`, `scripts/get_breakdown_metric.sh:35-87`, `scripts/get_media_list.sh:35-37`, `scripts/get_total_media.sh:30-34`, `scripts/get_usage_data.sh:29-31`, `scripts/get_video_list.sh:13-17`, and `scripts/get_video_url_by_name.sh:14-18`. **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Medium ### Vulnerable Code ```bash CREATE_RESPONSE=$(curl -s -X POST 'https://api.aiozstream.network/api/media/create' \ -H "stream-public-key: $PUBLIC_KEY" \ -H "stream-secret-key: $SECRET_KEY" \ -H 'Content-Type: application/json' \ -d "{ \"title\": \"$TITLE\", \"type\": \"video\" }") ``` The upload request repeats the same pattern: ```bash UPLOAD_RESPONSE=$(curl -s -X POST "https://api.aiozstream.network/api/media/$VIDEO_ID/part" \ -H "stream-public-key: $PUBLIC_KEY" \ -H "stream-secret-key: $SECRET_KEY" \ -H "Content-Range: bytes 0-$END_POS/$FILE_SIZE" \ -F "file=@$WORK_FILE" \ -F "index=0" \ -F "hash=$HASH") ``` ### Technical Analysis The scripts correctly obtain credentials from environment variables and send them only to the declared AIOZ Stream HTTPS endpoint. Credential transmission is required for the Skill's legitimate functionality. However, interpolating the secret into a `curl -H` argument places the complete header in the curl process argument vector. Depending on the operating system's process-inspection policy, other local users, privileged monitoring software, process telemetry, or debugging tools may be able to observe the command line while curl is running. The issue is repeated across all API operations. Consequently, frequent analytics request ...[truncated 1462 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Avoid placing sensitive header values directly in process arguments. - Provide headers through a protected temporary curl configuration file or standard input where supported. - If a temporary configuration is necessary: 1. Create it with `mktemp`. 2. Set a restrictive `umask`, such as `umask 077`, before creation. 3. Register a `trap` to remove it on normal exit and signals. 4. Never print its contents or path in verbose logs. - Disable shell tracing around credential handling and ensure callers do not run these scripts under `set -x`. - Prefer short-lived, narrowly scoped API tokens if AIOZ Stream supports them. - Restrict local process inspection through operating-system controls where practical. - Redact authentication headers from process telemetry, monitoring agents, and debugging output. ]]>
