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

Invalid volume label string causes read beyond string size in fprintf at info_handle.c:1219 #14

Closed
hongxuchen opened this issue Jun 19, 2018 · 3 comments
Assignees

Comments

@hongxuchen
Copy link

hongxuchen commented Jun 19, 2018

AddressSanitizer: heap-buffer-overflow at info_handle.c:1219

POC file:
https://github.com/ntu-sec/pocs/blob/master/liblnk/hbo_info_handle.c%3A1219_1.input.txt

gdb output:
https://github.com/ntu-sec/pocs/blob/master/liblnk/hbo_info_handle.c%3A1219_1.gdb.txt

@hongxuchen hongxuchen changed the title AddressSanitizer: heap-buffer-overflow at lnktools/info_handle.c:1219 AddressSanitizer: heap-buffer-overflow at info_handle.c:1219 Jun 19, 2018
@joachimmetz joachimmetz self-assigned this Jun 19, 2018
@joachimmetz
Copy link
Member

joachimmetz commented Jun 23, 2018

The volume label data is:

liblnk_location_information_read_data: unicode volume information volume label size             : 4
liblnk_location_information_read_data: unicode volume information volume label data:
00000000: ce d9 00 00                                        ....

Converted into UTF-8, which does not appear to be correct.

liblnk_file_get_utf8_volume_label: volume information data:
00000000: ef bf bd                                           ...

which causes fprintf to read an additional byte.

==28427== Invalid read of size 1
==28427==    at 0x4C32BD4: __strlen_sse2 (vg_replace_strmem.c:460)
==28427==    by 0x52B4955: vfprintf (vfprintf.c:1643)
==28427==    by 0x52B5B8F: buffered_vfprintf (vfprintf.c:2330)
==28427==    by 0x52B2C55: vfprintf (vfprintf.c:1301)
==28427==    by 0x52BC183: fprintf (fprintf.c:32)
==28427==    by 0x40282B: info_handle_link_information_fprint (info_handle.c:1219)
==28427==    by 0x403F3D: info_handle_file_fprint (info_handle.c:2572)
==28427==    by 0x4046B5: main (lnkinfo.c:277)

@joachimmetz
Copy link
Member

libyal/libuna#8

@joachimmetz joachimmetz changed the title AddressSanitizer: heap-buffer-overflow at info_handle.c:1219 Invalid volume label string causes heap-buffer-overflow in fprintf at info_handle.c:1219 Jun 23, 2018
@joachimmetz joachimmetz changed the title Invalid volume label string causes heap-buffer-overflow in fprintf at info_handle.c:1219 Invalid volume label string causes read beyond string size in fprintf at info_handle.c:1219 Jun 23, 2018
@joachimmetz
Copy link
Member

With libuna libyal/libuna@fce50a5 this issue no longer surfaces. Seeing that no liblnk code needed to be changed to fix this issue, marking this as "invalid".

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

2 participants