https://bugs.exim.org/show_bug.cgi?id=1903

            Bug ID: 1903
           Summary: PCRE2 10.23-RC1 - Heap Buffer Overflow
           Product: PCRE
           Version: N/A
          Hardware: x86-64
                OS: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
          Assignee: p...@hermes.cam.ac.uk
          Reporter: fumfi....@gmail.com
                CC: pcre-dev@exim.org

Created attachment 932
  --> https://bugs.exim.org/attachment.cgi?id=932&action=edit
POC to trigger heap overflow (pcre2test)

PCRE2 library is prone to a vulnerability which leads to Heap Overflow.

Affected:
- PCRE2 version 10.23-RC1 2016-08-01 (SVN revision: 573)

To reproduce the problem (pcre2test):
pcre2test heap_overflow1_573 /dev/null

ASAN output:

==31830==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x60e00000dff8 at pc 0x7f8bb08405b5 bp 0x7fff667672b0 sp 0x7fff667672a8
WRITE of size 1 at 0x60e00000dff8 thread T0
    #0 0x7f8bb08405b4 in compile_regex XYZ/pcre/src/pcre2_compile.c:7515:5
    #1 0x7f8bb082ff62 in pcre2_compile_8 XYZ/pcre/src/pcre2_compile.c:9297:7
    #2 0x4edf58 in process_pattern XYZ/pcre/src/pcre2test.c:5033:1
    #3 0x4edf58 in main XYZ/pcre/src/pcre2test.c:7739
    #4 0x7f8baf72382f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #5 0x41a828 in _start (/usr/local/bin/pcre2test+0x41a828)

0x60e00000dff8 is located 0 bytes to the right of 152-byte region
[0x60e00000df60,0x60e00000dff8)
allocated by thread T0 here:
    #0 0x4b903c in __interceptor_malloc
/home/development/llvm/3.9.0/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64:3
    #1 0x4f048e in my_malloc XYZ/pcre/src/pcre2test.c:2380:15
    #2 0x7f8bb082f716 in pcre2_compile_8 XYZ/pcre/src/pcre2_compile.c:9230:3
    #3 0x4edf58 in process_pattern XYZ/pcre/src/pcre2test.c:5033:1
    #4 0x4edf58 in main XYZ/pcre/src/pcre2test.c:7739
    #5 0x7f8baf72382f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: heap-buffer-overflow
XYZ/pcre/src/pcre2_compile.c:7515:5 in compile_regex
Shadow bytes around the buggy address:
  0x0c1c7fff9ba0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c7fff9bb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c7fff9bc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c7fff9bd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c7fff9be0: fa fa fa fa fa fa fa fa fa fa fa fa 00 00 00 00
=>0x0c1c7fff9bf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00[fa]
  0x0c1c7fff9c00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c7fff9c10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c7fff9c20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c7fff9c30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c1c7fff9c40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==31830==ABORTING

Regards,
Kamil Frankowicz

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-- 
## List details at https://lists.exim.org/mailman/listinfo/pcre-dev 

Reply via email to