Project

General

Profile

Actions

Bug #2603

closed

memleak/coredump: Ja3BufferInit

Added by Peter Manev over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Target version:
Affected Versions:
Effort:
Difficulty:
Label:

Description

Pcap privately shared.
I get memleaks (or a coredump if Suri is compiled without clang/asan)
using -

pevma@DonPedro:~/Work/Suricata/Bugs/tmp$ /opt/suricata-asan/bin/suricata --build-info
This is Suricata version 4.1.0-dev (rev 1f4cd75f)
Features: UNITTESTS PCAP_SET_BUFF AF_PACKET HAVE_PACKET_FANOUT LIBCAP_NG LIBNET1.1 HAVE_HTP_URI_NORMALIZE_HOOK PCRE_JIT HAVE_NSS HAVE_LUA HAVE_LUAJIT HAVE_LIBJANSSON TLS MAGIC RUST 
SIMD support: SSE_4_2 SSE_4_1 SSE_3 
Atomic intrisics: 1 2 4 8 16 byte(s)
64-bits, Little-endian architecture
GCC version 4.2.1 Compatible Clang 6.0.1 (tags/RELEASE_601/final), C version 199901
compiled with _FORTIFY_SOURCE=0
L1 cache line size (CLS)=64
thread local storage method: __thread
compiled with LibHTP v0.5.27, linked against LibHTP v0.5.27

Suricata Configuration:
  AF_PACKET support:                       yes
  eBPF support:                            no
  XDP support:                             
  PF_RING support:                         no
  NFQueue support:                         no
  NFLOG support:                           no
  IPFW support:                            no
  Netmap support:                          no
  DAG enabled:                             no
  Napatech enabled:                        no
  WinDivert enabled:                       no

  Unix socket enabled:                     yes
  Detection enabled:                       yes

  Libmagic support:                        yes
  libnss support:                          yes
  libnspr support:                         yes
  libjansson support:                      yes
  liblzma support:                         no
  hiredis support:                         no
  hiredis async with libevent:             no
  Prelude support:                         no
  PCRE jit:                                yes
  LUA support:                             yes, through luajit
  libluajit:                               yes
  libgeoip:                                yes
  Non-bundled htp:                         no
  Old barnyard2 support:                   no
  Hyperscan support:                       yes
  Libnet support:                          yes
  liblz4 support:                          no

  Rust support (experimental):             yes
  Rust strict mode:                        no
  Rust debug mode:                         no

  Suricatasc install:                      yes

  Profiling enabled:                       no
  Profiling locks enabled:                 no

Development settings:
  Coccinelle / spatch:                     yes
  Unit tests enabled:                      yes
  Debug output enabled:                    no
  Debug validation enabled:                no

Generic build parameters:
  Installation prefix:                     /opt/suricata-asan
  Configuration directory:                 /opt/suricata-asan/etc/suricata/
  Log directory:                           /opt/suricata-asan/var/log/suricata/

  --prefix                                 /opt/suricata-asan
  --sysconfdir                             /opt/suricata-asan/etc
  --localstatedir                          /opt/suricata-asan/var

  Host:                                    x86_64-pc-linux-gnu
  Compiler:                                clang (exec name) / clang (real)
  GCC Protect enabled:                     no
  GCC march native enabled:                yes
  GCC Profile enabled:                     no
  Position Independent Executable enabled: no
  CFLAGS                                   -ggdb3 -Werror -Wchar-subscripts -fno-strict-aliasing -fstack-protector-all -fsanitize=address -fno-omit-frame-pointer -Wno-unused-parameter -Wno-unused-function -march=native -I${srcdir}/../rust/gen/c-headers
  PCAP_CFLAGS                               -I/usr/include
  SECCFLAGS                                
pevma@DonPedro:~/Work/Suricata/Bugs/tmp$ 
pevma@DonPedro:~/Work/Suricata/Bugs/tmp$ sudo LSAN_OPTIONS=suppressions=/home/pevma/Work/Suricata/suricomp/suricata/qa/lsan.suppress ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-6.0/bin/llvm-symbolizer  /opt/suricata-asan/bin/suricata -k none  -r  ../bug-core-ssl/2021938.pcap -l tmplogs/ -S /dev/null

[25348] 22/8/2018 -- 12:06:36 - (suricata.c:1084) <Notice> (LogVersion) -- This is Suricata version 4.1.0-dev (rev 1f4cd75f)
[25348] 22/8/2018 -- 12:06:36 - (tm-threads.c:2172) <Notice> (TmThreadWaitOnThreadInit) -- all 9 packet processing threads, 4 management threads initialized, engine started.
[25348] 22/8/2018 -- 12:06:36 - (suricata.c:2839) <Notice> (SuricataMainLoop) -- Signal Received.  Stopping engine.
[25349] 22/8/2018 -- 12:06:36 - (source-pcap-file.c:383) <Notice> (ReceivePcapFileThreadExitStats) -- Pcap-file module read 1 files, 882 packets, 218982 bytes

