VYPR
High severity8.1NVD Advisory· Published Aug 31, 2017· Updated May 13, 2026

CVE-2017-0902

CVE-2017-0902

Description

RubyGems version 2.6.12 and earlier is vulnerable to a DNS hijacking vulnerability that allows a MITM attacker to force the RubyGems client to download and install gems from a server that the attacker controls.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
rubygems-updateRubyGems
< 2.6.132.6.13

Affected products

1

Patches

1
8d91516fb703

[RemoteFetcher] Avoid DNS Hijacking Vulnerability

https://github.com/rubygems/rubygemsSamuel GiddinsMay 1, 2017via ghsa
2 files changed · +16 1
  • lib/rubygems/remote_fetcher.rb+1 1 modified
    @@ -110,7 +110,7 @@ def api_endpoint(uri)
         else
           target = res.target.to_s.strip
     
    -      if /\.#{Regexp.quote(host)}\z/ =~ target
    +      if URI("http://" + target).host.end_with?(".#{host}")
             return URI.parse "#{uri.scheme}://#{target}#{uri.path}"
           end
     
    
  • test/rubygems/test_gem_remote_fetcher.rb+15 0 modified
    @@ -241,6 +241,21 @@ def test_api_endpoint_ignores_trans_domain_values_that_end_with_original
         dns.verify
       end
     
    +  def test_api_endpoint_ignores_trans_domain_values_that_end_with_original_in_path
    +    uri = URI.parse "http://example.com/foo"
    +    target = MiniTest::Mock.new
    +    target.expect :target, "evil.com/a.example.com"
    +
    +    dns = MiniTest::Mock.new
    +    dns.expect :getresource, target, [String, Object]
    +
    +    fetch = Gem::RemoteFetcher.new nil, dns
    +    assert_equal URI.parse("http://example.com/foo"), fetch.api_endpoint(uri)
    +
    +    target.verify
    +    dns.verify
    +  end
    +
       def test_api_endpoint_timeout_warning
         uri = URI.parse "http://gems.example.com/foo"
     
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

20

News mentions

0

No linked articles in our index yet.