Advisory

GHSA-p3h2-2j4p-p83g

Details, part 2 of 2. The advisory

Details

3. Conclusion
True Positive

Key evidence:

  • manifest.name flows directly into finalExtractDir and is used by fs.mkdirSync and fs.renameSync without sanitization (src/controllers/mcpbController.ts:106-116).
  • manifest.name is parsed from manifest.json inside an uploaded archive, with only a non‑empty check (src/controllers/mcpbController.ts:89-97).
  • The /mcpb/upload endpoint exposes the upload handler that processes user‑supplied archives (src/routes/index.ts:297-299).

4. Remediation Recommendations

  • Add normalization and base directory validation before using manifest.name to construct finalExtractDir (e.g., const resolved = path.resolve(baseDir, server-${safeName}); if (!resolved.startsWith(baseDir)) reject;).
  • Use path.basename() to strip directory components from manifest.name and enforce a strict character allow‑list (alphanumeric, _, -, .) before use.
  • Consider rejecting any manifest.name that contains path separators or traversal sequences, and add unit tests for malicious traversal inputs.

Sources & licences