Bug 1944097 - bmptopnm converts bmp file with heap-buffer-overflow.
Summary: bmptopnm converts bmp file with heap-buffer-overflow.
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: netpbm
Version: 35
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Josef Ridky
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-29 09:37 UTC by 1259920914
Modified: 2022-12-13 15:20 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-12-13 15:20:30 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
poc file to this bug (1.10 KB, image/bmp)
2021-03-29 09:38 UTC, 1259920914
no flags Details

Description 1259920914 2021-03-29 09:37:40 UTC
Description of problem:
A heap-buffer-overflow problem in netpbm bmptopnm.

Version-Release number of selected component (if applicable):
svn revision: 4078

How reproducible:
First install requirements for netpbm:
svn checkout http://svn.code.sf.net/p/netpbm/code/advanced netpbm
cd to netpbm, ./configure choose static. Then open config.mk, add "-g and -fsanitize=address" to CFLAGS and "LDFLAGS = -fsanitize=address" to the file.
Then make. 

Steps to Reproduce:
[path to the file]/bmptopnm c2

Actual results:
./bin/bmptopnm /mnt/disk/out/netpbm_bmptopnm/c2
bmptopnm: Windows (v1) BMP, 536870917x5x8
bmptopnm: warning: some image data remains unread.
bmptopnm: WRITING PPM IMAGE
P6
536870917 5
255
=================================================================
==909==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60700000e000 at pc 0x000000406614 bp 0x7ffd2369e0a0 sp 0x7ffd2369e090
READ of size 1 at 0x60700000e000 thread T0
    #0 0x406613  (/usr/local/netpbm_asan/bin/bmptopnm+0x406613)
    #1 0x7f1afd16683f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2083f)
    #2 0x406bd8  (/usr/local/netpbm_asan/bin/bmptopnm+0x406bd8)

0x60700000e000 is located 0 bytes to the right of 80-byte region [0x60700000dfb0,0x60700000e000)
allocated by thread T0 here:
    #0 0x7f1afd8b1602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x402e5d  (/usr/local/netpbm_asan/bin/bmptopnm+0x402e5d)

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 ??
Shadow bytes around the buggy address:
  0x0c0e7fff9bb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff9bc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff9bd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff9be0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff9bf0: fa fa fa fa fa fa 00 00 00 00 00 00 00 00 00 00
=>0x0c0e7fff9c00:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff9c10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff9c20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff9c30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff9c40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c0e7fff9c50: 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
==909==ABORTING


Additional info:
credit: jimoyong from NSFOCUS Security Team

Comment 1 1259920914 2021-03-29 09:38:07 UTC
Created attachment 1767287 [details]
poc file to this bug

Comment 2 Ben Cotton 2021-08-10 12:57:23 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 3 Ben Cotton 2022-11-29 16:54:38 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 4 Ben Cotton 2022-12-13 15:20:30 UTC
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13.

Fedora Linux 35 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.