<div dir="ltr"><div><div>Package: dcraw</div><div>Version: 9.27-1+b1</div><div>Severity: normal</div><div><br></div><div>A stack-based buffer overflow bug exists in dcraw.</div><div><br></div><div>Running the attached poc file raises a stack-based buffer overflow error, which may allow a control flow hijack attack.</div><div><br></div><div>Following gdb log shows the program resulting in segfault.</div><div><br></div><div>jason@debian-amd64-stretch:~/report/debian-latest/dcraw$ gdb dcraw -q</div><div>Reading symbols from dcraw...(no debugging symbols found)...done.</div><div>(gdb) run poc_ovf</div><div>Starting program: /usr/bin/dcraw poc_ovf</div><div>[Thread debugging using libthread_db enabled]</div><div>Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".</div><div><br></div><div>Program received signal SIGSEGV, Segmentation fault.</div><div>strlen () at ../sysdeps/x86_64/strlen.S:137</div><div>137     ../sysdeps/x86_64/strlen.S: No such file or directory.</div><div>(gdb) bt 10</div><div>#0  strlen () at ../sysdeps/x86_64/strlen.S:137</div><div>#1  0x00007ffff72dfa84 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x7ffff73d3305 "*** %s ***: %s terminated\n") at ../sysdeps/posix/libc_fatal.c:109</div><div>#2  0x00007ffff73681f7 in __GI___fortify_fail (msg=msg@entry=0x7ffff73d32ed "stack smashing detected") at fortify_fail.c:30</div><div>#3  0x00007ffff73681c0 in __stack_chk_fail () at stack_chk_fail.c:28</div><div>#4  0x000055555557ea4e in ?? ()</div><div>#5  0xffffffffffffffff in ?? ()</div><div>#6  0xffffffffffffffff in ?? ()</div><div>#7  0xffffffffffffffff in ?? ()</div><div>#8  0xffffffffffffffff in ?? ()</div><div>#9  0xffffffffffffffff in ?? ()</div><div>(More stack frames follow...)</div><div> </div><div>Address sanitizer reports stack-buffer-overflow error in find_green() function as follow.</div><div><br></div><div><div>jason@debian-amd64-stretch:~/report/source-latest/dcraw$ ./dcraw-9.27/dcraw poc_ovf</div><div>=================================================================</div><div>==5868==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffc720 at pc 0x000000595ece bp 0x7fffffffa6b0 sp 0x7fffffffa6a8</div><div>WRITE of size 2 at 0x7fffffffc720 thread T0</div><div>    #0 0x595ecd in find_green /home/jason/report/source-latest/dcraw/dcraw-9.27/dcraw.c:8147:19</div><div>    #1 0x59e77b in identify /home/jason/report/source-latest/dcraw/dcraw-9.27/dcraw.c:8716:5</div><div>    #2 0x5b94f9 in main /home/jason/report/source-latest/dcraw/dcraw-9.27/dcraw.c:10007:15</div><div>    #3 0x7ffff6a4f2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)</div><div>    #4 0x41c049 in _start (/home/jason/report/source-latest/dcraw/dcraw-9.27/dcraw+0x41c049)</div><div><br></div><div>Address 0x7fffffffc720 is located in stack of thread T0 at offset 8288 in frame</div><div>    #0 0x595a6f in find_green /home/jason/report/source-latest/dcraw/dcraw-9.27/dcraw.c:8133</div><div><br></div><div>  This frame has 2 object(s):</div><div>    [32, 8288) 'img' <== Memory access at offset 8288 overflows this variable</div><div>    [8544, 8560) 'sum'</div><div>HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext</div><div>      (longjmp and C++ exceptions *are* supported)</div><div>SUMMARY: AddressSanitizer: stack-buffer-overflow /home/jason/report/source-latest/dcraw/dcraw-9.27/dcraw.c:8147:19 in find_green</div><div>Shadow bytes around the buggy address:</div><div>  0x10007fff7890: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</div><div>  0x10007fff78a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</div><div>  0x10007fff78b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</div><div>  0x10007fff78c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</div><div>  0x10007fff78d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</div><div>=>0x10007fff78e0: 00 00 00 00[f2]f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2</div><div>  0x10007fff78f0: f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2 f2</div><div>  0x10007fff7900: f2 f2 f2 f2 00 00 f3 f3 00 00 00 00 00 00 00 00</div><div>  0x10007fff7910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</div><div>  0x10007fff7920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</div><div>  0x10007fff7930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</div><div>Shadow byte legend (one shadow byte represents 8 application bytes):</div></div><div><br></div><div>-- System Information:</div><div>Debian Release: 9.1</div><div>  APT prefers stable-updates</div><div>  APT policy: (500, 'stable-updates'), (500, 'stable')</div><div>Architecture: amd64 (x86_64)</div><div><br></div><div>Kernel: Linux 4.9.0-3-amd64 (SMP w/1 CPU core)</div><div>Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)</div><div>Shell: /bin/sh linked to /bin/dash</div><div>Init: systemd (via /run/systemd/system)</div><div><br></div><div>Versions of packages dcraw depends on:</div><div>ii  libc6            2.24-11+deb9u3</div><div>ii  libjpeg62-turbo  1:1.5.1-2</div><div>ii  liblcms2-2       2.8-4</div><div><br></div><div>dcraw recommends no packages.</div><div><br></div><div>Versions of packages dcraw suggests:</div><div>pn  gphoto2  <none></div><div>ii  netpbm   2:10.0-15.3+b2</div><div><br></div><div>-- no debconf information</div></div><div><br></div></div>