PHP Architect logo

Want to check out an issue? Sign up to receive a special offer.

PHP Security in 2025: Lessons from the Core Security Audit

Posted by on September 2, 2025
Picture this: You’re responsible for a piece of software that powers nearly three-quarters of all websites on the internet. Every day, billions of people interact with applications built on your platform. The responsibility is staggering – and so is the target on your back.
This was the reality facing The PHP Foundation in 2024 when they made a decision that took considerable courage: invite external security experts to conduct the first comprehensive audit of PHP’s core codebase in over a decade. Not as an emergency response to some discovered vulnerability, but as a proactive assessment of a language that had evolved dramatically since its early, more security-troubled days.
I remember the announcement hitting the PHP community with a mix of excitement and nervous energy. After all, when you’re powering everything from personal blogs to Fortune 500 enterprise applications, opening your code to professional scrutiny requires confidence – or perhaps faith – in the improvements made over the years.
The partnership that made this possible was as interesting as the audit itself: Germany’s Sovereign Tech Agency provided funding, the Open Source Technology Improvement Fund (OSTIF) coordinated the effort, and Quarkslab – a French security firm with deep expertise in complex software systems – spent two months systematically dissecting PHP’s most critical components.
When the results were announced in April 2025, they told a story that even PHP’s most ardent supporters might not have dared to hope for.

The Framework: Strategic Choices About What to Examine

The Impossible Challenge of Comprehensive Coverage

Quarkslab faced an enormous challenge from the outset. PHP’s codebase spans hundreds of thousands of lines of C code, dozens of extensions, and integration points with countless external libraries. A truly comprehensive audit would require years, not months.
The solution was strategic focus. Rather than trying to examine everything superficially, the team made deliberate choices about where their limited time would have maximum impact.
The scope was carefully crafted by The PHP Foundation and OSTIF to target PHP’s most critical attack surfaces – the components that, if compromised, could affect virtually every PHP installation worldwide. This wasn’t arbitrary selection; it was risk-based prioritization at its finest.
High-Priority Targets included components that handle external data or provide foundational functionality:
PHP-FPM: The FastCGI Process Manager that powers most production PHP deployments
MySQL Native Driver: Database connectivity that affects nearly every web application
HTTP header parser and MIME handling: The first line of defense against web-based attacks
JSON parsing: Universal data interchange that touches almost every modern application
OpenSSL integration: Cryptographic operations and secure communications
Password and hashing functions: Core security primitives that protect user data
Key Tasks also included evaluating existing security tooling and building new fuzzers compatible with Google’s OSS-Fuzz infrastructure – investments that would pay dividends long after the audit concluded.

The Attack Model: Thinking Like an Adversary

Quarkslab developed a sophisticated attack model that considered multiple threat scenarios. This wasn’t just about finding bugs – it was about understanding how those bugs could be weaponized in real-world contexts.
The team focused on scenarios where vulnerabilities in PHP core could bypass application-level security measures. This approach ensured they were identifying issues that couldn’t be easily mitigated through better coding practices at the application layer.
Their methodology combined multiple analysis techniques, each with its own strengths:
Static Analysis involved automated tools scanning source code for common vulnerability patterns – buffer overflows, integer overflows, format string bugs. This phase generated thousands of potential issues requiring expert human review to separate genuine vulnerabilities from false positives.
Manual Code Review saw security experts examining the most complex and critical code sections by hand, hunting for subtle logic flaws and design issues that automated tools invariably miss.
Dynamic Analysis and Fuzzing pushed PHP components to their limits with millions of specially crafted test inputs designed to trigger edge cases and error conditions that might never occur in normal usage but could be deliberately triggered by attackers.

The Results: What Two Months of Professional Scrutiny Revealed

When Quarkslab delivered their final report, the numbers told a remarkable story about PHP’s current security posture.
The Overall Picture: 27 total issues identified, with 17 having actual security implications. For a codebase that has been continuously developed for over two decades by hundreds of contributors, this represented a dramatic validation of PHP’s security evolution.
The severity breakdown was equally revealing:
  • 2 high-severity security issues requiring immediate attention
  • 6 medium-severity issues needing fixes but posing lower immediate risk
  • 9 low-severity issues representing edge cases or theoretical vulnerabilities
  • 10 informational findings highlighting improvement opportunities
