php2shell: Would Rust Have Fixed It? Yes...Yes, It Would Have.

Patch the PHP request-parser vulnerabilities behind php2shell, understand the memory-safety failure, and consider Rust and Fission for a server-rendered application.
2026-10-22
By Fission Team, Courtney Robinson
Project
Migration
On 21 October 2026, PHP published emergency fixes for two critical remote-code-execution vulnerabilities: CVE-2026-109618 (github.com/php/php-src/security/advisories/GHSA-w8hw-w9fx-j79w) and CVE-2026-109619 (github.com/php/php-src/security/advisories/GHSA-6wmf-4rv5-p3rp).
Collectively dubbed php2shell, the vulnerabilities were discovered by researchers from Calif, OpenAI and Wiz. Both received a CVSS 4.0 score of 9.2.
What makes php2shell especially serious is where the bugs live and when an attacker can reach them.
These are not bugs in a WordPress plugin, an app's authentication code, or an overlooked upload handler. They are memory-safety bugs in PHP itself. A specially constructed request can reach them while PHP is parsing the request, before the application starts running.
The Calif write-up describes two related failure modes:
•
An out-of-memory condition can interrupt PHP while an internal hash-table entry is only partially initialized. Cleanup later treats stale memory as a valid object.
•
Request-owned session state can survive after its memory has been freed. A later request handled by the same worker can consume those dangling pointers.
The researchers demonstrated unauthenticated remote code execution against Apache mod_php. The PHP security team says any PHP installation serving web requests may be affected—including PHP-FPM, php-cgi, FrankenPHP, and LiteSpeed—though the demonstrated mod_php path is considered the highest risk.
This affects far more than PHP developers. WordPress alone powers roughly 40% of the websites measured by W3Techs, and PHP is detected on about 70% of sites where the server-side language is known. The numbers have limits, but the point is clear: a bug in PHP's request parser can put a huge number of sites in scope. W3Techs publishes the figures and methodology here.

If you run PHP, update it now

Many teams are looking after PHP systems they did not build. Others run sites that bring in revenue and cannot be rewritten in the middle of a security incident. If that is you, the priority is to protect the system you have now.
Upgrade to one of these fixed PHP releases:
Branch
Fixed release
PHP 8.5
8.5.12
PHP 8.4
8.4.27
PHP 8.3
8.3.36
PHP 8.2
8.2.35
The official PHP security advisory is clear: updating is the only complete fix.
After upgrading:
1.
Confirm the version used by every web-facing SAPI, not just the version printed by php -v.
2.
Restart all Apache, PHP-FPM, LiteSpeed, FrankenPHP and other persistent PHP workers.
3.
Rebuild and redeploy containers rather than patching only a running instance.
4.
Check every pool, virtual host and application image. It is common to have more than one PHP version installed.
5.
Verify that your distribution actually includes the backported security patch when its package version differs from upstream PHP.
6.
Treat PHP 8.1 and older as unsupported unless a distribution or commercial LTS vendor explicitly confirms that it has backported both fixes.
7.
Review logs and unexpected changes as part of your normal incident response. Updating blocks these attacks going forward; it cannot tell you whether an exposed server was attacked earlier.
The PHP team also published small source backports for PHP 7.4, 8.0, and 8.1. If you can, move to a supported release or a patched package from your vendor rather than carrying a private PHP build indefinitely.

If you genuinely cannot update immediately

The PHP project lists measures that reduce exposure to known attack paths:
•
Disable session upload progress with session.upload_progress.enabled=0.
•
Restart every worker after changing it.
•
Remove finite PHP memory limits with memory_limit=-1 at an administrator-controlled level.
•
Apply conservative request-body and upload limits at PHP and HTTP-server boundaries.
•
On PHP 8.5, set fatal_error_backtraces=0.
•
Remove attacker-reachable fatal errors and invalid per-request configuration.
Removing PHP's memory limit also removes a protection against memory exhaustion. The PHP team recommends conservative request limits at the HTTP boundary, including the decoded request size; changing one setting without those limits can expose a different denial-of-service problem. See the two official advisories and the session-state mitigation notes before applying a temporary configuration.
These settings only reduce risk along known paths; they are not patches. They do not make an affected PHP installation safe. Use them as a short-term measure while you upgrade, not as a reason to put the upgrade off.

