WonderCMS 3.1.3 - Authenticated RCE & Blind SSRF Vulnerability
The WonderCMS theme/plugin installer allowed an authenticated user to upload a crafted ZIP containing a PHP backdoor, which was extracted to a predictable path and could be executed, leading to remote code execution. A separate filter on the custom plugin repository URL could be bypassed to perform a blind SSRF, which the author chained with a gopher payload to FastCGI to achieve RCE.
Halo, pada kesempatan kali ini saya akan menulis sedikit tentang vulnerability yang ditemukan pada CMS WonderCMS yang memiliki impact paling tinggi yaitu RCE (Remote Code Execution). Sebenarnya ini research kecil-kecilan untuk mengisi kegabutan weekend kali ini, yah… itung-itung sambil belajar research dan belajar…
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
WonderCMS is a small, free website builder and open source CMS that has been developed since 2008. It is installed in one step and is deliberately lightweight: the whole core is a single PHP file, and there is no DBMS. All configuration is stored in a file called database.js, so a web server and PHP are enough to run it.

The research targets version 3.1.3. Because the core is one PHP file and the features that do not require authentication offered nothing interesting, the author focused on authenticated features. The attack vector is therefore an attacker who has already obtained valid credentials and can log in to the CMS dashboard.

The feature at the centre of both findings is the theme/plugin installer. It installs themes and plugins from a repository, and in the dashboard a new plugin or theme can be installed with a single click.

Setup
The CMS was downloaded and installed on an Ubuntu VM with only a web server and PHP, no database. The author used Burp Suite to capture the installer requests. Two functions of the installer are named in the report: installUpdateThemePluginAction and addCustomThemePluginRepository. The first is analysed for the RCE, the second for the SSRF. For the SSRF-to-RCE chain, a FastCGI service was prepared, listening on a TCP connection on port 9000 instead of the default socket, and the Gopherus tool was used to generate the gopher payload.
Finding it
The starting point was curiosity rather than a target list: the author opened exploit-db, saw an entry named "WonderCMS 3.1.3 - 'uploadFile' Stored Cross-Site Scripting", visited the WonderCMS website, downloaded the CMS and installed it to look for something further. Two issues came out of that: a path to RCE through the plugin installer, and a blind SSRF in the custom repository feature.
Exploitation
Step 1: capture the install request
Clicking the install button produces a request that Burp Suite captures:

The installer relies on at least the two functions mentioned above; the RCE analysis concentrates on installUpdateThemePluginAction.

Step 2: understand what the installer does with the archive
The function downloads the plugin from the server and temporarily stores it at data/files/ZIPFromURL.zip. The zip is then extracted into data/plugins/folderplugin-master/ and renamed to data/plugins/folderplugin/.

Step 3: plant a PHP backdoor in the plugin archive
Because the plugin to be installed is under the attacker's control, a PHP backdoor can be placed inside the zip file. The path produced by the extraction is predictable and directly reachable over HTTP, so after installing the crafted plugin the backdoor is available at:
/data/plugins/folderplugin/evil.php
Step 4: automate and get a shell
A small script automates the process and yields shell access.

The exploit was published on exploit-db as 49155.
Step 5: the custom repository filter
The second issue lives in the same installer feature. The function addCustomThemePluginRepository is the more interesting one because it filters the destination of the plugin being installed. It is the function used when installing a custom plugin through the feature.

When using it, the destination has to be a GitHub or GitLab repository. The source code shows the check:

The code forbids any destination other than GitHub and GitLab by using strpos to look for the strings "https://github.com/" and "https://gitlab.com/" in the $url variable. The check is weak: strpos returns an integer position when the searched string is present, and FALSE (boolean) when it is not. Any URL that merely contains those strings passes. The author tested this by redirecting the destination to a server under their control.

The filter was bypassed. The SSRF is blind: nothing is reflected in the response body, so internal files cannot be read directly with the file:// scheme.
Step 6: prepare FastCGI over TCP
To demonstrate the highest impact, RCE through the SSRF, the author used FastCGI, which by default runs over a socket. To get command execution through the FastCGI configuration, it was switched to a TCP connection on port 9000.

To reach the internal network, the gopher protocol is used: the gopher:// scheme allows interaction with a specific IP and port and the sending of arbitrary bytes. The report notes that the technique is not limited to FastCGI; services such as Redis, MySQL, PostgreSQL, Memcached, Zabbix and SMTP can be targeted in the same way. With the FastCGI service prepared, the payload can be sent to it.
Step 7: generate the payload
The Gopherus tool generates the payload. A reverse shell payload is created directly.

Step 8: run the exploit

A Python script automates the exploit process.