Four vulnerabilities were serious enough to receive CVE identifiers – the kind that enterprise security teams track and prioritize for patching worldwide.

The High-Stakes Vulnerabilities

CVE-2024-8928: The Mystery High-Severity Issue

The most intriguing finding remains partially shrouded in secrecy. Quarkslab’s public report identifies this only as a high-severity vulnerability with CVE-2024-8928, but notes that “details will be provided after fixes are applied by PHP maintainers. Fixes are complex and in progress.”
This careful handling tells us several important things about both the vulnerability and PHP’s security process. The issue is clearly complex enough that developing a comprehensive fix requires significant engineering effort and extensive testing. The PHP team’s decision to withhold details until a complete solution is available demonstrates mature vulnerability disclosure practices – preventing potential exploitation during the fix development period.
The phrase “fixes are complex” suggests this isn’t a simple input validation bug that can be patched with a few lines of code. It likely involves fundamental components of PHP’s architecture – perhaps memory management, request processing, or another core system where changes require careful consideration of far-reaching effects.

CVE-2024-8929: When Trusted Servers Turn Malicious

This vulnerability represents one of the audit’s most conceptually fascinating discoveries. The issue allows a malicious MySQL server to cause PHP clients to leak partial heap content through a buffer over-read vulnerability in the MySQL Native Driver.
The Technical Reality: The MySQL Native Driver, like most database client libraries, was built on a reasonable assumption – that database servers are trustworthy parties in the communication relationship. When a MySQL server returns query results, it includes metadata about the result set: column names, data types, field lengths, and other structural information that helps the client interpret the data.
The driver uses this server-provided metadata to make decisions about memory allocation and data structure organization. Under normal circumstances, this works perfectly. But a malicious server could send carefully crafted metadata designed to cause the driver to read beyond allocated memory boundaries, potentially exposing sensitive information from other parts of the PHP process’s memory space.
Why This Changes Everything: This vulnerability fundamentally challenges traditional web application threat models. We spend enormous effort securing our applications against malicious users trying to exploit our databases. This vulnerability flips the script – it shows how compromised database infrastructure can attack the applications that depend on it.
Consider the implications in modern cloud environments where database services might be shared among multiple tenants, or in scenarios involving connection pooling where memory from one database interaction might contain sensitive data from another user’s session. The trusted database server becomes a potential attack vector against its own clients.
The Fix Challenge: Resolving this required the PHP team to implement more defensive database client practices – validating server-provided metadata, implementing stricter bounds checking, and ensuring that memory allocation decisions can’t be manipulated by potentially untrustworthy servers. It’s a delicate balance between maintaining compatibility with legitimate MySQL installations while defending against malicious ones.

The Medium-Severity Discoveries

CVE-2024-9026: PHP-FPM Configuration Vulnerabilities

This finding affected PHP-FPM’s handling of configuration values, creating scenarios where attackers might manipulate certain settings in ways that could compromise security or stability. While not immediately exploitable for arbitrary code execution, configuration manipulation vulnerabilities are often the first link in attack chains that combine multiple smaller issues into significant compromises.
The fix required careful analysis of how PHP-FPM processes configuration data and implements additional validation to prevent malicious manipulation of critical settings.

CVE-2024-8925: Cryptographic Key Length Handling

The audit uncovered subtle issues in how PHP’s OpenSSL integration handled key length parameters in certain cryptographic operations. Improper validation could potentially lead to the use of weaker cryptographic parameters than intended, or in some cases, cause crashes or undefined behavior when processing edge-case inputs.
This type of vulnerability illustrates why cryptographic code requires such careful review – small implementation details can have significant security implications, even when the underlying cryptographic algorithms are sound.

The Low-Severity and Informational Findings

