CVE-2026-39963: S9y/serendipity Serendipity Has A Host Header Vulnerability

MODERATE
Advisory Identifier: GHSA-4m6c-649p-f6gf
CVSS 6.9
CWE-565
Published
Advisory Summary

CVE-2026-39963 is a MODERATE (CVSS 6.9) serendipity has a host header vulnerability (CWE-565: Reliance on Cookies without Validation and Integrity Checking) affecting S9y/serendipity libraries in the Packagist ecosystem. The issue involves serendipity has a host header injection allows authentication cookie scoping to attacker-controlled domain in functions_config.inc.php. Remediation is available by upgrading affected packages to version 2.6.0.

CVE-2026-39963 at a Glance

CVE Identifier CVE-2026-39963
GHSA Identifier GHSA-4m6c-649p-f6gf
Severity MODERATE
CVSS v3.1 Base Score 6.9
CWE Classification CWE-565: Reliance on Cookies without Validation and Integrity Checking
Affected Product S9y/serendipity
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 6.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-39963

To remediate this vulnerability, upgrade all affected S9y/serendipity dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

s9y/serendipity fixed: 2.6.0
Upgrade s9y/serendipity to 2.6.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for s9y/serendipity

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-39963, inspect your project dependencies for S9y/serendipity:

inspect dependencies for s9y/serendipity

Analyze the terminal output to locate any version of S9y/serendipity in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.6.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-565: Reliance on Cookies without Validation and Integrity Checking, where the product relies on the existence or values of cookies when performing security-critical operations, but it does not properly ensure that the setting is valid for the associated user. In S9y/serendipity, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The `serendipity_setCookie()` function uses `$_SERVER['HTTP_HOST']` 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/functions_config.inc.php:726`: ```php function serendipity_setCookie($name, $value, $securebyprot = true, ...) { $host = $_SERVER['HTTP_HOST']; // ← 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 // functions_config.inc.php:455-498 serendipity_setCookie('author_autologintoken', $rnd, true, false, true); serendipity_setCookie('author_username', $user); serendipity_setCookie('author_token', $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]/serendipity_admin.php 2>&1 | grep -i "set-cookie" ``` Expected output: ```http Set-Cookie: serendipity[author_token]=; 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** — `author_autologintoken` 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 `HTTP_HOST` against the configured `$serendipity['url']` before use: ```php function serendipity_setCookie($name, $value, ...) { global $serendipity; $configured = parse_url($serendipity['url'], PHP_URL_HOST); $host = preg_replace('/:[0-9]+$/', '', $_SERVER['HTTP_HOST']); $host = ($host === $configured) ? $host : $configured; setcookie("serendipity[$name]", $value, [ 'domain' => $host, ... ]); } ```

CVE-2026-39963 Affected S9y/serendipity Versions

1 component(s)
Fixed Versions:
2.6.0
Product / Package Ecosystem Affected Versions Fixed Version
s9y/serendipity
Packagist
< 2.6.0
2.6.0

References

Frequently Asked Questions

What is CVE-2026-39963?
CVE-2026-39963 is a security vulnerability in S9y/serendipity involving Serendipity has a Host Header Injection allows authentication cookie scoping to attacker-controlled domain in functions_config.inc.php under CWE-565: Reliance on Cookies without Validation and Integrity Checking.
Which S9y/serendipity versions are affected?
Affected versions include releases prior to 2.6.0 across affected packages: s9y/serendipity.
What version fixes CVE-2026-39963?
Upgrading to 2.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is s9y/serendipity affected?
Yes, s9y/serendipity is affected in releases prior to 2.6.0. Upgrade your dependency to 2.6.0 or later.
What is the CVSS score of CVE-2026-39963?
CVE-2026-39963 has a CVSS v3.1 base score of 6.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:L/A:N.
What CWE is associated with CVE-2026-39963?
CVE-2026-39963 is classified under CWE-565: Reliance on Cookies without Validation and Integrity Checking (The product relies on the existence or values of cookies when performing security-critical operations, but it does not properly ensure that the setting is valid for the associated user.).
How can I check Packagist dependencies for CVE-2026-39963?
Run the dependency tree command: 'inspect dependencies for s9y/serendipity'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4m6c-649p-f6gf",
  "modified" : "2026-04-15T21:14:19Z",
  "published" : "2026-04-14T22:32:29Z",
  "aliases" : [ "CVE-2026-39963" ],
  "summary" : "Serendipity has a Host Header Injection allows authentication cookie scoping to attacker-controlled domain in functions_config.inc.php",
  "details" : "### Summary\nThe `serendipity_setCookie()` function uses `$_SERVER['HTTP_HOST']` 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.\n\n### Details\nIn `include/functions_config.inc.php:726`:\n```php\nfunction serendipity_setCookie($name, $value, $securebyprot = true, ...) {\n    $host = $_SERVER['HTTP_HOST']; // ← attacker-controlled, no validation\n\n    if ($securebyprot) {\n        if ($pos = strpos($host, \":\")) {\n            $host = substr($host, 0, $pos); // strips port only\n        }\n    }\n\n    setcookie(\"serendipity[$name]\", $value, [\n        'domain'   => $host,   // ← poisoned domain\n        'httponly' => $httpOnly,\n        'samesite' => 'Strict'\n    ]);\n}\n```\n\nThis function is called during login with sensitive cookies:\n```php\n// functions_config.inc.php:455-498\nserendipity_setCookie('author_autologintoken', $rnd, true, false, true);\nserendipity_setCookie('author_username', $user);\nserendipity_setCookie('author_token', $hash);\n```\n\nIf 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.\n\n### PoC\n```bash\ncurl -v -X POST \\\n  -H \"Host: attacker.com\" \\\n  -d \"serendipity[user]=admin&serendipity[pass]=admin\" \\\n  http://[TARGET]/serendipity_admin.php 2>&1 | grep -i \"set-cookie\"\n```\n\nExpected output:\n```http\nSet-Cookie: serendipity[author_token]=; domain=attacker.com; HttpOnly\n```\n\n### Impact\n- **Session fixation** — attacker pre-sets a cookie scoped to their domain, then tricks the victim into authenticating, inheriting the poisoned token\n- **Token leakage** — `author_autologintoken` scoped to wrong domain may be sent to attacker-controlled infrastructure\n- **Privilege escalation** — if admin logs in under a poisoned Host header, their admin token is compromised\n\n### Suggested Fix\nValidate `HTTP_HOST` against the configured `$serendipity['url']` before use:\n```php\nfunction serendipity_setCookie($name, $value, ...) {\n    global $serendipity;\n    $configured = parse_url($serendipity['url'], PHP_URL_HOST);\n    $host = preg_replace('/:[0-9]+$/', '', $_SERVER['HTTP_HOST']);\n    $host = ($host === $configured) ? $host : $configured;\n\n    setcookie(\"serendipity[$name]\", $value, [\n        'domain' => $host,\n        ...\n    ]);\n}\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "s9y/serendipity"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.6.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/s9y/Serendipity/security/advisories/GHSA-4m6c-649p-f6gf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-39963"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/s9y/Serendipity"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/s9y/Serendipity/releases/tag/2.6.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-565" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-14T22:32:29Z",
    "nvd_published_at" : "2026-04-15T04:17:39Z"
  }
}