Skip to content
SecurityPHP2Shell affects most WordPress sites. Am I affected? →
presscomet
Security

Rotate WordPress security keys after PHP2Shell

PHP2Shell can disclose PHP worker memory — which may hold passwords, tokens and API keys. If your site was exposed and unpatched, rotate your WordPress salts and every other secret. A step-by-step checklist.

By the Presscomet teamPublished 12 min read

On this page
  1. Why a memory leak means rotating secrets
  2. What the keys and salts actually are
  3. Generate new salts the official way
  4. Where they go in wp-config.php
  5. Rotating keys logs everyone out
  6. The full rotation checklist
  7. After you rotate
  8. A stack with fewer secrets to leak

Why a memory leak means rotating secrets

PHP2Shell is really two bugs. One of them, CVE-2026-109619, can do more than run code: researchers showed it could disclose chunks of a PHP worker’s memory to an unauthenticated attacker. That’s the detail that makes secret rotation a precaution worth taking even if you never found a single malicious file.

Think about what passes through a PHP worker’s memory in a normal day. The password someone just typed into the login form. The database credentials WordPress uses on every request. A session token. An API key your SMTP or payment plugin loaded to send a message or take an order. None of those are necessarily written to disk where you could inspect them — but they’re in memory while they’re in use, and a memory-disclosure bug doesn’t care whether a value was ever saved to a file. One demonstrated technique leaked roughly 67 KB of worker memory per attack.

So if your site was exposed and unpatched during the PHP2Shell window, you can’t know what leaked. The safe, boring assumption is that your secrets were seen, which means replacing them. This guide is the rotation half of the response; it pairs with checking whether you were hacked, and the two are best done together.

Patch PHP before you rotate

Rotating secrets on a runtime that’s still vulnerable just hands the attacker the new ones on the next request. Confirm PHP is on a fixed build (8.5.12, 8.4.27, 8.3.36, 8.2.35 or a vendor backport) and that the workers were restarted first. Then rotate.

What the keys and salts actually are

Open your wp-config.php and you’ll find a block of eight lines near the middle, usually under a comment that says “Authentication Unique Keys and Salts.” They are four keys and four matching salts:

AUTH_KEY / AUTH_SALT
Protect the login cookie for the standard (http) admin session
SECURE_AUTH_KEY / SECURE_AUTH_SALT
The same, for sessions served over HTTPS
LOGGED_IN_KEY / LOGGED_IN_SALT
Identify a logged-in user who isn’t in the admin area
NONCE_KEY / NONCE_SALT
Harden the one-time tokens (nonces) that guard form submissions

These aren’t passwords you type anywhere. WordPress uses them behind the scenes to sign and encrypt the login cookies it stores in your browser, so the server can trust a returning visitor without keeping a session table. That design is why the keys matter: anyone who knows them can forge a cookie that WordPress will accept as a valid, logged-in session — no password required. A memory leak that exposes them is therefore worth taking seriously, and the fix is simply to change them.

WordPress ships wp-config.php with placeholder text in these lines (“put your unique phrase here”). On a correctly set-up site they’ll already be long random strings. Either way, the rotation is the same: replace all eight with a fresh set.

Generate new salts the official way

WordPress.org runs a tiny service that returns eight ready-made lines, freshly randomised on every request. It’s the method WordPress’s own documentation points to.

https://api.wordpress.org/secret-key/1.1/salt/

Open that URL in your browser and you’ll get eight complete define() lines you can paste straight in. Or, if you have shell access, fetch it on the server or let WP-CLI do the whole job in one command:

Generate fresh salts from the command line
# Fetch eight ready-made define() lines$ curl -s https://api.wordpress.org/secret-key/1.1/salt/# Or let WP-CLI generate and replace them in wp-config.php in one step$ wp config shuffle-salts

wp config shuffle-salts is the fastest route

If WP-CLI is available, wp config shuffle-salts regenerates all eight values and writes them into wp-config.php for you — no copy-and-paste, no risk of a typo breaking the file. It logs everyone out just the same.

Where they go in wp-config.php

If you’re editing by hand, find the eight existing lines and replace them with your new set. The shape looks like this — these are placeholders, not real keys; use the unique values the generator gives you, never the example strings below:

