Rust rewrite of PHP interpreter achieves logical memory safety with 15% overhead
The Rust implementation provides logical memory safety for a core PHP fragment while preserving full functionality.
Security & privacy arXiv 24 Nov 2026 Method Prototype evidence
Published as “A Star is Reborn: The PHP Interpreter Rewritten in Safe Rust”
Why it matters
A safe-Rust PHP interpreter can close both native and logical memory-safety gaps in existing deployments with minimal performance cost, improving the security of widely used PHP web applications.
Summary
The safe-Rust rewrite of the PHP 5.0.0 interpreter eliminates both native memory-safety violations and logical memory-safety violations for all 173 historically known bugs, produces byte-identical output on 8 real applications and 1,143 PHP tests, and adds only about 15% runtime overhead. The authors formalize logical memory safety via an abstract PHP machine, prove the safety property, and verify a core part of the Rust implementation with Verus, providing strong evidence through both formal proof and extensive empirical testing.
What they found 2
- The safe-Rust interpreter exhibits no native or logical memory-safety violations on the 173 known bugs.
“Our safe Rust behaves safely on all these vulnerabilities with no native memory-safety violations or logical memory-safety violations.”
- Runtime overhead of the safe-Rust interpreter is modest.
“It incurs an average of only 15% runtime overhead on the PHP performance benchmark.”
Caveats 3
- Our safety property mainly targets the execution stage of the translated interpreter. Interpreter startup, PHP script compilation, and shutdown are outside the modeled execution and are therefore not covered by the logical memory-safety proof.
- We assume the PHP compiler correctly compiles the source scripts into correct opcode sequences, and do not formally verify its correctness.
- We work with PHP 5.0.0, a prior version of the PHP interpreter.
What’s new here 4
- Formal definition and enforcement of logical memory safety for language interpreters.
- An abstract PHP machine model that captures PHP memory semantics and is proved safe.
- A verified translation of the PHP 5.0.0 interpreter to safe Rust that guarantees both native and logical memory safety.
- Empirical validation on 173 historical vulnerabilities, full PHP test suites, and real applications with modest performance impact.