Versions 0.2.1 and 0.3.0 of client-certificate-auth contain an open redirect vulnerability. The middleware unconditionally redirects HTTP requests to HTTPS using the unvalidated Host header, allowing an attacker to redirect users to arbitrary domains.
// lib/clientCertificateAuth.js (versions 0.2.1, 0.3.0)
if (!req.secure && req.header('x-forwarded-proto') != 'https') {
return res.redirect('https://' + req.header('host') + req.url);
}
http://vulnerable-app.example.com/loginHost: attacker.com302 Found → https://attacker.com/loginExploitation requires that HTTP traffic reaches the Node.js application without TLS termination setting x-forwarded-proto: https. This condition is uncommon in production deployments behind modern reverse proxies or load balancers, which limits real-world exploitability.
The vulnerable redirect behavior has been completely removed in version 1.0.0.
npm install client-certificate-auth@^1.0.0
If upgrading is not immediately possible:
x-forwarded-proto: httpsclientCertificateAuth to validate the Host header against an allowlist{
"github_reviewed": true,
"github_reviewed_at": "2026-02-06T18:54:33Z",
"cwe_ids": [
"CWE-601"
],
"severity": "MODERATE",
"nvd_published_at": "2026-02-06T19:16:09Z"
}