wp-config.php — eight lines (use your OWN generated values)
define( 'AUTH_KEY',         'paste-your-own-unique-value-here' );define( 'SECURE_AUTH_KEY',  'paste-your-own-unique-value-here' );define( 'LOGGED_IN_KEY',    'paste-your-own-unique-value-here' );define( 'NONCE_KEY',        'paste-your-own-unique-value-here' );define( 'AUTH_SALT',        'paste-your-own-unique-value-here' );define( 'SECURE_AUTH_SALT', 'paste-your-own-unique-value-here' );define( 'LOGGED_IN_SALT',   'paste-your-own-unique-value-here' );define( 'NONCE_SALT',       'paste-your-own-unique-value-here' );

A few practical notes. Take a copy of wp-config.php before you edit it, so a stray keystroke can’t lock you out. Replace all eight lines, not some of them. And make sure each value stays inside its single quotes on one line — the generator’s output already does this correctly, which is the main reason to prefer it over inventing your own strings.

Don’t paste the example values

The block above is deliberately generic. Real keys are long, random and unique to your site; a shared or guessable value defeats the point. Always generate your own from the WordPress.org service or WP-CLI.

Rotating keys logs everyone out

The moment you save new keys and salts, every login cookie WordPress previously issued becomes invalid. Everyone is signed out at once: you, your editors, your logged-in members — and anyone who got in without permission and was relying on a stolen or forged session. You’ll simply log in again with your password.

That side-effect is a feature here. One of the ways an attacker keeps a foothold after exploiting a site is by holding a valid session or a forged auth cookie. Rotating the salts pulls the rug out from under all of them in a single step, which is why WordPress.org’s own hacked-site guidance lists it as a standard response. Pair it with resetting passwords (next section) and the stolen credentials become useless as well as the stolen sessions.

Expect to re-enter your password

Getting logged out right after editing wp-config.php is the confirmation that it worked. If you use a password manager, you’re seconds from being back in.

The full rotation checklist

The salts are the start, not the whole job. A leaked worker memory could have exposed anything PHP touched, so rotate every secret the site knows. Tick them off as you go — your progress is saved in this browser.

Interactive checklist

Rotate every secret after exposure

0/11

checked

1 · WordPress
2 · Database & server
3 · Connected services (API keys)

Ticks are saved in this browser only, so you can come back later.

Rotate salts and the DB password with WP-CLI
# Regenerate all eight keys and salts in wp-config.php$ wp config shuffle-salts# Point wp-config.php at the new database password you set in your panel$ wp config set DB_PASSWORD 'your-new-database-password'# Force a password reset for every administrator$ wp user reset-password $(wp user list --role=administrator --field=ID)

After you rotate

Rotation ends stolen sessions and makes leaked credentials useless — but it does not, by itself, remove a backdoor, delete a rogue admin account or fix a vulnerable runtime. It’s one step in a larger response, so make sure the others are done too.

  1. Step 1: Confirm PHP is patched and restarted

    If you haven’t already, this is non-negotiable — see the PHP2Shell guide for patching every kind of host, and how to confirm with a managed host.
  2. Step 2: Check for indicators of compromise

    Rotating secrets assumes exposure; now find out whether anyone acted on it. Work through the was-I-hacked checklist.
  3. Step 3: Clean up or restore if you found anything

    If something turned up, follow the recovery checklist — restore a clean backup from before your exposure window, or rebuild from official sources.
  4. Step 4: Change passwords again once you’re sure it’s clean

    WordPress.org recommends a second password change after you’ve confirmed the site is clean, in case the first round leaked before the hole was closed.
  5. Step 5: Watch for a few weeks

    New admin users, unexpected logins, host notices and a site: search. A quiet month is the sign you’re through it.

A stack with fewer secrets to leak

The reason PHP2Shell forces a secret-rotation scramble is that a PHP worker holds your credentials in memory on every request, and a runtime bug put that memory within reach. Presscomet takes a different shape: it runs the same wp-admin, block editor, URLs and REST API on Node.js with a single SQLite file, and it has no PHP runtime. The whole class of PHP-runtime memory-disclosure bugs — PHP2Shell included — doesn’t apply to it, because PHP isn’t there to leak.

That’s a real reduction in what can go wrong, and it deserves honest edges. Presscomet still has its own secrets, its own login to protect, and its own software to keep updated — Node.js, its libraries and the host — so it isn’t “unhackable,” and good key hygiene still matters. It also doesn’t run PHP plugins: the common jobs (SEO, forms, SMTP, redirects, security, custom fields) are built in, but WooCommerce stores aren’t supported. The details are on our WordPress security page.

Rotate first, then consider the stack

