Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolv::getaddresses is OS-dependent, therefore by playing around with different IP formats one can return blank values. This bug can be abused to bypass your exclusion list.
Resolv::getaddresses
💻 Machine 1
irb(main):002:0> Resolv.getaddresses("127.0.0.1") => ["127.0.0.1"] irb(main):003:0> Resolv.getaddresses("localhost") => ["127.0.0.1"] irb(main):004:0> Resolv.getaddresses("127.000.000.1") => ["127.0.0.1"]
💻 Machine 2
irb(main):008:0> Resolv.getaddresses("127.0.0.1") => ["127.0.0.1"] irb(main):009:0> Resolv.getaddresses("localhost") => ["127.0.0.1"] irb(main):010:0> Resolv.getaddresses("127.000.000.1") => []
irb(main):001:0> require 'private_address_check' => true irb(main):002:0> PrivateAddressCheck.resolves_to_private_address?("127.1") => false # Bypass
I suggest staying away from Resolv::getaddresses altogether and using the Socket class.
Socket
irb(main):002:0> Resolv.getaddresses("127.1") => [] irb(main):003:0> Socket.getaddrinfo("127.1", nil).sample[3] => "127.0.0.1"
The text was updated successfully, but these errors were encountered:
This issue has been resolved in 58a0d7f.
Sorry, something went wrong.
No branches or pull requests
Description
Resolv::getaddressesis OS-dependent, therefore by playing around with different IP formats one can return blank values. This bug can be abused to bypass your exclusion list.Proof of concept
Mitigation
I suggest staying away from
Resolv::getaddressesaltogether and using theSocketclass.The text was updated successfully, but these errors were encountered: