Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heap-buffer-overflow exit in createIfdTableArray() at exif.c:284 #5

Open
Diggingwei opened this issue Jan 11, 2024 · 0 comments
Open

Comments

@Diggingwei
Copy link

Summary

A heap-buffer-overflow caused when using exif.

Version

$git log --oneline -1
f875872 (HEAD, origin/master, origin/HEAD, master)

Environment

Ubuntu: 18.04
clang : 12.0.0

Reproduce

PoC : poc.zip
Command Line : ./exif poc

Debug Info

==61179==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000050 at pc 0x0000004c9d3a bp 0x7fffffffded0 sp 0x7fffffffdec8
READ of size 4 at 0x602000000050 thread T0
    #0 0x4c9d39 in createIfdTableArray /src/project/exif_project/exif/exif.c:284:21
    #1 0x4f4086 in main /src/project/exif_project/exif/sample_main.c:63:16
    #2 0x7ffff7c57082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)
    #3 0x41c3bd in _start (/src/project/exif_project/exif/fuzz_issue-exif/exif_cov+0x41c3bd)

0x602000000051 is located 0 bytes to the right of 1-byte region [0x602000000050,0x602000000051)
allocated by thread T0 here:
    #0 0x49761d in malloc (/src/project/exif_project/exif/fuzz_issue-exif/exif_cov+0x49761d)
    #1 0x4db40a in addTagNodeToIfd /src/project/exif_project/exif/exif.c:1541:43
    #2 0x4ce000 in parseIFD /src/project/exif_project/exif/exif.c:2361:13
    #3 0x4c9989 in createIfdTableArray /src/project/exif_project/exif/exif.c:271:15
    #4 0x4f4086 in main /src/project/exif_project/exif/sample_main.c:63:16
    #5 0x7ffff7c57082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082)

SUMMARY: AddressSanitizer: heap-buffer-overflow /src/project/exif_project/exif/exif.c:284:21 in createIfdTableArray
Shadow bytes around the buggy address:
  0x0c047fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c047fff8000: fa fa 00 00 fa fa fd fa fa fa[01]fa fa fa fa fa
  0x0c047fff8010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8050: 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
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  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
  Shadow gap:              cc
==61179==ABORTING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant