Skip to content

[BUG] Security: Path Traversal File Read Vulnerability in creative-ad-agent-server of Creative Ad Agent #1

Description

@BruceJqs

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

  1. Start the affected server
cd server
npm install
touch ../.env
npm start
  1. 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'
  1. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions