CVE-2024-25625 (published 2024-02-19T16:15Z)

Pimcore's Admin Classic Bundle provides a Backend UI for Pimcore. A potential security vulnerability has been discovered in `pimcore/admin-ui-classic-bundle` prior to version 1.3.4. The vulnerability involves a Host Header Injection in the `invitationLinkAction` function of the UserController, specifically in the way `$loginUrl` trusts user input.  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. This vulnerability can be used to perform phishing attacks by making the URLs in the invitation links emails point to an attacker-controlled domain. Version 1.3.4 contains a patch for the vulnerability. The maintainers 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.


Weakness information:
cwe_id: CWE-74
cwe_name: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
description: 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.
extended_description: Software or other automated logic has certain assumptions about what constitutes data and control respectively. It is the lack of verification of these assumptions for user-controlled input that leads to injection problems. Injection problems encompass a wide variety of issues -- all mitigated in very different ways and usually attempted in order to alter the control flow of the process. For this reason, the most effective way to discuss these weaknesses is to note the distinct features that classify them as injection weaknesses. The most important issue to note is that all injection problems share one thing in common -- i.e., they allow for the injection of control plane data into the user-controlled data plane. This means that the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed.
         

Fix information:
repo_url: https://github.com/pimcore/admin-ui-classic-bundle
commit_details: repo_url: https://github.com/pimcore/admin-ui-classic-bundle
author: JiaJia Ji
author_date: 2024-02-19 09:32:07+01:00
msg: [Security]: Prevent potential host injection in invitation link (#428)
repository: repo_url: https://github.com/pimcore/admin-ui-classic-bundle
repo_name: pimcore/admin-ui-classic-bundle
repo_language: JavaScript
owner: pimcore
file_changes: filename: UserController.php
change_type: ModificationType.MODIFY
diff: @@ -25,6 +25,7 @@ use Pimcore\Model\Asset;
 use Pimcore\Model\DataObject;
 use Pimcore\Model\Element;
 use Pimcore\Model\User;
+use Pimcore\SystemSettingsConfig;
 use Pimcore\Tool;
 use Symfony\Component\HttpFoundation\File\UploadedFile;
 use Symfony\Component\HttpFoundation\JsonResponse;
@@ -35,6 +36,7 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
 use Symfony\Component\HttpKernel\Event\ControllerEvent;
 use Symfony\Component\Routing\Annotation\Route;
 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
+use Symfony\Component\Routing\RouterInterface;
 use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
 use Symfony\Component\Validator\Validator\ValidatorInterface;
 use Symfony\Contracts\Translation\TranslatorInterface;
@@ -1160,7 +1162,7 @@ class UserController extends AdminAbstractController implements KernelController
      *
      * @throws \Exception
      */
-    public function invitationLinkAction(Request $request, TranslatorInterface $translator): JsonResponse
+    public function invitationLinkAction(Request $request, TranslatorInterface $translator, RouterInterface $router): JsonResponse
     {
         $success = false;
         $message = '';
@@ -1187,6 +1189,15 @@ class UserController extends AdminAbstractController implements KernelController
                 }
 
                 $token = Tool\Authentication::generateTokenByUser($user);
+
+                $domain = SystemSettingsConfig::get()['general']['domain'];
+                if (!$domain) {
+                    throw new \Exception('No main domain set in system settings, unable to generate login invitation link');
+                }
+
+                $context = $router->getContext();
+                $context->setHost($domain);
+
                 $loginUrl = $this->generateCustomUrl([
                     'token' => $token,
                     'reset' => true,

programming_language: PHP