hermes-control-interface
hermes-control-interface copied to clipboard
[BUG] XSS via escapeHtml Function
Vulnerability Description The escapeHtml() function used for sanitizing user input before rendering did not escape quote characters, allowing attribute-based XSS attacks.
Affected Code Location
server.js — the escapeHtml() utility function
Risk Assessment
- Severity: High
- Impact: Injection of malicious scripts into HTML pages viewed by other users
Original Vulnerable Code
javascript
function escapeHtml(str) {
return String(str)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
// Missing quote escaping!
;
}
Fix Applied (v3.3.0)
Added quote escaping to prevent attribute injection:
javascript
function escapeHtml(str) {
return String(str)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''')
;
}
✅ RESOLVED in v3.5.0
Fix applied: All 15+ error handler locations where e.message/err.message was rendered with innerHTML without escaping have been wrapped with escapeHtml().
Commit: 0da4883
This was part of the XSS hardening sprint alongside dead code removal (D1+D2). All error displays throughout the admin UI now properly escape HTML entities.
Release: https://github.com/xaspx/hermes-control-interface/releases/tag/v3.5.0