Summary
Yu AI Code Mother's static resource interface does not safely constrain user-controlled paths to the configured preview directory. An unauthenticated attacker may use path traversal sequences to read files outside that directory when the vulnerable endpoint is accessible.
Affected context
The vulnerability occurs in Yu AI Code Mother v4.3's /api/static/{deployKey}/ interface when a request-controlled path is appended to the preview root without canonicalization or containment checks. Deployments are most exposed when this endpoint is reachable by anonymous users and the preview process has read access to sensitive files.
Exploit preconditions
- Attack surface: The HTTP static resource interface at
/api/static/{deployKey}/ - Required access: No authentication, when the endpoint is publicly reachable
- Trigger point: Processing a user-controlled resource path
- Why exploitation is possible: The supplied path is concatenated with the preview root without normalization and verification that the resolved path remains within the intended directory
Why this happens
The underlying bug is an incomplete path containment implementation. User-controlled path components are combined with a trusted directory before canonicalization and boundary validation, allowing traversal elements to resolve outside the permitted root. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.
Potential impact
- Attackers may read application configuration files
- Sensitive credentials, tokens, or private keys could be exposed
- Source code or deployment metadata may be disclosed
- Exposed information could enable further compromise of connected systems
- Confidentiality of files accessible to the service account may be reduced
General mitigation guidance
Mitigation generally focuses on enforcing a strong filesystem containment boundary for every static-resource request.
Common defensive patterns include:
- Resolve and canonicalize the requested path before access
- Verify that the resolved path remains beneath the intended preview root using a boundary-aware comparison
- Prefer allowlisted resource identifiers or framework-managed static file serving over direct path concatenation
- Reject traversal markers, encoded separators, absolute paths, and ambiguous path forms as defense-in-depth
- Run the service with the least filesystem privileges required
- Keep sensitive files outside directories exposed to static-resource handlers
- Apply authentication and network access controls where anonymous preview access is unnecessary
How teams detect issues like this
Organizations can look for path traversal risks through:
- Static analysis rules identifying direct concatenation of request paths with filesystem locations
- Code review checks for canonicalization followed by directory-boundary validation
- Tests using encoded, mixed-separator, absolute, and traversal-style path representations
- Web application firewall or gateway policies that detect traversal indicators
- Access-log monitoring for unusual requests to static endpoints and repeated file-read probing
- Automated security review tools that flag filesystem access using untrusted path input

