CVE-2026-39963: Serendipity: Host Header Injection enables authentication cookie scoping to an attacker-controlled domain
Summary The serendipitysetCookie() function uses $SERVER['HTTPHOST'] without validation as the domain parameter of setcookie(). An attacker can force authentication cookies — including session tokens and auto-login tokens — to be scoped to an attacker-controlled domain, facilitating session hijacking.
Details In include/functionsconfig.inc.php:726: php function serendipitysetCookie($name, $value, $securebyprot = true, ...) { $host = $SERVER['HTTPHOST']; // ← attacker-controlled, no validation
if ($securebyprot) { if ($pos = strpos($host, ":")) { $host = substr($host, 0, $pos); // strips port only } }
setcookie("serendipity[$name]", $value, [ 'domain' => $host, // ← poisoned domain 'httponly' => $httpOnly, 'samesite' => 'Strict' ]); }
This function is called during login with sensitive cookies: php // functionsconfig.inc.php:455-498 serendipitysetCookie('authorautologintoken', $rnd, true, false, true); serendipitysetCookie('authorusername', $user); serendipitysetCookie('authortoken', $hash);
If an attacker can influence the Host header at login time (e.g. via MITM, reverse proxy misconfiguration, or load balancer), authentication cookies are issued scoped to the attacker's domain instead of the legitimate one.
PoC bash curl -v -X POST \ -H "Host: attacker.com" \ -d "serendipity[user]=admin&serendipity[pass]=admin" \ http://[TARGET]/serendipityadmin.php 2>&1 | grep -i "set-cookie"
Expected output: http Set-Cookie: serendipity[authortoken]=; domain=attacker.com; HttpOnly
Impact - Session fixation — attacker pre-sets a cookie scoped to their domain, then tricks the victim into authenticating, inheriting the poisoned token - Token leakage — authorautologintoken scoped to wrong domain may be sent to attacker-controlled infrastructure - Privilege escalation — if admin logs in under a poisoned Host header, their admin token is compromised
Suggested Fix Validate HTTPHOST against the configured $serendipity['url'] before use: php function serendipitysetCookie($name, $value, ...) { global $serendipity; $configured = parseurl($serendipity['url'], PHPURLHOST); $host = pregreplace('/:[0-9]+$/', '', $SERVER['HTTPHOST']); $host = ($host === $configured) ? $host : $configured;
setcookie("serendipity[$name]", $value, [ 'domain' => $host, ... ]); }
Other sources
Serendipity is a PHP-powered weblog engine. In versions 2.6-beta2 and below, the serendipitysetCookie() function in include/functionsconfig.inc.php uses $SERVER['HTTPHOST'] without validation as the domain parameter of setcookie(). An attacker who can influence the Host header at login time, such as via MITM, reverse proxy misconfiguration, or load balancer manipulation, can force authentication cookies including session tokens and auto-login tokens to be scoped to an attacker-controlled domain. This enables session fixation, token leakage to attacker-controlled infrastructure, and privilege escalation if an admin logs in under a poisoned Host header. This issue has been fixed in version 2.6.0.
— MITRE
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2026-39963?
CVE-2026-39963 is considered a high severity vulnerability due to its potential to allow attackers to hijack user sessions.
How do I fix CVE-2026-39963?
To fix CVE-2026-39963, upgrade to Serendipity version 2.6.0 or later where the vulnerability is patched.
What kind of attack can CVE-2026-39963 facilitate?
CVE-2026-39963 can facilitate session hijacking attacks by allowing an attacker to manipulate cookies sent to an attacker-controlled domain.
Which software is affected by CVE-2026-39963?
CVE-2026-39963 affects versions of the Serendipity blogging software prior to version 2.6.0.
What function is responsible for the vulnerability in CVE-2026-39963?
The vulnerability in CVE-2026-39963 originates from the `serendipity_setCookie()` function using `$_SERVER['HTTP_HOST']` without proper validation.