Skip to content
Introducing AI OS for Business & School — our most powerful products yet.Explore →
App Corp iconApp Corp
CMS
Headless WordPress
WPGraphQL
Next.js

Headless WordPress Isn't Enough: PHP Risk Remains

Headless WordPress Isn't Enough: Why Decoupling Doesn't Remove PHP Risk

AE

App Corp Engineering

Editorial Team

October 29, 202611 mins read
11 mins readRead time
1,197Words
Oct 2026Published

This free scan includes a PHP2Shell runtime check

Fixed in 8.5.12, 8.4.27, 8.3.36, 8.2.35. Reviewed 27 October 2026.

What to do now
App Corp Engineering·Editorial Team
Last updated 2026-10-29

What is Headless WordPress Isn't Enough?

Headless WordPress is an architecture where WordPress handles only content editing and storage while a separate front end, often Next.js, fetches content through the WP REST API or WPGraphQL. Decoupling does not remove PHP from the stack: the WordPress origin still runs the PHP interpreter, so vulnerabilities like PHP2Shell, tracked as CVE-2026-109618 and CVE-2026-109619, remain exploitable unless the origin is patched or taken off the public internet.

Headless WordPress, meaning WordPress as a back end with Next.js, Gatsby or Astro as the front end, still runs PHP. The WordPress server, its admin, its REST or GraphQL API and its plugins are all exposed to PHP2Shell unless they are patched or isolated. Decoupling does reduce public attack surface when the front end is static and the WordPress origin is locked down, but many headless setups do not lock it down. Headless WordPress often doubles the stack: you maintain PHP, WordPress, plugins and a JavaScript front end. If you already run a Next.js front end, moving the back end to Payload CMS, a TypeScript-native CMS that runs inside Next.js, removes PHP entirely and simplifies your architecture.

What headless WordPress is and why teams chose it

In a headless or decoupled setup, WordPress is used only for content editing and storage, and a separate front end, often Next.js, fetches content through the WP REST API or WPGraphQL and renders the public site. Teams chose it for good reasons: performance, with static or ISR pages served from a CDN; developer experience, with React and TypeScript on the front end; familiarity, because editors keep using the WordPress admin; and security in theory, because the public site no longer exposes WordPress directly. That last point is where the PHP2Shell reality check comes in. Decoupling changes which servers are reachable from the public web, but it does not change what runs on the WordPress origin, and that is precisely the layer PHP2Shell attacks.

Where PHP2Shell hits a headless setup

PHP2Shell, meaning CVE-2026-109618 and CVE-2026-109619 rated 9.2 on CVSS v4.0, lets an unauthenticated attacker achieve remote code execution or read process memory on any PHP installation serving web requests. The exploit runs before any application code, so it does not matter whether WordPress is rendering themes or only serving JSON. In a typical headless deployment the following remain reachable: /wp-json or /graphql, because the front end needs it at build or request time; /wp-admin and /wp-login.php, because editors need to log in; xmlrpc.php, often left enabled; media URLs served from wp-content/uploads on the WordPress domain; and preview endpoints for draft preview, which are often unauthenticated routes. If your WordPress back end sits on a public hostname such as cms.example.com or wp.example.com, attackers can find it through DNS, certificate transparency logs or your front end's network calls. Wiz demonstrated PHP2Shell against a default WordPress container, and a headless back end is still a default WordPress install underneath.

mermaid
flowchart LR
  V[Visitor] --> CDN[CDN and Next.js static pages]
  CDN -->|build or ISR fetch| API
  A[Attacker] -->|direct requests| API
  subgraph WP[WordPress origin: PHP]
    API[/wp-json and /graphql/]
    ADM[/wp-admin and wp-login.php/]
    XML[/xmlrpc.php/]
    UP[/wp-content/uploads/]
  end
  A --> ADM
  A --> XML

The data is still there

Memory disclosure through PHP2Shell can expose passwords, tokens, API keys and certificates from other users' requests. In a headless setup that often includes application passwords or JWT secrets used by the Next.js front end, preview secrets, webhook secrets that trigger front-end rebuilds, and database credentials. An attacker who reads those can tamper with content that your secure static front end then faithfully publishes, which defeats the main security argument for decoupling in the first place. The double-stack problem compounds the risk. Headless WordPress often trades one maintenance burden for two: you maintain the PHP runtime, WordPress core, and plugins including WPGraphQL, ACF, ACF-to-GraphQL, JWT auth and preview plugins, often more plugins than a traditional install, alongside a Node.js or Next.js front end with its npm dependencies, two hosting environments, two auth systems, and manual or codegen schema sync between WordPress fields and TypeScript types. The headless architecture brought modern front-end benefits, but kept every PHP-era risk.

If you stay headless: a hardening checklist

Staying headless for now is reasonable while you plan, and three tiers of work make it far safer. Immediately: patch PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 and restart workers, following the PHP2Shell Emergency Checklist, and rotate all secrets shared between WordPress and the front end, including application passwords, JWT, preview and webhook secrets. This week: take WordPress off the public internet by putting the admin and API behind a VPN, zero-trust access such as Cloudflare Access or Tailscale, or an IP allowlist limited to your build system and editors; serve media from a CDN or object storage rather than the WordPress origin; disable xmlrpc.php, REST endpoints you do not use, user enumeration through /wp-json/wp/v2/users and GraphQL introspection in production; use static generation so the front end does not need runtime access to WordPress; and apply PHP's interim hardening by setting session.upload_progress.enabled to zero, lowering post_max_size and adding proxy request limits. This quarter: reduce plugins to the minimum, add server-level monitoring for PHP processes spawning shells, and decide whether to replace the back end. Headless WordPress that is fully locked down is much safer than a public one, but a CMS you have to hide is a CMS that is working against you.

