Describe the bug
A path traversal vulnerability (CWE-22) has been identified in the Creative Ad Agent SDK server, specifically within server/sdk-server.ts. The /images/:sessionId?/:filename endpoint accepts user-controlled route parameters and constructs a filesystem path without validating that the resolved path remains inside the intended generated-images directory. An attacker with network access to the server can supply encoded traversal sequences (e.g., %2e%2e/) to read arbitrary files accessible to the server process, including repository files or host system files such as /etc/hosts. Commit 751b9e5 is confirmed affected, and no fixed version is available at the time of reporting.
To Reproduce
- Start the affected server
cd server
npm install
touch ../.env
npm start
- Read a file outside the intended
generated-images directory
curl -i --path-as-is 'http://127.0.0.1:3001/images/%2e%2e/README.md'
- Read a host file
curl -i --path-as-is 'http://127.0.0.1:3001/images/%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2fetc/hosts'
Expected behavior
A clear and concise description of what you expected to happen.
Environment
- OS: MacOS
- Node.js version: 22.17.0
- Deployment: local
Describe the bug
A path traversal vulnerability (CWE-22) has been identified in the Creative Ad Agent SDK server, specifically within server/sdk-server.ts. The /images/:sessionId?/:filename endpoint accepts user-controlled route parameters and constructs a filesystem path without validating that the resolved path remains inside the intended generated-images directory. An attacker with network access to the server can supply encoded traversal sequences (e.g., %2e%2e/) to read arbitrary files accessible to the server process, including repository files or host system files such as /etc/hosts. Commit 751b9e5 is confirmed affected, and no fixed version is available at the time of reporting.
To Reproduce
cd server npm install touch ../.env npm startgenerated-imagesdirectorycurl -i --path-as-is 'http://127.0.0.1:3001/images/%2e%2e/README.md'curl -i --path-as-is 'http://127.0.0.1:3001/images/%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2fetc/hosts'Expected behavior
A clear and concise description of what you expected to happen.
Environment