hermes-control-interface icon indicating copy to clipboard operation
hermes-control-interface copied to clipboard

[BUG] Path Traversal Vulnerability in Profile Names

Open stamandster opened this issue 7 months ago • 1 comments

Vulnerability Description The sanitizeProfileName() function used to sanitize profile names before passing them to Hermes CLI commands was insufficient. It only removed whitespace but did not prevent path traversal attacks using .. sequences.

Affected Code Location
/mnt/c/Users/chris/hermes-control-interface/server.js — the sanitizeProfileName() function used throughout profile-related endpoints

Risk Assessment
- Severity: Critical
- Impact: An authenticated admin could use a crafted profile name like ../../etc to write to arbitrary locations on the filesystem
- Attack Vector: POST requests to any endpoint accepting a profile parameter (e.g., /api/skills/install, /api/skills/uninstall, profile management endpoints)

Original Vulnerable Code
javascript
function sanitizeProfileName(name) {
  return String(name).replace(/\s+/g, '').slice(0, 64);
}


Fix Applied
Added validation to reject profile names containing path traversal sequences:
javascript
function sanitizeProfileName(name) {
  const sanitized = String(name).replace(/\s+/g, '').slice(0, 64);
  // Prevent path traversal attacks
  if (sanitized.includes('..') || sanitized.includes('/') || sanitized.includes('\\')) {
    return '';
  }
  return sanitized;
}

stamandster avatar Apr 23 '26 14:04 stamandster

✅ Already fixed in v3.4.0

This issue was resolved in v3.4.0 but the issue was never closed. Confirming closure in v3.4.0 with the v3.5.0 release.

Release: https://github.com/xaspx/hermes-control-interface/releases/tag/v3.5.0

xaspx avatar Apr 27 '26 11:04 xaspx