Tcl Library Source Code

View Ticket
Login
Ticket UUID: dac0c417efb3a2a0dd6a201089ae8239c654ac14
Title: Protecting against attacks and general improvements
Type: Bug Version: all
Submitter: anonymous Created on: 2022-04-22 15:50:52
Subsystem: (unused) Assigned To:
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2022-04-25 13:36:25
Resolution: None Closed By: nobody
    Closed on:
Description:
I am classifying this as a bug because at least one case can be used for general attacks... It is, however, a very broad issue which can affect many library routines.

While working with several of the hashing libraries, I noticed that there was a lot of inconsistency in the commands. Some take a "-hex" (or "-bin"?) option, while others take a "-format" option. Some take options for "-file" or "-channel", others do not. And most importantly, some take a "--" option to terminate option processing and allow data strings to begin with a "-".

I suggest:

Priority 1) All library routines which accept general strings are updated to accept "--" so they can allow data strings which may appear to be option flags, such as "::md5::md5 $data" where $data contains "-file /etc/passwd". While this is not much of an attack in this case (it is unlikely an attacker can regenerate the password file from the MD5 hash, and also unlikely to be very useful in modern password file systems... there are other system files which may be targeted for further attacks), there are other library routines that might be vulnerable to such an attack.

Priority 2) All library routines are reviewed and updated for consistency. In my case, CRC* takes the "-format" option, while SHA* can take the "-hex" option. "-hex" can be added to CRC* (and maybe an explicit "-bin"? option), and "-format" can be added to MD*/SHA*. And so on. (Updating the "pure TCL" routines is likely easier than updating the "tcllibc" "C" ones.)
User Comments: aku added on 2022-04-25 13:36:25:
Are you willing to provide patches ?

anonymous (claiming to be Corrections) added on 2022-04-23 00:21:14:
Also note that a "work-around" of prefixing the data with something to guard against a starting "-" is _NOT_ an option for hashing as that changes the output of the hash function, making it meaningless. This may or may not be true for other tcllib routines.