Project

General

Profile

Actions

Bug #1272

closed

Segfault in libhtp 0.5.15

Added by Andreas Herz over 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

I'm getting some segfaults with the newest suricata 2.0.3 release bundled with libhtp 0.5.15.
I can't trigger it to reproduce it directly, but running suricata on one of our productive systems the segfault triggers from time to time, so it seems to be some special http traffic that is troublesome for libhtp.

Coredump:

Thread 7 (LWP 29696):
#0  0xb7498b7e in recv () from /lib/libpthread.so.0
#1  0x0815b3d5 in recv (__flags=0, __n=<optimized out>, __buf=<optimized out>, __fd=<optimized out>) at /usr/include/bits/socket2.h:45
#2  NFQRecvPkt (t=0x82465c0 <nfq_q>, tv=0x8246480 <nfq_t>) at source-nfq.c:862
#3  0x0815b8b5 in ReceiveNFQLoop (tv=0xafe6560, data=0x8246480 <nfq_t>, slot=0xabeb458) at source-nfq.c:990
#4  0x081838da in TmThreadsSlotPktAcqLoop (td=0xafe6560) at tm-threads.c:703
#5  0xb749199b in ?? () from /lib/libpthread.so.0
#6  0xb73f547e in clone () from /lib/libc.so.6

Thread 6 (LWP 29699):
#0  0xb7495a02 in pthread_cond_wait () from /lib/libpthread.so.0
#1  0x0817e09f in TmqhInputFlow (tv=0xaa780b0) at tmqh-flow.c:93
#2  0x08183ffa in TmThreadsSlotVar (td=0xaa780b0) at tm-threads.c:810
#3  0xb749199b in ?? () from /lib/libpthread.so.0
#4  0xb73f547e in clone () from /lib/libc.so.6

Thread 5 (LWP 29689):
#0  0xb73befdc in nanosleep () from /lib/libc.so.6
#1  0xb73ef04c in usleep () from /lib/libc.so.6
#2  0x08179324 in main (argc=8, argv=0xbf83e2d4) at suricata.c:2357

Thread 4 (LWP 29700):
#0  0xb7495a02 in pthread_cond_wait () from /lib/libpthread.so.0
#1  0x0817f89f in TmqhInputSimple (t=0xaab0a78) at tmqh-simple.c:55
#2  0x08183ffa in TmThreadsSlotVar (td=0xaab0a78) at tm-threads.c:810
#3  0xb749199b in ?? () from /lib/libpthread.so.0
#4  0xb73f547e in clone () from /lib/libc.so.6

Thread 3 (LWP 29698):
#0  0xb7495a02 in pthread_cond_wait () from /lib/libpthread.so.0
#1  0x0817e09f in TmqhInputFlow (tv=0xb48bd40) at tmqh-flow.c:93
#2  0x08183ffa in TmThreadsSlotVar (td=0xb48bd40) at tm-threads.c:810
#3  0xb749199b in ?? () from /lib/libpthread.so.0
#4  0xb73f547e in clone () from /lib/libc.so.6

Thread 2 (LWP 29701):
#0  0xb7495d95 in pthread_cond_timedwait () from /lib/libpthread.so.0
#1  0x08121161 in FlowManagerThread (td=0xba7d1d0) at flow-manager.c:545
#2  0xb749199b in ?? () from /lib/libpthread.so.0
#3  0xb73f547e in clone () from /lib/libc.so.6

Thread 1 (LWP 29697):
#0  0xb77709f7 in htp_tx_res_process_body_data_ex () from /usr/lib/libhtp-0.5.15.so.1
#1  0xb7771f7b in htp_tx_state_response_complete_ex () from /usr/lib/libhtp-0.5.15.so.1
#2  0xb776e3fc in htp_connp_RES_FINALIZE () from /usr/lib/libhtp-0.5.15.so.1
#3  0xb776df4a in htp_connp_res_data () from /usr/lib/libhtp-0.5.15.so.1
#4  0xb776881a in htp_connp_close () from /usr/lib/libhtp-0.5.15.so.1
#5  0x0806adf6 in HTPHandleResponseData (f=0x8e2d4a8, htp_state=0xb2b5f840, pstate=0xb2b5f818,
    input=0xb34fd7ec "HTTP/1.0 200 OK\r\nServer: Apache/2.2.22 (Unix)\r\nX-Web-Node: www239\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Methods: POST, GET, OPTIONS\r\nAccess-Control-Max-Age: 86400\r\nCache-Control: max-a"..., input_len=795, local_data=0x0) at app-layer-htp.c:820
