Summary
TinyAGI 0.0.20 contains a file inclusion weakness in the collectFiles function used by its Message API Endpoint. A remote attacker may influence file selection or inclusion through the exposed API, potentially accessing unintended files when the endpoint processes attacker-controlled input.
Affected context
The issue occurs in TinyAGI 0.0.20 within packages/core/src/response.ts, where the collectFiles function handles files for the Message API Endpoint. Risk depends on the endpoint being reachable by an attacker and on externally influenced file names or paths being used without sufficiently restricting them to an intended directory or resource set.
Exploit preconditions
- Attack surface: Network-reachable Message API Endpoint
- Required access: Ability to send requests accepted by the endpoint; authentication requirements are deployment-dependent
- Trigger point: File collection or response processing through the
collectFilesfunction - Why exploitation is possible: Attacker-influenced file references may be used to select files outside the endpoint's intended resource boundary
Why this happens
The underlying weakness is improper control of externally influenced file names or paths. When application logic uses request-derived values to locate or include files without strict allowlisting, canonicalization, and boundary enforcement, an attacker may cause access to unintended filesystem resources.
This behavior maps to CWE-73: External Control of File Name or Path, which covers cases where external input controls a file name or path used by the application.
Potential impact
- An attacker may read unintended files available to the service process
- Sensitive configuration, application, or environment data could be exposed
- File contents could be returned through API responses
- The service could experience information disclosure or follow-on compromise
- Shared-host or container data may be exposed if filesystem permissions allow it
General mitigation guidance
Mitigation generally focuses on removing direct trust in client-supplied file paths and enforcing a narrow resource boundary.
Common defensive patterns include:
- Resolve requested resources from server-side identifiers rather than arbitrary paths
- Apply strict allowlists for permitted files and extensions
- Canonicalize paths and verify that resolved paths remain within an approved directory
- Reject traversal markers, absolute paths, symbolic-link escapes, and unexpected path formats
- Prefer secure-by-default APIs that select from predefined resources
- Run the service with least-privilege filesystem permissions
- Avoid returning raw filesystem errors or contents that reveal sensitive details
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis rules that trace request parameters into file-system APIs
- Code review checks for path concatenation, file inclusion, and missing canonicalization
- Tests covering traversal attempts, absolute paths, symbolic links, and unauthorized extensions
- Runtime monitoring for unusual file access by the service process
- Policy enforcement requiring allowlisted resource identifiers for API-driven file access
Automated security review tools may help identify externally controlled path flows, but findings should be validated against deployment-specific filesystem permissions and routing behavior.

