Re: 'printenv' XSS vulnerability

From: Marc Slemko (marcs@znep.com)
Date: 12/23/02

  • Next message: Stephan Sachweh: "Antwort: Openwebmail 1.71 remote root compromise"
    Date: Mon, 23 Dec 2002 08:43:13 -0800 (PST)
    From: Marc Slemko <marcs@znep.com>
    To: "Dr.Tek" <tek@superw00t.com>
    
    

    On Sun, 22 Dec 2002, Dr.Tek wrote:

    > 'printenv' is a test CGI script that tends to come default with most
    > Apache installation. Usually located in the "/cgi-bin/" directory.
    >
    >
    > An XSS vulnerbility exist which will allow anyone to input specially
    > crafted links and/or other malicious/obscene scripts.
    >
    >
    > Example exploitation:
    >
    > http://www.w00tw00t.com/cgi-bin/printenv/ href="bad">If you see this
    > error, Click here!</a>

    That does not post any cross site scripting risk when using standards
    compliant browsers and a moderately recent version of the script.

    It does not output HTML, but rather text/plain. The only reason
    that may be rendered as HTML for you is if your browser is broken
    and ignores the text/plain MIME type. IE is known to be broken in
    this way, and yes it is a security hole in IE. Microsoft has
    decreed, in their infinite wisdom, that text/plain can never be
    used safely with IE with arbitrary input since there is no way to
    encode characters since... it is plain text.

    >
    >
    > Fix:
    >
    > Since 'printenv' is just an example CGI script that has no real use and
    > has its own problems. Just remove it.

    Agreed, if you don't need it then don't use it. It isn't installed as
    a runnable script by default for a variety of reasons, including this one.



    Relevant Pages

    • Re: ssi and Perl/CGI
      ... How do I go about passing variables to the script via include virtual ... I'll give cmd a whirl, though cgi seems to work great if all my page ... content is coming from the CGI script. ...
      (perl.beginners)
    • Re: CGI Question
      ... leftframe.cgi, not javascript. ... > a CGI script (and it's initially called with NO ... > and the right frame contains an HTML file. ...
      (perl.beginners)
    • Re: Slightly OT: Incoming email triggers
      ... > I found a provider who offers Tcl as a scripting language - great ... > - a script gets activated ... The phrase you're looking for is "mail delivery agent," and the question ... you could always .htaccess protect a CGI script that you run which is a ...
      (comp.lang.tcl)
    • Re: perl/cgi exploit with bracketed module names passed in as CGI param
      ... > cgi script prints the raw cgi param value back out, ... which allows to evaluate a string inside of brackets, ... you put your CGI-parameters into a string and run that string through ...
      (comp.lang.perl.misc)
    • Re: root privileges from cgi script?
      ... I require for a staff member to be able to initiate a backup script ... > a chain of backup processes. ... > I would welcome any suggestions on how to do two things from a CGI script; ... > I know suex can't be used because ROOT is specifically not allowed. ...
      (comp.unix.shell)