CVE-2024-25625: Pimcore/admin ui classic bundle Pimcore Host Header Injection Vulnerability

HIGH
Advisory Identifier: GHSA-3qpq-6w89-f7mx
CVSS 8.1
CWE-74
Published
Advisory Summary

CVE-2024-25625 is a HIGH (CVSS 8.1) pimcore host header injection vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Pimcore/admin ui classic bundle libraries in the Packagist ecosystem. The issue involves pimcore host header injection in user invitation link. Remediation is available by upgrading affected packages to version 1.3.4.

CVE-2024-25625 at a Glance

CVE Identifier CVE-2024-25625
GHSA Identifier GHSA-3qpq-6w89-f7mx
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Pimcore/admin ui classic bundle
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.1

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

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

How to Fix CVE-2024-25625

To remediate this vulnerability, upgrade all affected Pimcore/admin ui classic bundle dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

pimcore/admin-ui-classic-bundle fixed: 1.3.4
Upgrade pimcore/admin-ui-classic-bundle to 1.3.4
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 pimcore/admin-ui-classic-bundle

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-25625, inspect your project dependencies for Pimcore/admin ui classic bundle:

inspect dependencies for pimcore/admin-ui-classic-bundle

Analyze the terminal output to locate any version of Pimcore/admin ui classic bundle in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.4), 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-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Pimcore/admin ui classic bundle, 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

## Overview A potential security vulnerability discovered in `pimcore/admin-ui-classic-bundle` version up to v1.3.3 . The vulnerability involves a Host Header Injection in the `invitationLinkAction` function of the UserController, specifically in the way `$loginUrl` trusts user input. ## Details The host header from incoming HTTP requests is used unsafely when generating URLs. An attacker can manipulate the HTTP host header in requests to the /admin/user/invitationlink endpoint, resulting in the generation of URLs with the attacker's domain. In fact, if a host header is injected in the POST request, the $loginURL parameter is constructed with this unvalidated host header. It is then used to send an invitation email to the provided user. Here is an excerpt from the affected section of UserController.php file: ``` // /src/Controller/Admin/UserController.php public function invitationLinkAction(Request $request, TranslatorInterface $translator): JsonResponse { // ..snip.. $token = Tool\Authentication::generateTokenByUser($user); $loginUrl = $this->generateCustomUrl([ 'token' => $token, 'reset' => true, ]); try { $mail = Tool::getMail([$user->getEmail()], 'Pimcore login invitation for ' . Tool::getHostname()); $mail->setIgnoreDebugMode(true); $mail->text("Login to pimcore and change your password using the following link. This temporary login link will expire in 24 hours: \r\n\r\n" . $loginUrl); $mail->send(); // ..snip.. } // ..snip.. private function generateCustomUrl(array $params, string $fallbackUrl = 'pimcore_admin_login_check', int $referenceType = UrlGeneratorInterface::ABSOLUTE_URL): string { try { $adminEntryPointRoute = $this->getParameter('pimcore_admin.custom_admin_route_name'); //try to generate invitation link for custom admin point $loginUrl = $this->generateUrl($adminEntryPointRoute, $params, $referenceType); } catch (\Exception $e) { //use default login check for invitation link $loginUrl = $this->generateUrl($fallbackUrl, $params, $referenceType); } return $loginUrl; } ``` The $loginUrl variable is constructed using the generateCustomUrl function. If an attacker injects a malicious host header into a POST request, the resulting $loginUrl will include the malicious domain, and this link is then sent via email to the user. ## Proof of Concept Here is an example of a request that exploits this vulnerability: ``` POST /admin/user/invitationlink HTTP/1.1 Host: attacker-domain.evil Cookie: PHPSESSID=test X-pimcore-extjs-version-major: 7 X-pimcore-extjs-version-minor: 0 X-Requested-With: XMLHttpRequest X-pimcore-csrf-token: 961c37cf60edfdc2eec5a705cb048aaa8c32804d username=[username of a valid user] ``` The URL in the email will look like: `http://attacker-domain.evil/admin/login/login?token=[TOKEN]` ## Impact This vulnerability can be used to perform phishing attacks by making the URLs in the invitation links emails point to an attacker-controlled domain. ## Remediation We recommend validating the host header and ensuring it matches the application's domain. It would also be beneficial to use a default trusted host or hostname if the incoming host header is not recognized or is absent. Similar vulnerability (CVE-2024-23648) has been fixed in this project (https://github.com/pimcore/admin-ui-classic-bundle/commit/70f2205b5a5ea9584721d4f3e803f4d0dd5e4655) ## Credit Discovered by @v0lck3r (Oussama RAHALI), Feb 2024.

CVE-2024-25625 Affected Pimcore/admin ui classic bundle Versions

1 component(s)
Fixed Versions:
1.3.4
Product / Package Ecosystem Affected Versions Fixed Version
pimcore/admin-ui-classic-bundle
Packagist
< 1.3.4
1.3.4

References

Frequently Asked Questions

What is CVE-2024-25625?
CVE-2024-25625 is a security vulnerability in Pimcore/admin ui classic bundle involving Pimcore Host Header Injection in user invitation link under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Pimcore/admin ui classic bundle versions are affected?
Affected versions include releases prior to 1.3.4 across affected packages: pimcore/admin-ui-classic-bundle.
What version fixes CVE-2024-25625?
Upgrading to 1.3.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pimcore/admin-ui-classic-bundle affected?
Yes, pimcore/admin-ui-classic-bundle is affected in releases prior to 1.3.4. Upgrade your dependency to 1.3.4 or later.
What is the CVSS score of CVE-2024-25625?
CVE-2024-25625 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2024-25625?
CVE-2024-25625 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check Packagist dependencies for CVE-2024-25625?
Run the dependency tree command: 'inspect dependencies for pimcore/admin-ui-classic-bundle'. 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-3qpq-6w89-f7mx",
  "modified" : "2024-02-20T23:44:20Z",
  "published" : "2024-02-20T23:44:20Z",
  "aliases" : [ "CVE-2024-25625" ],
  "summary" : "Pimcore Host Header Injection in user invitation link",
  "details" : "## Overview\n\nA potential security vulnerability discovered in `pimcore/admin-ui-classic-bundle` version up to v1.3.3 . The vulnerability involves a Host Header Injection in the `invitationLinkAction` function of the UserController, specifically in the way `$loginUrl` trusts user input. \n\n## Details\n\nThe host header from incoming HTTP requests is used unsafely when generating URLs. An attacker can manipulate the HTTP host header in requests to the /admin/user/invitationlink endpoint, resulting in the generation of URLs with the attacker's domain. \n\nIn fact, if a host header is injected in the POST request, the $loginURL parameter is constructed with this unvalidated host header. It is then used to send an invitation email to the provided user.\n\nHere is an excerpt from the affected section of UserController.php file:\n```\n// /src/Controller/Admin/UserController.php \n    public function invitationLinkAction(Request $request, TranslatorInterface $translator): JsonResponse\n    {\n            // ..snip..\n                $token = Tool\\Authentication::generateTokenByUser($user);\n                $loginUrl = $this->generateCustomUrl([\n                    'token' => $token,\n                    'reset' => true,\n                ]);\n\n                try {\n                    $mail = Tool::getMail([$user->getEmail()], 'Pimcore login invitation for ' . Tool::getHostname());\n                    $mail->setIgnoreDebugMode(true);\n                    $mail->text(\"Login to pimcore and change your password using the following link. This temporary login link will expire in  24 hours: \\r\\n\\r\\n\" . $loginUrl);\n                    $mail->send();\n      // ..snip..\n    }\n    // ..snip..\n    private function generateCustomUrl(array $params, string $fallbackUrl = 'pimcore_admin_login_check', int $referenceType = UrlGeneratorInterface::ABSOLUTE_URL): string\n    {\n        try {\n            $adminEntryPointRoute = $this->getParameter('pimcore_admin.custom_admin_route_name');\n\n            //try to generate invitation link for custom admin point\n            $loginUrl = $this->generateUrl($adminEntryPointRoute, $params, $referenceType);\n        } catch (\\Exception $e) {\n            //use default login check for invitation link\n            $loginUrl = $this->generateUrl($fallbackUrl, $params, $referenceType);\n        }\n\n        return $loginUrl;\n    }\n```\nThe $loginUrl variable is constructed using the generateCustomUrl function. If an attacker injects a malicious host header into a POST request, the resulting $loginUrl will include the malicious domain, and this link is then sent via email to the user.\n\n## Proof of Concept\n\nHere is an example of a request that exploits this vulnerability:\n```\nPOST /admin/user/invitationlink HTTP/1.1 \nHost: attacker-domain.evil \nCookie: PHPSESSID=test\nX-pimcore-extjs-version-major: 7\nX-pimcore-extjs-version-minor: 0\nX-Requested-With: XMLHttpRequest\nX-pimcore-csrf-token: 961c37cf60edfdc2eec5a705cb048aaa8c32804d\n\nusername=[username of a valid user]\n```\n\n\nThe URL in the email will look like: `http://attacker-domain.evil/admin/login/login?token=[TOKEN]`\n\n## Impact\n\nThis vulnerability can be used to perform phishing attacks by making the URLs in the invitation links emails point to an attacker-controlled domain.\n\n## Remediation\n\nWe recommend validating the host header and ensuring it matches the application's domain. It would also be beneficial to use a default trusted host or hostname if the incoming host header is not recognized or is absent.\n\nSimilar vulnerability (CVE-2024-23648) has been fixed in this project  (https://github.com/pimcore/admin-ui-classic-bundle/commit/70f2205b5a5ea9584721d4f3e803f4d0dd5e4655)\n\n## Credit\n\nDiscovered by @v0lck3r (Oussama RAHALI), Feb 2024.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "pimcore/admin-ui-classic-bundle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pimcore/admin-ui-classic-bundle/security/advisories/GHSA-3qpq-6w89-f7mx"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-25625"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pimcore/admin-ui-classic-bundle/commit/b9fee9d383fc73dbd5e1d98dbb0ff3266d6b5a82"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pimcore/admin-ui-classic-bundle"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-02-20T23:44:20Z",
    "nvd_published_at" : "2024-02-19T16:15:52Z"
  }
}