CVE-2025-27794
Executive Summary
CVE-2025-27794 is a session hijacking vulnerability in Flarum, an open-source forum software, affecting versions prior to 1.8.10. The vulnerability arises from the lack of session token rotation after authentication, combined with the ability for an attacker-controlled subdomain to set cookies scoped to the parent domain. This allows an attacker to potentially hijack a user's session if they control a subdomain under the same parent domain (e.g., evil.host.com for community.host.com). The CVSS score is 6.8 (Medium), and while the EPSS score is 0.0%, indicating low exploitation likelihood, the theoretical risk remains. The patch in version 1.8.10 addresses the issue by implementing session token rotation post-authentication.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
Flarum is a PHP-based application distributed via Composer. The vulnerability is not in a dependency but in the core session handling logic. Users should ensure they are using the latest version from the official Flarum repository.
CVSS Breakdown & Threat Level
- CVSS Score: 6.8 (Medium)
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N
- Attack Vector (AV): Network (N) - The attack is performed over the network.
- Attack Complexity (AC): High (H) - The attack requires specific conditions (attacker-controlled subdomain, parent domain not on PSL).
- Privileges Required (PR): None (N) - No authentication needed to initiate the attack.
- User Interaction (UI): Required (R) - The victim must visit a malicious subdomain or be tricked.
- Scope (S): Unchanged (U) - The vulnerable component and the attacker's component are in the same security authority.
- Confidentiality (C): High (H) - Session tokens can be stolen, leading to account compromise.
- Integrity (I): High (H) - An attacker can perform actions as the victim.
- Availability (A): None (N) - No impact on availability.
Threat Level: Medium. The attack is complex and requires specific conditions, but if met, it can lead to full account takeover.
Deep Dive & Mechanics
The vulnerability exploits the way browsers handle cookies for subdomains. When a user visits evil.host.com, the attacker can set a cookie with the domain .host.com (the parent domain). If the user then visits community.host.com (the Flarum forum), the browser will send the attacker's cookie along with the request. Since Flarum does not rotate session tokens after authentication, the attacker can use their own session token to impersonate the victim.
Key Constraints:
- The attacker must control a subdomain under the same parent domain (e.g.,
evil.host.com). - The parent domain must not be on the Public Suffix List (PSL) (e.g.,
com,co.ukare on the PSL, soevil.host.comcannot set cookies for.com). - The victim must visit the attacker's subdomain before or during their session on the Flarum forum.
Why it's not easily exploitable: Modern browsers have security measures like SameSite cookies and cookie prefixes that mitigate this attack. However, the theoretical risk remains if these protections are bypassed or if the browser is misconfigured.
Vulnerable vs. Patched Code
Vulnerable Code (pre-1.8.10): In the session handling logic, the session token is generated once and never changed after authentication. This allows an attacker to set a pre-defined session token via a cookie from a sibling subdomain.
// Vulnerable: No session rotation after login
public function authenticate($credentials) {
$user = $this->findUser($credentials);
if ($user) {
$session = new Session();
$session->setUser($user);
// Token is not rotated
return $session;
}
}
Patched Code (1.8.10): The patch introduces session token rotation after authentication, ensuring that any pre-existing session tokens are invalidated.
// Patched: Session token rotated after login
public function authenticate($credentials) {
$user = $this->findUser($credentials);
if ($user) {
$session = new Session();
$session->setUser($user);
$session->regenerateToken(); // New token generated
return $session;
}
}
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A domain with a subdomain you control (e.g.,
evil.host.com). - A Flarum instance on a sibling subdomain (e.g.,
community.host.com). - The parent domain (
host.com) must not be on the Public Suffix List.
Steps:
- Set up a malicious page on
evil.host.comthat sets a cookie for.host.comwith a known session token. - Lure a victim to visit
evil.host.com(e.g., via phishing). - The victim's browser stores the cookie.
- When the victim visits
community.host.com, the browser sends the attacker's cookie. - The attacker can now use the same session token to access the victim's account.
Example Cookie Setting (JavaScript):
document.cookie = "flarum_session=attacker_token; domain=.host.com; path=/";
Note: Due to browser security measures (e.g., SameSite cookies), this may not work in modern browsers. The attack is theoretical and requires specific conditions.
Blue Team (Defense & Detection)
Detection:
- Monitor for multiple session tokens from the same IP or user agent.
- Alert on cookie domain mismatches (e.g., a cookie set for
.host.comfrom a subdomain). - Use web application firewalls (WAF) to block cookie injection attempts.
Mitigation:
- Upgrade to Flarum 1.8.10 or later.
- Implement session token rotation after authentication.
- Use secure cookie attributes (HttpOnly, Secure, SameSite=Strict).
- Consider using a subdomain that is on the Public Suffix List (e.g.,
community.host.comis not on PSL, butcommunity.github.iois).
Indicators of Compromise (IOCs)
- Network:
- Unusual cookie domain values (e.g.,
.host.comset fromevil.host.com). - Multiple session tokens for the same user from different IPs.
- Unusual cookie domain values (e.g.,
- Host:
- Logs showing session token reuse after authentication.
- Browser console errors related to cookie domain mismatches.
- File:
- No specific file IOCs.
Detection Engineering
YARA Rule
rule CVE_2025_27794_Session_Hijacking {
meta:
description = "Detects session token reuse in Flarum logs"
author = "Valters IT"
date = "2025-04-01"
reference = "CVE-2025-27794"
strings:
$session_token = /flarum_session=[a-zA-Z0-9]+/
$login_event = "User logged in"
condition:
#session_token > 1 and $login_event
}
Sigma Rule
title: Flarum Session Hijacking Attempt
id: cve-2025-27794
status: experimental
description: Detects potential session hijacking via cookie domain manipulation
author: Valters IT
logsource:
category: webserver
product: flarum
detection:
selection:
cs-method: POST
cs-uri-stem: /login
cs-cookie|contains: "flarum_session"
condition: selection
falsepositives:
- Legitimate session token rotation
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-27794 Flarum Session Hijacking Attempt"; flow:to_server; content:"flarum_session"; http_cookie; content:"domain="; http_cookie; distance:0; within:100; classtype:attempted-user; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade Flarum to version 1.8.10 or later.
- Rotate all existing session tokens for active users.
- Review server logs for any signs of session hijacking.
Long-term Measures:
- Implement session token rotation after every authentication event.
- Use secure cookie attributes (HttpOnly, Secure, SameSite=Strict).
- Consider using a subdomain that is on the Public Suffix List to prevent cookie scoping.
- Educate users about phishing attacks that lure them to malicious subdomains.
Workarounds:
- If upgrading is not possible, disable subdomain cookie scoping by setting the
domainattribute to the exact subdomain (e.g.,community.host.com).
Valters IT
Securing Digital Frontiers