S21SEC-024 - Vignette TCL Injection

From: S21SEC (vul-serv_at_s21sec.com)
Date: 05/26/03

  • Next message: Michael Nelson: "Re: bazarr CALL POLICE"
    Date: Mon, 26 May 2003 16:14:17 +0200
    To: bugtraq@securityfocus.com
    
    

    ###############################################################
    ID: S21SEC-024-en
    Title: Vignette TCL Injection
    Date: 03/04/2003
    Status: Vendor contacted and solution available
    Scope: TCL code Execution, Remote command execution
    Platforms: All
    Author: rpinuaga
    Location: http://www.s21sec.com/es/avisos/s21sec-024-en.txt
    Release: External
    ###############################################################

                                    S 2 1 S E C

                               http://www.s21sec.com

                               Vignette TCL Injection

    About Vignette
    --------------

    Vignette develops Content Management and Application Portal Software.

    Description of vulnerability
    ----------------------------

    Vignette Software presents a vulnerability in some propietary commands that permits the injection of TCL code under some circunstances.

    The affected Vignette commands are:
    - NEEDS
    - VALID_PATHS

    All the TCL templates or scripts, that use this commands, are vulnerable to remote code injection.

    The source code of both commands is located in a file called "stdlib.tcl" at the Vignette library directory. The offending code is the following:

    ========== stdlib.tcl (Extracted from Vignette 5.6.3) ==========

    -- Lines 1049/1053 (NEEDS command) --

            SET cookieName "vgn_creds"
            SET formPath [CURL /vgn/login]

                    SET queryString [SHOW HTTP_QUERY_STRING] <--- (!)

            } elseif {[llength $args] < 2} {
            error "Usage: NEEDS LOGIN cookieName URL\n"

    --
    -- Lines 1141/1146 (NEEDS command) --
        } elseif {![string compare $arg "COOKIE"]} {
            global _Cookie HTTP_COOKIE
            
            regsub -all {; } [SHOW HTTP_COOKIE] { } cookieString            <--- (!)
            
            set cookies [split $cookieString { }]
            foreach c $cookies {
    --
    -- Lines 1272/1277 (VALID_PATHS command) --
        global _Path
        if {[info exists _Path] == 1 && [lsearch $paths $_Path] == -1} {
        
        
        system_error "Invalid path \"$_Path\" for template (referer='[SHOW HTTP_REFERER]')"         <--- (!)
        
        
        }
        return ""
    --
    =================================================
    As seen, the value of some unfiltered variables is used and evaluated with the SHOW command. If the external variable contains Vignette code, then arbitrary TCL execution is posible. The affected input variables are:
    - HTTP_QUERY_STRING, converted to queryString in NEEDS command.
    - HTTP_COOKIE, converted to cookieString in NEEDS command.
    - HTTP_REFERER, showed in VALID_PATHS command.
    This three variables are received directly form the web client, and aren't sanitized in any way. If the Vignette/TCL escape characters are included "[" and "]" the code between them is evaluated as valid TCL code.
    The VALID_PATHS command is very few used in Vignette Applications, but the NEEDS command is extensively used, even in the default Vignette templates. The following default installed templates are vulnerables and remotely exploitables:
    /vgn/ac/edit - [NEEDS LOGIN]
    /vgn/ac/index - [NEEDS LOGIN]
    /vgn/vr/Editing - [NEEDS LOGIN]
    /vgn/vr/Select - [NEEDS LOGIN]
    /vgn/legacy/edit - [NEEDS LOGIN]
    /vgn/ppstats - [NEEDS LOGIN]
    It's important to note that the bug not only affect the default Vignette Applications, nor it affects all the applications developed over a Vignette Server Software, that use the affected commands.
    Affected Versions and platforms
    -------------------------------
    This vulnerability has been tested in Vignette StoryServer 5, and Vignette V/6. But it seems that all currently avaliable versions are vulnerable.
    Solution
    --------
    Replace the offending SHOW evaluations in stdlib.tcl with directly passed variables. For example:
    instead: SET queryString [SHOW HTTP_QUERY_STRING]
    use ==> SET queryString $HTTP_QUERY_STRING
    instead: regsub -all {; } [SHOW HTTP_COOKIE] { } cookieString
    use ==> regsub -all {; } $HTTP_COOKIE { } cookieString
    instead: system_error "Invalid path \"$_Path\" for template (referer='[SHOW HTTP_REFERER]')"
    use ==> system_error "Invalid path \"$_Path\" for template (referer='$HTTP_REFERER')"
    Vignette users should procceed to contact vignette throught the standard channels VOLS etc in order to get a solution.
    Additional information
    ----------------------
    These vulnerabilities have been found and researched by:
     Ramon Pinuaga Cascales         rpinuaga@s21sec.com
    You can find the last version of this warning in:
            http://www.s21sec.com/es/avisos/s21sec-024-en.txt
    And other S21SEC warnings in http://www.s21sec.com/es/avisos/
    

  • Next message: Michael Nelson: "Re: bazarr CALL POLICE"

    Relevant Pages

    • Re: tcltest (was Re: How do you convert a TCL list into a string that PHP can read?)
      ... This might be a great time to mention that I learned TCL via.. ... I used to work at Vignette and I know first hand ... You actually get a lot more than just the test command, ...
      (comp.lang.tcl)
    • Re: S21SEC-024 - Vignette TCL Injection
      ... > vulnerable to remote code injection. ... The actual vulnerability depends on the code path ... taken in the NEEDS Tcl procedure. ... The problematic command here is not SHOW, ...
      (Bugtraq)
    • [NEWS] Vignette Story Server Sensitive Information Disclosure
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Vignette Story Server allows the publication of both static and dynamic ... exists vulnerability within the TCL interpreter used that allows 'dumping' ... @stake calls Vignette contact to explain vulnerability, ...
      (Securiteam)
    • Re: TCL equivalent of PHP "phpinfo()"?
      ... > Practical Programming in Tcl and Tk ... Vignette - content management. ... global simply puts the variable reference into the scope of ... the proc so that the proc can use it. ...
      (comp.lang.tcl)
    • Vignette and Tcl (was Re: Veblenesque rant)
      ... Phil Powell wrote: ... > Enterprise-ready. ... For at least 6 years, maybe more, Vignette has been "getting away from ... Do they still have Tcl in the product or have they finally succeeded? ...
      (comp.lang.tcl)