Finish rotating your secrets and confirm the site is clean before you move anything — migrating an exposed site carries the exposure with it. Once you’re settled, you can check what would move over to Presscomet; it reads your public site and never changes anything on your server.

Sources

Facts checked against these sources on October 24, 2026. Things change quickly; the vendor advisory always wins.

  1. [1]Editing wp-config.php: security keys — WordPress Developer Resources
  2. [2]Secret-key (salt) generator service — WordPress.org
  3. [3]wp config shuffle-salts — WP-CLI
  4. [4]FAQ: My site was hacked (rotate secrets) — WordPress.org Documentation
  5. [5]PHP2Shell: memory disclosure of worker memory — Imperva
  6. [6]PHP2Shell advisory (impact and mitigations) — Sophos
  7. [7]GHSA-6wmf-4rv5-p3rp (CVE-2026-109619) — php-src on GitHub

Frequently asked questions

What are WordPress security keys and salts?

They are eight secret random strings in wp-config.php: four keys (AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY) and four matching salts (AUTH_SALT, SECURE_AUTH_SALT, LOGGED_IN_SALT, NONCE_SALT). WordPress uses them to encrypt the login cookies it stores in your browser and to harden nonces. They aren’t passwords you type — they work behind the scenes — but anyone who knows them can forge valid login sessions, so they’re worth protecting and rotating.

Why should I rotate my WordPress secrets after PHP2Shell?

Because PHP2Shell (CVE-2026-109619 in particular) was shown to disclose chunks of a PHP worker’s memory to an unauthenticated attacker. That memory can contain anything PHP handled recently: passwords, session tokens, database credentials and API keys — including values that were never written to a file. If your site was exposed and unpatched, you can’t be sure what leaked, so the safe assumption is that your secrets were seen and should be replaced.

How do I change the WordPress salts?

Generate a fresh set of eight lines from the WordPress.org secret-key service at https://api.wordpress.org/secret-key/1.1/salt/, then paste them over the existing AUTH_KEY through NONCE_SALT define() lines in wp-config.php. If you have WP-CLI, wp config shuffle-salts does the same thing in one command. Either way, every logged-in session is invalidated immediately, so you and everyone else will need to log in again.

Does changing the salts log everyone out?

Yes. WordPress signs its login cookies with the keys and salts, so replacing them makes every existing cookie invalid at once. Everyone — you, your team and anyone who got in without permission — is logged out and must sign in again. That’s exactly why rotating salts is a standard response to a suspected compromise: it ends any session an attacker was holding.

Is rotating keys enough on its own after a hack?

No. Rotating secrets ends stolen sessions and makes leaked credentials useless, but it doesn’t remove a backdoor file, a rogue admin account or a vulnerable runtime. Rotation is one step. You also need to confirm PHP is patched, check for indicators of compromise, and clean up or restore from a known-good backup if you find anything.

What else should I rotate besides the WordPress salts?

Everything a leaked worker memory could have exposed: the database password (and update wp-config.php to match), every administrator and editor password, your SFTP/SSH credentials and any unknown authorized SSH keys, your hosting control-panel login, and API keys for connected services — SMTP/email, payment gateways, analytics, CDN and backup storage. Revoke old API keys rather than just issuing new ones.

Do I need to rotate secrets if my host patched before I was exposed?

If your site was never reachable on a vulnerable PHP build — for example a managed host that patched or mitigated before the vulnerability was public — your exposure may have been zero, and routine rotation is enough. If you can’t establish that, or you were online and unpatched during the exposure window, rotate as a precaution. It’s cheap insurance compared with a forged-session foothold.

Run WordPress without a PHP runtime to patch.

Presscomet keeps your wp-admin, editor, URLs and content, and serves pages without PHP or MySQL. Check your site for free, then migrate in one click — your old site is only ever read.

Check my site
  • SecurityPHP2Shell and WordPress: are you affected, and how do you fix it?

    Two critical bugs in PHP itself put almost every WordPress site on an affected runtime until the host patches it. Here’s what happened in plain English, a checker that tells you whether you’re affected, and step-by-step fixes for every kind of hosting.

  • SecurityWordPress hacked? A step-by-step recovery checklist

    Redirects to spam sites, admin users you never created, a warning from Google or a suspension notice from your host. Here’s the order to do things in, so you clean the site once and it stays clean.

  • SecurityWordPress security checklist 2026 (interactive, scored)

    Thirty minutes, twenty-seven checks, one score. Items are weighted by how much risk they actually remove, so you fix the things that matter first — starting with the one most checklists forget: the PHP runtime underneath WordPress.