Skip to main content

PHP CVE-2026-39963

MEDIUM
Reliance on Cookies without Validation and Integrity Checking (CWE-565)
2026-04-14 https://github.com/s9y/Serendipity GHSA-4m6c-649p-f6gf
6.9
CVSS 3.1 · Vendor: https://github.com/s9y/Serendipity
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Intercept login request traffic
  2. Delivery
    Inject attacker.com Host header
  3. Exploit
    Trigger serendipity_setCookie() with poisoned domain
  4. Install
    Set-Cookie issued with domain=attacker.com
  5. C2
    Admin credentials cached to wrong domain scope
  6. Execute
    Attacker retrieves authentication token
  7. Impact
    Session hijacking achieved

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A08:2025 - Software or Data Integrity Failures
ASVS 5.0
V3 - Web Frontend Security Cookie integrity validation
Impact

CVSS 6.9 (AV:N/AC:H/PR:N/UI:R/S:C) with changed scope reflects moderate-to-high impact but higher attack complexity and user interaction requirement. Exploitation probability (EPSS 6.9) aligns with the CVSS assessment. The AC:H (high complexity) factor reflects the need for attacker control over the HTTP Host header, which requires MITM, reverse proxy misconfiguration, or load balancer compromise-realistic but not trivial in properly configured environments. UI:R (user interaction required) mandates that the victim must authenticate during the attack window, further reducing real-world exploitation likelihood in automated attack scenarios. However, the S:C (scope changed) and high confidentiality impact (C:H) indicate that successful exploitation compromises authentication boundaries and grants access to privileged accounts (admin tokens), making this a real priority for Serendipity deployments in untrusted networks or behind misconfigured reverse proxies. The existence of proof-of-concept code elevates practical risk slightly. Overall assessment: medium-priority vulnerability requiring patching in production environments, especially those accepting requests from untrusted upstream proxies or operating in shared hosting/CDN scenarios where Host header control is easier.

Exploit ScenarioDerived

An attacker positioned as a man-in-the-middle (or controlling a misconfigured reverse proxy) intercepts a Serendipity administrator's login request and injects Host: attacker.com into the HTTP headers. The serendipity_setCookie() function uses this poisoned Host header to set the author_token cookie with domain=attacker.com instead of the legitimate domain. When the administrator's browser sends subsequent requests to attacker.com, it automatically includes the stolen authentication token, granting the attacker authenticated access to the Serendipity admin panel. A proof-of-concept curl command demonstrates the vulnerability by triggering cookie domain poisoning via a POST to serendipity_admin.php with a crafted Host header.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Apr 15, 2026

Serendipity's serendipity_setCookie() function accepts unsanitized HTTP_HOST header values as the cookie domain parameter, allowing remote attackers to scope authentication cookies (session tokens, auto-login tokens) to attacker-controlled domains and facilitate session hijacking. The vulnerability requires user interaction (victim authentication during poisoned Host header) and man-in-the-middle or reverse proxy misconfiguration to exploit, affecting all versions of Serendipity that use the vulnerable function. A proof-of-concept demonstrating cookie domain poisoning exists; exploitation probability is moderate (EPSS 6.9, CVSS AC:H reflects attack complexity), and no evidence of active exploitation has been identified.

RemediationAI

Validate the HTTP_HOST header against the configured serendipity['url'] before using it as a cookie domain. The vendor-suggested fix (referenced in the CVE description) implements hostname parsing and comparison: extract the configured hostname using parse_url($serendipity['url'], PHP_URL_HOST), sanitize the HTTP_HOST header with preg_replace('/:[0-9]+$/', '', ...) to strip port numbers, and use the configured hostname if the request's Host header does not match. Apply the patch provided in the GitHub security advisory (https://github.com/advisories/GHSA-4m6c-649p-f6gf). Alternatively, implement a Content Security Policy and configure reverse proxies to validate and normalize Host headers before forwarding requests to Serendipity. Monitor for signs of session hijacking by reviewing cookie domains in browser developer tools and server logs for mismatched Host headers.

Affected Packages

