Skip to content
New issue

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

NSE script: http-find-host.nse #1251

Closed
wants to merge 1 commit into from
Closed

NSE script: http-find-host.nse #1251

wants to merge 1 commit into from

Conversation

zhovner
Copy link

@zhovner zhovner commented Jun 24, 2018

Find website backend behind reverse proxy like Cloudflare by sending specific HTTP Host header and looking for a title.

Find website backend behind reverse proxy like Cloudflare by sending specific HTTP Host header and looking for a title.
@dmiller-nmap
Copy link

Thanks for your contribution. Can you explain how this script is different than the existing http-title script? The http library already sets the Host header to the first of the following values it finds:

  1. The target name provided on the command line, e.g. nmap example.com
  2. The reverse-DNS name for the IP, e.g. the same as dig -x X.X.X.X
  3. The IP address.

Is there a reason you can't just use http-title and provide the site domain name on the command line as the target? Maybe we can find a better solution that would improve all of the http scripts.

@zhovner
Copy link
Author

zhovner commented Jul 11, 2018

Is there a reason you can't just use http-title and provide the site domain name on the command line as the target?

For example you looking for a backend of example.com that using a CloudFlare http proxy.
So example.com DNS A record pointed to 111.111.111.111 that is cloudflare proxy network.
You suppose that backend of example.com is somewhere in 222.0.0.0/8 network. So you targeting nmap to this network with specific Host: example.com http header. And print the result ONLY when title is matching your string.

The http-title script uses method http.get from nse http library. I can't find how to send a specific Host: header by using this method.
That's why I'm using http.generic_request instead.

Maybe you right, that http-title script can do the same after little modification.

@dmiller-nmap
Copy link

I understand now. Yes, I think we can make a simple override in the form of a script arg like http.host that would override the host header in all cases where it isn't explicitly set. That would affect http-title as well as lots of other scripts, but only if the script arg is set.

In order to set the Host header via http.get, you would pass the header in the options table like so:

http.get(host, port, "/", {header={Host="example.com"}})

@nmap-bot nmap-bot closed this in 5318e42 Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants