{"id":1481,"date":"2017-03-14T16:29:17","date_gmt":"2017-03-14T14:29:17","guid":{"rendered":"http:\/\/blogs.gentoo.org\/ago\/?p=1481"},"modified":"2017-03-14T16:29:17","modified_gmt":"2017-03-14T14:29:17","slug":"libpcre-null-pointer-dereference-in-main-pcretest-c","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/ago\/2017\/03\/14\/libpcre-null-pointer-dereference-in-main-pcretest-c\/","title":{"rendered":"libpcre: NULL pointer dereference in main (pcretest.c)"},"content":{"rendered":"<p><strong>Description<\/strong>:<br \/>\n<a href=\"http:\/\/www.pcre.org\">libpcre<\/a> is a perl-compatible regular expression library.<\/p>\n<p>A fuzz on libpcre1 through the pcretest utility revealed a null pointer dereference in the utility itself. For the nature of the crash, it is not security relevant because the library is not affected but if you have a web application that calls directly the pcretest utility to parse untrusted data, then you are affected.<br \/>\nAlso, it is important share the details because some distros\/packagers may want to take the patch in their repository.<\/p>\n<p>The complete ASan output:<\/p>\n<pre><font size=\"2\"># pcretest -16 -d $FILE\r\n==26399==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000052db1c bp 0x7ffc7de68070 sp 0x7ffc7de67ba0 T0)                                                                                                                                            \r\n==26399==The signal is caused by a READ memory access.                                                                                                                                                                                                                         \r\n==26399==Hint: address points to the zero page.                                                                                                                                                                                                                                \r\n    #0 0x52db1b in main \/tmp\/portage\/dev-libs\/libpcre-8.40\/work\/pcre-8.40\/pcretest.c:5083:25                                                                                                                                                                                   \r\n    #1 0x7f70603bc78f in __libc_start_main \/tmp\/portage\/sys-libs\/glibc-2.23-r3\/work\/glibc-2.23\/csu\/..\/csu\/libc-start.c:289                                                                                                                                                     \r\n    #2 0x41b438 in _init (\/usr\/bin\/pcretest+0x41b438) \r\n<\/font><\/pre>\n<p><strong>Affected version:<\/strong><br \/>\n8.40<\/p>\n<p><strong>Fixed version:<\/strong><br \/>\n8.41 (not released atm)<\/p>\n<p><strong>Commit fix:<\/strong><br \/>\n<a href=\"https:\/\/vcs.pcre.org\/pcre\/code\/trunk\/pcretest.c?r1=1685&amp;r2=1686&amp;sortby=date\">https:\/\/vcs.pcre.org\/pcre\/code\/trunk\/pcretest.c?r1=1685&amp;r2=1686&amp;sortby=date<\/a><\/p>\n<p><strong>Credit:<\/strong><br \/>\nThis bug was discovered by Agostino Sarubbo of Gentoo.<\/p>\n<p><strong>CVE:<\/strong><br \/>\nN\/A<\/p>\n<p><strong>Reproducer:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00195-pcre-nullptr-main\">https:\/\/github.com\/asarubbo\/poc\/blob\/master\/00195-pcre-nullptr-main<\/a><\/p>\n<p><strong>Timeline:<\/strong><br \/>\n2017-02-22: bug discovered and reported to upstream<br \/>\n2017-02-23: upstream released a patch<br \/>\n2017-03-14: blog post about the issue<\/p>\n<p><strong>Note:<\/strong><br \/>\nThis bug was found with <a href=\"http:\/\/lcamtuf.coredump.cx\/afl\">American Fuzzy Lop<\/a>.<\/p>\n<p><strong>Permalink:<\/strong><\/p>\n<blockquote data-secret=\"bnYtcFxnsN\" class=\"wp-embedded-content\"><p><a href=\"http:\/\/blogs.gentoo.org\/ago\/2017\/03\/14\/libpcre-null-pointer-dereference-in-main-pcretest-c\/\">libpcre: NULL pointer dereference in main (pcretest.c)<\/a><\/p><\/blockquote>\n<p><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" src=\"http:\/\/blogs.gentoo.org\/ago\/2017\/03\/14\/libpcre-null-pointer-dereference-in-main-pcretest-c\/embed\/#?secret=bnYtcFxnsN\" data-secret=\"bnYtcFxnsN\" width=\"600\" height=\"338\" title=\"&#8220;libpcre: NULL pointer dereference in main (pcretest.c)&#8221; &#8212; agostino&#039;s blog\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description: libpcre is a perl-compatible regular expression library. A fuzz on libpcre1 through the pcretest utility revealed a null pointer dereference in the utility itself. For the nature of the crash, it is not security relevant because the library is &hellip; <a href=\"https:\/\/blogs.gentoo.org\/ago\/2017\/03\/14\/libpcre-null-pointer-dereference-in-main-pcretest-c\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":140,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[12,10],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2EaBc-nT","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1481"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/users\/140"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/comments?post=1481"}],"version-history":[{"count":1,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1481\/revisions"}],"predecessor-version":[{"id":1482,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/posts\/1481\/revisions\/1482"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/media?parent=1481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/categories?post=1481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/ago\/wp-json\/wp\/v2\/tags?post=1481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}