T09 · Insecure Skill Coding Practices
- Location
usage_example.py:29- Finding
Local File Path Disclosure Through Multipart Filename
- Content
View full analysis
Vulnerability Details
File Location:
usage_example.py, lines 29-32
Vulnerability Type: Local path information disclosure
Risk Level: LowVulnerable Code:
python with open(image_path, 'rb') as f: files = {'file': (image_path, f, 'image/jpeg')} print(f"Uploading image to the OpenClaw Gateway...") response = requests.post(target_url, files=files, headers=headers, timeout=60)Technical Analysis
The caller-controlled
image_pathis used both to open the local image and as the filename in the multipart upload. Therequestslibrary includes the supplied filename in the multipartContent-Dispositionmetadata.If
image_pathis an absolute path or contains directory components, this may disclose local environment information to the remote OpenClaw API, including usernames, directory structures, project names, mount points, or organizational naming conventions. The remote service only requires the image contents and does not need the complete local path.Attack Path
- A caller invokes
call_coral_ai_skill()with a path such as/home/alice/confidential-project/reef.jpg. - The function opens the image locally.
- The complete path is assigned as the multipart filename.
requests.post()transmits this filename in the multipart request metadata.- The remote API or its request logs receive and may retain the local path.
Impact Assessment
Exploitation does not grant additional privileges or code execution. It can disclose low-sensitivity workstation or server metadata to the configured remote service. This information may support reconnaissance by revealing usernames, project identifiers, filesystem organization, or deployment details. The scope is limited to path information supplied through
image_path.- A caller invokes
- Remediation
View remediation
Remediation Suggestions
Use only a sanitized basename as the multipart filename, or use a fixed generic filename:
python import os with open(image_path, "rb") as f: upload_name = os.path.basename(image_path) files = {"file": (upload_name, f, "image/jpeg")} response = requests.post( target_url, files=files, headers=headers, timeout=60, )For stronger metadata minimization, use a constant such as
upload.jpg. Validate that the source path refers to an expected regular file before opening it.
