Re: Several new CGI vulnerabilities

From: Lincoln Stein (lsteinat_private)
Date: Tue Nov 10 1998 - 11:43:27 PST

  • Next message: Wietse Venema: "Re: tcpd -DPARANOID doesn't work, and never did"

    Gus writes:
     > On Mon, 9 Nov 1998, xnec wrote:
     > >
     > > EXPLOIT:
     > >
     > > Each of these are exploitable by inputing metacharacters into the
     > > recipient's email address.  Each script calls something similar
     > > to:
     > >
     > >  open( MAIL, "|$mailprog $email" )
     >
     > This is one that just won't go away, and rather than try the (frankly
     > quite fruitless) metachar filtering route, it might be an idea for CGI
     > providing ISP's to insist on the use of perl's Mail::Sendmail module,
     > which cuts out any potential pipe/metachar related bugs by communicating
     > directly w/ the SMTP server.
    
    Net::SMTP is more likely to be installed on ISP's
    machines. Mail::Sendmail is a bit of an oddball.  There are also other
    ways to avoid the fruitless metachar search and destroy mission.
    First off, why do people think they need to put the recipient's
    address on the command line in the first place?
    
       open (MAIL,"| /usr/lib/sendmail -t -oi");
       print MAIL <<END;
       To: $mailto
       From: me (me\@nowhere.com)
       Subject: nothing much
    
       Hi there!
       END
       close MAIL;
    
    And here's a general Perl technique for opening pipes without getting
    the shell involved at all:
    
       open (MAIL,"|-") || exec '/usr/lib/sendmail','-t','-oi';
       print MAIL <<END;
       To: $mailto
       From: me (me\@nowhere.com)
       Subject: nothing much
    
       Hi there!
       END
       close MAIL;
    
    Lincoln
    
    --
    ========================================================================
    Lincoln D. Stein                           Cold Spring Harbor Laboratory
    lsteinat_private                                   Cold Spring Harbor, NY
    ========================================================================
    



    This archive was generated by hypermail 2b30 : Fri Apr 13 2001 - 14:22:41 PDT