T09 · Insecure Skill Coding Practices
- Location
scripts/scan.py:73- Finding
Unrestricted archival and upload of sensitive files to configurable network endpoints
- Content
View full analysis
Vulnerability Details
File Location:
scripts/scan.py:73-78,scripts/scan.py:176-184,scripts/scan.py:226, andscripts/scan.py:316-324
Vulnerability Type: Unrestricted sensitive-data collection and network disclosure
Risk Level: HighVulnerable Code
python with zipfile.ZipFile(temp_zip.name, 'w', zipfile.ZIP_DEFLATED) as zipf: for root, dirs, files in os.walk(dir_path): for file in files: file_path = os.path.join(root, file) # Calculate relative path for the zip archive arcname = os.path.relpath(file_path, dir_path) zipf.write(file_path, arcname)python # Prepare multipart upload with open(file_to_upload, 'rb') as f: file_content = f.read() files = { 'File': (os.path.basename(file_to_upload), file_content, 'application/zip') } data = { 'Name': name, 'Description': description, 'IntegrateType': 'file', 'ScanNow': 'true' }python response = requests.post(self.upload_url, headers=v_request.headers, data=prepped.body)python base_url = os.environ.get("SCAN_BASE_URL", "") ak = os.environ.get("VOLC_ACCESS_KEY") or os.environ.get("VOLC_ACCESSKEY") or os.environ.get("SCAN_AK") sk = os.environ.get("VOLC_SECRET_KEY") or os.environ.get("VOLC_SECRETKEY") or os.environ.get("SCAN_SK") region = os.environ.get("VOLC_REGION", DEFAULT_REGION) host = os.environ.get("SCAN_SERVICE_HOST", DEFAULT_HOST) service = os.environ.get("VOLC_SERVICE", DEFAULT_SERVICE) session_token = os.environ.get("VOLC_SESSION_TOKEN", "") user_id = os.environ.get("VOLC_USERID", "")Technical Analysis
The directory-packaging routine recursively includes every file reachable through
os.walk()without applying exclusions, validating file types, checking for secrets, presenting a manifest, or imposing file-count and archive-size limits. The resulting archive is read in full and t ...[truncated 2778 chars]- Remediation
View remediation
Remediation Suggestions
- Default strictly to a loopback analysis service and require explicit, informed user consent before uploading any content to a remote service.
- Enforce HTTPS for every non-loopback endpoint. Reject plaintext remote URLs rather than relying on user configuration.
- Maintain an allowlist of trusted service origins and reject arbitrary
SCAN_BASE_URLandSCAN_SERVICE_HOSTvalues. - Build archives from an explicit allowlist of required source and metadata files rather than recursively including all files.
- Exclude sensitive and unnecessary content by default, including
.env*, private-key formats, credential files, VCS metadata, caches, build output, sockets, and symlinks. - Perform secret detection before packaging and stop the upload when likely credentials or private keys are found.
- Display the exact destination and a complete archive manifest, including total size, before remote transmission.
- Add configurable limits for individual file size, total archive size, recursion depth, and file count.
- Stream uploads instead of reading the complete archive into memory.
- Avoid forwarding signed authorization headers to any destination that has not passed strict origin validation.
- Update
SKILL.mdto disclose cloud and configurable remote-upload behavior accurately, including what files are collected and where they are sent. - Implement the documented
config.jsonbehavior securely or remove that claim from the documentation.
