CVE Decoded #4: CVE-2026–87902 (WordPress)
A double-encoded pagename parameter bypassed WordPress's template path handling, allowing directory traversal out of the theme folder. Because PHP includes template files as code, an attacker could execute a local PHP file and achieve unauthenticated remote code execution.
medium.com
Published on medium.com
Cve
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
CVE-2026-87902 is a vulnerability in WordPress Core, affecting versions 4.7.0 to 7.1.1. It is classified as a path traversal and local file inclusion (LFI) flaw that leads to remote code execution (RCE), with CWE identifiers 98 and 22. The advisory was published on 22 September 2026 and carries a CVSS score of 9.2, rated Critical. The affected platform is described as web, PHP and open source.

The feature at the centre of the bug is WordPress's page template resolution. When a visitor requests a page such as abc.com/about, WordPress has to decide which PHP file in the active theme renders that content. It looks for a page template, a PHP file that knows how to render that specific type of content. The function responsible for this lookup is get_page_template(), which lives in wp-includes/template.php.
In one line, as the author puts it: a double-encoded URL parameter fooled WordPress into escaping its theme folder and executing arbitrary PHP code on the server, with no login required.
Setup
The write-up describes the attack as unauthenticated: no account, password or subscriber login is needed. The precondition it names is a WordPress site running an affected version (4.7.0 to 7.1.1) with a theme that uses standard template folders. The author notes that many standard PHP distributions ship helper tools such as PEAR's pearcmd.php, which the attack used together with register_argc_argv. The author frames the piece as a learning exercise, explaining the CVE from scratch rather than reporting a live engagement.
Finding it
The author starts from two classic web weaknesses combined: double URL encoding and path traversal, leading to local file inclusion. The reasoning is that perimeter defences recognise the usual traversal encodings, so the interesting question is what happens when the encoding is layered once more and an internal component decodes it again.
URL encoding turns a dot into %2e and a slash into %2f, so the traversal sequence ../ appears as %2e%2e%2f. Firewalls and sanitisers block that pattern. But the percent sign itself can be encoded as %25, so %2e becomes %252e: the % turns into %25 while 2e stays as it is. To the outer security layers, %252e looks like an ordinary string containing a percent sign, and it passes through.
The second half of the problem is that WordPress itself later calls urldecode() on the page slug, which turns %25 back into % and unpacks the value into real . and / characters, that is, ../.
Exploitation
Step 1: Find a WordPress site
The attacker locates any WordPress site running an affected version (4.7.0 to 7.1.1) with a theme that uses standard template folders.
Step 2: Send the double-encoded payload
The attacker sends an unauthenticated HTTP GET request targeting a valid page ID, with a crafted, double-encoded pagename query parameter. The %252e%252e string passes perimeter filters because it looks like harmless encoded characters.
Step 3: Trigger the internal decode
Inside get_page_template(), WordPress runs urldecode() on the incoming page slug:
$decoded_slug = urldecode( $pagename );
When this runs on %252e, the %25 turns back into %, and in subsequent query processing that unpacks directly into . and /, producing ../.
Step 4: Bypass the prefix
Normally WordPress prepends page- to custom template names before searching the active theme directory:
page- + [slug] + .php
A raw traversal such as ../../../../tmp/shell would make WordPress look for page-../../../../tmp/shell.php, which would not match. So the attacker supplied a slug that begins with a real theme directory:
pagename=templates/../../../../tmp/shell
WordPress glued the parts together:
page- + templates/../../../../tmp/shell.php= page-templates/../../../../tmp/shell.php
Because page-templates was a real directory inside the theme, the operating system accepted the path, traversed all the way back up to the server root, and located /tmp/shell.php outside the theme.
Step 5: Escape the theme directory
The path bridges through the theme's page-templates/ directory, climbs out of wp-content/themes, and points directly to a local PHP gadget file.
Step 6: Turn file reading into code execution
In PHP there is a large difference between reading a file and including one. When WordPress finds a template file it does not merely read the text, it calls include() or require(), and including a file means executing every line of code inside it.
The attacker did not need to upload a file first. Many standard PHP server distributions ship helper tools such as PEAR's pearcmd.php. By passing command-line arguments through HTTP query parameters, leveraging register_argc_argv, the attacker could command pearcmd.php to write a small web shell to /tmp/, then use the traversal bug to execute it. The result is unauthenticated remote code execution on the server, running with the privileges of the web server.
Root cause
The vulnerable implementation of get_page_template() in WordPress up to and including 7.1.1 performed no validation on the decoded slug:
function get_page_template() { $id = get_queried_object_id(); $template = get_page_template_slug(); $pagename = get_query_var( 'pagename' ); if ( ! $pagename && $id ) { } $decoded_slug = urldecode( $pagename ); $templates = array(); if ( $decoded_slug ) { $templates[] = "page-{$decoded_slug}.php"; } $templates[] = 'page.php'; return locate_template( $templates );}
The code assumed that because it appended page- at the front, nobody could escape into the rest of the filesystem. The urldecode() call meant that a value which had already passed perimeter checks in double-encoded form was decoded into traversal characters only after those checks were done. The page- prefix was defeated by starting the slug with a genuine theme directory name, templates/, so the resulting page-templates/ path was valid and the traversal after it was accepted by the operating system.
Existing defences did not stop it because the firewall saw only the still-encoded %252e%252e string, and because the application itself trusted the prefix as a boundary. The escalation from file read to code execution came from PHP's include semantics and from the presence of command-line helper tools on the server.
Impact
The author rates the issue as a nightmare at 9.2 on CVSS, for three reasons:
- No authentication needed. The attacker does not need an account, a password or a subscriber login. Anyone who can view the website can trigger it.
- Massive attack surface. WordPress is everywhere, and automated threat actor bots scour the internet for unpatched sites around the clock.
- Exploitation in the wild. Within hours of the security advisory going live on 22 September 2026, security honeypots and telemetry detected active automated scanning and exploitation attempts worldwide.
Successful exploitation gives code execution with the privileges of the web server, which the author describes as a complete server takeover. The write-up also draws a wider lesson: the WordPress flaw on its own was a path traversal that let you read files, but because PHP executes the files it includes, and because old utilities were sitting on the server, a simple read flaw escalated into full compromise. Securing an application is not only about fixing the application; it is about hardening the environment so that when the application makes a mistake, the blast radius is contained.
Fix
The patched code is shown for WordPress 7.1.2, commit fdeab470f4b4, and uses a two-layered defence. First, validate_file() is applied to the decoded slug at input time:
function get_page_template() { $id = get_queried_object_id(); $template = get_page_template_slug(); $pagename = get_query_var( 'pagename' ); $decoded_slug = urldecode( $pagename ); if ( $decoded_slug && validate_file( $decoded_slug ) !== 0 ) { $decoded_slug = ''; } $templates = array(); if ( $decoded_slug ) { $templates[] = "page-{$decoded_slug}.php"; } $templates[] = 'page.php'; return locate_template( $templates );}
Second, locate_template() gained a strict boundary check using _wp_is_template_path_allowed(), which resolves the real path and compares it against the stylesheet and template directories:
function _wp_is_template_path_allowed( $template_path ) { $real_template_path = realpath( $template_path ); $allowed_paths = array( realpath( get_stylesheet_directory() ), realpath( get_template_directory() ), ); foreach ( $allowed_paths as $allowed ) { if ( $real_template_path && str_starts_with( $real_template_path, $allowed . DIRECTORY_SEPARATOR ) ) { return true; } } return false; }
By combining validate_file() at input time with realpath() verification at resolution time, path tricks are stopped at both stages.
On top of updating to WordPress 7.1.2, the author recommends hardening the environment:
- Check PHP configuration. In
php.ini, setregister_argc_argv = Off. This kills the commonpearcmd.phpcommand-line argument injection gadget. - Disable unused PHP modules. Remove or lock down legacy CLI helpers such as
pearcmd.phpif they exist in the server environment. - Audit access logs. Check web server access logs around September 2026 for incoming requests containing
%252eor suspiciouspagename=arguments.
Variants to test
- Other double-encoded traversal sequences. Try
%252e%252e%252fand mixed forms such as%252e%2e%2fin parameters that the application decodes more than once. A positive result is a resolved path outside the intended directory, visible in error messages, log entries or returned file content. - Other parameters that reach
urldecode(). Look for any input that is decoded after perimeter filtering, not justpagename. A positive result is a traversal character appearing in a filesystem path after the application's own decoding step. - Prefix-defeating slugs. Wherever the application prepends a fixed string before a path lookup, start the input with a real directory name so the concatenation forms a valid path, as
templates/did here. A positive result is a successful lookup of a file outside the intended base directory. - Include versus read. Identify endpoints that
include()orrequire()a path derived from user input rather than reading it. A positive result is execution of PHP code placed in a writable location such as/tmp/. register_argc_argvandpearcmd.php. On PHP hosts whereregister_argc_argvis on and PEAR is installed, test whether query parameters reachpearcmd.phpas command-line arguments. A positive result is a file written to disk through that gadget.- Log review for known indicators. Search access logs for
%252eand unusualpagename=values. A positive result is a request pattern matching the exploitation steps above against your own hosts.
What happened, in plain words
A very popular piece of software for building websites, WordPress, had a bug that let a stranger take over a web server without logging in. The stranger did not need a username, a password or any kind of account. They only needed to send one specially crafted web address to a WordPress site that had not been updated.
The trick was to hide a dangerous instruction inside the web address by scrambling it twice. The outer layers of protection looked at the scrambled text, saw nothing alarming, and let it through. WordPress then unscrambled it itself, and the dangerous instruction appeared. That instruction told WordPress to step outside the folder where website themes live and run a file from somewhere else on the server. Because of how the programming language PHP works, running a file means executing whatever instructions are inside it. So the stranger could make the server do whatever they wanted.
The bug is tracked as CVE-2026-87902. It affects WordPress versions 4.7.0 to 7.1.1, was published on 22 September 2026, and is rated Critical with a CVSS score of 9.2. The patched code is shown for WordPress 7.1.2.

