<div dir="ltr"><div>I have thanksfulness about using strace. </div><div>Yesterday i found a bug in the strace, i guess this is a stack buffer overflow.</div><div><br></div><div>So i report it. Thank you.</div><div><br></div><div><br></div>Tested Version : strace-4.9, strace-4.8<br>Environment : Ubuntu 14.04.1 LTS x86_64<div>Details:</div><div><br></div><div>stack buffer overflow in startup_child() strace.c</div><div><br></div><div>Input length check could be bypassed using long string without having '/', and the strcpy() function in PATH concat processing code starts to overwrite stack data.</div><div><br></div><div>-------------- TEST PAYLOAD</div><div><br></div><div>abc@ubuntu:~/strace-4.9$ ./strace `perl -e 'print "a"x5042'`</div><div>Segmentation fault<br></div><div><br></div><div>-------------- BELOW is GDB output</div><div><br></div><div><div>(gdb) r `perl -e 'print "a"x5042'`                                                                                                         </div><div>Starting program: /home/abc/strace-4.9/strace `perl -e 'print "a"x5042'`                                                                   </div><div>                                                                                                                                           </div><div>Program received signal SIGSEGV, Segmentation fault.                                                                                       </div><div>__GI_getenv (name=0x7fe3b8107b5b "NGUAGE", name@entry=0x7fe3b8107b59 "LANGUAGE") at getenv.c:85                                            </div><div>85      getenv.c: No such file or directory.                                                                                               </div><div>(gdb) bt                                                                                                                                   </div><div>#0  __GI_getenv (name=0x7fe3b8107b5b "NGUAGE", name@entry=0x7fe3b8107b59 "LANGUAGE") at getenv.c:85</div><div>#1  0x00007fe3b7fbc681 in guess_category_value (categoryname=0x7fe3b80f16b3 <_nl_category_names+51> "LC_MESSAGES", category=5)</div><div>    at dcigettext.c:1372</div><div>#2  __dcigettext (domainname=0x7fe3b8107a99 <_libc_intl_domainname> "libc", msgid1=0x7fe3b81081ac "File name too long", </div><div>    msgid2=msgid2@entry=0x0, plural=plural@entry=0, n=n@entry=0, category=category@entry=5) at dcigettext.c:573</div><div>#3  0x00007fe3b7fbb5df in __GI___dcgettext (domainname=<optimized out>, msgid=<optimized out>, category=category@entry=5)</div><div>    at dcgettext.c:52</div><div>#4  0x00007fe3b801398e in __GI___strerror_r (errnum=errnum@entry=36, buf=buf@entry=0x0, buflen=buflen@entry=0) at _strerror.c:71</div><div>#5  0x00007fe3b80138cf in strerror (errnum=errnum@entry=36) at strerror.c:32</div><div>#6  0x000000000041230f in verror_msg (err_no=36, fmt=fmt@entry=0x4273da "Can't stat '%s'", p=p@entry=0x7fff6b28dbf8) at strace.c:277</div><div>#7  0x000000000041315a in perror_msg_and_die (fmt=fmt@entry=0x4273da "Can't stat '%s'") at strace.c:323</div><div>#8  0x000000000041371e in startup_child (argv=0x7fff6b28f160) at strace.c:1220</div><div>#9  0x6161616161616161 in ?? ()</div><div>#10 0x6161616161616161 in ?? ()</div><div>#11 0x6161616161616161 in ?? ()</div><div>#12 0x6161616161616161 in ?? ()</div><div>#13 0x6161616161616161 in ?? ()</div></div><div><br></div></div>