This is bigger than WordPress

WordPress is the obvious headline because it is so widely used. But php2shell sits below the application: if a site handles requests with an affected PHP runtime, the quality of its application code does not remove the runtime risk.
Ten of the best-known PHP-based systems and frameworks are:
1.
WordPress
2.
WooCommerce
3.
Drupal
4.
Joomla
5.
Adobe Commerce/Magento
6.
Moodle
7.
MediaWiki
8.
PrestaShop
9.
Symfony
10.
Laravel
They all depend on PHP and run on top of that runtime. You do not need to replace any of them to fix php2shell. But if you were already planning to replace an ageing PHP app, simplify an expensive deployment stack, or reduce a large plugin surface, this is a reasonable time to look at the alternatives.

Would Rust have prevented php2shell?

The direct answer is yes—for these specific bugs.
Safe Rust would have prevented the specific use-after-free and stale-pointer failures behind php2shell.
Rust's ownership and borrowing rules prevent safe Rust code from using memory after it has been freed. A reference cannot outlive the value it points to, and partially initialised data cannot be treated as a fully valid value. That guarantee depends on sound implementations of any unsafe Rust and native libraries underneath the application. Rust does not prevent an authentication mistake, an unsafe dependency bug, or every possible denial of service. The difference is that the rules that prevent these particular memory errors are checked while the program is compiled, through the ownership model.

Why Rust for server-rendered applications?

Memory safety is a good reason to consider Rust, but it is not the only one.
A Rust web app is normally compiled into a native executable. It does not need a PHP interpreter to load and run scripts for every request. Depending on the framework, that executable can handle HTTP traffic directly.
That can mean:
•
Lower and more predictable memory use.
•
Less CPU spent repeatedly bootstrapping application code.
•
Native performance without requiring an opcode cache.
•
One typed codebase checked ahead of deployment.
•
No production PHP extension or interpreter-version mismatch.
•
No separate PHP-FPM process manager.
•
Fewer moving parts than an Apache/Nginx, PHP-FPM, OPcache and application combination.
•
Straightforward container images containing the application and its required assets.
•
Errors in data types and interfaces caught during compilation rather than after a particular request reaches production.
You may still put the service behind a reverse proxy, CDN, load balancer, or managed ingress. Those are useful for TLS, caching, rate limiting, and routing between services. The difference is that they are deployment choices, not extra servers required to interpret and run the application.
Modern PHP 8 is much better than the PHP many of us remember. It has type declarations, enums, attributes, improved error handling, better performance, and a strong package ecosystem. The complaints people still have today are more like these:
•
Types do not cover every dynamic array or externally sourced data shape.
•
Many mistakes remain runtime errors.
•
Behaviour can differ between CLI, FPM and Apache configurations.
•
Configuration can be distributed across php.ini, pool files, virtual hosts, .user.ini, extensions and application settings.
•
Production performance often depends on coordinated worker, OPcache and web-server tuning.
•
Large plugin ecosystems increase supply-chain and compatibility exposure.
•
Long-lived systems can accumulate framework, PHP-version and extension constraints that make upgrades progressively harder.

Where Fission fits

