DataSoft / Honeyd

virtual honeypots
GNU General Public License v2.0
350 stars 103 forks source link

Segfault because of NULL in "tmpl" #76

Open husak opened 11 years ago

husak commented 11 years ago

Honeyd received segfault while dealing with udp packets because "tmpl" was not checked for NULL in udp_recv_cb

Program received signal SIGSEGV, Segmentation fault.
udp_recv_cb (tmpl=0x0, pkt=pkt@entry=0x7ffff5cbb6a4 "E", pktlen=pktlen@entry=58) at honeyd.c:2719
2719            if (!strcmp("default", tmpl->name))  {
(gdb) backtrace
#0  udp_recv_cb (tmpl=0x0, pkt=pkt@entry=0x7ffff5cbb6a4 "E", pktlen=pktlen@entry=58) at honeyd.c:2719
#1  0x0000000000413deb in honeyd_dispatch (tmpl=tmpl@entry=0x0, iface=<optimized out>, ip=ip@entry=0x7ffff5cbb6a4, iplen=iplen@entry=58) at honeyd.c:3029
#2  0x0000000000414262 in honeyd_delay_cb (fd=<optimized out>, which=<optimized out>, arg=0x7fffffffd5c0) at honeyd.c:876
#3  0x000000000040f09b in honeyd_delay_packet (tmpl=tmpl@entry=0x0, iface=iface@entry=0x102ae50, ip=0x7ffff5cbb6a4, iplen=58, src=src@entry=0x0, dst=dst@entry=0x0, ms=0, flags=<optimized out>, spoof=...)
    at honeyd.c:944
#4  0x00000000004147ea in honeyd_input (inter=inter@entry=0x102ae50, ip=ip@entry=0x7ffff5cbb6a4, iplen=<optimized out>, iplen@entry=58) at honeyd.c:3343
#5  0x000000000041499d in honeyd_recv_cb (ag=0x102ae50 "", pkthdr=<optimized out>, pkt=0x7ffff5cbb696 "") at honeyd.c:3417
#6  0x00007ffff7fbdfbe in ?? () from /usr/lib/x86_64-linux-gnu/libpcap.so.0.8
#7  0x000000000042c26a in interface_recv (fd=<optimized out>, type=<optimized out>, arg=0x102ae50) at interface.c:556
#8  0x00007ffff7ba6ccc in event_base_loop () from /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5
#9  0x000000000040d90b in main (argc=<optimized out>, argv=<optimized out>) at honeyd.c:3950
altf4 commented 11 years ago

Thanks for the bug report! Could you by chance tell us just a few extra things:

a) What exact build are you using? Perhaps post the git hash. b) What were you doing at the time the segfault occurred?

PherricOxide commented 11 years ago

Could you also provide your honeyd configuration file located at,

 ~/.config/nova/config/haystack_honeyd.config