{"id":1203,"date":"2016-02-13T07:03:45","date_gmt":"2016-02-13T07:03:45","guid":{"rendered":"http:\/\/www.gironsec.com\/blog\/?p=1203"},"modified":"2016-02-13T19:48:26","modified_gmt":"2016-02-13T19:48:26","slug":"and-now-for-something-completely-different","status":"publish","type":"post","link":"https:\/\/www.gironsec.com\/blog\/2016\/02\/and-now-for-something-completely-different\/","title":{"rendered":"And now for something completely different"},"content":{"rendered":"<p>I know a lot of what I do on this web site is related to RE and assembly and malware and such. It works fine. Today will be different. Today we&#8217;re going to rip apart some open source software.<\/p>\n<p><a href=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/02\/1443653478726.png\" rel=\"attachment wp-att-1206\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/02\/1443653478726.png\" alt=\"1443653478726\" width=\"500\" height=\"314\" class=\"alignnone size-full wp-image-1206\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/02\/1443653478726.png 500w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/02\/1443653478726-300x188.png 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>The target today is <a href=\"http:\/\/phoronix-test-suite.com\/\" target=\"_blank\">Phoronix Test Suite<\/a>. We&#8217;re going to find us some vulnerabilities, because I haven&#8217;t done that in a while.<\/p>\n<p>Also you need root to run this test suite, so any time I can get code to run, its about the same as root compromise \ud83d\ude42<\/p>\n<p>Since this is a large pack of code, we&#8217;re going to be grouping the code by vulnerabilities found.<\/p>\n<p>===XSS===<\/p>\n<p>There&#8217;s A LOT of XSS in this suite. Here&#8217;s just a few grabbed from the base index.php of the common directories.<\/p>\n<p>Line 120 of phoronix-test-suite\\pts-core\\phoromatic\\export-public-viewer\\index.php<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\">&lt;div id=<span style=\"color: #a31515\">&quot;config_option_line&quot;<\/span>&gt;\r\n&lt;form action=<span style=\"color: #a31515\">&quot;&lt;?php $_SERVER[&#39;REQUEST_URI&#39;]; ?&gt;&quot;<\/span> name=<span style=\"color: #a31515\">&quot;update_result_view&quot;<\/span> method=<span style=\"color: #a31515\">&quot;post&quot;<\/span>&gt;\r\nShow Results For The Past &lt;select name=<span style=\"color: #a31515\">&quot;view_results_limit&quot;<\/span> id=<span style=\"color: #a31515\">&quot;view_results_limit&quot;<\/span>&gt;\r\n<\/pre>\n<\/div>\n<p>Line 107 of phoronix-test-suite\\pts-core\\web-interface\\index.php<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #0000ff\">if<\/span>($PAGE_REQUEST == $url || $URI == $url)\r\n {\r\n\t$new_header .= <span style=\"color: #a31515\">&#39;&lt;a href=&quot;?&#39;<\/span> . $url . <span style=\"color: #a31515\">&#39;&quot;&gt;&lt;span class=&quot;dark_alt&quot;&gt;&#39;<\/span> . $page . <span style=\"color: #a31515\">&#39;&lt;\/span&gt;&lt;\/a&gt; &#39;<\/span>;\r\n}\r\n<span style=\"color: #0000ff\">else<\/span>\r\n{\r\n\t<span style=\"color: #0000ff\">if<\/span>($custom_header &amp;&amp; $page == <span style=\"color: #a31515\">&#39;Main&#39;<\/span>)\r\n\t{\r\n\t\t$new_header .= <span style=\"color: #a31515\">&#39;&lt;a href=&quot;?&#39;<\/span> . $url . <span style=\"color: #a31515\">&#39;&quot;&gt;&lt;span class=&quot;alt&quot;&gt;&#39;<\/span> . $page . <span style=\"color: #a31515\">&#39;&lt;\/span&gt;&lt;\/a&gt; &#39;<\/span>;\r\n\t}\r\n\t<span style=\"color: #0000ff\">else<\/span>\r\n\t{\r\n\t\t$new_header .= <span style=\"color: #a31515\">&#39;&lt;a href=&quot;?&#39;<\/span> . $url . <span style=\"color: #a31515\">&#39;&quot;&gt;&#39;<\/span> . $page . <span style=\"color: #a31515\">&#39;&lt;\/a&gt; &#39;<\/span>;\r\n\t}\r\n}\r\n<\/pre>\n<\/div>\n<p>$URI is set earlier on line 39 as <\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\">$URI = substr($_SERVER[<span style=\"color: #a31515\">&#39;REQUEST_URI&#39;<\/span>], strpos($_SERVER[<span style=\"color: #a31515\">&#39;REQUEST_URI&#39;<\/span>], <span style=\"color: #a31515\">&#39;?&#39;<\/span>) + 1);\r\n<\/pre>\n<\/div>\n<p>Line 200 of phoronix-test-suite\\pts-core\\phoromatic\\pages\\phoromatic_welcome.php<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<table>\n<tr>\n<td>\n<pre style=\"margin: 0; line-height: 125%\">1\r\n2\r\n3<\/pre>\n<\/td>\n<td>\n<pre style=\"margin: 0; line-height: 125%\">&lt;div style=<span style=\"color: #a31515\">&quot;float: left; width: 25%;&quot;<\/span>&gt;&lt;input type=<span style=\"color: #a31515\">&quot;hidden&quot;<\/span> name=<span style=\"color: #a31515\">&quot;seed_accountid&quot;<\/span> value=<span style=\"color: #a31515\">&quot;&#39; . <\/span>\r\n<span style=\"color: #a31515\">(isset($_GET[&#39;seed_accountid&#39;]) ? $_GET[&#39;seed_accountid&#39;] : null) . &#39;&quot;<\/span> <span style=\"color: #a31515\">\/&gt;&lt;input type=&quot;text&quot; name=&quot;register_username&quot; \/<\/span>&gt; \r\n<span style=\"color: #a31515\">&lt;sup&gt;<\/span>1<span style=\"color: #a31515\">&lt;\/sup&gt;&lt;\/div&gt;<\/span>\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>===Code Exec===<\/p>\n<p>Line 264 of \/phoronix-test-suite\/pts-core\/phoromatic\/public_html\/phoromatic.php<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<table>\n<tr>\n<td>\n<pre style=\"margin: 0; line-height: 125%\">1\r\n2\r\n3\r\n4<\/pre>\n<\/td>\n<td>\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #0000ff\">if<\/span>(is_file(<span style=\"color: #a31515\">&#39;..\/communication-resources\/&#39;<\/span> . $REQUEST . <span style=\"color: #a31515\">&#39;.php&#39;<\/span>))\r\n{\r\n\trequire(<span style=\"color: #a31515\">&#39;..\/communication-resources\/&#39;<\/span> . $REQUEST . <span style=\"color: #a31515\">&#39;.php&#39;<\/span>);\r\n}\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>Since we control the $REQUEST variable (the variable being a global representative of either GET or POST, as long as the file is real, we can include it. How do we exploit this? Throw some code into a request, then set the $request variable to \/var\/log\/httpd\/access.log that way it gets included as well as the code we added earlier. <\/p>\n<p>How does one dork the internets for this? Easy!<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<table>\n<tr>\n<td>\n<pre style=\"margin: 0; line-height: 125%\">1\r\n2\r\n3<\/pre>\n<\/td>\n<td>\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #000080; font-weight: bold\">&lt;div<\/span> <span style=\"color: #FF0000\">id=<\/span><span style=\"color: #0000FF\">&quot;pts_copyright&quot;<\/span><span style=\"color: #000080; font-weight: bold\">&gt;<\/span>Copyright &amp;#xA9; 2008 - <span style=\"color: #008080\">&lt;?php echo date(&#39;Y&#39;); ?&gt;<\/span> by Phoronix Media. \r\nAll trademarks used are properties of their respective owners. All rights reserved. <span style=\"color: #000080; font-weight: bold\">&lt;strong&gt;<\/span>\r\n<span style=\"color: #008080\">&lt;?php echo pts_core::program_title(true); ?&gt;<\/span><span style=\"color: #000080; font-weight: bold\">&lt;\/strong&gt;&lt;\/div&gt;<\/span>\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>I skipped a ton of others to keep this short and sweet. I also mainly stuck to grep.<\/p>\n<p>I hope you enjoyed my hax. Until next time.<\/p>\n<div style=\"width: 426px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-1203-1\" width=\"426\" height=\"240\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/webm\" src=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/02\/turtle.webm?_=1\" \/><a href=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/02\/turtle.webm\">http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/02\/turtle.webm<\/a><\/video><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I know a lot of what I do on this web site is related to RE and assembly and malware and such. It works fine. Today will be different. Today we&#8217;re going to rip apart some open source software. The target today is Phoronix Test Suite. We&#8217;re going to find us some vulnerabilities, because I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[107],"_links":{"self":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1203"}],"collection":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/comments?post=1203"}],"version-history":[{"count":4,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1203\/revisions"}],"predecessor-version":[{"id":1210,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1203\/revisions\/1210"}],"wp:attachment":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/media?parent=1203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/categories?post=1203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/tags?post=1203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}