On Thursday, PHP version 8.6 was released on its usual yearly schedule, popping up as if the web scripting language hadn’t been under intense scrutiny this past month. For those who missed it: a swarm of unearthed vulnerabilities has plagued PHP since October, allowing unauthenticated attackers to crash PHP workers or execute arbitrary code on the server. Users of every PHP-based application, including WordPress, Laravel, and Symfony, had to scramble to update their PHP instances. The PHP core development community, along with the PHP Foundation, responded with a coordinated release of patched versions of PHP (8.5.13, 8.4.28, 8.3.37, 8.2.36 and the new 8.6) that closed seven critical remote code execution (RCE) flaws in one sweep. In addition to patching specific exploitable holes in the PHP engine, the new version of PHP also tamps down some of PHP’s historically liberal configuration settings. Lucky for PHP, and for the rest of us, core developer Jörg Sowa called out these lax settings in June, when he posted a proposal to set more security-friendly defaults. Sowa saw that three configuration settings of PHP’s session extension – Strict Mode, HttpOnly, and SameSite – were designed to boost security but shipped “with defaults that leave applications unnecessarily exposed.” No cookies for impostors In a retrospective posted last month, the PHP Foundation admitted that consensus-driven gridlock had stalled complex fixes for months and vowed to get patches out the door sooner, should the vulnerabilities leak ahead of the agreed-upon deadline. Code-wise, Sowa’s proposal to harden PHP settings was accepted for PHP 8.6. These changes won’t stop the flood of AI-generated CVEs, but at least these holes will be more difficult to exploit. For Strict Mode, PHP will no longer accept uninitialized session IDs that it didn’t create itself. Before, an attacker could just plant a made-up session ID on the victim to gain entry. “The built-in files handler checks whether a session file for that ID exists on disk; because an attacker-planted ID has no corresponding file, a fresh random ID is generated instead,” Sowa wrote. Furthermore, PHP will now, by default, add the HttpOnly flag to its session Set-Cookie header, blocking client-side JavaScript from reading the session ID, which could otherwise be stolen to masquerade as the user. Believe it or not, any script on the page could read it before. Finally, the server will withhold session cookies on cross-site POST requests, as well as for subrequests and iframes. “Without it, a forged form or link on an attacker-controlled site can trigger authenticated requests using the victim’s session,” Sowa wrote. Going forward, cookies will only be sent on same-site requests and top-level GET navigations, such as clicking a normal link. Collectively, these changes should thwart session hijacking and cross-site request forgeries. They won’t stop remote code execution hacks, though they will make it a lot more difficult for attackers to gain entry. The new release brings some other security-minded changes as well. The PHP engine will be a lot stricter when it encounters strings with null values (“\0”). In many cases, it will now throw an error rather than silently letting it pass. Null values are a favored trick for triggering RCEs. A C function will treat the null value as the end of the string, processing everything before the null byte and ignoring everything after, much to an attacker’s delight. Continuing in this spirit of “if you see something, say something,” a number of other PHP functions will also no longer remain silent when things go awry. Operations for closing a file or copying data, for instance, will explicitly return a false value when terminating prematurely or failing, an alert developers could use to minimize data integrity bugs. Beyond security, PHP 8.6 also comes with a number of new goodies. PHPers are abuzz over Partial Function Application (PFA), which will let them pre-fill some of a function’s arguments to generate a reusable closure on the fly — leapfrogging JavaScript in this ability. The new edition also gets a native polling API, which will be handy for event-driven networking; a stopwatch-like Duration class that can track elapsed time across more than 250 years; and a clamp() function to ensure a given value stays within an acceptable range. Another tricky day for PHP devs For administrators, this PHP update round may be a bit of a shambles. As backend software engineer Rajekevin Dourepoulle notes in a blog post, these changes will take effect post-installation only if the configurations aren’t specified elsewhere, such as in an application, framework, or even another php.ini file – all of which can override the PHP settings themselves. “In practice: if your deployment reuses the old php.ini (an Ansible template, a COPY php.ini in a Dockerfile, a file copied from server to server), you move to 8.6 and gain nothing, because the explicit session.use_strict_mode = 0 line overrides the new default,” he wrote. Despite all these heroic efforts, PHP remains the champion of inscrutability. ®
The next version of the C++ programming language may be delayed at the last minute due to a dispute over a security-enhancing Contracts feature. Contracts have deeply split C++ technical maintainers. One group backs the C++ creator Bjarne Stroustrup, who is against the technology in its present form in grounds it was hastily implemented. But others are eager to see Contracts implemented, even arguing the tech's detractors are poisoning the C++ development process itself. The disagreement boiled over just before a vote to ratify the new version of the language. In October, the Draft International Standard (DIS) of C++26 failed its ISO ballot — the next-to-last stage in the International Organization for Standardization’s approval process during which a standard's technical details are formally ratified by a set of national standards bodies. The ballot saw 13 votes cast in favor, 9 against, and 12 abstentions, failing to meet the ISO requirement of having no more than 25 percent negative votes. Contracts was the major sticking point for those voting nay. Contracts dispute Contracts allow developers to add preconditions and postconditions to code, as well as assertions that check whether specified conditions hold. Such checks can help catch programming errors that might otherwise lead to undefined behavior. Design by Contract has long been a feature of languages like Ada and Eiffel. Developers have proposed adding Contracts to C++ for at least a decade, after when they were abruptly yanked from C++20 owing to concerns over dangerous defaults. But Stroustrup roasted the revised proposal (P2900) that made it into C++26. “The P2900 contracts and extensions aim to change the nature of C++ and are an existential threat to C++, adding complexity and bloat,” Stroustrup and his colleagues wrote in a paper last August. They noted that the implementation is messy, outdated, not sufficiently tested, and could be more effectively implemented as a library. Not everyone agrees. Andreas Fertig, a member of the C++ standardization committee, feels that the criticisms have already been vetted and that vetoing the proposal this late in the C++ release process is damaging to C++ itself. “The topic has been worked on for years and has received a majority vote multiple times in its current form. By voting ‘no,’ an established system, one based primarily on trust and respectful collaboration, has been shaken,” Fertig wrote in a blog post. The elephant in the room is, of course, the ongoing criticism of how easy it is for developers to accidentally create security holes in C++, leading more than a few projects to adopt Rust. Adding controls might, as Stroustrup notes, hamper C++’s chief attribute of being a blazing-fast language. Sore losers Fertig accused Stroustrup and Co. of being sore losers. “Every ISO standard is simply a set of compromises. Everyone loses sometimes, and everyone wins sometimes,” he wrote. But in this case, “the losing parties refused to accept their loss. The question that primarily determines how to move forward is whether the group can rebuild trust." Unlike Fertig, Harry Bott, CEO of the C++ Alliance – which maintains the open source EDG C++ compiler front end – does not see the Contracts discussion as disruptive to C++ itself. “The draft being sent back isn’t a failure of the process—it’s the process working as intended,” he wrote to The Register by email. “That doesn’t mean the process can’t improve. The goal should be to learn from this and strengthen the process so C++ can continue to evolve in a way developers can rely on.” Where to now? With the ballot failing at this late point of the standardization process – a rarity in C++ history – the language risks missing its expected shipping date of this year. That outcome may force everyone to refer to the new version as “C++27” rather than C++26. (That’s only the informal name; the official name of this eighth version of the language, should it be released next year, would be “ISO/IEC 14882:2027.”) ISO C++ working group WG21 is meeting next week in Búzios, Brazil, for the confronto final. According to a blog post from Thibault Ricord-Marchal, a software engineering consultant at the Paris-based Margo consultancy, the group faces a number of choices. They can carve Contracts out of the spec so the rest of C++26 can ship. That will be messy work, though. The undo button has to be smashed on a lot of library hardening already done using Contracts. Another option is moving Contracts into a separate technical specification, where work can continue to refine the technology. Or they could do a minor revision, vote again and hope the balmy Brazilian weather chills everyone out.®