hermes-control-interface
hermes-control-interface copied to clipboard
[BUG] CSRF Protection on State-Changing Endpoints
Vulnerability Description State-changing endpoints (POST, PUT, DELETE) lacked CSRF protection, allowing attackers to trick authenticated users into performing unintended actions.
Affected Code Location
All mutating API endpoints in server.js
Risk Assessment
- Severity: High
- Impact: Cross-site request forgery attacks could modify data, delete sessions, install skills, or change settings
Fix Applied (v3.3.0)
Added CSRF token validation middleware (requireCsrf) to all state-changing endpoints:
javascript
// CSRF middleware
function requireCsrf(req, res, next) {
const token = req.headers['x-csrf-token'] || req.body?._csrf;
if (!token || token !== req.session?.csrfToken) {
return res.status(403).json({ error: 'CSRF token invalid or missing' });
}
next();
}
✅ 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