#6  0x0806feba in AppLayerParserParse (alp_tctx=0xb5900a48, f=0x8e2d4a8, alproto=1, flags=11 '\v',
    input=0xb34fd7ec "HTTP/1.0 200 OK\r\nServer: Apache/2.2.22 (Unix)\r\nX-Web-Node: www239\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Methods: POST, GET, OPTIONS\r\nAccess-Control-Max-Age: 86400\r\nCache-Control: max-a"..., input_len=795) at app-layer-parser.c:836
#7  0x08056590 in AppLayerHandleTCPData (tv=0xaaa46c8, ra_ctx=0xb5900880, p=0x8d4e150, f=0x8e2d4a8, ssn=0xb2b5f788, stream=0xb2b5f790,
    data=0xb34fd7ec "HTTP/1.0 200 OK\r\nServer: Apache/2.2.22 (Unix)\r\nX-Web-Node: www239\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Methods: POST, GET, OPTIONS\r\nAccess-Control-Max-Age: 86400\r\nCache-Control: max-a"..., data_len=795, flags=11 '\v') at app-layer.c:288
#8  0x0816f2e5 in StreamTcpReassembleInlineAppLayer (tv=0xaaa46c8, ra_ctx=0xb5900880, ssn=0xb2b5f788, stream=0xb2b5f790, p=0x8d4e150)
    at stream-tcp-reassemble.c:2361
#9  0x08173c24 in StreamTcpReassembleHandleSegment (tv=0xaaa46c8, ra_ctx=0xb5900880, ssn=0xb2b5f788, stream=0xb2b5f790, p=0x8d4e150, pq=0xb5900474)
    at stream-tcp-reassemble.c:3548
#10 0x0816af85 in StreamTcpPacketStateFinWait1 (tv=0xaaa46c8, p=0x8d4e150, stt=0xb5900468, ssn=0xb2b5f788, pq=0xb5900474) at stream-tcp.c:2917
#11 0x0816c500 in StreamTcpPacket (tv=0xaaa46c8, p=0x8d4e150, stt=0xb5900468, pq=0xb49d970) at stream-tcp.c:4344
#12 0x0816d83c in StreamTcp (tv=0xaaa46c8, p=0x8d4e150, data=0xb5900468, pq=0xb49d970, postpq=0xb49d9c4) at stream-tcp.c:4581
#13 0x08183d0e in TmThreadsSlotVarRun (tv=0xaaa46c8, p=0x8d4e150, slot=0xb49d950) at tm-threads.c:559
#14 0x08184016 in TmThreadsSlotVar (td=0xaaa46c8) at tm-threads.c:814
#15 0xb749199b in ?? () from /lib/libpthread.so.0
#16 0xb73f547e in clone () from /lib/libc.so.6

Suricata:

This is Suricata version 2.0.3 RELEASE
Features: NFQ PCAP_SET_BUFF LIBPCAP_VERSION_MAJOR=1 AF_PACKET HAVE_PACKET_FANOUT LIBCAP_NG HAVE_HTP_URI_NORMALIZE_HOOK HAVE_NSS 
SIMD support: none
Atomic intrisics: 1 2 4 8 byte(s)
32-bits, Little-endian architecture
GCC version 4.4.6 20110731 (Red Hat 4.4.6-3), C version 199901
compiled with -fstack-protector
compiled with _FORTIFY_SOURCE=2
L1 cache line size (CLS)=64
compiled with LibHTP v0.5.15, linked against LibHTP v0.5.15
Suricata Configuration:
  AF_PACKET support:                       yes
  PF_RING support:                         no
  NFQueue support:                         yes
  NFLOG support:                           no
  IPFW support:                            no
  DAG enabled:                             no
  Napatech enabled:                        no
  Unix socket enabled:                     no
  Detection enabled:                       yes

  libnss support:                          yes
  libnspr support:                         yes
  libjansson support:                      no
  Prelude support:                         no
  PCRE jit:                                no
  LUA support:                             no
  libluajit:                               no
  libgeoip:                                no
  Non-bundled htp:                         no
  Old barnyard2 support:                   no
  CUDA enabled:                            no

  Suricatasc install:                      no

  Unit tests enabled:                      no
  Debug output enabled:                    no
  Debug validation enabled:                no
  Profiling enabled:                       no
  Profiling locks enabled:                 no
  Coccinelle / spatch:                     no

Generic build parameters:
  Installation prefix (--prefix):          /usr
  Configuration directory (--sysconfdir):  /etc/suricata/
  Log directory (--localstatedir) :        /var/log/suricata/

  Host:                                    i686-redhat-linux-gnu
  GCC binary:                              gcc -std=gnu99
  GCC Protect enabled:                     yes
  GCC march native enabled:                no
  GCC Profile enabled:                     no


Files

foo.gz (3.55 KB) foo.gz Andreas Herz, 09/17/2014 06:02 AM
foo.xml (1.36 KB) foo.xml Andreas Herz, 09/17/2014 06:02 AM
Actions

Also available in: Atom PDF