CVE-2023-28108 (published 2023-03-16T17:15Z)

Pimcore is an open source data and experience management platform. Prior to version 10.5.19, quoting is not done properly in UUID DAO model. There is the theoretical possibility to inject custom SQL if the developer is using this methods with input data and not doing proper input validation in advance and so relies on the auto-quoting being done by the DAO class. Users should update to version 10.5.19 to receive a patch or, as a workaround, apply the patch manually.

CVSS v3 base score: 7.8, HIGH (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-89
cwe_name: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
description: The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.
extended_description: 
            
            
         
         

Fix information:
repo_url: https://github.com/pimcore/pimcore
commit_details: repo_url: https://github.com/pimcore/pimcore
author: lukmzig
author_date: 2023-03-15 16:24:56+01:00
msg: [Task] Optimized get by UUID (#14633)

* fix: unify uuid queries

* replaced query with queryBuilder

---------

Co-authored-by: ChristianFeldkirchne <christian.feldkirchner@pimcore.com>
repository: repo_url: https://github.com/pimcore/pimcore
repo_name: pimcore/pimcore
description: Core Framework for the Open Source Data & Experience Management Platform (PIM, MDM, CDP, DAM, DXP/CMS & Digital Commerce)
repo_language: PHP
owner: pimcore
file_changes: filename: Dao.php
change_type: ModificationType.MODIFY
diff: @@ -15,6 +15,7 @@
 
 namespace Pimcore\Model\Tool\UUID;
 
+use Doctrine\DBAL\Types\Types;
 use Pimcore\Db\Helper;
 use Pimcore\Model;
 
@@ -80,7 +81,17 @@ class Dao extends Model\Dao\AbstractDao
      */
     public function getByUuid($uuid)
     {
-        $data = $this->db->fetchAssociative('SELECT * FROM ' . self::TABLE_NAME ." where uuid='" . $uuid . "'");
+        $queryBuilder = $this->db->createQueryBuilder();
+        $queryBuilder
+            ->select('*')
+            ->from(self::TABLE_NAME)
+            ->where('uuid = :uuid')
+            ->setParameter('uuid', $uuid, Types::STRING);
+
+        $data = $queryBuilder
+            ->execute()
+            ->fetchAssociative();
+
         $model = new Model\Tool\UUID();
         $model->setValues($data);
 
@@ -94,6 +105,18 @@ class Dao extends Model\Dao\AbstractDao
      */
     public function exists($uuid)
     {
-        return (bool) $this->db->fetchOne('SELECT uuid FROM ' . self::TABLE_NAME . ' where uuid = ?', [$uuid]);
+        $queryBuilder = $this->db->createQueryBuilder();
+        $queryBuilder
+            ->select('uuid')
+            ->from(self::TABLE_NAME)
+            ->where('uuid = :uuid')
+            ->setParameter('uuid', $uuid, Types::STRING);
+
+
+        $result = $queryBuilder
+            ->execute()
+            ->fetchOne();
+
+        return (bool) $result;
     }
 }

programming_language: PHP