Docker image with FPM is vulnerable to CVE-2019-11043
The recommended nginx configuration used with the nextcloud:fpm Docker image exposes PHP-FPM to CVE-2019-11043, a flaw in how PHP-FPM handles certain requests. An attacker could use a public exploit tool to run arbitrary commands on the server.
- Triaged in 40 hours
- Fixed in 4 months
- Paid in 4 months
- Disclosed after 5 months
The CVE-2019-11043 vulnerability can be exploited in the latest nextcloud:fpm image.
This is due to the specific nginx configuration recommended for nextcloud: https://github.com/nextcloud/docker#base-version---fpm https://github.com/nextcloud/documentation/blob/master/admin_manual/installation/nginx.rst https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/web/nginx.conf
Here's the exploit: https://github.com/neex/phuip-fpizdam
Sample exploit run:
./phuip-fpizdam http://localhost:8080/ocs/v2.php
2019/10/22 19:36:29 Base status code is 200 2019/10/22 19:36:30 Status code 502 for qsl=1765, adding as a candidate 2019/10/22 19:36:31 The target is probably vulnerable. Possible QSLs: [1755 1760 1765] 2019/10/22 19:36:48 Attack params found: --qsl 1760 --pisos 191 --skip-detect 2019/10/22 19:36:48 Trying to set "session.auto_start=0"... 2019/10/22 19:36:50 Detect() returned attack params: --qsl 1760 --pisos 191 --skip-detect <-- REMEMBER THIS 2019/10/22 19:36:50 Performing attack using php.ini settings... 2019/10/22 19:36:52 Success! Was able to execute a command by appending "?a=/bin/sh+-c+'which+which'&" to URLs 2019/10/22 19:36:52 Trying to cleanup /tmp/a... 2019/10/22 19:36:52 Done!
To fix the issue, you need to update PHP-FPM version in the nextcloud:fpm image. Reference: https://bugs.php.net/bug.php?id=78599
Impact
Execute arbitrary PHP code on the target server
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the nginx configuration recommended for Nextcloud passes requests to PHP-FPM in a way that triggers the CVE-2019-11043 bug in the PHP-FPM version shipped in the image.
Impact
An attacker could execute arbitrary PHP code on the target server.
What the attacker needed
Nextcloud:fpm image with recommended nginx config; network access to the web server
The fix
The PHP-FPM version in the nextcloud:fpm image should be updated to a patched release.
How it was found
- Run the public exploit tool against the target URL.
- The tool detects the target is probably vulnerable and finds attack parameters.
- The tool performs the attack using php.ini settings.
- The tool confirms it can execute a command by appending a query string to URLs.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
PHP-FPM runs PHP code. A bug in it, combined with the recommended nginx setup, lets an attacker run commands. The report shows a ready-made tool against the Nextcloud FPM image.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.