Overview
| Artifact ID: | 5ed4b110a32ed4b5dd196ee548d58dd904b1fa9c5935286171920f2dc0cbc8bc |
|---|---|
| Ticket: | c6897e6e6a8a65a995ec35c9c297b926bf1b6783
select notifier crashes/misbehaves on fd >= FD_SETSIZE |
| User & Date: | obj on 2019-11-05 04:31:45 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
The select notifier crashes or misbehaves if given a file descriptor that's >= FD_SETSIZE. This is because it's using the FD_* macros blindly without checking whether the descriptor is in range, which trashes the stack. This has security implications. The overrun doesn't seem directly exploitable, but it is at a minimum a cheap DoS attack against a typical server that's accepting connections on a socket - establish ~1000 connections and the process will crash unavoidably. To reproduce on Linux (FD_SETSIZE is 1024): $ ulimit -n 4096 $ ./crashme.tcl 600 # 600*2 > 1024 [...] *** buffer overflow detected ***: tclsh terminated Aborted (core dumped) On FreeBSD, there's no immediate crash but the notifier starts spinning without making progress. From inspection it looks like the select notifier code in 8.7 still has the same problem. --- 8< --- #!/usr/bin/env tclsh proc dummy {args} {} proc accept_one {sock addr port} { fileevent $sock readable dummy puts -nonewline stderr "+" } proc crashme {count} { puts -nonewline stderr "connecting $count sockets " set listener [socket -server accept_one 0] lassign [chan configure $listener -sockname] listenIp listenHost listenPort for {set i 0} {$i < $count} {incr i} { set client [socket -async $listenIp $listenPort] fileevent $client readable dummy puts -nonewline stderr "." update } puts stderr " done." } if {!$tcl_interactive} { crashme [lindex $::argv 0] } --- 8< --- - foundin changed to: "8.6.9"
- is_private changed to: "0"
- login: "obj"
- priority changed to: "5 Medium"
- private_contact changed to: "900fc5ce35b9c7638101bd1f61914637995d3ab3"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "obj"
- subsystem changed to: "01. Notifier"
- title changed to:
select notifier crashes/misbehaves on fd >= FD_SETSIZE
- type changed to: "Bug"