Static vs Dynamic Websites: Which Is Safer?

By: Irina Shvaya | October 23, 2026
PHP2Shell, October 2026: two critical flaws in PHP itself (CVE-2026-109618 and CVE-2026-109619) were fixed on 21 October 2026 in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. Any site running on PHP needs the server updated. See our PHP2Shell Resource Center.

As of 23 October 2026, PHP2Shell has been fixed in the PHP engine, and owners of dynamic PHP sites have spent the week updating PHP and restarting servers. A purely static site, made of prebuilt files served from a content delivery network, had no PHP on its public server to patch. So static is safer in one specific way: it runs far less code where attackers can reach it.

That doesn't make static automatically safe, or dynamic automatically risky. Most business sites need something that runs on a server: a contact form, site search, a booking tool, a checkout or a place for staff to edit content. Each of those brings back server code that someone has to patch. And a headless site, with a static frontend and a CMS backend, still runs that backend somewhere.

This guide explains the difference in plain terms, what PHP2Shell showed about each approach, what still needs a server on a "static" site, how headless fits in between, and who should choose which.

Key Takeaways

  • A static site serves prebuilt files, so no application code runs on the public server when someone visits a page. That removes a whole class of flaws, including engine flaws like PHP2Shell, for those pages.
  • Vendor claims about static security are real but narrow. Netlify says static edge content offers "no active processes or surface area for attack"; that covers prebuilt files, not functions, forms or accounts.
  • "Static" hosting often includes server code. Cloudflare Pages Functions, for example, "deploy server-side code to enable dynamic functionality."
  • A headless WordPress or Drupal backend still runs PHP and needed the PHP2Shell fix like any other PHP server. A static frontend doesn't patch the backend.
  • Switching architecture is not an emergency fix. If you run PHP today, patch it and restart it first, then plan any change.

Static, Dynamic and In Between: Plain Definitions

  • Static site. Every page is built ahead of time into ordinary files (HTML, CSS, JavaScript, images) and served as is. Visiting a page reads a file; no program on the server builds the page for you.
  • Dynamic site. Pages are built on the server each time someone visits, usually from a database. WordPress, Drupal, Joomla and Magento work this way in their standard setup, and the code that builds the page runs on PHP.
  • Headless or hybrid site. The content lives in a CMS (the "backend"), and a separate frontend displays it. The frontend may be fully static, rendered on a server, or a mix. Our comparison of headless and traditional CMSs covers the business side.

Attack surface is the term security people use for everything on a site that an attacker can reach and send input to. The basic security difference between static and dynamic is the size of that surface.

Why Static Sites Expose Less

When a page is a prebuilt file, there is no login form on the page to guess, no database query to manipulate and no runtime processing each request. OWASP's attack surface cheat sheet recommends exactly this kind of reduction: "turning off features and interfaces that aren't being used" and "not storing confidential data that you don't absolutely have to."

Static hosting vendors make the case strongly, and their claims should be read as vendor claims:

  • Jamstack.org, a site run by Netlify, says static architecture means "fewer servers and systems to harden against attack" and "read-only hosting reducing attack vectors even further."
  • Netlify's security page says "content deployed to the edge nodes is fully prerendered and static, offering no active processes or surface area for attack." That is accurate for prebuilt files on its edge network. The same page lists "Application architecture," "Data handling" and "Authentication mechanisms" as customer responsibilities.

Both points hold at once. The static files are a very small target. Everything you add around them, such as functions, forms, a build pipeline, third-party scripts and team accounts, is still surface you own.

What PHP2Shell Showed About Each Approach

PHP2Shell is two critical flaws in the PHP engine that can allow unauthenticated remote code execution. On a dynamic PHP site, the flaw sat on every page request, because every request reached PHP. The fix was the same for every PHP site regardless of CMS: install a patched PHP build and restart every PHP worker. Updating WordPress, Drupal or a plugin didn't help. Our PHP2Shell guide for WordPress shows that process for the most common case.

A static site with no PHP anywhere had nothing to patch. But three patterns showed where "static" stops protecting you:

  1. A PHP backend behind a static frontend. A headless WordPress or Drupal site still runs PHP for its CMS. That server needed the fix like any other.
  2. PHP behind a protective network. Vercel's PHP2Shell bulletin says its firewall rules covered "PHP functions deployed on Vercel" and "Requests Vercel rewrites or proxies to external PHP backends," but that "Requests that bypass Vercel's network, including direct requests to an external PHP backend, are not covered." It told customers to "Upgrade the PHP runtime to a patched release immediately, regardless of WAF protections or hosting provider."
  3. Custom PHP beside a hosted platform. BigCommerce said it patched its own services, then told merchants: "If you run your own PHP applications, please review any custom PHP solutions... and apply the PHP patches as soon as possible."

So the PHP2Shell question for a static or headless site is simple: does any part of it, including the CMS, a form handler or an integration, run on PHP? If yes, that part needed patching.

What Still Needs a Server on a "Static" Site

Most business sites need at least one of these. Each brings server code back, whether you run it or a vendor does.

FeatureWhere the server code usually runsWhat you need to watch
Contact and quote formsA serverless function, the host's form service or a third-party form toolSpam and abuse limits, where submissions are stored, who can read them
Site searchA hosted search service or a functionAPI keys exposed in the browser, what data is indexed
Content editing (CMS)A headless CMS, hosted by a vendor or on your own serverAdmin logins, two-factor authentication, patching if self-hosted
Logins and member areasAn authentication service or your own functionsNetlify, for example, lists "Authentication mechanisms" as the customer's job
Checkout and paymentsA payment provider, often in an embedded framePayment-page scripts fall under PCI DSS 4.0 requirements
Previews and server renderingThe host's functions or edge runtimeFramework updates, as React2Shell showed

Hosting platforms reflect this. Cloudflare's Pages documentation describes "Pages Functions" that "deploy server-side code to enable dynamic functionality," and now tells new projects to start with Workers, its broader application platform. Vercel's shared responsibility page says PCI customers "are responsible for choosing an appropriate payment gateway provider to integrate an iframe." If you take card payments, our guide to PCI DSS 4.0 website requirements covers the script rules that apply on any architecture.

Server-rendered JavaScript has its own engine-level risk. In December 2025, React disclosed React2Shell (CVE-2025-55182), "an unauthenticated remote code execution vulnerability in React Server Components" rated CVSS 10.0. CISA added it to its Known Exploited Vulnerabilities catalog on 5 December 2025. Vercel's advice then matched its PHP2Shell advice: "do not rely on the WAF for full protection. Immediate upgrades to a patched version are required."

Static, Dynamic and Headless Side by Side

QuestionStaticDynamic (traditional CMS)Headless
Code running on the public server per page viewNone for prebuilt pagesYes, on every requestDepends on the frontend; the CMS runs separately
Runtime to patch (for example, PHP)None for pages; functions run on the host's runtimeYes, plus the CMS and pluginsThe CMS backend, and the frontend framework if server-rendered
Public admin loginNone, unless you add a CMSUsually yesOn the CMS backend, which can be restricted
Main risksBuild pipeline, dependencies, forms and functions, accountsUnpatched runtime, CMS and plugins; stolen loginsBoth sets, plus the API between them
Editing for non-technical staffHarder without a CMSEasyEasy, through the CMS
PHP2Shell action neededOnly if some part runs PHPPatch PHP and restartPatch the PHP backend and restart, if PHP-based

Headless as the Middle Path

Headless lets editors keep a familiar CMS while visitors get a static or mostly static frontend. It can shrink what the public sees. It doesn't remove the backend, and it adds an API between the two halves. Our headless and custom website security guide covers the frontend side in detail: dependencies, secrets and API routes. On the CMS side, using WordPress as the example, the official documentation sets a few limits worth knowing:

  • Don't switch off the REST API. The REST API is how a headless frontend reads WordPress content. The REST API FAQ says "You should not disable the REST API; doing so will break WordPress Admin functionality."
  • Require authentication if content isn't public. The same FAQ says "You can require authentication for all REST API requests by adding an is_user_logged_in check to the rest_authentication_errors filter." A developer should make that change.
  • Use the right credentials for the frontend. WordPress has shipped Application Passwords since version 5.6, and the authentication docs say they are sent "over https:// using Basic Auth."
  • Patch the backend as a real server. A CMS backend that only editors use is still a PHP server, and PHP2Shell didn't require a login.

Hosted headless CMS products shift backend patching to the vendor, the same way hosted website builders do. Self-hosting a headless WordPress or Drupal backend keeps it with you or your host. If you are weighing a headless build, our headless CMS development team plans both halves together.

Who Should Choose Which

Your situationOften a good fitWhy
Brochure site that changes a few times a yearStaticLittle server code to maintain; edits can go through a developer
Staff edit content weekly and no one patches serversDynamic CMS on a managed host, or a hosted builderThe host or vendor patches the runtime
Large content site with a developer teamHeadlessSmaller public surface, but only if the team owns both halves
Store with many integrationsHosted commerce platform or a well-maintained dynamic storeCheckout code is complex; patching ownership matters more than architecture
Site with logins, member data or regulated informationWhichever option has a clear, written owner for every server componentLogins and data bring back server code on any architecture

Static and headless builds trade an admin panel and a runtime for a build pipeline and a dependency tree. That is a better trade only if someone will watch those too. Our guide to the most secure way to build a website compares languages and stacks on the same terms.

Switching Is Not This Week's Fix

If your site runs on PHP, the PHP2Shell fix is a patched PHP build and a restart, and it takes far less time than a rebuild. Moving to static or headless can be a sound decision for the next version of your site, but it should come after the patch, with a plan for content editing, forms, redirects and search rankings. Our secure website rebuild planning guide covers how to scope that work.

Conclusion

As of 23 October 2026, static sites are safer in one clear way: prebuilt pages run no application code on the public server, so engine flaws like PHP2Shell have nothing to hit there. But forms, search, logins, checkout and any CMS backend bring server code back, and a headless backend still needed the PHP2Shell fix like any PHP server. Choose the architecture whose remaining server parts you can name an owner for. If a PHP server sits anywhere in your setup and you're not sure it was patched and restarted, our emergency PHP patching team can check it with you. Every PHP2Shell guide is in our PHP2Shell Resource Center.

Frequently Asked Questions

Are static websites immune to hacking?

No. Prebuilt pages remove a lot of server-side risk, but a static site can still be compromised through its hosting account, its build pipeline, a vulnerable dependency, a third-party script or a function that handles forms. Netlify's own security page lists authentication and application architecture as customer responsibilities.

Did PHP2Shell affect static sites?

A static site with no PHP anywhere had nothing to patch for PHP2Shell. A static frontend backed by a PHP CMS, or a site that sends forms or other requests to a PHP server, did need that server patched and restarted.

Is a headless WordPress site safe from PHP2Shell?

Not automatically. The frontend may be static, but the WordPress backend still runs on PHP, and PHP2Shell didn't require a login. The backend needs a patched PHP build and a restart, like any WordPress server.

Is a dynamic website less secure?

It has more surface to look after, but a well-maintained dynamic site on a supported, patched runtime with few plugins is a reasonable choice. The risk comes from unpatched runtimes, outdated plugins and weak logins, which are all fixable.

Does a firewall or CDN in front of my PHP site replace patching?

No. Vercel's PHP2Shell bulletin says its rules "do not replace patching" and don't cover direct requests to a PHP backend. The PHP project and national cyber agencies give the same advice: update PHP, and the PHP project adds that every worker must be restarted.

Should I rebuild my site as static because of PHP2Shell?

Not as an emergency response. Patch PHP first. A static or headless rebuild can make sense later if your content changes rarely or you have a developer team to own the build pipeline and dependencies.

Can a static site still have a contact form?

Yes, but the form submission has to go somewhere that runs code, such as a serverless function, your host's form service or a third-party form tool. That piece needs the same care as any server code: spam limits, secure storage and someone keeping it updated.

Put this into action with eSEOspace

We help businesses grow with maintenance & support that actually performs. Explore the services behind this guide:

Book a free strategy call →

Get a FREE Audit

We'll perform a comprehensive SEO, AEO, GEO & CRO audit of your website — completely free — and show you exactly how to outrank your competitors.

Don't have a site yet? Get in touch →

Get a FREE GEO/AEO/SEO Audit

We'll analyze your site's SEO, GEO, AEO & CRO — completely free — and show you exactly how to get found across Google and AI answers.

Don't have a site yet? Get in touch →

You Might Also like to Read