Apache web server bug grants root access on shared hosting environments
zdnet.com
zdnet.com
Also, I just want to throw out there that the name of this one is great:
"Why the name ? CARPE: stands for CVE-2019-0211 Apache Root Privilege Escalation DIEM: the exploit triggers once a day
I had to."
Usually when a range like that is given, yes.
> From version 2.4.17 (Oct 9, 2015) to version 2.4.38 (Apr 1, 2019)
This case implies that they know the bug was introduced in a particular change, which went public with version 2.4.17 and was either fixed or otherwise mitigated in 2.4.38.
The only earlier or other versions that I would expect to see affected are dev/alpha/beta branches.
> Apache's team has been prompt to respond and patch, and nice as hell. Really good experience. PHP never answered regarding the UAF.
I expect that it'll be fixed, not not handled as a security issue, as it doesn't fit within PHPs model of security vulns.
I'm not sure how I feel about such a response. Many exploits require odd, but valid code, and more often than not it exists out there.
Also, it feels weird for this to be tagged as a JSON issue?
Maybe I am conflating things or mixing something up, but I was under the impression that it only used root-privileges to obtain access to restricted ports and immediately afterwords lowered its privileges lever to something sane/non-risky.
And if that is how it operates, then this exploit should not be effective.
Is that wrong? Have I been misled?
This hasn't been true for what, 10+ years? Apache runs as user www-data on Ubuntu/Debian and as user httpd on Redhat / SUSE based distributions.
You're entirely right, but this is a bit of embellishment on the part of the exploit author (even though it is serious!)
Apache is saying the same thing.
"In Apache HTTP Server 2.4 releases 2.4.17 to 2.4.38, ...code executing in less-privileged child processes or threads (including scripts executed by an in-process scripting interpreter) could execute arbitrary code with the privileges of the parent process (usually root)"
https://httpd.apache.org/security/vulnerabilities_24.html#CV...
What is the scoreboard?
It’s one of the reasons I’m always suspicious any time I run into a company that runs Apache rather than nginx or one of the many other alternatives. There is absolutely nothing wrong with running Apache, but it always makes me wonder exactly why they are... is it because they’ve got this one app that won’t run on anything else because of crap like this? More often than not...
There's also suPHP which allows you to do the same thing for PHP processes.
The code running with greater privilege is kept to a minimum but at least some needs to be there, and this exploit potentially gives a route through to manipulate it.
FastCGI and similar can help here - it can push the creation of user specific processes away from Apache, making it harder to cross the barrier.
cPanel definitely responded to this CVE: https://github.com/CpanelInc/ea-apache2/blob/386800043a02e88...
https://access.redhat.com/security/cve/cve-2019-0211
My guess is because they're on an older version (2.4.6) that isn't affected. But that all depends on what patches have been applied to the RHEL/CentOS version.
Vulnerabilities always seem to be related to CGI scripts somehow.
To the contrary, CGIs, running separate per-request processes, are one of the few mainstream mechanisms to create per-request isolates transparent to the host's security infrastructure and process monitoring. You have to go to great lengths to achieve similar isolation if you're starting with eg. FCGI-like multithreaded or evented dispatch in a single process [1].
Perhaps you've get that impression because of the wild west shared hosting scene (made possible by CGIs and isolation in the first place) eg. popular PHP-based packages WordPress, Drupal, Joomla, etc. Then I'm with you - the security record of these plugin monstrosities is truly in a league of it's own. Just so we're on the same page, the most recent WP wtf involves theme developers DDOSing their competitors (who are reselling their themes) via your site.
[1]: https://github.com/google/sandboxed-api
[2]: https://www.jemjabella.co.uk/2019/security-alert-pipdig-inse...
PHP-FPM supports an arbitrary number of named pools, each of which may be configured with its own user/group pair. Ideally, each virtual host gets its own pool.
e.g.,
[poolname]
user = poolowner
group = poolgroup
listen = /run/php/php7.2-fpm-poolname.sock
listen.owner = www-data
listen.group = www-data
...FastCGI is more faf to configure where mod_php is more likely to be configured out of the box. Most shared hosting environment are configured entirely out-of-the-box as the market is so saturated and margins so low there is no way to justify anything else. Potential customers who care much about security will most likely be looking for their own dedicated server or VM instead so there isn't really much of a market for a more secure shared host.
Also if packing as many users as possible into as little hardware as possible, which is the only way to make any margin in shared hosting these days, you'll find mod_php more efficient by this measure. You don't have a pool of processes that only specific users can take advantage of, taking up an amount of RAM (however small) each even when not actively in use.
So FastCGI tends to be used less. When I ran PHP I used it, usually as you suggest one pool per vhost, but I was only hosting my own projects and some bits for friends & family, so I didn't need to justify the setup effort against any "bottom line".
More people are starting to realize that FastCGI is one of the keys to good and consistent performance (as much as PHP will allow, anyway) and are recognizing that mod_php for the disaster that it is.
So now more and more popular environments support it - cPanel gained native PHP-FPM support, and commercial shared web hosts are mostly using Litespeed (drop-in replacement for Apache httpd that is evented and invented its own FCGI-like called "LSAPI").
Not sure if I totally agree with mod_php being more efficient for a greedy host either - attaching the PHP runtime to the threaded/forked httpd request handler is very expensive.
You can set the per-pool minimum worker size to 0 with FCGI with a short keepalive, which allows you to keep a low average per-tenant memory footprint, but better performance when many requests arrive at once. That's also basically what Litespeed does.
I've found that caching any results of logic that's repeated per request makes PHP pretty damn fast. I use apcu, it saves state with an mmap backed cache.
I would venture a guess and say it's largely because all the shared hosting providers use it. Less and less people actually choose it given a choice.
Most shared hostings still use Apache for compatibility with .htaccess and rubbish like that.