CVE-2026-41887
Description
Flarum is open-source forum software. Prior to versions 1.8.16 and 2.0.0-rc.1, Flarum's patch for CVE-2023-27577 restricted the @import and data-uri() LESS features in the custom_less setting, but the same restriction was never applied to other settings registered as LESS config variables (for example theme_primary_color and theme_secondary_color, as well as any key registered via Extend\Settings::registerLessConfigVar()). Those values are interpolated verbatim into the LESS source at compile time, allowing an authenticated administrator to craft a theme-color value that injects an arbitrary @import directive into the compiled forum.css. Because the underlying LESS parser honours @import (inline) '<path>', an attacker can read arbitrary files reachable by the PHP process (local file inclusion) or trigger outbound HTTP(S) requests (server-side request forgery). This issue has been patched in versions 1.8.16 and 2.0.0-rc.1.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
flarum/corePackagist | < 1.8.16 | 1.8.16 |
flarum/corePackagist | >= 2.0.0-beta.1, < 2.0.0-rc.1 | 2.0.0-rc.1 |
Affected products
1Patches
12 files changed · +72 −6
framework/core/src/Forum/ValidateCustomLess.php+19 −6 modified@@ -43,13 +43,26 @@ public function whenSettingsSaving(Saving $event): void return; } - // Restrict what features can be used in custom LESS - if (isset($event->settings['custom_less']) && preg_match('/@import|data-uri\s*\(/i', $event->settings['custom_less'])) { - $translator = $this->container->make(TranslatorInterface::class); + // Restrict what features can be used in custom LESS. This applies to + // the `custom_less` setting as well as any setting registered as a + // LESS config variable (e.g. `theme_primary_color`), since those + // values are interpolated directly into the LESS source. + $lessFeatureKeys = array_merge( + isset($event->settings['custom_less']) ? ['custom_less'] : [], + array_intersect( + array_keys($event->settings), + array_column($this->customLessSettings, 'key') + ) + ); + + foreach ($lessFeatureKeys as $key) { + if (is_string($event->settings[$key]) && preg_match('/@import|data-uri\s*\(/i', $event->settings[$key])) { + $translator = $this->container->make(TranslatorInterface::class); - throw new ValidationException([ - 'custom_less' => $translator->trans('core.admin.appearance.custom_styles_cannot_use_less_features') - ]); + throw new ValidationException([ + $key => $translator->trans('core.admin.appearance.custom_styles_cannot_use_less_features') + ]); + } } // We haven't saved the settings yet, but we want to trial a full
framework/core/tests/integration/api/settings/SetTest.php+53 −0 modified@@ -78,4 +78,57 @@ public function max_setting_length_validated() $this->assertEquals(422, $response->getStatusCode()); } + + #[Test] + public function theme_primary_color_rejects_less_import() + { + $response = $this->send( + $this->request('POST', '/api/settings', [ + 'authenticatedAs' => 1, + 'json' => [ + 'theme_primary_color' => "#4D698E;@import (inline) '/etc/passwd';", + ], + ]) + ); + + $this->assertEquals(422, $response->getStatusCode()); + $this->assertNotEquals( + "#4D698E;@import (inline) '/etc/passwd';", + $this->app->getContainer()->make('flarum.settings')->get('theme_primary_color') + ); + } + + #[Test] + public function theme_secondary_color_rejects_less_import() + { + $response = $this->send( + $this->request('POST', '/api/settings', [ + 'authenticatedAs' => 1, + 'json' => [ + 'theme_secondary_color' => "#4D698E;@import (inline) '/etc/passwd';", + ], + ]) + ); + + $this->assertEquals(422, $response->getStatusCode()); + $this->assertNotEquals( + "#4D698E;@import (inline) '/etc/passwd';", + $this->app->getContainer()->make('flarum.settings')->get('theme_secondary_color') + ); + } + + #[Test] + public function theme_primary_color_rejects_data_uri() + { + $response = $this->send( + $this->request('POST', '/api/settings', [ + 'authenticatedAs' => 1, + 'json' => [ + 'theme_primary_color' => "#4D698E;background:data-uri('/etc/passwd');", + ], + ]) + ); + + $this->assertEquals(422, $response->getStatusCode()); + } }
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
8- github.com/advisories/GHSA-xjvc-pw2r-6878ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2023-27577ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2026-41887ghsaADVISORY
- github.com/flarum/framework/commit/2d90a1f19f0e46f8c7e1b07c48ba74b5e38f8410nvdWEB
- github.com/flarum/framework/releases/tag/v1.8.16nvdWEB
- github.com/flarum/framework/releases/tag/v2.0.0-rc.1nvdWEB
- github.com/flarum/framework/security/advisories/GHSA-vhm8-wwrf-3gcwghsaWEB
- github.com/flarum/framework/security/advisories/GHSA-xjvc-pw2r-6878nvdWEB
News mentions
18- Lens Agents brings policy control to AI across cloud and desktopHelp Net Security · May 4, 2026
- Sophisticated Deep#Door Backdoor Enables Espionage, DisruptionSecurityWeek · May 1, 2026
- New Python Backdoor Uses Tunneling Service to Steal Browser and Cloud CredentialsThe Hacker News · Apr 30, 2026
- AI-powered honeypots: Turning the tables on malicious AI agentsCisco Talos Intelligence · Apr 29, 2026
- TeamPCP Supply Chain Campaign: Update 008 - 26-Day Pause Ends with Three Concurrent Compromises (Checkmarx KICS, Bitwarden CLI Cascade, xinference PyPI), CanisterSprawl npm Worm Identified, and Tier 1 Coverage Returns, (Mon, Apr 27th)SANS Internet Storm Center · Apr 27, 2026
- Researchers Uncover Pre-Stuxnet ‘fast16’ Malware Targeting Engineering SoftwareThe Hacker News · Apr 25, 2026
- IR Trends Q1 2026: Phishing reemerges as top initial access vector, as attacks targeting public administration persistCisco Talos Intelligence · Apr 22, 2026
- Bad Apples: Weaponizing native macOS primitives for movement and executionCisco Talos Intelligence · Apr 21, 2026
- Microsoft Patch Tuesday for April 2026 - Snort Rule and Prominent VulnerabilitiesCisco Talos Intelligence · Apr 14, 2026
- How AI Assistants are Moving the Security GoalpostsKrebs on Security · Mar 8, 2026
- Defending Against China-Nexus Covert Networks of Compromised DevicesCISA Alerts
- ABB Ability Symphony Plus EngineeringCISA Alerts
- FIRESTARTER BackdoorCISA Alerts
- Siemens RUGGEDCOM CROSSBOW Station Access Controller (SAC)CISA Alerts
- Siemens TPM 2.0CISA Alerts
- Siemens SINEC NMSCISA Alerts
- ABB System 800xA, Symphony Plus IEC 61850CISA Alerts
- Siemens SCALANCECISA Alerts