The words you need first
Before the details make sense, here are the basic ideas, explained as if you have never touched web security.
A web server is a computer somewhere in the world that holds website files and sends them to your browser when you visit a site. When you type an address, your browser asks that computer for a page, and the computer replies with the page.
A URL is the address you type, like abc.com/about. The part after the slash, about, is often called the path or the slug. It tells the server which page you want.
A query parameter is extra information added to the end of a URL after a question mark. In abc.com/?pagename=about, the parameter is called pagename and its value is about. Websites use these to pass choices around, the same way a form at a counter lets you tick a box.
WordPress is a free, open-source system for building websites. It powers everything from small personal blogs to large corporate news sites. It is open source, which means its code is public and anyone can read it, including people looking for mistakes.
PHP is the programming language WordPress is written in. It runs on the server, not in your browser. A PHP file is a list of instructions the server carries out.
A theme is a folder of files that decides how a WordPress site looks. Each theme contains PHP files called templates, which are blueprints for drawing a particular kind of page.
A page template is one of those blueprint files. When you visit abc.com/about, WordPress has to pick the right template file from the active theme folder and use it to build the page you see.
Path traversal is the vulnerability class at the heart of this story. A computer stores files in folders inside folders, like rooms inside rooms. A path is the written route to a file, such as themes/mytheme/page.php. The two dots .. mean go up one folder. So ../ means step back out of the current folder. Path traversal means tricking a program into using .. to walk out of the folder it was supposed to stay in and reach files elsewhere. The everyday comparison: a hotel clerk is told to fetch items only from the hotel shop, but a guest writes an order that says walk out of the shop, down the corridor, and into the manager's office. If the clerk follows the written route without checking, they fetch the wrong thing.
Local File Inclusion (LFI) is what happens when a program does not just read a file but pulls it into itself and runs it. The word local means the file is already on the same server, rather than fetched from elsewhere.
Remote Code Execution (RCE) is the worst outcome: an attacker gets the server to run code of their choosing. Remote means the attacker is somewhere else on the internet, not sitting at the machine.
URL encoding is how special characters are written safely inside a web address. Some characters have meanings in URLs, so they are replaced by a percent sign and two characters. A dot . becomes %2e, and a slash / becomes %2f. Your browser does this automatically all the time without telling you.
Double encoding means encoding something that is already encoded. The percent sign % itself can be encoded as %25. So %2e becomes %252e. This matters because a filter that checks for the first layer may not recognise the second.
A firewall or WAF (web application firewall) is a guard that sits in front of a website and inspects incoming requests, blocking ones that look malicious. The comparison is a security guard at a theme park gate checking bags.
CVSS is a scoring system for how serious a security flaw is, from 0 to 10. A 9.2 is near the top of the scale.
CWE stands for Common Weakness Enumeration. It is a catalogue of types of software mistake, each with a number. This bug is listed under CWE-98 (improper control of filename for include) and CWE-22 (path traversal).
A commit is a saved change to a codebase, with an identifier, like a receipt for an edit. The fix here is commit fdeab470f4b4.
A honeypot is a decoy server set up to look vulnerable so that researchers can watch attackers try to break in and learn what they do.
The feature that had the bug
When you visit a page on a WordPress site, WordPress has to work out how to draw it. It looks at your request and searches through the active theme folder for the right template file. The function that does this search is called get_page_template(), and it lives in a file called wp-includes/template.php.
In one line, as the author puts it: a double-encoded URL parameter fooled WordPress into escaping its theme folder and executing arbitrary PHP code on the server, with no login required.
What the attacker needed
The attack is unauthenticated: no account, password or subscriber login is needed. The report names one condition for it to work, and describes a second element the attack relied on:
- The site runs an affected WordPress version, 4.7.0 to 7.1.1, with a theme that uses standard template folders.
- The server has PHP helper tools such as PEAR's
pearcmd.phppresent, and a PHP setting calledregister_argc_argvis enabled. That setting lets command-line style arguments reach a script through a web request, which is how the attacker gets a file written to disk.
How the trick was found
The author starts from two classic web weaknesses combined: double URL encoding and path traversal, leading to local file inclusion. The reasoning is that perimeter defences recognise the usual traversal encodings, so the interesting question is what happens when the encoding is layered once more and an internal component decodes it again.
URL encoding turns a dot into %2e and a slash into %2f, so the traversal sequence ../ appears as %2e%2e%2f. Firewalls and sanitisers block that pattern. But the percent sign itself can be encoded as %25, so %2e becomes %252e: the % turns into %25 while 2e stays as it is. To the outer security layers, %252e looks like an ordinary string containing a percent sign, and it passes through.
The second half of the problem is that WordPress itself later calls urldecode() on the page slug. urldecode() is a PHP function that reverses URL encoding. It turns %25 back into % and unpacks the value into real . and / characters, that is, ../.
The attack, step by step
Step 1: Find a WordPress site
The attacker locates any WordPress site running an affected version (4.7.0 to 7.1.1) with a theme that uses standard template folders. This is easy because WordPress is everywhere.
Step 2: Send the double-encoded payload
The attacker sends an unauthenticated HTTP GET request targeting a valid page ID, with a crafted, double-encoded pagename query parameter. A GET request is simply the kind your browser makes when you open a page: it asks the server to give you something. The %252e%252e string passes perimeter filters because it looks like harmless encoded characters.
Step 3: Trigger the internal decode
Inside get_page_template(), WordPress runs urldecode() on the incoming page slug:
$decoded_slug = urldecode( $pagename );
Line by line: $pagename is the value the visitor sent in the pagename parameter. urldecode() takes that text and turns any encoded characters back into their real form. The result is stored in a new variable called $decoded_slug. The reason this line exists is innocent: WordPress wanted to support friendly page names containing non-English characters or spaces, which arrive encoded. The side effect is that it also decodes anything an attacker has hidden.
When this runs on %252e, the %25 turns back into %, and in subsequent query processing that unpacks directly into . and /, producing ../.
Step 4: Bypass the prefix
Normally WordPress prepends page- to custom template names before searching the active theme directory:
page- + [slug] + .php
This is a naming convention. If the slug is about, WordPress looks for a file called page-about.php. The prefix is meant to keep lookups inside the theme's own naming scheme.
A raw traversal such as ../../../../tmp/shell would make WordPress look for page-../../../../tmp/shell.php, which would not match, because no file starts with the literal text page-... So the attacker supplied a slug that begins with a real theme directory:
pagename=templates/../../../../tmp/shell
WordPress glued the parts together:
page- + templates/../../../../tmp/shell.php= page-templates/../../../../tmp/shell.php
Read that result slowly. The prefix page- plus the attacker's templates/ forms page-templates/, which is a genuine folder inside the theme. The operating system sees a valid starting point, then follows the ../ steps upward, out of the theme, all the way to the server root, and arrives at /tmp/shell.php, a file outside the theme. The prefix was supposed to be a fence; the attacker made the fence part of the road.
Step 5: Escape the theme directory
The path bridges through the theme's page-templates/ directory, climbs out of wp-content/themes, and points directly to a local PHP gadget file. A gadget here means an existing file on the server that can be made to do something useful to the attacker, without the attacker having to upload anything.
Step 6: Turn file reading into code execution
In PHP there is a large difference between reading a file and including one. When WordPress finds a template file it does not merely read the text, it calls include() or require(), and including a file means executing every line of code inside it. The comparison: reading a recipe aloud is harmless, but handing it to a cook who immediately follows it is not, if the recipe was written by a stranger.
The attacker did not need to upload a file first. Many standard PHP server distributions ship helper tools such as PEAR's pearcmd.php. By passing command-line arguments through HTTP query parameters, leveraging register_argc_argv, the attacker could command pearcmd.php to write a small web shell to /tmp/, then use the traversal bug to execute it. A web shell is a tiny script that lets the attacker run commands on the server through their browser. The result is unauthenticated remote code execution on the server, running with the privileges of the web server.
Why the code was vulnerable
The vulnerable implementation of get_page_template() in WordPress up to and including 7.1.1 performed no validation on the decoded slug:
function get_page_template() { $id = get_queried_object_id(); $template = get_page_template_slug(); $pagename = get_query_var( 'pagename' ); if ( ! $pagename && $id ) { } $decoded_slug = urldecode( $pagename ); $templates = array(); if ( $decoded_slug ) { $templates[] = "page-{$decoded_slug}.php"; } $templates[] = 'page.php'; return locate_template( $templates );}
Line by line:
function get_page_template() {starts the definition of the function that decides which template to use.$id = get_queried_object_id();asks WordPress which page is being viewed and stores its internal number.$template = get_page_template_slug();fetches any template name already chosen for that page.$pagename = get_query_var( 'pagename' );reads thepagenamevalue out of the visitor's request. This is the value the attacker controls.if ( ! $pagename && $id ) { }is an empty branch: if there is no page name but there is an ID, nothing happens here.$decoded_slug = urldecode( $pagename );decodes the visitor's value, turning hidden encodings back into real characters.$templates = array();creates an empty list of candidate template files.if ( $decoded_slug ) {checks that there is something to look for.$templates[] = "page-{$decoded_slug}.php";adds the prefixed name to the list, with the decoded value dropped straight in.$templates[] = 'page.php';adds the default fallback template.return locate_template( $templates );asks WordPress to find the first of these files that exists and use it.
The code assumed that because it appended page- at the front, nobody could escape into the rest of the filesystem. The urldecode() call meant that a value which had already passed perimeter checks in double-encoded form was decoded into traversal characters only after those checks were done. The page- prefix was defeated by starting the slug with a genuine theme directory name, templates/, so the resulting page-templates/ path was valid and the traversal after it was accepted by the operating system.
Existing defences did not stop it because the firewall saw only the still-encoded %252e%252e string, and because the application itself trusted the prefix as a boundary. The escalation from file read to code execution came from PHP's include semantics and from the presence of command-line helper tools on the server.
How bad was it
The author rates the issue as a nightmare at 9.2 on CVSS, for three reasons:
- No authentication needed. The attacker does not need an account, a password or a subscriber login. Anyone who can view the website can trigger it.
- Massive attack surface. WordPress is everywhere, and automated threat actor bots scour the internet for unpatched sites around the clock. A bot here is a program that scans the web automatically, like a robot going door to door checking locks.
- Exploitation in the wild. Within hours of the security advisory going live on 22 September 2026, security honeypots and telemetry detected active automated scanning and exploitation attempts worldwide.
Successful exploitation gives code execution with the privileges of the web server, which the author describes as a complete server takeover. The wider lesson: the WordPress flaw on its own was a path traversal that let you read files, but because PHP executes the files it includes, and because old utilities were sitting on the server, a simple read flaw escalated into full compromise. Securing an application is not only about fixing the application; it is about hardening the environment so that when the application makes a mistake, the blast radius is contained.
The fix
The patched code is shown for WordPress 7.1.2, commit fdeab470f4b4, and uses a two-layered defence. First, validate_file() is applied to the decoded slug at input time:
function get_page_template() { $id = get_queried_object_id(); $template = get_page_template_slug(); $pagename = get_query_var( 'pagename' ); $decoded_slug = urldecode( $pagename ); if ( $decoded_slug && validate_file( $decoded_slug ) !== 0 ) { $decoded_slug = ''; } $templates = array(); if ( $decoded_slug ) { $templates[] = "page-{$decoded_slug}.php"; } $templates[] = 'page.php'; return locate_template( $templates );}
Line by line, the parts that changed:
- The first lines are the same as before: get the page ID, the existing template name and the visitor's
pagenamevalue, then decode it. if ( $decoded_slug && validate_file( $decoded_slug ) !== 0 ) {is new.validate_file()is a WordPress function that checks a path for dangerous patterns such as... It returns 0 when the path looks acceptable and a non-zero number when it does not. So this line asks: is there a value, and did the check flag it?$decoded_slug = '';is the response: if the check flagged the value, throw it away and use an empty string instead. The dangerous input never reaches the file lookup.- The rest builds the candidate list and calls
locate_template()as before, but now with a cleaned value.
Second, locate_template() gained a strict boundary check using _wp_is_template_path_allowed(), which resolves the real path and compares it against the stylesheet and template directories:
function _wp_is_template_path_allowed( $template_path ) { $real_template_path = realpath( $template_path ); $allowed_paths = array( realpath( get_stylesheet_directory() ), realpath( get_template_directory() ), ); foreach ( $allowed_paths as $allowed ) { if ( $real_template_path && str_starts_with( $real_template_path, $allowed . DIRECTORY_SEPARATOR ) ) { return true; } } return false; }
Line by line:
function _wp_is_template_path_allowed( $template_path ) {defines a helper that answers one question: is this file path inside the theme folders we allow?$real_template_path = realpath( $template_path );asks the operating system for the true, final location of the path, with every..already resolved.realpath()is the key: it cannot be fooled by clever spelling, because it reports where the file actually is.$allowed_paths = array(starts a list of folders that are permitted.realpath( get_stylesheet_directory() ),adds the real location of the active theme's stylesheet folder.realpath( get_template_directory() ),adds the real location of the parent theme folder.);closes the list.foreach ( $allowed_paths as $allowed ) {goes through each permitted folder in turn.if ( $real_template_path && str_starts_with( $real_template_path, $allowed . DIRECTORY_SEPARATOR ) ) {checks two things: the path really exists, and its true location begins with one of the permitted folders followed by a directory separator.str_starts_with()is a plain text comparison of the beginning of a string.return true;means the path is inside an allowed folder, so it is fine.}closes the check.return false;means no permitted folder matched, so the path is rejected.
By combining validate_file() at input time with realpath() verification at resolution time, path tricks are stopped at both stages. The comparison: one guard checks the order slip at the door, and a second guard checks the actual route the clerk walked before handing anything over.
Hardening beyond the patch
On top of updating to WordPress 7.1.2, the author recommends hardening the environment:
- Check PHP configuration. In
php.ini, setregister_argc_argv = Off. This kills the commonpearcmd.phpcommand-line argument injection gadget.php.iniis PHP's main settings file. - Disable unused PHP modules. Remove or lock down legacy CLI helpers such as
pearcmd.phpif they exist in the server environment. If a tool is not needed, it should not be sitting there waiting to be misused. - Audit access logs. Check web server access logs around September 2026 for incoming requests containing
%252eor suspiciouspagename=arguments. Access logs are the server's diary of every request it received.
Things worth testing on your own systems
- Other double-encoded traversal sequences. Try
%252e%252e%252fand mixed forms such as%252e%2e%2fin parameters that the application decodes more than once. A positive result is a resolved path outside the intended directory, visible in error messages, log entries or returned file content. - Other parameters that reach
urldecode(). Look for any input that is decoded after perimeter filtering, not justpagename. A positive result is a traversal character appearing in a filesystem path after the application's own decoding step. - Prefix-defeating slugs. Wherever the application prepends a fixed string before a path lookup, start the input with a real directory name so the concatenation forms a valid path, as
templates/did here. A positive result is a successful lookup of a file outside the intended base directory. - Include versus read. Identify endpoints that
include()orrequire()a path derived from user input rather than reading it. A positive result is execution of PHP code placed in a writable location such as/tmp/. register_argc_argvandpearcmd.php. On PHP hosts whereregister_argc_argvis on and PEAR is installed, test whether query parameters reachpearcmd.phpas command-line arguments. A positive result is a file written to disk through that gadget.- Log review for known indicators. Search access logs for
%252eand unusualpagename=values. A positive result is a request pattern matching the exploitation steps above against your own hosts.
Glossary
- Access log: a file where a web server records every request it receives.
- Bot: an automated program that performs tasks on the internet, such as scanning many sites for weaknesses.
- Commit: a saved change to a codebase, identified by a hash such as
fdeab470f4b4. - CVE: Common Vulnerabilities and Exposures, a public identifier for a specific security flaw, here CVE-2026-87902.
- CVSS: a scoring system from 0 to 10 for the severity of a security flaw; 9.2 is Critical.
- CWE: Common Weakness Enumeration, a numbered catalogue of types of software mistake; this bug is CWE-98 and CWE-22.
- Double encoding: encoding text that is already URL-encoded, for example turning
%2einto%252e. - Firewall / WAF: a guard in front of a website that inspects and blocks suspicious requests.
- GET request: the ordinary kind of request a browser makes to ask a server for a page.
- Gadget: an existing file or feature on a server that an attacker can repurpose to do something they want.
- Honeypot: a decoy server set up to attract and observe attackers.
include()/require(): PHP instructions that pull a file into the running program and execute its contents.- Local File Inclusion (LFI): making a program load and run a file that is already on the same server.
- Open source: software whose code is public and can be read and changed by anyone.
- Page template: a PHP file in a WordPress theme that defines how a particular page is drawn.
- Path: the written route to a file through folders, such as
wp-content/themes/mytheme/page.php. - Path traversal: tricking a program into using
..to leave its intended folder and reach other files. - PEAR /
pearcmd.php: a collection of PHP helper tools, and a script within it that can be made to write files when command-line arguments reach it. - PHP: the programming language WordPress is written in, executed on the server.
php.ini: PHP's main configuration file.- Query parameter: extra information appended to a URL after a question mark, such as
pagename=about. realpath(): a PHP function that reports the true, final location of a file path with all..resolved.register_argc_argv: a PHP setting that lets command-line style arguments reach a script through a web request.- Remote Code Execution (RCE): making a server run code of the attacker's choosing from elsewhere on the internet.
- Slug: the readable part of a URL that identifies a page, such as
about. - Theme: a folder of files in WordPress that controls how a site looks, including its templates.
- URL: the address of a page on the web.
- URL encoding: writing special characters in a URL as a percent sign plus two characters, such as
%2efor a dot. urldecode(): a PHP function that reverses URL encoding.validate_file(): a WordPress function that checks a path for dangerous patterns such as...- Web server: the computer that stores and serves website files.
- Web shell: a small script that lets an attacker run commands on a server through a browser.
- WordPress: a free, open-source system for building websites, written in PHP.