The nine low-severity issues primarily involved edge cases that would be extremely difficult to exploit in practice, but the PHP team chose to address them anyway as part of their comprehensive security approach. Many required very specific conditions to trigger and involved rarely-used code paths.
The 10 informational findings provided perhaps the most valuable long-term insights. These weren’t exploitable vulnerabilities but rather observations about code quality, consistency, and areas where future problems might emerge if not addressed proactively.
Memory Management Observations: While PHP’s overall memory management was solid, Quarkslab noted some inconsistencies in how different components handled memory allocation failures and cleanup routines.
Error Handling Variations: The audit revealed that different parts of PHP’s codebase had evolved different philosophies about error handling, which could potentially create scenarios where security-relevant errors are handled inconsistently.
Code Quality Assessment: Overall, Quarkslab praised the quality of PHP’s codebase, noting good documentation, consistent coding standards, and clear evidence of security awareness in recent development work.

The Response: PHP’s Security Process in Action

Watching how the PHP development team responded to Quarkslab’s findings provided a masterclass in mature open-source security management.

Real-Time Collaboration

Rather than waiting for a final report and then scrambling to respond, the PHP security team worked closely with Quarkslab throughout the audit process. This collaborative approach had several crucial advantages:
Immediate Context: When Quarkslab discovered a potential vulnerability, they could immediately explain not just what they found, but how they found it and what exploitation scenarios they had considered.
Iterative Fix Development: As the PHP team developed patches, Quarkslab could validate that fixes actually resolved the vulnerabilities without introducing new issues or missing related problems.
Knowledge Transfer: The ongoing dialogue ensured that PHP maintainers understood not just the specific issues found, but the analysis techniques that discovered them – knowledge that would inform future development decisions.

Comprehensive Fix Strategy

Each security issue received thorough analysis and testing across multiple dimensions:
Root Cause Analysis: Rather than just patching the immediate symptoms, the team worked to understand why each vulnerability existed and whether similar issues might be lurking elsewhere in the codebase.
Regression Prevention: All fixes were validated against PHP’s extensive test suite to ensure they didn’t break existing functionality – particularly crucial in a language runtime where seemingly small changes can have far-reaching effects.
Performance Considerations: Security improvements were analyzed for potential performance impacts to ensure that security gains didn’t come at unacceptable costs to application speed.
Multi-Version Support: Fixes needed to be backported to all supported PHP versions while maintaining compatibility with each version’s specific feature set and constraints.

Mature Disclosure Practices

The handling of vulnerability disclosure demonstrated sophisticated understanding of responsible security practices:
Coordinated Timeline: Security updates were released simultaneously across all supported PHP versions to prevent attackers from reverse-engineering vulnerabilities by comparing patched and unpatched versions.
Clear Communication: Users received comprehensive information about which vulnerabilities were being addressed without providing detailed exploitation information that could be misused.
Ongoing Transparency: The decision to redact details of the most complex vulnerability until fixes were complete showed commitment to user safety over public relations concerns.

Historical Context: The Long Road to Security Maturity

To truly appreciate the significance of these audit results, we need to understand them against the backdrop of PHP’s sometimes turbulent security history.

The Wild West Era: PHP’s Early Security Struggles

I started working with PHP in the early days of PHP1, during what I now think of as the “security learning period.” PHP 4 and early PHP 5 had features that made development incredibly fast but security incredibly fragile. The infamous `register_globals` automatically created global variables from HTTP request parameters – convenient for developers, disastrous for security.
During this era, PHP applications were routinely compromised through attacks that seem almost quaint by today’s standards. SQL injection was epidemic not because developers were unaware of the risk, but because PHP made it so easy to write vulnerable code that many developers never learned secure practices.
The security issues from this period created lasting reputation problems that persist even today. Many of the “PHP is insecure” opinions still circulating are based on vulnerabilities and practices from this era, even though the language has been fundamentally transformed.

The Security Awakening: Learning from Mistakes

The release of PHP 5.3 in 2009 marked the beginning of PHP’s security transformation. The development team had learned hard lessons from the previous era and began making security a priority in language design rather than an afterthought.
This period saw the deprecation and eventual removal of dangerous features like `register_globals`, the introduction of proper input filtering functions, improved default configurations that were secure by default, and comprehensive documentation about security best practices.
However, this transition was challenging because it required existing PHP developers to unlearn ingrained habits and practices. Many applications continued using insecure patterns even as the language provided better alternatives.

Modern PHP: Security as a Design Principle