Fission is a Rust application framework for building interfaces across Web, server-side rendered sites (like PHP), static sites, desktop, mobile and terminal targets.
For a new server-rendered app—or a gradual replacement for an existing PHP system—Fission gives you a familiar model:
•
A route produces HTML on the server.
•
Forms and actions are typed.
•
State transitions happen through reducers.
•
Fallible and asynchronous work is separated into effects.
•
Server actions are signed and validated.
•
Public pages can be cached or statically generated.
•
Session-private routes can be rendered per request.
•
Focused browser workers or WASM islands can add interactivity without turning the entire site into a client-side application.
•
The same widgets, validation rules, localisation and application state can be reused on other targets.
You keep the server-rendered model that made PHP effective, with Rust's compile-time checks and memory-safety guarantees.

A login page in PHP and Fission

Consider a routine screen: username, password, a sign-in button and a forgotten-password link.
The PHP version uses strict types, a prepared query, password hashing, a generic authentication error, CSRF protection, and session-ID rotation. A production system also needs rate limiting, audit logging, secure cookie settings, and a real account-recovery flow.
The Fission example below uses Compose for the view and a typed server-form schema for the HTTP boundary. It is a view and registration excerpt, not a complete authentication system. The PHP example includes its database check; the Rust application must supply an equivalent authentication handler rather than treating a successful UI transition as proof of identity.

PHP

<?php

declare(strict_types=1);

session_start([
  'cookie_httponly' => true,
  'cookie_secure' => true,
  'cookie_samesite' => 'Lax',
]);

$pdo = new PDO(
  $_ENV['DATABASE_URL'],
  $_ENV['DATABASE_USER'],
  $_ENV['DATABASE_PASSWORD'],
  [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION],
);

$_SESSION['csrf'] ??= bin2hex(random_bytes(32));

$username = '';
$error = null;

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
  $username = trim((string) ($_POST['username'] ?? ''));
  $password = (string) ($_POST['password'] ?? '');
  $csrf = (string) ($_POST['csrf'] ?? '');

  if (!hash_equals($_SESSION['csrf'], $csrf)) {
      http_response_code(400);
      $error = 'Your session expired. Try again.';
  } else {
      $query = $pdo->prepare(
          'SELECT id, password_hash
             FROM users
            WHERE username = :username'
      );

      $query->execute(['username' => $username]);
      $user = $query->fetch(PDO::FETCH_ASSOC);

      if ($user && password_verify(
          $password,
          $user['password_hash'],
      )) {
          session_regenerate_id(true);
          $_SESSION['user_id'] = $user['id'];

          header('Location: /account', true, 303);
          exit;
      }

      $error = 'The username or password was incorrect.';
  }
}
?>

<h1>Sign in</h1>

<?php if ($error !== null): ?>
  <div role="alert">
      <?= htmlspecialchars($error, ENT_QUOTES, 'UTF-8') ?>
  </div>
<?php endif ?>

<form method="post">
  <input
      type="hidden"
      name="csrf"
      value="<?= htmlspecialchars(
          $_SESSION['csrf'],
          ENT_QUOTES,
          'UTF-8',
      ) ?>"
  >

  <label>
      Username
      <input
          name="username"
          value="<?= htmlspecialchars(
              $username,
              ENT_QUOTES,
              'UTF-8',
          ) ?>"
          autocomplete="username"
          required
      >
  </label>

  <label>
      Password
      <input
          type="password"
          name="password"
          autocomplete="current-password"
          required
      >
  </label>

  <button type="submit">Sign in</button>
  <a href="https://example.com/forgot-password">Forgot password?</a>
</form>

Fission Compose

A server-rendered form does not need to copy every keystroke into application state. The browser owns the unsubmitted editing values; the server receives the declared controls when the visitor submits the form.
use fission::prelude::*;

