T09 · Insecure Skill Coding Practices
- Location
skill-scripts/send_feishu_music.py:181- Finding
Unrestricted Local File Disclosure Through Cover Audio Upload
- Content
View full analysis
Vulnerability Details
File Location:
skill-scripts/send_feishu_music.py, lines 181–184; transmitted bygenerate_music()at line 92
Vulnerability Type: Unrestricted local file read and external transmission
Risk Level: HighVulnerable Code
python cover_audio_b64 = None if args.cover: with open(os.path.expanduser(args.cover), 'rb') as f: cover_audio_b64 = base64.b64encode(f.read()).decode('utf-8') print(f"Using cover mode with reference audio: {args.cover}", file=sys.stderr)The resulting value is included in the MiniMax request:
python "audio_base64": cover_audio_base64,Technical Analysis
The
--coverargument accepts an arbitrary filesystem path. The script expands the user directory marker and reads the complete file without verifying that the path:- Resides in an approved audio directory.
- Refers to a regular file rather than a symlink or special file.
- Contains supported audio data.
- Meets a reasonable size limit.
- Was explicitly approved for upload.
The entire file is Base64-encoded and inserted into a request sent to
https://api.minimaxi.com/v1/music_generation. Base64 is a transport encoding and provides no confidentiality or access control.Uploading a user-selected reference audio file is necessary for the documented cover-generation feature. However, unrestricted access to every file readable by the process exceeds the minimum privileges needed for that feature and creates a local-file disclosure channel.
Attack Path
- An attacker or untrusted instruction gains influence over the arguments used to invoke the Skill.
- The attacker supplies a sensitive readable path through
--cover, such as an application configuration, credential file, or private document. - The script opens and reads the entire target file using the privileges of the OpenClaw process.
- The file content is Base64-encoded.
generate_music()places the encoded content in theaudio_base64request ...[truncated 780 chars]
- Remediation
View remediation
Remediation Suggestions
- Canonicalize the supplied path with
Path.resolve()before opening it. - Restrict reference files to a dedicated, trusted audio directory and verify that the resolved path remains beneath that directory.
- Reject absolute paths, traversal components, symlinks, device files, pipes, sockets, and other non-regular files.
- Validate the file using content-based audio inspection rather than relying only on its extension.
- Allowlist supported formats and enforce a strict maximum file size before reading the file into memory.
- Open files defensively, including protection against symlink and time-of-check/time-of-use attacks where supported.
- Require explicit user confirmation before uploading any file outside the expected workspace.
- Document clearly that the selected reference audio is transmitted to MiniMax.
- Consider accepting a previously approved media object rather than a raw local filesystem path.
- Canonicalize the supplied path with
