Skip to main content
Vulnerability Database/CVE-2021-48016

CVE-2021-48016: DedeCMS PHP Code Injection RCE Vulnerability

CVE-2021-48016 is a PHP code injection vulnerability in DedeCMS through 5.8.1-beta that enables unauthenticated remote code execution via crafted HTTP Referer headers. This article covers technical details, exploitation methods, affected versions, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2021-48016 Overview

CVE-2021-48016 is an unauthenticated PHP code injection vulnerability in DedeCMS through version 5.8.1-beta. The flaw resides in the ShowMsg() function within include/common.func.php, which writes the HTTP Referer header into a DedeTemplate string that is subsequently included and executed. Attackers can send a crafted request to /plus/flink.php?dopost=save with an empty validation code to trigger execution of arbitrary PHP and operating system commands. The Shadowserver Foundation first observed exploitation attempts in the wild on 2023-10-14, confirming active abuse of this remote code execution flaw [CWE-94].

Critical Impact

Unauthenticated remote attackers can achieve full code execution on the underlying web server by sending a single crafted HTTP request containing a malicious Referer header.

Affected Products

  • DedeCMS 5.8.1-beta
  • DedeCMS prior releases through 5.8.1-beta
  • Web applications bundling the vulnerable include/common.func.php and plus/flink.php components

Discovery Timeline

  • 2026-10-22 - CVE-2021-48016 published to NVD
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2021-48016

Vulnerability Analysis

The vulnerability is a PHP code injection flaw rooted in unsafe handling of attacker-controlled HTTP headers. When a user submits a friendly-link request to /plus/flink.php with dopost=save, DedeCMS invokes ShowMsg() to render a status page. ShowMsg() embeds the raw Referer header value directly into a template string parsed by the DedeTemplate engine. Because the engine evaluates PHP expressions found in the template, injected markup is executed in the context of the web server process.

The pre-condition for exploitation is trivial. The flink.php handler accepts an empty validation code, allowing unauthenticated access to the vulnerable code path. No session, CSRF token, or captcha check gates the request, so a single HTTP POST yields remote code execution.

Root Cause

The root cause is improper neutralization of special elements used in code [CWE-94]. The ShowMsg() function treats the Referer header as trusted template content rather than untrusted user input. The DedeTemplate parser then evaluates the embedded PHP, converting a reflected header value into an executable payload. Insufficient input validation on the validate parameter in flink.php compounds the issue by exposing the sink to unauthenticated callers.

Attack Vector

Exploitation is network-based and requires no authentication or user interaction. An attacker issues an HTTP POST to /plus/flink.php?dopost=save with form fields that satisfy the save path, an empty validate parameter, and a Referer header containing PHP template syntax. The injected code is written to a temporary template cache file, included by the engine, and executed by the PHP interpreter. Public proof-of-concept logic exists in the Nuclei template referenced below; see the VulnCheck DedeCMS RCE Advisory, the SrcIncite CMS Security Analysis, and the GitHub Nuclei Template for DedeCMS RCE for the exact request structure.

Stop Remote Code Execution Before It Runs

Singularity™ Endpoint detects and blocks exploit attempts at machine speed, including zero-days and novel attack techniques.

Stop Exploit Attempts

Detection Methods for CVE-2021-48016

Indicators of Compromise

  • HTTP POST requests to /plus/flink.php?dopost=save originating from unauthenticated clients.
  • Referer headers containing PHP tags, backticks, or DedeTemplate directives such as {dede: sequences.
  • New or modified files under the DedeCMS template cache directory and unexpected PHP files written beneath the web root.
  • Child processes such as sh, bash, cmd.exe, curl, or wget spawned by the PHP-FPM or Apache worker process serving DedeCMS.

Detection Strategies

  • Deploy the GitHub Nuclei Template for DedeCMS RCE against internet-facing DedeCMS instances to confirm exposure.
  • Inspect web server access logs for POST requests to flink.php with abnormally long or syntactically unusual Referer values.
  • Correlate inbound web requests with outbound connections from the web server to flag command-and-control callbacks following exploitation.

Monitoring Recommendations

  • Enable full HTTP request header logging on reverse proxies or web application firewalls fronting DedeCMS to retain Referer values for forensic review.
  • Alert on file-write events within DedeCMS template, cache, and upload directories using file integrity monitoring.
  • Monitor for anomalous process lineage where the web server user executes shell interpreters or network utilities.

How to Mitigate CVE-2021-48016

Immediate Actions Required

  • Restrict access to /plus/flink.php at the web server or WAF layer until a patched build is deployed.
  • Block or sanitize inbound requests containing PHP syntax inside the Referer header through a WAF rule.
  • Audit DedeCMS installations for webshells, modified template files, and unauthorized administrator accounts.
  • Rotate credentials and API keys stored on compromised hosts before returning them to service.

Patch Information

No vendor-supplied patch URL is listed in the NVD entry for CVE-2021-48016. Review the vulnerable function in GitHub DedeCMS Common Functions and consult the VulnCheck DedeCMS RCE Advisory for remediation guidance. Organizations should migrate to a maintained content management platform where the DedeCMS project does not publish a fixed release.

Workarounds

  • Deploy a WAF rule to drop requests to /plus/flink.php where the Referer header contains <?, ?>, backticks, or DedeTemplate markers.
  • Remove or rename plus/flink.php if the friendly-link feature is unused.
  • Run the PHP worker under a least-privilege account with restricted filesystem write permissions and no outbound network access.
  • Place the DedeCMS application behind authentication at the reverse proxy for administrative networks only.
bash
# Example WAF rule (ModSecurity) to block injection in the Referer header for flink.php
SecRule REQUEST_URI "@beginsWith /plus/flink.php" \
    "id:1004801,phase:1,deny,status:403,log,msg:'CVE-2021-48016 flink.php access blocked',\
    chain"
    SecRule REQUEST_HEADERS:Referer "@rx (<\?|\?>|`|\{dede:)" \
        "t:none,t:lowercase"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.