=================================================================
==25348==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x4ea988 in calloc (/opt/suricata-asan/bin/suricata+0x4ea988)
    #1 0x18f2081 in Ja3BufferInit /home/pevma/Work/Suricata/suricomp/suricata/src/util-ja3.c:40:25
    #2 0x8c4c8d in TLSDecodeHSHelloVersion /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:566:30
    #3 0x8c3eb0 in TLSDecodeHandshakeHello /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:1060:11
    #4 0x8c0828 in SSLv3ParseHandshakeType /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:1123:18
    #5 0x8bf49e in SSLv3ParseHandshakeProtocol /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:1344:14
    #6 0x8bbb49 in SSLv3Decode /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:1991:22
    #7 0x8b7c5e in SSLDecode /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:2161:30
    #8 0x88a5cd in SSLParseClientRecord /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:2248:12
    #9 0x80046a in AppLayerParserParse /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-parser.c:1152:13
    #10 0x5739e1 in TCPProtoDetect /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer.c:431:17
    #11 0x5723c8 in AppLayerHandleTCPData /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer.c:590:13
    #12 0x1779660 in ReassembleUpdateAppLayer /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp-reassemble.c:1068:13
    #13 0x1778388 in StreamTcpReassembleAppLayer /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp-reassemble.c:1141:12
    #14 0x177f113 in StreamTcpReassembleHandleSegmentUpdateACK /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp-reassemble.c:1690:9
    #15 0x177ed94 in StreamTcpReassembleHandleSegment /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp-reassemble.c:1731:9
    #16 0x1724dd6 in StreamTcpHandleFin /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp.c:2727:9
    #17 0x16f123f in StreamTcpPacketStateEstablished /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp.c:2510:14
    #18 0x16642a9 in StreamTcpStateDispatch /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp.c:4609:17
    #19 0x165b50d in StreamTcpPacket /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp.c:4775:13
    #20 0x166538c in StreamTcp /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp.c:5112:11
    #21 0x143478f in FlowWorker /home/pevma/Work/Suricata/suricomp/suricata/src/flow-worker.c:216:9
    #22 0x18009ce in TmThreadsSlotVarRun /home/pevma/Work/Suricata/suricomp/suricata/src/tm-threads.c:143:17
    #23 0x18128be in TmThreadsSlotVar /home/pevma/Work/Suricata/suricomp/suricata/src/tm-threads.c:598:17
    #24 0x7f21dab9ef29 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7f29)

Indirect leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x4ea760 in __interceptor_malloc (/opt/suricata-asan/bin/suricata+0x4ea760)
    #1 0x18f4ad3 in Ja3BufferAddValue /home/pevma/Work/Suricata/suricomp/suricata/src/util-ja3.c:181:27
    #2 0x8c4d24 in TLSDecodeHSHelloVersion /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:570:18
    #3 0x8c3eb0 in TLSDecodeHandshakeHello /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:1060:11
    #4 0x8c0828 in SSLv3ParseHandshakeType /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:1123:18
    #5 0x8bf49e in SSLv3ParseHandshakeProtocol /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:1344:14
    #6 0x8bbb49 in SSLv3Decode /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:1991:22
    #7 0x8b7c5e in SSLDecode /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:2161:30
    #8 0x88a5cd in SSLParseClientRecord /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-ssl.c:2248:12
    #9 0x80046a in AppLayerParserParse /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer-parser.c:1152:13
    #10 0x5739e1 in TCPProtoDetect /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer.c:431:17
    #11 0x5723c8 in AppLayerHandleTCPData /home/pevma/Work/Suricata/suricomp/suricata/src/app-layer.c:590:13
    #12 0x1779660 in ReassembleUpdateAppLayer /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp-reassemble.c:1068:13
    #13 0x1778388 in StreamTcpReassembleAppLayer /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp-reassemble.c:1141:12
    #14 0x177f113 in StreamTcpReassembleHandleSegmentUpdateACK /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp-reassemble.c:1690:9
    #15 0x177ed94 in StreamTcpReassembleHandleSegment /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp-reassemble.c:1731:9
    #16 0x1724dd6 in StreamTcpHandleFin /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp.c:2727:9
    #17 0x16f123f in StreamTcpPacketStateEstablished /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp.c:2510:14
    #18 0x16642a9 in StreamTcpStateDispatch /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp.c:4609:17
    #19 0x165b50d in StreamTcpPacket /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp.c:4775:13
    #20 0x166538c in StreamTcp /home/pevma/Work/Suricata/suricomp/suricata/src/stream-tcp.c:5112:11
    #21 0x143478f in FlowWorker /home/pevma/Work/Suricata/suricomp/suricata/src/flow-worker.c:216:9
    #22 0x18009ce in TmThreadsSlotVarRun /home/pevma/Work/Suricata/suricomp/suricata/src/tm-threads.c:143:17
    #23 0x18128be in TmThreadsSlotVar /home/pevma/Work/Suricata/suricomp/suricata/src/tm-threads.c:598:17
    #24 0x7f21dab9ef29 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7f29)

SUMMARY: AddressSanitizer: 152 byte(s) leaked in 2 allocation(s).

Actions

Also available in: Atom PDF