Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
There was a stack overflow caused by array out of bound write in fmt_entry function of ncurses tool with latest verison(6.0). Crafted input could lead to arbitrary code execution.
Description of problem:
n the loop for_each_string(j, tterm) of fmt_entry function( line:725), there was array out of bound write for the buffer that led to the return address of fmt_entry function was covered later.
Version-Release number of selected component (if applicable):
<=6.0
How reproducible:
infotocap $POC
Steps to Reproduce:
The debug information is as follows:
$gdb infotocap
…
(gdb) set args $POC
(gdb) b dump_entry.c:1143 // the stack overflow related caller point
(gdb) r
...
(gdb) x/10i
$pc => 0x41621c <dump_entry+1724>: mov %r14d,%r8d 0x41621f
<dump_entry+1727>: mov 0x3c(%rsp),%r9d 0x416224
<dump_entry+1732>: callq 0x410150
<fmt_entry> 0x416229
<dump_entry+1737>: cmpl $0x0,0x34(%rsp) ...
(gdb) si //3 times
(gdb) i r $rsp rsp 0x7fffffffb2e8
(gdb) x/4x $rsp
0x7fffffffb2e8: 0x29 0x62 0x41 0x00 // the ret address
<dump_entry+1737>
(gdb) b dump_entry.c:725
(gdb) c //repeat 9 times
(gdb) b dump_entry.c:724
(gdb) c //repeat 24 times
(gdb) b dump_entry.c:838
(gdb) c
Continuing.
Breakpoint 18, fmt_entry (tterm=0x675430, pred=<optimized out>, content_only=<optimized out>, suppress_untranslatable=0, infodump=0, numbers=0) at ../progs/dump_entry.c:838
838 len += (int) strlen(capability) + 1;
(gdb) x/4x 0x7fffffffb2e8 //check the ret address again
0x7fffffffb2e8: 0x2f 0x25 0x7b 0x31 //it was overflowed
(gdb) continue //until the function return
….
Program received signal SIGSEGV, Segmentation fault. 0x00000000004135ee in fmt_entry (tterm=<optimized out>, pred=<optimized out>, content_only=<optimized out>, suppress_untranslatable=<optimized out>, infodump=<optimized out>, numbers=<optimized out>) at ../progs/dump_entry.c:984
…
(gdb) x/10i
$pc => 0x4135ee <fmt_entry+13470>: retq 0x4135ef
<fmt_entry+13471>: movslq %fs:(%r14),%rax ...
(gdb) x/4x 0x7fffffffb2e8 //check the ret address again, it was
// overflowed by 0x2f 0x25 0x7b 0x31
0x7fffffffb2e8: 0x2f 0x25 0x7b 0x31
Actual results:
specified function return address be covered
crash
Expected results:
crash
Additional info:
Credits:
This vulnerability is detected by team OWL337, with our custom fuzzer coll AFL. Please contact ganshuitao and chaoz.cn if you need more info about the team, the tool or the vulnerability.