PHP and WordPress under attack: how sites get hacked, and how to move to a modern stack
NSA has told every organisation running PHP to prepare for an urgent fix. Here's what we know, the weaknesses attackers exploit most, what to do today, and why a modern React and Next.js architecture removes whole categories of risk.
Key takeaways
- Patch the moment the fix lands. NSA says two critical PHP vulnerabilities can give attackers a path to a server's files or database. If you can't update, NSA advises taking the system offline.
- Most WordPress hacks come from plugins. Security researchers consistently find that over 90% of reported WordPress vulnerabilities are in plugins and themes, not WordPress itself.
- Old PHP versions are the biggest risk. Every version older than PHP 8.2 no longer receives security fixes, and PHP 8.2 itself reaches end of life on 31 December 2026.
- Architecture matters more than any single patch. Pre-rendered React and Next.js sites have no code running on most requests and no uploaded files that can execute, which removes whole classes of attack.
What NSA announced
On 21 October 2026, NSA Cyber advised all organisations using PHP to be prepared for an update addressing two critical vulnerabilities. According to NSA, these vulnerabilities can provide a direct path to the server's file system or database. Where an immediate update isn't feasible, NSA recommends taking affected systems offline until they can be fully mitigated, and says more specific guidance will follow.
What this means in practice
- Known: two critical flaws, PHP-wide relevance, risk of file system or database access, and a recommendation to go offline if you can't patch.
- Not yet published at the time of writing: CVE numbers, affected versions and patched releases. Watch NSA's announcement and php.net for details.
- Assume exposure until proven otherwise if you run any public PHP application, including WordPress, Drupal, Joomla, Magento or custom PHP code.
A flaw with a direct path to files or a database is the worst kind for a website: it can mean stolen customer data, defaced pages, injected malware, or a server quietly turned into part of a botnet.
Why PHP and WordPress are prime targets
Attackers go where the volume is. According to W3Techs, PHP runs roughly three out of four websites whose server-side language is known, and WordPress alone powers over 40% of all websites. One working exploit can be fired at millions of sites within hours.
- A long tail of outdated installations. Many sites still run PHP versions that stopped receiving security fixes years ago, often on shared hosting nobody actively manages.
- A huge plugin ecosystem. WordPress has tens of thousands of plugins written by developers with very different security skills. Each one runs with full access to the site.
- Fully automated attacks. Bots scan the internet around the clock for known vulnerable plugin versions and exposed files. Attackers typically start exploiting within hours to days of a public disclosure.
- Valuable targets. PHP sites often hold customer accounts, orders, payment flows and email systems, and they make good hosts for phishing pages and spam.
Recent major vulnerabilities
The NSA advisory follows a steady run of serious PHP and WordPress flaws. A selection of the most significant:
| When | Affected | Severity | What happened |
|---|---|---|---|
| Oct 2026 | PHP (NSA advisory) | Critical | Two critical flaws with a path to the file system or database. Details pending. |
| Jul 2026 | PHP core CVE-2026-12184, CVE-2026-14355 | High | Flaws in stream handling and the OpenSSL extension that could crash PHP-FPM or corrupt memory. Fixed in the July 2026 PHP releases. |
| Nov 2024 | Really Simple Security plugin CVE-2024-10924 | Critical | Authentication bypass letting attackers log in as any user, including administrators, on a plugin with over 4 million installs. |
| Aug 2024 | LiteSpeed Cache plugin CVE-2024-28000 | Critical | Unauthenticated privilege escalation to administrator on a plugin with over 5 million installs. Exploited in the wild. |
| Aug 2024 | GiveWP donation plugin CVE-2024-5932 | Critical | PHP object injection leading to remote code execution on donation sites. |
| Jun 2024 | PHP on Windows (CGI) CVE-2024-4577 | Critical | Argument injection allowing remote code execution. Exploited within days, including by ransomware groups. |
| Jun 2024 | WordPress.org plugins | Critical | Supply-chain attack: several plugins were updated with malicious code that created rogue administrator accounts. |
| Apr 2024 | glibc iconv, via PHP CVE-2024-2961 | High | A bug in a system library that researchers showed could be turned into remote code execution through PHP's filter features. |
| Apr 2024 | WP-Automatic plugin CVE-2024-27956 | Critical | SQL injection used to create admin accounts and plant backdoors, with millions of attack attempts recorded. |
| Feb 2024 | Bricks Builder theme CVE-2024-25600 | Critical | Unauthenticated remote code execution, mass-exploited shortly after disclosure. |
The pattern is clear: a few flaws in PHP itself, and a constant stream of critical issues in the plugins and themes that sit on top of it.
How attackers actually break in
Behind the headlines, most PHP and WordPress compromises come down to the same handful of weaknesses. Here is how each one works, and how to close it.
1. Outdated PHP and software versions
Most common- How it works
- Attackers identify versions from response headers, file paths and plugin readme files, then use public exploits for known, unpatched flaws.
- Why it happens
- Updates break old themes and plugins, so sites stay frozen on versions that no longer get security fixes.
- Fix
- Run a supported PHP version, update core, plugins and themes weekly, and remove anything you don't use.
2. Vulnerable and abandoned plugins
Critical- How it works
- A plugin exposes an action (often through
admin-ajax.phpor the REST API) without checking who is calling it. Attackers call it directly to change settings, create admins or upload files. - Why it happens
- Missing permission checks and missing nonces (anti-forgery tokens). Plugins run with full privileges and there's no sandbox.
- Fix
- Keep the plugin count low, choose actively maintained plugins, and replace abandoned ones.
3. SQL injection
Critical- How it works
- User input is pasted directly into a database query, so an attacker can change the query to read password hashes, dump customer data or create accounts.
- Why it happens
- Building queries with string concatenation instead of parameters, which is common in older PHP code and plugins.
- Fix
- Always use prepared statements (
$wpdb->prepare()or PDO) and give the database user only the permissions it needs.
4. File uploads that become web shells
Critical- How it works
- An attacker uploads a file that is really PHP code, disguised as an image or document, then visits its URL. The server runs it, giving them full control: a "web shell".
- Why it happens
- In a classic PHP setup, any
.phpfile inside the web folder can be executed, and the uploads folder is writable by design. - Fix
- Validate file types on the server, rename uploads, store them outside the web root or in object storage, and block PHP execution in upload folders.
5. File inclusion and path traversal
Critical- How it works
- Code loads a file based on user input. Attackers swap in paths like
../../wp-config.phpto read secrets, or chain PHP's stream filters to run code. - Why it happens
- PHP's
includeand file functions will open whatever path they're given, including specialphp://streams. - Fix
- Never build file paths from user input. Use a fixed allow-list.
6. PHP object injection
Critical- How it works
- When PHP
unserialize()s data an attacker controls, it can rebuild objects whose built-in methods run automatically. Chained together ("gadget chains"), these can delete files or execute code. - Why it happens
- Storing serialized PHP objects in cookies, form fields or the database, a pattern common in older plugins.
- Fix
- Use JSON for anything that comes from users, never
unserialize()untrusted input.
7. Login attacks
High- How it works
- Bots try leaked passwords against
wp-login.php, usexmlrpc.phpto test hundreds of passwords in a single request, and list usernames from author pages and the REST API. - Why it happens
- The admin login sits on the public website, often protected only by a password.
- Fix
- Enforce multi-factor authentication, rate-limit logins, disable XML-RPC if unused, and put the admin behind single sign-on or an access gateway.
8. Cross-site scripting (XSS) and request forgery (CSRF)
High- How it works
- Attackers plant JavaScript in a comment, form or URL. When an administrator views it, the script runs in their session and can create a new admin or install a malicious plugin.
- Why it happens
- Output that isn't escaped, and actions that don't verify the request came from the real user.
- Fix
- Escape all output (
esc_html(),esc_attr()), verify nonces on every action, and set a Content Security Policy.
9. Misconfiguration and exposed secrets
High- How it works
- Bots look for files such as
wp-config.php.bak,.env,debug.log,phpinfo()pages, open directory listings and database dumps left on the server. - Why it happens
- Manual edits on live servers, backups saved in the web folder, and debug settings left on.
- Fix
- Keep secrets out of the web root, turn off debug output in production, disable directory listing, and lock file permissions.
10. Supply-chain attacks and nulled software
Critical- How it works
- Attackers compromise a plugin developer's account and push a malicious update, or distribute "free" pirated (nulled) premium themes with hidden backdoors.
- Why it happens
- Automatic updates and plugin code run with full trust; pirated software is never checked.
- Fix
- Never install nulled software, review what each plugin does, monitor file changes, and keep off-site backups.
The structural weaknesses behind the bugs
To be fair, PHP itself has improved enormously. Modern PHP 8 with a well-built framework and strict practices can be secure. But the typical PHP and WordPress site has design traits that keep producing the problems above:
- Code runs on every request. Every page view executes PHP with access to the database and file system, so every request is a chance to exploit a bug.
- Executable files live where users can write. Uploads, caches and plugin folders sit inside the web root, which is what makes web shells possible.
- Plugins have no permission model. A contact-form plugin has the same power as the site owner. One weak plugin compromises everything.
- The public site and the admin are the same server. The login page is exposed to the whole internet.
- An endless patching treadmill. PHP, the CMS, every plugin and every theme each need constant updates, and any update can break the site, so updates get postponed.
- Performance problems. Page builders, heavy plugins and database queries on every view make sites slow, which hurts search rankings and conversions and leads to complicated caching setups.
- Hard to test and maintain. Global state, loosely typed legacy code and theme-plugin coupling make changes risky and expensive.
What to do right now if you run PHP
Immediate action checklist
- List every system running PHP: websites, WordPress installs, admin panels and internal tools.
- Check each PHP version against php.net's supported versions.
- Book a maintenance window so you can apply the NSA-referenced update as soon as it's released.
- Take full backups of files and databases, store them off the server, and test a restore.
- If a system can't be patched quickly, take it offline as NSA advises, or put it behind authentication.
- Update WordPress core, plugins and themes, and delete anything inactive.
- Turn on a web application firewall, such as Cloudflare's, to block known attack patterns.
- Enforce multi-factor authentication for every admin account and rotate passwords and API keys.
- Restrict the database user's permissions and ensure the database isn't reachable from the internet.
- Block PHP execution in upload folders and remove backup, debug and config files from the web root.
- Review admin accounts and recently modified files for signs of compromise.
- Follow NSA and php.net for the follow-up guidance and patched versions.
These steps reduce today's risk. They don't change the underlying architecture, and the next critical flaw will start the cycle again.
The modern stack: React, Next.js and Node.js
A modern web architecture separates what visitors see from where content is managed and where data lives. A typical setup looks like this:
- React builds the interface from reusable components, so the whole site is consistent and easy to change.
- Next.js renders those components ahead of time where possible, so most pages are ready-made files served instantly from a global network, and renders on demand only where needed.
- Node.js and serverless functions handle forms, logins, payments and APIs: small, isolated pieces of code instead of one monolith.
- TypeScript catches whole classes of bugs before code ships.
- A headless CMS (or WordPress itself, kept private) gives editors a familiar interface without exposing it on the public site.
- Managed databases and object storage (PostgreSQL, MongoDB, S3-compatible storage) with encryption and backups built in.
- Edge hosting with CI/CD: every change is tested and deployed automatically, and any release can be rolled back in seconds.
Why it's more secure by design
- Nothing to execute on most requests. Pre-rendered pages are plain files. There's no server code to inject into.
- Uploads can't run. Media lives in object storage, separate from application code, so the web-shell attack disappears.
- The admin is off the public site. Editors sign in to the CMS on a separate, protected domain with single sign-on and MFA.
- Safe by default. React escapes output automatically, which blocks most XSS. Modern ORMs use parameterised queries, which blocks SQL injection.
- Dependencies are tracked. Lockfiles and automated scanners flag vulnerable packages and open the fix for you.
- Immutable deployments. The live site can't be edited in place, so an attacker can't quietly modify files, and every release is reproducible.
Side-by-side comparison
| Area | Typical PHP / WordPress | Modern React / Next.js |
|---|---|---|
| Page delivery | PHP and database run on every view | Pre-rendered pages served from a global edge network |
| Attack surface | Core, PHP, every plugin and theme, admin login | Small set of APIs; static pages have nothing to exploit |
| File uploads | Stored in a writable, executable web folder | Stored in object storage, never executed |
| Admin access | Public wp-login.php | Separate CMS with SSO and MFA |
| Extensions | Third-party plugins with full privileges | Reviewed code and managed services with scoped access |
| Updates | Manual, risky, often postponed | Automated tests, preview deploys and one-click rollback |
| Performance | Caching layers to make up for slow pages | Fast by default; strong Core Web Vitals |
| Scaling | Bigger servers, more caching | Scales automatically on the edge |
| Developer experience | Hard to test, global state | TypeScript, components and automated tests |
Modern isn't immune, and we won't pretend it is
No technology is unhackable. Modern JavaScript stacks have had serious issues too:
- CVE-2025-29927 (March 2025): a Next.js flaw that let attackers bypass middleware-based authorisation checks.
- CVE-2025-55182 (December 2025): a critical remote code execution flaw in React Server Components affecting several frameworks, including Next.js.
- npm supply-chain attacks (September 2025): widely used packages were briefly published with malicious code after maintainer accounts were phished.
The difference is in the shape of the risk. There's a far smaller attack surface, fixes ship centrally and are applied with one dependency update and an automated deploy, and there's no marketplace of third-party code running as administrator. Good security still takes discipline: dependency updates, authorisation checks on the server (never only in middleware), code review and monitoring. That's what we build in from day one.
How a WordPress to React migration works
Moving off WordPress doesn't mean starting from scratch or losing what you've built. A well-run migration keeps your content, features and search rankings:
- Audit. Inventory every page, post, plugin, form, integration and URL, and agree on what to keep, replace or retire.
- Choose the content model. Keep WordPress as a private, headless CMS, or move to a modern headless CMS, depending on how your team works.
- Rebuild the front end. Recreate your design, or refresh it, as React components in Next.js.
- Replace plugins with services. Forms become secure API routes, search moves to a fast search index, and shops move to a proper commerce platform.
- Migrate content. Export posts, pages, media and users, then check them page by page.
- Protect SEO. Map every old URL to a 301 redirect, and keep titles, descriptions, structured data and sitemaps.
- Launch safely. Run both sites side by side, switch over in a planned window, and keep a rollback plan ready.
Not ready to migrate yet?
Start with hardening. We can patch, harden and monitor your PHP or WordPress site now, then plan a migration on your timeline.
Sources and further reading
- NSA Cyber: PHP advisory, 21 October 2026
- PHP: Supported versions
- OWASP Top 10 web application security risks
- WordPress: Hardening WordPress
- W3Techs: Usage statistics of PHP · WordPress
- Patchstack: WordPress vulnerability research
- NVD vulnerability records: CVE-2024-4577 · CVE-2024-2961 · CVE-2024-25600 · CVE-2024-27956 · CVE-2024-5932 · CVE-2024-28000 · CVE-2024-10924 · CVE-2026-12184 · CVE-2026-14355 · CVE-2025-29927 · CVE-2025-55182
This report reflects publicly available information as of 21 October 2026 and is general guidance, not a security audit of your systems. NSA has said more specific guidance will follow; always check official sources for the latest details.
Worried about your PHP or WordPress site?
We'll review it, tell you honestly where you stand, and help you patch now or move to a modern, secure stack.