Actions
Bug #3907
closedhttp2 rust - 'index out of bounds: the len is 2 but the index is 63'
Affected Versions:
Effort:
Difficulty:
Label:
Description
Affected versions: gitmaster only
Running normal/usual AFPv3.
thread '<unnamed>' panicked at 'index out of bounds: the len is 2 but the index is 63', src/http2/parser.rs:298:23 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace fatal runtime error: failed to initiate panic, error 5 Aborted (core dumped)
Suri info:
/usr/local/bin/suricata --build-info This is Suricata version 6.0.0-dev (1be294718 2020-09-05) Features: 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 TLS_C11 MAGIC RUST SIMD support: SSE_4_2 SSE_4_1 SSE_3 Atomic intrinsics: 1 2 4 8 16 byte(s) 64-bits, Little-endian architecture GCC version 4.2.1 Compatible Clang 7.0.1 (tags/RELEASE_701/final), C version 201112 compiled with _FORTIFY_SOURCE=0 L1 cache line size (CLS)=64 thread local storage method: _Thread_local compiled with LibHTP v0.5.33, linked against LibHTP v0.5.33 Suricata Configuration: AF_PACKET support: yes eBPF support: yes XDP support: yes 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 hiredis support: no hiredis async with libevent: no Prelude support: no PCRE jit: yes LUA support: yes, through luajit libluajit: yes GeoIP2 support: yes Non-bundled htp: no Old barnyard2 support: Hyperscan support: yes Libnet support: yes liblz4 support: yes Rust support: yes Rust strict mode: yes Rust compiler path: /root/.cargo/bin/rustc Rust compiler version: rustc 1.46.0 (04488afe3 2020-08-24) Cargo path: /root/.cargo/bin/cargo Cargo version: cargo 1.46.0 (149022b1d 2020-07-17) Cargo vendor: yes Python support: yes Python path: /usr/bin/python3 Python distutils yes Python yaml yes Install suricatactl: yes Install suricatasc: yes Install suricata-update: not bundled Profiling enabled: no Profiling locks enabled: no Plugin support (experimental): yes Development settings: Coccinelle / spatch: no Unit tests enabled: no Debug output enabled: no Debug validation enabled: no Generic build parameters: Installation prefix: /usr/local Configuration directory: /usr/local/etc/suricata/ Log directory: /usr/local/var/log/suricata/ --prefix /usr/local --sysconfdir /usr/local/etc --localstatedir /usr/local/var --datarootdir /usr/local/share Host: x86_64-pc-linux-gnu Compiler: clang (exec name) / g++ (real) GCC Protect enabled: no GCC march native enabled: yes GCC Profile enabled: no Position Independent Executable enabled: no CFLAGS -ggdb3 -O0 -Werror -Wchar-subscripts -Wshadow -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-function -fno-strict-aliasing -fstack-protector-all -fsanitize=address -fno-omit-frame-pointer -Wno-unused-parameter -Wno-unused-function -std=c11 -march=native -I${srcdir}/../rust/gen -I${srcdir}/../rust/dist PCAP_CFLAGS -I/usr/include SECCFLAGS
#2 0x0000000000ec3be7 in std::sys::unix::abort_internal () at src/libstd/sys/unix/mod.rs:167 #3 0x0000000000eb2a05 in std::sys_common::util::abort () at src/libstd/sys_common/util.rs:19 #4 0x0000000000eb493e in std::panicking::rust_panic () at src/libstd/panicking.rs:577 #5 0x0000000000eb47ca in std::panicking::rust_panic_with_hook () at src/libstd/panicking.rs:545 #6 0x0000000000eb433b in rust_begin_unwind () at src/libstd/panicking.rs:437 #7 0x0000000000edb481 in core::panicking::panic_fmt () at src/libcore/panicking.rs:85 #8 0x0000000000edb442 in core::panicking::panic_bounds_check () at src/libcore/panicking.rs:62 #9 0x0000000000d99a0d in <usize as core::slice::SliceIndex<[T]>>::index (self=63, slice=...) at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libcore/slice/mod.rs:3103 #10 core::slice::<impl core::ops::index::Index<I> for [T]>::index (self=..., index=63) at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libcore/slice/mod.rs:2955 #11 <alloc::vec::Vec<T> as core::ops::index::Index<I>>::index (self=<optimized out>, index=63) at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/liballoc/vec.rs:1975 #12 suricata::http2::parser::http2_frame_header_static (n=<optimized out>, dyn_headers=<optimized out>) at src/http2/parser.rs:298 #13 0x0000000000d9a078 in suricata::http2::parser::http2_parse_headers_block_indexed (input=..., dyn_headers=<optimized out>) at src/http2/parser.rs:345 #14 suricata::http2::parser::http2_parse_headers_block (input=..., dyn_headers=0x60d0005fd9c8) at src/http2/parser.rs:541 #15 0x0000000000d9a96b in suricata::http2::parser::http2_parse_frame_headers (input=..., flags=<optimized out>, dyn_headers=0x60d0005fd9c8) at src/http2/parser.rs:577 #16 0x0000000000d719c2 in suricata::http2::http2::HTTP2State::parse_frame_data (self=0x60d0005fd9c0, ftype=1, input=..., complete=255, hflags=37, dir=4) at src/http2/http2.rs:601 #17 suricata::http2::http2::HTTP2State::parse_frames (self=<optimized out>, input=..., il=<optimized out>, dir=<optimized out>) at src/http2/http2.rs:711 #18 0x0000000000d72c86 in suricata::http2::http2::HTTP2State::parse_ts (self=0x60d0005fd9c0, input=...) at src/http2/http2.rs:794 #19 suricata::http2::http2::rs_http2_parse_ts (flow=<optimized out>, state=0x60d0005fd9c0, _pstate=<optimized out>, input=<optimized out>, input_len=1577, _data=<optimized out>, _flags=<optimized out>) at src/http2/http2.rs:901 #20 0x000000000067b5ef in AppLayerParserParse (tv=0x61200346d2c0, alp_tctx=0x619017302280, f=0x6132c27da3c0, alproto=29, flags=4 '\004', input=0x61d004a9f2d2 "", input_len=1577) at app-layer-parser.c:1234 #21 0x00000000005c2036 in AppLayerHandleTCPData (tv=0x61200346d2c0, ra_ctx=0x60303c4248a0, p=0x61e1a4d5cc80, f=0x6132c27da3c0, ssn=0x6120e8767040, stream=0x7fe51b76da00, data=0x61d004a9f2d2 "", data_len=1577, flags=4 '\004') at app-layer.c:672 #22 0x0000000000b5a026 in ReassembleUpdateAppLayer (tv=0x61200346d2c0, ra_ctx=0x60303c4248a0, ssn=0x6120e8767040, stream=0x7fe51b76da00, p=0x61e1a4d5cc80, dir=UPDATE_DIR_OPPOSING) at stream-tcp-reassemble.c:1167 #23 0x0000000000b581fc in StreamTcpReassembleAppLayer (tv=0x61200346d2c0, ra_ctx=0x60303c4248a0, ssn=0x6120e8767040, stream=0x6120e87670d0, p=0x61e1a4d5cc80, dir=UPDATE_DIR_OPPOSING) at stream-tcp-reassemble.c:1228 #24 0x0000000000b5ff58 in StreamTcpReassembleHandleSegmentUpdateACK (tv=0x61200346d2c0, ra_ctx=0x60303c4248a0, ssn=0x6120e8767040, stream=0x6120e87670d0, p=0x61e1a4d5cc80) at stream-tcp-reassemble.c:1802 #25 0x0000000000b5fbe1 in StreamTcpReassembleHandleSegment (tv=0x61200346d2c0, ra_ctx=0x60303c4248a0, ssn=0x6120e8767040, stream=0x6120e8767050, p=0x61e1a4d5cc80, pq=0x6060022407e8) at stream-tcp-reassemble.c:1845 #26 0x0000000000b3496c in HandleEstablishedPacketToClient (tv=0x61200346d2c0, ssn=0x6120e8767040, p=0x61e1a4d5cc80, stt=0x6060022407e0, pq=0x6060022407e8) at stream-tcp.c:2445 #27 0x0000000000af666a in StreamTcpPacketStateEstablished (tv=0x61200346d2c0, p=0x61e1a4d5cc80, stt=0x6060022407e0, ssn=0x6120e8767040, pq=0x6060022407e8) at stream-tcp.c:2678 #28 0x0000000000ad978a in StreamTcpStateDispatch (tv=0x61200346d2c0, p=0x61e1a4d5cc80, stt=0x6060022407e0, ssn=0x6120e8767040, pq=0x6060022407e8, state=4 '\004') at stream-tcp.c:4672 #29 0x0000000000acfca4 in StreamTcpPacket (tv=0x61200346d2c0, p=0x61e1a4d5cc80, stt=0x6060022407e0, pq=0x60d000802110) at stream-tcp.c:4861 #30 0x0000000000ada98d in StreamTcp (tv=0x61200346d2c0, p=0x61e1a4d5cc80, data=0x6060022407e0, pq=0x60d000802110) at stream-tcp.c:5199 #31 0x0000000000980cf8 in FlowWorkerStreamTCPUpdate (tv=0x61200346d2c0, fw=0x60d0008020e0, p=0x61e1a4d5cc80, detect_thread=0x617000f75000) at flow-worker.c:364 #32 0x000000000097fc3e in FlowWorker (tv=0x61200346d2c0, p=0x61e1a4d5cc80, data=0x60d0008020e0) at flow-worker.c:524 #33 0x0000000000b8a2bf in TmThreadsSlotVarRun (tv=0x61200346d2c0, p=0x61e1a4d5cc80, slot=0x60600004a780) at tm-threads.c:117 --Type <RET> for more, q to quit, c to continue without paging-- #34 0x0000000000aab043 in TmThreadsSlotProcessPkt (tv=0x61200346d2c0, s=0x60600004a780, p=0x61e1a4d5cc80) at ./tm-threads.h:192 #35 0x0000000000aa3f31 in AFPParsePacketV3 (ptv=0x6120e7d6ffc0, pbd=0x7fd560b17000, ppd=0x7fd560b18ca8) at source-af-packet.c:1113 #36 0x0000000000aa25a8 in AFPWalkBlock (ptv=0x6120e7d6ffc0, pbd=0x7fd560b17000) at source-af-packet.c:1128 #37 0x0000000000a99ed1 in AFPReadFromRingV3 (ptv=0x6120e7d6ffc0) at source-af-packet.c:1178 #38 0x0000000000a97aa8 in ReceiveAFPLoop (tv=0x61200346d2c0, data=0x6120e7d6ffc0, slot=0x6060024f9620) at source-af-packet.c:1571 #39 0x0000000000b97b20 in TmThreadsSlotPktAcqLoop (td=0x61200346d2c0) at tm-threads.c:312 #40 0x00007fe598e15fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486 #41 0x00007fe597d694cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Updated by Victor Julien over 4 years ago
- Status changed from New to Assigned
- Assignee set to Philippe Antoine
- Target version set to 6.0.0rc1
- Affected Versions 6.0.0beta1, git master added
- Affected Versions deleted (
6.0.0rc1)
Updated by Philippe Antoine over 4 years ago
- Status changed from Assigned to In Review
https://github.com/OISF/suricata/pull/5383
Thanks for finding this
I should run some fuzz testing, as this bug was pretty shallow...
Updated by Philippe Antoine over 4 years ago
Indeed, found in one minute of fuzzing by running `FUZZ_APPLAYER=29 ./src/fuzz_applayerparserparse`
Updated by Philippe Antoine over 4 years ago
- Status changed from In Review to Closed
Actions