The exploit was published on exploit-db as 49154.
The SSRF also affects installUpdateThemePluginAction, and there it is even easier because that function has no filter on the repository destination at all.

Root cause
Two separate mistakes combine into the two findings.
- Unvalidated archive contents and predictable extraction paths (RCE). The installer downloads an attacker-supplied zip, extracts it, and renames the result to a predictable directory under
data/plugins/. The extracted files are directly accessible, so a PHP file inside the archive becomes executable at a known URL. - Substring check instead of URL validation (SSRF).
addCustomThemePluginRepositoryusesstrposto test for"https://github.com/"and"https://gitlab.com/"in$url. A position result is truthy andFALSEis falsy, so the check only asks whether those strings appear anywhere in the URL, not whether the URL points at GitHub or GitLab. Any URL containing those strings passes, which is what the author used to redirect the request to their own server.installUpdateThemePluginActionhas no destination filter at all.
The author focused on features that require authentication, so the attack vector is an attacker who already holds valid credentials.
Impact
With valid dashboard credentials, an attacker can install a crafted plugin and execute arbitrary PHP through a predictable path, obtaining a shell. Through the custom repository feature, the same authenticated attacker can make the server issue requests to arbitrary destinations, including internal hosts and third-party systems, and by pointing gopher at a FastCGI service on port 9000 can escalate the blind SSRF to command execution. The report also notes that other internal services reachable over gopher, such as Redis, MySQL, PostgreSQL, Memcached, Zabbix and SMTP, are potential targets. Because the SSRF is blind, direct reading of internal files with file:// is not possible.
Fix
The report does not describe a patch or a code change. Based on the root causes, the fixes would be to validate the actual host of the repository URL rather than searching for a substring, to apply the same destination restriction to installUpdateThemePluginAction, and to validate or restrict the contents and extraction paths of downloaded plugin archives so that executable files cannot be placed at predictable, web-reachable locations.
Variants to test
- Substring-based URL allowlists elsewhere. Submit a URL that contains the allowed host string but points elsewhere, for example a path or query containing
https://github.com/. A positive result is the server fetching the attacker-controlled destination. - Installer functions without a filter. Try the same redirect against
installUpdateThemePluginAction. A positive result is an outbound request to an arbitrary host with no filtering at all. - Predictable extraction directories. Install a benign archive and check whether the extracted folder name and path can be predicted and reached over HTTP. A positive result is a directly accessible file at a stable path under
data/plugins/. - Archive content handling. Place a PHP file in a plugin zip and request it after installation. A positive result is the file being served and executed rather than treated as inert content.
- Gopher against internal services. With a reachable FastCGI listener on TCP port 9000, send a Gopherus-generated payload through the SSRF. A positive result is command execution on the internal service; the same approach can be tried against Redis, MySQL, PostgreSQL, Memcached, Zabbix and SMTP.
Timeline
- 27 November 2020: finding the security issue
- 27 November 2020: report
- 28 November 2020: validation
- 28 November 2020: hall of fame
References
What happened, in plain words
WonderCMS is a small, free website builder. You install it in one step, and it is deliberately lightweight: the whole core is a single PHP file, and it does not need a database. All of its settings are kept in a file called database.js, so a web server with PHP is enough to run it. The research here looks at version 3.1.3.

Because the core is one PHP file, and the features that work without logging in offered nothing interesting, the author concentrated on features that require authentication. In plain terms: the attacker in this story already has a valid username and password and can log in to the CMS dashboard. That is an important starting condition, because it means the findings are not something a random visitor can trigger.

The feature at the centre of both findings is the theme/plugin installer. A theme changes how the site looks; a plugin adds functionality. The installer fetches themes and plugins from a repository, and in the dashboard you can install a new one with a single click.

Setup
The CMS was downloaded and installed on an Ubuntu virtual machine with only a web server and PHP, no database. To see what the browser sends when you click install, the author used Burp Suite, a tool that sits between your browser and the server and lets you read and edit every request. Two functions of the installer are named in the report: installUpdateThemePluginAction and addCustomThemePluginRepository. The first is analysed for the RCE, the second for the SSRF. For the SSRF-to-RCE chain, a FastCGI service was prepared, listening on a TCP connection on port 9000 instead of the default socket, and the Gopherus tool was used to generate the gopher payload.
Finding it
The starting point was curiosity rather than a target list. The author opened exploit-db, a public archive of published exploits, saw an entry named "WonderCMS 3.1.3 - 'uploadFile' Stored Cross-Site Scripting", visited the WonderCMS website, downloaded the CMS and installed it to look for something further. Two issues came out of that: a path to RCE through the plugin installer, and a blind SSRF in the custom repository feature.
Exploitation
Step 1: capture the install request
Clicking the install button produces a request that Burp Suite captures:

Why this step: before you can abuse a feature you have to see exactly what the browser asks the server to do. The captured request shows which page is called and which values are sent, and those values are what an attacker would later change.
The installer relies on at least the two functions mentioned above; the RCE analysis concentrates on installUpdateThemePluginAction.

Step 2: understand what the installer does with the archive
The function downloads the plugin from the server and temporarily stores it at data/files/ZIPFromURL.zip. The zip is then extracted into data/plugins/folderplugin-master/ and renamed to data/plugins/folderplugin/.

Why this matters: the installer trusts whatever is inside the downloaded zip. It unpacks it and puts the result in a folder whose name you can predict in advance. If you can put your own file in that zip, it ends up on the server at a location you already know.
Step 3: plant a PHP backdoor in the plugin archive
Because the plugin to be installed is under the attacker's control, a PHP backdoor can be placed inside the zip file. A backdoor here means a small PHP script that, when opened in a browser, lets the attacker run commands on the server. The path produced by the extraction is predictable and directly reachable over HTTP, so after installing the crafted plugin the backdoor is available at:
/data/plugins/folderplugin/evil.php
Line by line: this is a URL path, not a command. /data/plugins/ is the folder where installed plugins live, folderplugin is the predictable folder name produced by the extraction and rename, and evil.php is the file the attacker placed inside the zip. Because the web server runs PHP, simply visiting that address executes the file instead of showing it as text.
Step 4: automate and get a shell
A small script automates the process and yields shell access.

Why automate: the manual steps (build the zip, upload it, wait for extraction, open the backdoor) are repetitive. A script repeats them reliably and gives a shell, meaning an interactive command line on the server.
The exploit was published on exploit-db as 49155.
Step 5: the custom repository filter
The second issue lives in the same installer feature. The function addCustomThemePluginRepository is the more interesting one because it filters the destination of the plugin being installed. It is the function used when installing a custom plugin through the feature.

When using it, the destination has to be a GitHub or GitLab repository. The source code shows the check:

The code forbids any destination other than GitHub and GitLab by using strpos to look for the strings "https://github.com/" and "https://gitlab.com/" in the $url variable. The check is weak: strpos returns an integer position when the searched string is present, and FALSE (boolean) when it is not. Any URL that merely contains those strings passes. The author tested this by redirecting the destination to a server under their control.

In plain words: strpos answers the question "where in this text does this piece of text appear?" It does not answer "is this URL really GitHub?" So a URL that has https://github.com/ somewhere inside it, but actually points at the attacker's own server, is accepted. The filter was bypassed. The SSRF is blind: nothing is reflected in the response body, so internal files cannot be read directly with the file:// scheme. Blind means the attacker cannot see the reply from the internal service; they only know the request was sent.
Step 6: prepare FastCGI over TCP
To demonstrate the highest impact, RCE through the SSRF, the author used FastCGI, which by default runs over a socket. To get command execution through the FastCGI configuration, it was switched to a TCP connection on port 9000.

Why this step: FastCGI is the protocol a web server uses to talk to PHP. Normally it listens on a local socket. Switching it to a TCP port makes it reachable over the network, which is what lets the SSRF reach it. To reach the internal network, the gopher protocol is used: the gopher:// scheme allows interaction with a specific IP and port and the sending of arbitrary bytes. The report notes that the technique is not limited to FastCGI; services such as Redis, MySQL, PostgreSQL, Memcached, Zabbix and SMTP can be targeted in the same way. With the FastCGI service prepared, the payload can be sent to it.
Step 7: generate the payload
The Gopherus tool generates the payload. A reverse shell payload is created directly.

Why a tool: writing raw gopher bytes by hand is error-prone. Gopherus builds the exact byte sequence a FastCGI service expects, so the request looks like a legitimate one to that service. A reverse shell means the server connects back to the attacker and hands over a command line.
Step 8: run the exploit

A Python script automates the exploit process.

Why automate again: the SSRF request has to be sent with the right URL, the right payload and the right timing. A script does that consistently. The exploit was published on exploit-db as 49154.
The SSRF also affects installUpdateThemePluginAction, and there it is even easier because that function has no filter on the repository destination at all.

Root cause
Two separate mistakes combine into the two findings.
- Unvalidated archive contents and predictable extraction paths (RCE). The installer downloads an attacker-supplied zip, extracts it, and renames the result to a predictable directory under
data/plugins/. The extracted files are directly accessible, so a PHP file inside the archive becomes executable at a known URL. - Substring check instead of URL validation (SSRF).
addCustomThemePluginRepositoryusesstrposto test for"https://github.com/"and"https://gitlab.com/"in$url. A position result is truthy andFALSEis falsy, so the check only asks whether those strings appear anywhere in the URL, not whether the URL points at GitHub or GitLab. Any URL containing those strings passes, which is what the author used to redirect the request to their own server.installUpdateThemePluginActionhas no destination filter at all.
The author focused on features that require authentication, so the attack vector is an attacker who already holds valid credentials.
Impact
With valid dashboard credentials, an attacker can install a crafted plugin and execute arbitrary PHP through a predictable path, obtaining a shell. Through the custom repository feature, the same authenticated attacker can make the server issue requests to arbitrary destinations, including internal hosts and third-party systems, and by pointing gopher at a FastCGI service on port 9000 can escalate the blind SSRF to command execution. The report also notes that other internal services reachable over gopher, such as Redis, MySQL, PostgreSQL, Memcached, Zabbix and SMTP, are potential targets. Because the SSRF is blind, direct reading of internal files with file:// is not possible.
Fix
The report does not describe a patch or a code change. Based on the root causes, the fixes would be to validate the actual host of the repository URL rather than searching for a substring, to apply the same destination restriction to installUpdateThemePluginAction, and to validate or restrict the contents and extraction paths of downloaded plugin archives so that executable files cannot be placed at predictable, web-reachable locations.
Variants to test
- Substring-based URL allowlists elsewhere. Submit a URL that contains the allowed host string but points elsewhere, for example a path or query containing
https://github.com/. A positive result is the server fetching the attacker-controlled destination. - Installer functions without a filter. Try the same redirect against
installUpdateThemePluginAction. A positive result is an outbound request to an arbitrary host with no filtering at all. - Predictable extraction directories. Install a benign archive and check whether the extracted folder name and path can be predicted and reached over HTTP. A positive result is a directly accessible file at a stable path under
data/plugins/. - Archive content handling. Place a PHP file in a plugin zip and request it after installation. A positive result is the file being served and executed rather than treated as inert content.
- Gopher against internal services. With a reachable FastCGI listener on TCP port 9000, send a Gopherus-generated payload through the SSRF. A positive result is command execution on the internal service; the same approach can be tried against Redis, MySQL, PostgreSQL, Memcached, Zabbix and SMTP.
Timeline
- 27 November 2020: finding the security issue
- 27 November 2020: report
- 28 November 2020: validation
- 28 November 2020: hall of fame
References
- https://portswigger.net/web-security/ssrf
- https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery
- https://github.com/tarunkant/Gopherus
- https://spyclub.tech/2018/08/14/2018-08-14-blog-on-gopherus/
Glossary
- Authentication: proving who you are, usually with a username and password, so the site lets you into a private area.
- Backdoor: a hidden piece of code left on a server that lets an attacker run commands later.
- Blind SSRF: an SSRF where the attacker cannot see the response from the internal service, only send the request.
- Burp Suite: a tool that sits between your browser and a server so you can read and edit the requests and responses.
- CMS: content management system, software for building and editing a website without writing code.
- Database (DBMS): software that stores data in tables and answers queries; WonderCMS does not need one.
- exploit-db: a public archive of published exploits and proof-of-concept code.
- FastCGI: the protocol a web server uses to pass requests to PHP; it can listen on a local socket or on a TCP port.
- Gopher: an old internet protocol; the
gopher://scheme lets you send arbitrary bytes to a chosen IP and port, which is useful for talking to internal services. - Gopherus: a tool that generates gopher payloads for services such as FastCGI, Redis and MySQL.
- HTTP request: the message a browser sends to a server asking for a page or an action.
- PHP: the programming language most websites use on the server side; a
.phpfile is executed by the web server. - Plugin: an add-on that gives a website extra features.
- Port: a numbered channel on a computer; a service listens on a port so other machines can connect.
- RCE (Remote Code Execution): running your own commands on someone else's server over the network.
- Repository: an online place where code or plugins are stored and downloaded from, such as GitHub or GitLab.
- Reverse shell: a connection where the server reaches back to the attacker and gives them a command line.
- Shell: an interactive command line on a machine.
- Socket: a local connection point used by programs on the same machine to talk to each other.
- SSRF (Server Side Request Forgery): making a server send a request to a destination the attacker chooses, including internal systems the attacker cannot reach directly.
strpos: a PHP function that returns the position of a piece of text inside another, orFALSEif it is not found.- Theme: a package that changes how a website looks.
- VM (virtual machine): a computer simulated in software, used to test things safely.
- Zip: a compressed archive file that can hold many files inside one.