composer s9y/serendipity fix: 2.6.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in composer

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Serendipity is a lightweight PHP blog engine. The vulnerability resides in the serendipity_setCookie() function (include/functions_config.inc.php:726), which directly uses the HTTP_HOST server variable-attacker-controllable in HTTP requests-as the domain parameter to PHP's setcookie() function without validation against the configured server hostname. The root cause (CWE-565: Reliance on Cookies without Validation and Integrity Checking) stems from trusting untrusted input (HTTP_HOST header) for security-critical cookie scope decisions. While the code does strip port numbers when securebyprot=true, this defensive measure is insufficient because the hostname itself remains unvalidated. The function sets cookies with httponly and samesite=Strict flags, which provide some mitigation, but the domain poisoning bypasses the intended audience of the cookie. Affected product: Serendipity (pkg:composer/s9y_serendipity) in versions prior to patching.

Know when PHP gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/s9y/Serendipity) PRIMARY 6.9 MEDIUM
AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:L/A:N

Primary rating from Vendor (https://github.com/s9y/Serendipity) · only source for this CVE.

CVSS VectorVendor: https://github.com/s9y/Serendipity

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
Low
Availability
None

Lifecycle Timeline

2
Patch released
Apr 15, 2026 - 02:30 nvd
Patch available
CVE Published
Apr 14, 2026 - 22:32 nvd
MEDIUM 6.9

DescriptionCVE.org

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,
        ...
    ]);
}

Threat Intelligence Overview

EPSS Score
0.0%
Top 87% exploitable
Threat Intel
1
1 source
Social Media
1
Sightings
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS Vulnrichment GHSA CIRCL GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

34
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +34
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Privilege escalation occurs when an attacker leverages flaws in access control mechanisms to gain permissions beyond what they were originally granted.

Affected Products (CPE)CVE.org

pkg:composer/s9y_serendipity

More in PHP

View all
CVE-2019-11043 CRITICAL POC
9.8 Oct 28

In PHP versions 7.1.x below 7.1.33, 7.2.x below 7.2.24 and 7.3.x below 7.3.11 in certain configurations of FPM setup it

CVE-2012-1823 CRITICAL POC
9.8 May 11

sapi/cgi/cgi_main.c in PHP before 5.3.12 and 5.4.x before 5.4.2, when configured as a CGI script (aka php-cgi), does not

CVE-2016-1555 CRITICAL POC
9.8 Apr 21

(1) boardData102.php, (2) boardData103.php, (3) boardDataJP.php, (4) boardDataNA.php, and (5) boardDataWW.php in Netgear

CVE-2018-11138 CRITICAL POC
9.8 May 31

The '/common/download_agent_installer.php' script in the Quest KACE System Management Appliance 8.0.318 is accessible by

CVE-2024-11680 CRITICAL POC
9.8 Nov 26

ProjectSend versions prior to r1720 are affected by an improper authentication vulnerability. Rated critical severity (C

CVE-2025-49113 CRITICAL POC
9.9 Jun 02

Roundcube Webmail contains a critical PHP object deserialization vulnerability (CVE-2025-49113, CVSS 9.9) that allows au

CVE-2017-9841 CRITICAL POC
9.8 Jun 27

Util/PHP/eval-stdin.php in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP c

CVE-2025-0108 HIGH POC
8.8 Feb 12

Palo Alto Networks PAN-OS management web interface contains an authentication bypass allowing unauthenticated attackers

CVE-2021-25298 HIGH POC
8.8 Feb 15

Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re

CVE-2021-25296 HIGH POC
8.8 Feb 15

Nagios XI version xi-5.7.5 is affected by OS command injection. Rated high severity (CVSS 8.8), this vulnerability is re

CVE-2013-4983 CRITICAL POC
10.0 Sep 10

The get_referers function in /opt/ws/bin/sblistpack in Sophos Web Appliance before 3.7.9.1 and 3.8 before 3.8.1.1 allows

CVE-2023-6553 CRITICAL POC
9.8 Dec 15

The Backup Migration plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 1

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy