
Last updated 21 October 2026.
The essentials
- The PHP project has released security updates for two critical vulnerabilities in the PHP core, known as php2shell. They allow code execution without logging in and affect every PHP installation, which means every Moodle site.
- If NetSapiensis hosts your Moodle, you do not need to do anything. Your sites run patched PHP versions.
- If you run Moodle yourselves: update PHP today. No configuration setting closes the vulnerabilities completely.
Background
On 21 October 2026 the PHP project released security updates for two critical vulnerabilities, CVE-2026-109618 and CVE-2026-109619, collectively named php2shell. Both let an attacker run their own code on the web server without logging in, and both affect practically every PHP installation that accepts web traffic. Moodle is written in PHP, so this concerns every Moodle site.
The vulnerabilities sit in the PHP core, not in Moodle or any plugin. That means they can be exploited with a single crafted HTTP request, before the Moodle code even starts running. Logins, roles and settings in Moodle make no difference.
- CVE-2026-109618 abuses how PHP handles running out of memory. If PHP is interrupted in the middle of preparing a request, for example during a large file upload, the subsequent cleanup can treat partially initialised memory as valid. The result is memory corruption that can lead to code execution.
- CVE-2026-109619 abuses the fact that state from one request can survive in a PHP worker after its memory has been freed, and be reused by the next request. The demonstrated path goes through PHP’s session upload progress and, in PHP 8.5, through fatal error backtraces.
Both are rated 9.2 out of 10 under CVSS 4.0. Apache with mod_php is the most exposed, but PHP-FPM, php-cgi, FrankenPHP and LiteSpeed are affected too.
The timeline was unusually tight. The PHP project had announced a coordinated disclosure for 21 October, but details leaked the day before and the patches were therefore released earlier than planned. Security firms reported exploitation attempts within hours of the patches becoming public. No setting closes the vulnerabilities completely. Updating PHP is the only complete fix.
Which versions are affected
Every PHP version before these is vulnerable:
| Branch | Fixed version |
|---|---|
| PHP 8.5 | 8.5.12 |
| PHP 8.4 | 8.4.27 |
| PHP 8.3 | 8.3.36 |
| PHP 8.2 | 8.2.35 |
PHP 8.1 and older receive no official fixed release. For 7.4 to 8.1 the PHP project has published source changes that Linux distributions and hosting providers can build into their packages. For PHP 7.3 and older there is no fix at all. This matters for Moodle, because older Moodle versions only support older PHP. See the recommendations below.
What we have done for customers on our Moodle hosting
Security updates to the platform are part of our hosting service, and they do not wait for the monthly maintenance window. Every Moodle site we host now runs patched PHP versions. The update required no planned downtime beyond restarting the PHP processes, and no change in Moodle.
If we host your Moodle, you do not need to do anything. If you have questions about your specific environment, contact support@netsapiensis.se.
We keep monitoring
Security researchers are still analysing the vulnerabilities, and further attack paths and follow-up updates from the PHP project are likely over the coming weeks. We follow the advisories from the PHP project and CERT-EU and install further updates on the hosted sites as they are released. This article will be updated if the situation changes.
Recommendations if you run Moodle yourselves
1. Update PHP today, not at the next maintenance window. It is the only measure that closes the vulnerabilities. Afterwards, check with php -v on the server and under Site administration, Server, PHP info in Moodle that the web server actually uses the fixed version, not just the command line.
2. If you run PHP 8.1 or older, you have a bigger decision ahead. No fixed 8.1 release is coming. Either you get a backported fix from your Linux distribution, which you should verify in the distribution’s security advisory, or you must move to PHP 8.2 or newer. Moodle 4.1 does not support PHP 8.2, so such a site needs to be upgraded to Moodle 4.5 LTS or newer first. Moodle 4.5 supports PHP 8.1 to 8.3, Moodle 5.0 and 5.1 support PHP 8.2 to 8.4. Plan it as a project with testing on a copy of the site, but do not let the planning delay the PHP update on sites that can already take it.
3. If you cannot update within a few hours, reduce the exposure in the meantime. The measures below make the vulnerabilities harder to exploit but do not close them. They must be set in php.ini, in the FPM pool configuration or with php_admin_value in the web server configuration. Settings made via ini_set() or .user.ini are read too late.
session.upload_progress.enabled = 0. Moodle does not use the feature.memory_limit = -1set so that the application cannot change it, with a memory limit at the container or cgroup level instead. Do not use RLIMIT_AS or RLIMIT_DATA, they trigger the bug itself.- On PHP 8.5:
fatal_error_backtraces = 0. - Move any php_value and php_flag directives from .htaccess to php.ini. Warnings from such settings can trigger CVE-2026-109619.
- Lower
post_max_size,upload_max_filesize,max_input_varsandmax_file_uploadsto what your site really needs. - If you run Apache with mod_php, consider switching to PHP-FPM, which has a smaller attack surface for these particular bugs.
Blocking all multipart requests in the web server, as some guides suggest, stops file uploads in Moodle and is not a realistic option for a learning platform in production.
4. Do not rely on measures that do not help. Hiding error messages, disabling file uploads in PHP, adding checks in the application or relying solely on a web application firewall gives false security. A WAF rule can buy time but does not replace the update.
5. Look for traces. Review the web server and PHP logs from 20 October onwards. Look for unexpected out-of-memory errors, segmentation faults in PHP processes, unknown PHP files in the Moodle directory or in moodledata, and outgoing connections from the web server that you do not recognise. If you find something, assume the site is compromised and restore from a backup taken before 20 October.
6. Decide who owns PHP. Many organisations have clear ownership of Moodle but not of the PHP version underneath. This incident is a good occasion to write down who monitors the PHP project’s security advisories and how quickly a critical update must be completed.
Need help?
We help with PHP updates, upgrading Moodle to a version that supports modern PHP, and reviewing logs after the incident. Customers on our Moodle hosting have already received the update.
Subscribe to our newsletter to get security advisories and Moodle news straight to your inbox.
Sources: PHP project security advisories, CERT-EU Security Advisory 2026-018, Tenable: php2shell FAQ, Mattias Geniar: early mitigation steps, watchTowr: observed exploitation and SecurityWeek. Moodle™ is a registered trademark of Moodle Pty Ltd.