PHP 7, released in 2015, represented a fundamental maturation of the language’s approach to security. The introduction of scalar type hints, return type declarations, and stricter error handling reduced many categories of vulnerabilities at the language level – making secure code easier to write and insecure code harder to write accidentally.
PHP 8’s union types, named arguments, and match expressions continued this trend of making security a natural consequence of good code rather than something developers had to remember to add separately.

The Audit in Historical Context

Against this evolutionary backdrop, the 2024 audit results are extraordinary. Finding only 17 security issues in a comprehensive examination represents not just improvement but transformation. More significantly, the nature of the vulnerabilities found – complex edge cases, subtle interaction bugs, sophisticated attack scenarios – indicates that PHP has definitively moved beyond the era of obvious security mistakes.
The issues discovered by Quarkslab required professional-grade security expertise to identify and complex technical knowledge to exploit. This is a far cry from the simple configuration mistakes and input validation oversights that characterized PHP’s early security problems.

Lessons for the Broader PHP Ecosystem

While Quarkslab’s audit focused on PHP core, the findings offer valuable insights for everyone building on the PHP platform.

The Cascade Effect of Core Security

When vulnerabilities exist in foundational components, every application built on that foundation inherits those risks regardless of how well the application code itself is written. This creates what security researchers call a “cascade effect” – a single flaw in a core component can potentially affect millions of applications.
The MySQL Native Driver vulnerability perfectly illustrates this. Any PHP application using MySQLi – which includes a significant portion of all PHP web applications – was potentially affected. However, once the vulnerability was fixed in PHP core, all these applications became more secure without requiring any changes to their application code.
This dynamic explains why core security audits provide such exceptional value – they create security improvements that benefit the entire ecosystem simultaneously.

Framework Security Implications

PHP frameworks like Laravel, Symfony, and CodeIgniter provide additional security layers on top of PHP core. The audit findings highlighted several ways framework developers could further strengthen their security postures:
Database Abstraction Layer Security: The malicious server vulnerability raised important questions about how database abstraction layers validate server responses and handle unexpected data structures.
Logging Security Practices: Configuration manipulation vulnerabilities reminded framework developers to carefully validate any data that might be written to logs or configuration files.
Error Handling Consistency: The informational findings about inconsistent error handling in PHP core prompted discussions in framework communities about standardizing their own error handling approaches.

Application Developer Insights

For individual PHP developers, the audit provided several important insights:
Defense in Depth: Many of the vulnerabilities found could theoretically be mitigated through additional defensive programming practices at the application level, even though core-level fixes are preferable.
Trust Boundary Analysis: The MySQL server vulnerability challenged developers to think more systematically about trust relationships in their applications.
Comprehensive Testing: The effectiveness of Quarkslab’s fuzzing and edge-case testing highlighted the importance of thorough security testing in application development.

The Broader Impact: Changing Perceptions and Practices

Enterprise Adoption Momentum

The audit results have been cited in numerous industry reports and technology selection discussions. Several large organizations that had previously avoided PHP due to legacy security perceptions have begun reconsidering their technology strategies based on the audit findings.
More importantly, the audit demonstrated that PHP’s development process includes the kind of rigorous security assessment that enterprise organizations require. The collaborative approach with external experts, comprehensive fix development, and transparent communication all represent best practices in security management.

Academic and Research Recognition

The audit has gained recognition in academic and security research communities. Several computer science programs have begun using the PHP audit as a case study in comprehensive security assessment methodologies, and security conferences have featured presentations about both the findings and the collaborative process that produced them.

Industry Model for Open Source Security

The success of the PHP audit has generated interest from other major open source projects. The collaborative model – where auditors and maintainers work together rather than in opposition – is being studied as a potential template for similar efforts in other critical open source infrastructure.
The economic model is equally important. The combination of foundation funding, government support through the Sovereign Tech Agency, and professional coordination by OSTIF proves that comprehensive security audits can be economically feasible for major open source projects without requiring emergency funding or corporate crisis response.

Looking Forward: Building on Success

The Commitment to Regular Assessment