Warning

Take WordPress off the public internet: put the admin and API behind a VPN, zero-trust access or an IP allowlist, and serve media from a CDN or object storage.

Headless WordPress vs Payload CMS

If you already run a Next.js front end, Payload CMS is the natural next step. Since Payload 3.0 it installs directly into your Next.js app, so the admin, APIs and front end share one TypeScript codebase, one deployment and one auth system. Headless WordPress runs PHP plus Node; Payload runs Node only. Headless WordPress is exposed to PHP2Shell; Payload is not. The content model in WordPress is defined in the admin UI with ACF, while Payload's is typed config in code, version-controlled. Front-end types come from GraphQL codegen in headless WordPress, whereas Payload generates them automatically from config. Data fetching in Next.js uses HTTP calls to WordPress in the headless setup; with Payload, server components query content in-process through the Local API, fully typed from generated types. Live preview is a plugin plus custom wiring in WordPress and built into Payload. Access control is roles plus plugins versus function-based access control at field level. Deployments drop from two to one, and the database moves from MySQL to PostgreSQL or MongoDB. The Local API is the biggest practical win: there is no public API you are forced to expose, no API token to leak, and no schema drift. Payload also has strong backing, because Figma acquired the project in June 2025, and the full trade-off is covered in the Payload vs WordPress comparison.

ts
import { getPayload } from 'payload'
import config from '@payload-config'

export default async function Post({ params }: { params: Promise<{ slug: string }> }) {
  const { slug } = await params
  const payload = await getPayload({ config })
  const { docs } = await payload.find({
    collection: 'posts',
    where: { slug: { equals: slug } },
    limit: 1,
  })
  const post = docs[0]
  return <Article post={post} />
}

Migrating from headless WordPress to Payload

Headless sites are often the easiest WordPress sites to migrate, because the front end already exists. Keep your Next.js front end; components, routes and styling mostly stay. Recreate the content model in Payload, where ACF field groups map cleanly to Payload fields. Swap the data layer by replacing WPGraphQL or REST queries with Payload's Local API, and types come for free. Import content with an idempotent script from the WP REST API, move media to S3, R2 or Supabase Storage, and recreate preview and webhooks using Payload's built-in live preview and hooks. Then decommission WordPress and delete the PHP origin entirely. The full seven-phase process, including SEO preservation and cutover, is set out in How to Migrate from WordPress to Payload CMS. Running custom PHP applications next to your CMS is a separate problem with its own playbook in Replacing Legacy PHP Applications with TypeScript and Node.js.

Sources and references

SOCRadar documented PHP2Shell CVE-2026-109618 and CVE-2026-109619 at socradar.io, and Wiz Research published its research at wiz.io/blog/php2shell-php-rce. Recorded Future analysed exploitation at recordedfuture.com/blog/php2shell-vulnerability-exploitation. The WordPress REST API Handbook lives at developer.wordpress.org/rest-api, and WPGraphQL documentation is at wpgraphql.com/docs. Payload CMS documentation covering the Local API, live preview and access control is at payloadcms.com/docs, CMSWire covered the Figma acquisition at cmswire.com, Next.js documentation is at nextjs.org/docs, and Patchstack's State of WordPress Security report is at patchstack.com/whitepaper/state-of-wordpress-security-in-2025.

Headless WordPress vs Payload CMS

ConcernHeadless WordPressPayload CMS
RuntimePHP plus NodeNode only
Exposed to PHP2ShellYesNo
Content modelWordPress plus ACF, defined in the admin UITyped config in code, version-controlled
Types for the front endCodegen from GraphQLGenerated automatically from config
Data fetching in Next.jsHTTP calls to WordPressLocal API: direct, typed, no network hop
Live previewPlugin plus custom wiringBuilt in
Access controlRoles plus pluginsFunction-based, field level
DeploymentsTwoOne
DatabaseMySQLPostgreSQL or MongoDB

Payload replaces the PHP back end, the GraphQL hop and the codegen step with a single Next.js app, a typed Local API and one deployment.

Conclusion

Decoupling the front end was a good move, but it left the PHP-era risks in place behind the CDN. Patch PHP, rotate shared secrets and lock down the WordPress origin now, then treat PHP2Shell as the moment to finish the job: with your Next.js front end already in place, swapping the back end to Payload CMS is a contained data-layer change rather than a rebuild. App Corp runs headless-WordPress-to-Payload swaps on its pre-built path, mapping ACF fields to Payload collections and decommissioning the PHP origin, with full re-architecture available when the front end needs a refresh too.

Frequently Asked Questions

Key Takeaways

  • Headless WordPress still runs PHP: the back end server, admin, REST or GraphQL API and plugins are exposed to PHP2Shell unless patched or isolated
  • Decoupling reduces public attack surface only when the front end is static and the WordPress origin is locked down, which many setups never do
  • Headless WordPress often doubles the stack: PHP, WordPress and plugins alongside a JavaScript front end, two hosting environments and two auth systems
  • Memory disclosure through PHP2Shell can expose application passwords, JWT secrets, preview and webhook secrets that your static front end depends on
  • If you already run a Next.js front end, moving the back end to Payload CMS removes PHP entirely and collapses the architecture to one app
Ready to migrate?

Order a WordPress to Payload CMS migration

If this series convinced you to move off WordPress, order the migration directly on Contra. A fixed-scope engagement covering the site rebuild, content and media migration, technical SEO foundations, testing, and handover — delivered by the same engineering team that wrote these guides.

$250 fixed priceUp to 3 weeks deliveryUp to 10 pages migrated
Order on Contra

We value your privacy

We use strictly necessary cookies to keep our site secure and functional. With your consent, we also use performance cookies to understand how you interact with our site, and functional cookies to remember your preferences. Read our full Cookie Policy