Open
Description
version: master (commit caade60)
poc: poc
command: ./ffjpeg -e
Here is the trace reported by ASAN:
user@c3ae4d510abb:/path_to_ffjpeg/src$ ./ffjpeg -e poc
=================================================================
==17827==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x612000000148 at pc 0x555555567e84 bp 0x7fffffffe120 sp 0x7fffffffe110
READ of size 1 at 0x612000000148 thread T0
#0 0x555555567e83 in jfif_encode /path_to_ffjpeg/src/jfif.c:763
#1 0x555555556c63 in main /path_to_ffjpeg/src/ffjpeg.c:33
#2 0x7ffff73bf0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b2)
#3 0x55555555704d in _start (/path_to_ffjpeg/src/ffjpeg+0x304d)
0x612000000148 is located 0 bytes to the right of 264-byte region [0x612000000040,0x612000000148)
allocated by thread T0 here:
#0 0x7ffff769abc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
#1 0x555555557987 in bmp_load /path_to_ffjpeg/src/bmp.c:48
SUMMARY: AddressSanitizer: heap-buffer-overflow /path_to_ffjpeg/src/jfif.c:763 in jfif_encode
This issue is the same as #38, but the fix to it (0fa4cf8) is not complete. An integer overflow is still possible in line 43. In the example below, when width=1431655779, pb->stride=44 which bypasses the check in line 44. This will lead to a heap buffer flow in jfif.c as in the ASAN report above.
Lines 41 to 47 in caade60
pwndbg> p pb
$3 = (BMP *) 0x7fffffffe370
pwndbg> p *(BMP *) 0x7fffffffe370
$4 = {
width = 1431655779,
height = 6,
stride = 44,
pdata = 0x555555576490
}
Metadata
Assignees
Labels
No labels