The PHP Foundation has explicitly committed to making security audits a regular part of PHP’s development cycle rather than a one-time achievement. This represents a fundamental shift from reactive security (responding to discovered vulnerabilities) to proactive security (systematically hunting for vulnerabilities before they’re exploited).
Future audits will likely expand the scope to examine areas that couldn’t be covered in 2024 due to budget constraints – popular extensions like GD for image processing, cURL for HTTP client functionality, and various database drivers that represent significant attack surfaces in real-world applications.

Technical Innovations

The audit process has already sparked several technical improvements that will benefit PHP’s security long-term:
Enhanced Fuzzing Infrastructure: Quarkslab developed fuzzing tools specifically for PHP components, some of which are being integrated into PHP’s regular testing processes to catch potential issues before they reach release.
Static Analysis Improvements: The audit findings are being used to enhance static analysis tools for PHP, helping developers identify similar issues in their own code.
Security-Focused Testing: Security-specific test cases developed during the audit are being integrated into PHP’s continuous integration pipeline to prevent regression of fixed issues.

Community Engagement

The audit has catalyzed increased community engagement with security issues across the PHP ecosystem:
Security-Focused RFCs: Several PHP contributors have begun proposing language features specifically designed to improve security, informed by lessons learned from the audit.
Educational Initiatives: The PHP Foundation is developing educational materials to help developers understand and apply security insights from the audit.
Cross-Project Collaboration: The success of the collaborative model has encouraged more cooperation between different parts of the PHP ecosystem on security issues.

A New Chapter in PHP Security

The 2024 PHP core security audit represents far more than a routine security assessment – it marks a new chapter in PHP’s evolution from a rapid development tool to a mature, security-conscious platform trusted with mission-critical applications worldwide.

The Numbers Tell a Success Story

The final results – 27 issues found, 17 with security implications, 4 serious enough for CVE assignment – tell a remarkable story for a codebase of PHP’s age, complexity, and ubiquity. But the numbers only capture part of the achievement.
More significant is the nature of the vulnerabilities discovered. These weren’t the simple configuration mistakes or input validation oversights that characterized PHP’s early security challenges. Instead, they were sophisticated issues requiring professional security expertise to discover and complex technical knowledge to exploit – evidence that PHP has definitively moved beyond obvious security problems into the challenging realm of advanced security engineering.

The Process as Achievement

Perhaps more valuable than any specific vulnerability found and fixed was the establishment of a collaborative security assessment process that serves as a model for other major open source projects. The partnership between The PHP Foundation, the Sovereign Tech Agency, OSTIF, and Quarkslab created a template for proactive security that balances professional expertise with community collaboration.
The real-time cooperation between auditors and maintainers, the comprehensive approach to fix development, and the mature handling of vulnerability disclosure all represent best practices that other projects are already beginning to adopt.

A Foundation for Trust

The audit established PHP’s security credentials in a way that benefits the entire ecosystem. Enterprise organizations now have concrete evidence that modern PHP meets rigorous security standards. Developers have validation that their choice of PHP as a development platform is backed by professional security assessment and continuous improvement.
Most importantly, the audit created a foundation for ongoing security enhancement. The relationships built during the audit continue to benefit the PHP community. The analysis techniques developed will be applied to future development. The security awareness raised will influence countless future decisions throughout the ecosystem.

The Continuing Commitment

Security is never a destination – it’s an ongoing commitment to vigilance and improvement. The 2024 audit was a significant milestone, but it represents the beginning of a new approach to PHP security rather than the end of security concerns.
The commitment to regular audits, enhanced development processes, and strengthened security culture all represent investments in PHP’s long-term security posture that will serve the community well as the language continues to evolve and face new challenges.
For the millions of developers who build applications on PHP and the billions of users who interact with PHP-powered websites and services, this audit represents more than technical due diligence. It represents a commitment to security that extends from the language’s core to every application built upon it – a commitment validated by independent experts and supported by a mature, collaborative community dedicated to continuous improvement.
The story of PHP’s 2024 security audit is ultimately a story about transformation and responsibility. From a language designed primarily for rapid web development to a mature platform trusted with critical applications worldwide, PHP has evolved not just in features but in its fundamental approach to security. This audit marks a milestone in that evolution and establishes a standard for how major open source projects can approach security in an increasingly complex and threatening digital landscape.

Tags: