By framework

Security by framework — defenses specific to the stack you use

Security hardening guides for WordPress, Laravel, Next.js, Spring and more: each framework's dangerous defaults, the weak spots most often hit, and the fixes.

Published 2026-07-02 Updated 2026-10-06 9 min read
On this page

"Laravel security," "WordPress hardening" — when we search, we look for answers per technology. This page is the entry point to per-framework defense (no attack steps).

Shared (same on every framework)

access control, secrets, injection, dependency CVEs, misconfiguration. The basic defenses are shared too.

Framework-specific (each chapter)

the "dangerous defaults" and "the spot most often targeted." This is the only part that differs by technology.

Whatever the framework, the 'weakness types' are shared — only the dangerous defaults and the targeted spot differ.

Weakness types shared by every framework

The big picture first. These types are targeted over and over regardless of technology; each framework chapter explains how they show up in that technology.

Access control
auth ≠ authz, IDOR, exposed admin panels (the top source of incidents)
Secrets
.env/key exposure, plaintext storage, committed to Git
Injection
SQLi, XSS, template/command injection
Dependency CVEs / misconfig
unpatched known flaws, production debug, dangerous defaults

Guides by framework

Read the chapter for your stack. Each goes "default dangers → most-targeted spot → hardening steps."

1

WordPress

The largest share makes it the biggest target. The main ways in: plugin/theme vulnerabilities, skipped updates, weak admins, exposed admin panels. → WordPress security
2

Laravel

Defaults are solid, but incidents come from operations. The big three: .env exposure, APP_DEBUG=true in production, missing authorization (auth ≠ authz / Mass Assignment). → Laravel security
3

Next.js

The server/client boundary, env-var exposure, and dependency CVEs are the key points. → Next.js security
4

Java / Spring

Dependency CVEs (Log4Shell-class), Actuator exposure, authorization config, and deserialization. → Spring Boot security
5

Other frameworks

Server-side: Express (Node.js) · Ruby on Rails · Django · ASP.NET Core. Each follows "default dangers → targeted spot → hardening steps."

Settings to check first in production (quick table by framework)

On every framework, check two things first: whether production shows detailed errors, and where your secrets live. The setting names differ, so find your row below. Names were checked against each project's current official docs (version in the last column).

FrameworkTurn off detailed error pagesWhere secrets live, and the catchOften-missed settingDocs checked
WordPressWP_DEBUG set to false in wp-config.php (false by default)DB credentials in wp-config.php; never leave copies in public directoriesDISALLOW_FILE_EDIT to block file editing from the dashboard; delete unused pluginsAdvanced Administration Handbook
LaravelAPP_DEBUG=false in .envNever commit .env (an encrypted .env.encrypted is fine)After config:cache, env() outside config files returns nothing13.x
Next.jsRun next build then next start; never expose the dev serverNEXT_PUBLIC_ variables are inlined into browser JavaScriptA secret given a NEXT_PUBLIC_ prefix16.x
Spring BootKeep stack traces out of error responses (leave the default)Pass values via environment variables, not hard-coded configActuator exposes only health over HTTP by default; never set management.endpoints.web.exposure.include=*4.1
DjangoDEBUG = FalseLoad SECRET_KEY from an environment variable or file; keep it out of source controlSet ALLOWED_HOSTS; run manage.py check --deploy6.1
Ruby on RailsUse the production environment config (config/environments/production.rb)config/credentials.yml.enc plus config/master.key; never commit master.keyconfig.force_ssl = true to enforce HTTPS8.1
ExpressNODE_ENV=production removes stack traces from the default error responsePass via environment variables, not codehelmet for safe headers; app.disable('x-powered-by')Current official guide
ASP.NET CoreThe Developer Exception Page is on only in the Development environment (current template default)User secrets are for development; use environment variables or a key vault in productionNever run production with ASPNETCORE_ENVIRONMENT set to Development10.0

Real cases: most incidents came from skipped updates and production settings, not core bugs

The pattern that stands out is not the framework flaw itself, but a fix that was available and not applied, or a development setting left in production.

  • Equifax (2017): the fix for the Apache Struts flaw (CVE-2017-5638) was released the day it was disclosed, but it was not applied to a public system, and personal data on about 147 million people leaked (→ the Equifax breach).
  • Log4Shell (2021): a flaw in a Java logging library. Many organizations had it pulled in through other components and could not tell whether they used it (→ Log4Shell).
  • AI-agent cases (2026): when research AI agents reached real websites, credentials were read from an exposed debug page, and the sites did not notice (→ AI agents reaching real websites).

In the OWASP Top 10 (2025), number one is broken access control, number two is security misconfiguration, and number three is software supply chain failures (problems in the components you depend on). All of them happen on any framework.

How to check your own site

Only run these checks on sites you manage.

1

Open a non-existent URL and look at the error page

Open any made-up URL on your site and confirm that no source snippets, file paths, or configuration values appear. If they do, fix the "turn off detailed error pages" setting from the table above.
2

Use the framework's own check commands

Django has python manage.py check --deploy; Laravel shows debug mode with php artisan about --only=environment. On Spring Boot, check management.endpoints.web.exposure.include in your config.
3

Scan dependencies and what is visible from outside

For known vulnerabilities in dependencies, use npm audit for npm, composer audit for Composer, or osv-scanner for everything (from the browser: the dependency vulnerability scanner). For what outsiders can see, the security headers check shows missing headers, and the full site security audit checks .env and .git exposure, certificates, and cookie flags in one pass.

Common mistakes and fixes

Common mistakeWhat happensFix
Giving a secret API key a NEXT_PUBLIC_ prefixThe key is inlined into browser JavaScript where anyone can read itDrop the prefix, use it server-side only, and revoke the leaked key at the issuer
Exposing every monitoring endpoint (e.g. Spring Boot Actuator)Configuration values and memory contents can be read from outsideExpose only health and similar; keep the rest behind authentication
Deactivating unused plugins but leaving them installedThe files stay on the server and stop receiving updatesDelete what you do not use
Reading an update notice without confirming it was appliedThe hole stays open even though a fix exists (the Equifax pattern)Check the version after updating and run dependency scans on a schedule

This site's view: incidents come from how a framework is run, not the framework itself

Arguing "this framework is safe/dangerous" rarely helps. Most real incidents come not from a core bug but from usage — skipped updates, exposed secrets, missing authorization, dangerous defaults. This site runs on Next.js itself, and our main defense is nothing special: monitor dependency CVEs, keep secrets out of code and public directories, strong authentication, recoverable backups. Each framework chapter applies those basics to that specific technology.

First, cover the shared basics

Before diving into a framework chapter, it's efficient to first set up what works on every technology.

Sources

FAQ

QWhich framework is the most dangerous?
A

It's less about a 'dangerous framework' and more about 'dangerous usage.' That said, from an attacker's view, 'more installs = more worth targeting,' so the world's largest-share platform — WordPress and its plugins — is statistically the most targeted. Even so, on any framework, most incidents come not from a core bug but from operations: skipped updates, exposed secrets, missing authorization, and dangerous defaults. So fixing your own stack's dangerous defaults is more useful than ranking frameworks.

QIs a newer framework safer?
A

Not necessarily. Newer frameworks often ship safer defaults, but they also have a shorter track record (undiscovered flaws) and more misconfiguration from developers still learning them. Older frameworks are mature and well-tested but suffer from stale, unpatched major versions (EOL) and a large surface of plugins/dependencies. In the end, the operations that work are: track versions, understand the dangerous defaults, and defend in layers.

QWhere should I start?
A

First set up the basics shared by every framework (monitor dependency CVEs, keep secrets out of code and public directories, strong authentication, backups). Then open the chapter for the framework you actually use and fix its technology-specific dangerous defaults one by one (e.g. WordPress plugin management, Laravel's APP_DEBUG/authorization).

QWhat is the risk of leaving debug mode on in production?
A

When an error occurs, parts of your source code, configuration values, and the libraries you use are shown on screen. Laravel's documentation states that APP_DEBUG=true in production risks exposing sensitive configuration values to users, and Django says you must never enable debug in production. In the AI-agent cases disclosed in 2026, credentials were read from an exposed debug page. Always turn it off in production, then open a non-existent URL to confirm no detailed error appears.

QHow do I check whether my framework has a known vulnerability?
A

Check the version you run, then scan your dependencies as a whole. Use npm audit for npm, composer audit for PHP Composer, or osv-scanner across languages; this site's dependency vulnerability scanner works too. Vulnerabilities confirmed as exploited go into the US CISA KEV catalog, so update anything on KEV first.

QCan I put an API key in a Next.js NEXT_PUBLIC_ environment variable?
A

No. As the Next.js documentation explains, variables prefixed with NEXT_PUBLIC_ are inlined at build time into the JavaScript sent to the browser, where anyone can read them. Keep secret keys unprefixed and server-only, and route browser-side needs through your own server API.