Module: Msf::Exploit::Remote::HTTP::Atlassian::ProductFingerprint
- Defined in:
- lib/msf/core/exploit/remote/http/atlassian/product_fingerprint.rb
Overview
Fingerprints supported Atlassian Data Center products and their advertised versions. Consumers must also include Msf::Exploit::Remote::HttpClient.
Defined Under Namespace
Classes: FingerprintError, InvalidProductError, InvalidVersionError
Constant Summary collapse
- SUPPORTED_PRODUCTS =
%i[jira confluence bitbucket].freeze
Instance Method Summary collapse
-
#fingerprint_atlassian_product(product) ⇒ Hash{Symbol => Object}
Fingerprints one supported Atlassian product.
-
#fingerprint_bitbucket ⇒ Hash{Symbol => Object}
Fingerprints Bitbucket through its application properties endpoint.
-
#fingerprint_confluence ⇒ Hash{Symbol => Object}
Fingerprints Confluence through its login endpoint.
-
#fingerprint_jira ⇒ Hash{Symbol => Object}
Fingerprints Jira through its server information or login endpoint.
Instance Method Details
#fingerprint_atlassian_product(product) ⇒ Hash{Symbol => Object}
Fingerprints one supported Atlassian product.
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/msf/core/exploit/remote/http/atlassian/product_fingerprint.rb', line 50 def fingerprint_atlassian_product(product) product = product.to_s.downcase.to_sym raise InvalidProductError, product unless SUPPORTED_PRODUCTS.include?(product) case product when :jira fingerprint_jira when :confluence fingerprint_confluence when :bitbucket fingerprint_bitbucket end end |
#fingerprint_bitbucket ⇒ Hash{Symbol => Object}
Fingerprints Bitbucket through its application properties endpoint.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/msf/core/exploit/remote/http/atlassian/product_fingerprint.rb', line 122 def fingerprint_bitbucket res = send_request_cgi( 'method' => 'GET', 'uri' => normalize_uri(target_uri.path, 'rest', 'api', 'latest', 'application-properties'), 'headers' => { 'Accept' => 'application/json' } ) return atlassian_product_fingerprint(:bitbucket, res) unless res&.code == 200 document = res.get_json_document bitbucket_server = document.is_a?(Hash) && %w[buildDate displayName version buildNumber].all? { |key| document[key].is_a?(String) } return atlassian_product_fingerprint(:bitbucket, res) unless bitbucket_server atlassian_product_fingerprint(:bitbucket, res, detected: true, version: document['version']) end |
#fingerprint_confluence ⇒ Hash{Symbol => Object}
Fingerprints Confluence through its login endpoint.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/msf/core/exploit/remote/http/atlassian/product_fingerprint.rb', line 100 def fingerprint_confluence res = send_request_cgi( 'method' => 'GET', 'uri' => normalize_uri(target_uri.path, 'login.action') ) return atlassian_product_fingerprint(:confluence, res) unless res html = res.get_html_document = html.at_css('meta[name="ajs-product-name"]')&.[]('content') # Rex HTTP headers make include? case-insensitive, as required by HTTP. detected = res.headers.include?('X-Confluence-Request-Time') || .to_s.casecmp('Confluence').zero? return atlassian_product_fingerprint(:confluence, res) unless detected version = html.at_css('meta[name="ajs-version-number"]')&.[]('content') version ||= html.at_css('ul#poweredby li.print-only')&.text.to_s.match(/Confluence (\d+(?:\.\d+)+)/)&.captures&.first atlassian_product_fingerprint(:confluence, res, detected: true, version: version) end |
#fingerprint_jira ⇒ Hash{Symbol => Object}
Fingerprints Jira through its server information or login endpoint.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/msf/core/exploit/remote/http/atlassian/product_fingerprint.rb', line 68 def fingerprint_jira res = send_request_cgi( 'method' => 'GET', 'uri' => normalize_uri(target_uri.path, 'rest', 'api', '2', 'serverInfo'), 'headers' => { 'Accept' => 'application/json' } ) if res&.code == 200 document = res.get_json_document if jira_server_information?(document) return atlassian_product_fingerprint(:jira, res, detected: true, version: document['version']) end end res = send_request_cgi( 'method' => 'GET', 'uri' => normalize_uri(target_uri.path, 'login.jsp') ) return atlassian_product_fingerprint(:jira, res) unless res&.code == 200 html = res.get_html_document = html.at_css('meta[name="application-name"]') = &.[]('data-name').to_s.casecmp('jira').zero? && ['content'].to_s.casecmp('JIRA').zero? return atlassian_product_fingerprint(:jira, res) unless version = ['data-version'] || html.at_css('meta[name="ajs-version-number"]')&.[]('content') atlassian_product_fingerprint(:jira, res, detected: true, version: version) end |