fission_component! {
    pub LoginPage<()> {
        props {
            username: String,
            error: Option<String>,
            submit: ActionEnvelope,
        }
    }

    view(login, _state, cx) {
        let tokens = &cx.view.env().theme.tokens;
    } =>
        Center(Card(
            child: Column(
                gap: tokens.spacing.m,
                children: [
                    Text(cx.tr("auth.sign_in.title")),
                    TextInput(
                        label: Some(cx.tr("auth.username")),
                        value: login.username.clone(),
                        name: Some("username".into()),
                        form_id: Some("sign-in".into()),
                        autofill_hints: vec!["username".into()],
                        required: true,
                    ),
                    TextInput(
                        label: Some(cx.tr("auth.password")),
                        name: Some("password".into()),
                        form_id: Some("sign-in".into()),
                        autofill_hints: vec!["current-password".into()],
                        obscure_text: true,
                        autocorrect: false,
                        spell_check: false,
                        required: true,
                    ),
                    if let Some(error) = &login.error {
                        Alert(
                            title: error.clone(),
                            kind: AlertKind::Error,
                        )
                    },
                    Button(
                        child: Text(cx.tr("auth.sign_in")),
                        on_press: login.submit.clone(),
                    ).form_id("sign-in"),
                    Link::to(
                        cx.tr("auth.forgot_password"),
                        "/forgot-password/",
                    ),
                ],
            ),
        ))
}
The parent supplies an action already bound to its authentication reducer and an error translated for the current request. Keep English and a second language in the application's translation files, and install those bundles in the server environment. The component does not own a second session model or a second set of theme values.
Register the editable fields against that action's type in the server app:
use fission::server::{ServerFormField, ServerFormSchema};
use serde::Deserialize;

#[derive(Deserialize)]
struct LoginFields {
    username: String,
    password: String,
}

let schema = ServerFormSchema::new("sign-in")
    .field(ServerFormField::text("username").required().max_length(128))
    .field(ServerFormField::text("password").required().max_length(1024));

let app = app.form_action::<LoginFields, Authenticate, _>(schema, |fields| {
    Authenticate {
        username: fields.username,
        password: fields.password,
    }
});
Here app is the application's FissionServerApp and Authenticate is its own action type, bound by the parent to its authentication reducer. Those are application contracts, not authentication helpers provided by Fission. The schema rejects undeclared, repeated scalar, missing, and oversized fields before constructing that action. Matching form_id values connect the controls and submit button. Fission emits a signed form token and accepts normal browser submission without requiring a full Web app.
The handler still has real work to do. It must verify the password, rate-limit attempts, keep credentials out of logs, rotate or issue a secure server-side session, and return a deliberately generic failure. Asynchronous database or identity-provider work belongs in a registered server job, with explicit success and error reducers. A Rust session = Some(...) assignment is not a browser session cookie. Neither a signed form nor a hidden route replaces server-side authentication and authorisation.
Keep this route request-rendered and private: an action-bearing login form must not be served from a shared public HTML cache. Configure the action-origin policy and the host's CSRF checks deliberately; see the SSR security guide. The server jobs and actions guide covers the reducer/job boundary. The login form tutorial covers the shared interactive view and validation, not a ready-made authentication backend.
Compose describes the interface with Fission widgets and components. Fission can render it as server-side HTML, and the same shared interface can also be used in an Android or iOS app, or a Windows, Linux, or macOS desktop app.
In the end you retain the attractive parts of PHP’s model:
•
A request can produce complete HTML.
•
Forms work naturally.
•
Routes map cleanly to pages.
•
Server logic can live beside the application.
You do not need PHP's runtime model, loose request globals, interpreter configuration, FPM worker layer, or its exposure to these classes of memory-safety bug.
PHP became important because it made useful software unusually accessible. A person could upload a few files, connect a database, and publish something valuable. Huge parts of the web grew from that. Its success also means that decisions made deep inside the runtime now affect an extraordinary number of people.
The PHP maintainers, security researchers, and downstream vendors have done the right thing by coordinating and publishing fixes. Once the immediate incident is under control, it is also fair to ask what we want the next twenty years of web infrastructure to look like.
I'd like Fission to be one option for that future. If you want help getting started or need professional support with a potential migration, contact [email protected].