T09 · Insecure Skill Coding Practices
- Location
Scripts/index.js:39- Finding
Absolute Local File Path Disclosure to a Configurable Plaintext HTTP Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
Scripts/index.js, lines 39-59
Vulnerability Type: Local path information disclosure over an unencrypted and configurable network connection
Risk Level: MediumVulnerable Code
javascript const OCR_HOST = process.env.DEEPSEEK_OCR_HOST || "127.0.0.1"; const OCR_PORT = process.env.DEEPSEEK_OCR_PORT || 8001; const payload = JSON.stringify({ image: absolutePath }); const options = { hostname: OCR_HOST, port: OCR_PORT, path: "/ocr", method: "POST", headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(payload) }, timeout: 120000 }; const req = http.request(options, (res) => {Technical Analysis
The CLI resolves the user-supplied image path to an absolute filesystem path and transmits that path in a JSON request. The destination host and port can be changed through the
DEEPSEEK_OCR_HOSTandDEEPSEEK_OCR_PORTenvironment variables.The request uses Node.js
http.request, so no TLS encryption or endpoint authentication is provided. If the host is configured as a remote server, the absolute path may cross the local trust boundary in plaintext. Absolute paths can reveal usernames, home-directory layouts, mounted volumes, project names, customer identifiers, and sensitive filenames.The implementation sends only the path and not the image contents. Consequently, a remote OCR service normally cannot access the image unless it shares the same filesystem. This limits direct exposure to path metadata but also makes the documented OCR operation unreliable outside a shared local environment.
Attack Path
- An attacker or compromised execution environment gains influence over
DEEPSEEK_OCR_HOSTand, if needed,DEEPSEEK_OCR_PORT. - The endpoint is changed to an HTTP server controlled by the attacker.
- A user or agent invokes the CLI with
--imagereferencing a local image.
...[truncated 1046 chars]
- An attacker or compromised execution environment gains influence over
- Remediation
View remediation
Remediation Suggestions
- Keep the OCR endpoint restricted to loopback unless remote operation is explicitly required.
- Reject non-loopback destinations by default and use an explicit host allowlist for approved remote services.
- Require HTTPS for every remote endpoint and validate its certificate. Do not allow silent fallback to plaintext HTTP.
- Read and transmit validated image bytes rather than exposing an absolute local path. Enforce permitted image formats and strict file-size limits before upload.
- If a shared-filesystem service is intentionally required, pass a normalized identifier or an approved path relative to a narrowly scoped image directory instead of an unrestricted absolute path.
- Authenticate the OCR service and validate that responses originate from the intended endpoint.
- Document the network transfer, destination configuration, and data-handling behavior so users can provide informed consent.
- Treat environment variables as untrusted configuration in managed or multi-tenant execution environments and prevent unauthorized parties from changing the endpoint.
