what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Tcl 1.16 Cross Site Scripting

Tcl 1.16 Cross Site Scripting
Posted Feb 27, 2015
Authored by Ben Fuhrmannek

Tcl versions 1.0.0 through 1.16 suffer from a cross site scripting vulnerability.

tags | exploit, xss
SHA-256 | 730a7bdc810f6661614e8c85a4d349f300753b320e0c094481b7623cf1db1ed1

Tcl 1.16 Cross Site Scripting

Change Mirror Download

SektionEins GmbH
www.sektioneins.de

-= Security Advisory =-

Advisory: Cross-Site-Scripting (XSS) in tcllib's html::textarea
Release Date: 26 February 2015
Last Modified: 26 February 2015
Author: Ben Fuhrmannek [ben.fuhrmannek[at]sektioneins.de]

Application: tcllib - Tcl standard library - versions 1.0.0 to 1.16;
html package versions lower than 1.4.4
Severity: The use of html::textarea always results in XSS.
Risk: High
Vendor Status: resolved with html package version 1.4.4
Reference: https://www.sektioneins.de/en/advisories/advisory-012015-xss-tcllib-html-textarea.html
http://core.tcl.tk/tcllib/tktview/09110adc430de8c91d26015f9697cdd099755e63

Overview:

"The Tcl Library is a kitchen sink of packages across a broad spectrum of
things." - Tcl Library Home (http://core.tcl.tk/tcllib/home)

Applications using tcllib's ::html::textarea functions are vulnerable to
Cross-Site-Scripting. This function is usually used to programmatically add
an HTML <textarea> to the output stream of a CGI script.

No publicly available software has been found to be vulnerable. However it is
suspected that many non-public Tcl web applications using the
::html::textarea function are in operation.

Details:

User supplied input is directly inserted into the <textarea> as default
value, e.g. a textarea named 'ta' with a parameter of ta=XXX results in
`<textarea>XXX</textarea>`

This can be used to break out of the <textarea>-context and insert arbitrary
HTML content such as <script>-Tags.

The attack is possible using HTTP GET requests as well as POST and multipart
form encoded POST requests.

Code:

modules/html/html.tcl
(http://core.tcl.tk/tcllib/artifact/9a43f5efda2b74a5e61b60f261afdaf9ce1f1221)
lines 914-919

proc ::html::textarea {name {param {}} {current {}}} {
::set value [ncgi::value $name $current]
return "<[string trimright \
"textarea name=\"$name\"\
[tagParam textarea $param]"]>$value</textarea>\n"
}

Proof of Concept:

test.cgi

#!/usr/bin/env tclsh
package require ncgi
package require html

::ncgi::parse
::ncgi::header
puts [::html::textarea ta]

http://example.com/test.cgi?ta=%3C/textarea%3E%3Cscript%3Ealert%281%29%3C%2fs
cript%3E

Recommendation:

It is recommended to upgrade tcllib's html package to the current trunk
version.

In the meantime, a quick application level bugfix would be to encode the
input variable in question manually. Example with 'ta' as name:

set ::ncgi::value(ta) [::html::quoteFormValue [::ncgi::value ta {}]]

Disclosure Timeline:

28 January 2015 - submitted bug to Tcl Library bugtracker
http://core.tcl.tk/tcllib/tktview/09110adc430de8c91d26015f9697cdd099755e63

28 January 2015 - ticket was changed to priority '8', severity 'Severe'

24 February 2015 - ticket was changed to priority '9 Immediate', severity 'Critical'

26 February 2015 - ticket resolved and closed with revision 212d1feefe
http://core.tcl.tk/tcllib/info/212d1feefe

26 February 2015 - released advisory

CVE Information:

The Common Vulnerabilities and Exposures project (cve.mitre.org) has not
assigned a name to this vulnerability yet.

GPG-Key:

pub 4096R/B379CF81 2014-08-01 [expires: 2016-09-06]
Key fingerprint = FD91 EEC1 F7F1 48E3 DBBE AB10 9168 88DF B379 CF81

Copyright 2015 SektionEins GmbH. All rights reserved.

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close