Artifacts Associated With Ticket 00d04c4f120904aa
Ticket change [624fc3a85c] (rid 167368) by pooryorick on 2018-11-14 19:53:36:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- comment initialized to:
The following script: <code><verbatim> package require base64 package require tcl::chan::string package require tcl::transform::base64 set chan [tcl::chan::string {T3JpZ2luYWwtUmVjaXBpZW50OiA8L2ZheD1ibHViYkBndW1taS5ib290PgpBY3Rpb246IGZhaWxl ZApEaWFnbm9zdGljLUNvZGU6IHNtdHA7IDU1MCAjNS4xLjAgQWRkcmVzcyByZWplY3RlZC4KUmVt b3RlLU1UQTogNTMuMjQuMjgyLjE1MA= }] tcl::transform::base64 $chan puts [read $chan] </verbatim></code> produces a segmentation fault: <code><verbatim> #0 0x00007ffff793df53 in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6 #1 0x00007ffff7ef1249 in ResultAdd (rPtr=0x55555561bdf8, buf=0x55555566fd88 "\300\306`UUU", toWrite=-1) at /path/to/generic/tclIORTrans.c:3005 #2 0x00007ffff7ef199a in TransformDrain (rtPtr=0x55555561bda0, errorCodePtr=0x7fffffffdac0) at /path/to/generic/tclIORTrans.c:3239 </verbatim></code> Beware! This is the kind of report that could contain a trojan script that could conduct a terminal attack to execute arbitrary code. - is_private initialized to: "0"
- login: "pooryorick"
- priority initialized to: "5 Medium"
- private_contact initialized to: "e476148cded301ffff84bcdc432536dc0c949e88"
- resolution initialized to: "None"
- severity initialized to: "Severe"
- status initialized to: "Open"
- submitter initialized to: "pooryorick"
- subsystem initialized to: "25. Channel System"
- title initialized to: "transchan over a refchan: segmentation fault"
- type initialized to: "Bug"
Ticket change [6144984a28] (rid 167432) by sebres on 2018-11-15 16:20:48:
- assignee changed to: "sebres"
- icomment:
I have rewritten this for debug purposes without tcllib and simplest proc-handlers with debugging info: This produces following result... <code><pre style="padding:10pt;"> *********** initialize rc0 {read write} - push rc0 ... *********== initialize rt0 {read write} - read from rc0 ... *********** read rc0 4096 - current pos: 0, current buf: 189 ********* pos: 189, r: `T3JpZ2luYWwtUmVjaXBpZW50OiA8L2ZheD1ibHViYkBndW1taS5ib290PgpBY3Rpb246IGZhaWxl ZApEaWFnbm9zdGljLUNvZGU6IHNtdHA7IDU1MCAjNS4xLjAgQWRkcmVzcyByZWplY3RlZC4KUmVt b3RlLU1UQTogNTMuMjQuMjgyLjE1MA=` -- *********== read rt0 {T3JpZ2luYWwtUmVjaXBpZW50OiA8L2ZheD1ibHViYkBndW1taS5ib290PgpBY3Rpb246IGZhaWxl ZApEaWFnbm9zdGljLUNvZGU6IHNtdHA7IDU1MCAjNS4xLjAgQWRkcmVzcyByZWplY3RlZC4KUmVt b3RlLU1UQTogNTMuMjQuMjgyLjE1MA=} - current pos: 0, current buf: 0 *********== base64_Code `T3JpZ2luYWwtUmVjaXBpZW50OiA8L2ZheD1ibHViYkBndW1taS5ib290PgpBY3Rpb246IGZhaWxl ZApEaWFnbm9zdGljLUNvZGU6IHNtdHA7IDU1MCAjNS4xLjAgQWRkcmVzcyByZWplY3RlZC4KUmVt b3RlLU1UQTogNTMuMjQuMjgyLjE1MA=` *********== base64_Complete `T3JpZ2luYWwtUmVjaXBpZW50OiA8L2ZheD1ibHViYkBndW1taS5ib290PgpBY3Rpb246IGZhaWxl ZApEaWFnbm9zdGljLUNvZGU6IHNtdHA7IDU1MCAjNS4xLjAgQWRkcmVzcyByZWplY3RlZC4KUmVt b3RlLU1UQTogNTMuMjQuMjgyLjE1MA=` *********== base64_Complete, ret: 187 *********== base64_Code, ret: `Original-Recipient: </[email protected]> Action: failed Diagnostic-Code: smtp; 550 #5.1.0 Address rejected. Remote-MTA: 53.24.282.150` *********== read rt0, res: `Original-Recipient: </[email protected]> Action: failed Diagnostic-Code: smtp; 550 #5.1.0 Address rejected. Remote-MTA: 53.24.282.150` *********** read rc0 3960 - current pos: 189, current buf: 189 ********* pos: 189, r: `` -- *********== drain rt0 - current pos: 0, current buf: 1 *********== drain rt0, rest: `=` max size for a Tcl value (2147483647 bytes) exceeded </pre></code> How one can possibly see, the proc base64_Complete (using in transform channel rt0) calculates invalid offset (187 in opposite to 189 of the original buffer in reflected channel rc0), but full buffer is already transformed. Further investigation shows that binary decode on "empty" base64 buffer (only "=") produces a panic, with wrong got out (so segfault) within the drain-handler: <code><pre style="padding:10pt;"> % binary decode base64 = max size for a Tcl value (2147483647 bytes) exceeded </pre></code> WiP. - login: "sebres"
- mimetype: "text/x-fossil-wiki"
- priority changed to: "7 High"
- subsystem changed to: "16. Commands A-H"
Ticket change [b40f453731] (rid 167479) by sebres on 2018-11-15 22:35:29:
- icomment:
fixed in branch [./timeline?r=bug-00d04c4f12|bug-00d04c4f12].
- login: "sebres"
- mimetype: "text/x-fossil-wiki"
- priority changed to: "Immediate"
- resolution changed to: "Open"
- status changed to: "Fixed"
- type changed to: "Code_Defect"
- icomment:
Ticket change [625eef4f02] (rid 167558) by sebres on 2018-11-19 07:34:58:
- assignee changed to: "nobody"
- closedate changed to: "2458441.81595187"
- closer changed to: "sebres"
- foundin changed to: ">= 8.6"
- icomment: "merged"
- login: "sebres"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- title changed to:
base64 transchan over a refchan: segmentation fault
- type changed to: "Bug"