May I ask why when we find a DNS server running in port 53, We should add name.htb to hosts file?

It's hard to understand for me, Anyone can answer my question?

Comments

  • @Zerox9137 said:

    It's hard to understand for me, Anyone can answer my question?

    I am sorry, but I am not sure I understand your question.

    In general, HTB machines do not use DNS for hostname resolution. There are exceptions but that is normally down to the specific box (or endgame etc). This means you normally need to add the hostname to the hosts file if you want to access it via hostname.

    As examples. Imagine you are working on a box called EXAMPLE which uses IP 10.10.10.10.

    You can visit in a browser with http://10.10.10.10 and you will get content. But only the default server content (remember a HTTP server can serve different content based on the HOST header).

    However, if you want to visit http://example.htb or if you think it might give different content, you can do one of the following:

    • add 10.10.10.10 example.htb to your hosts file
    • intercept and modify your HTTP requests with burp or similar to add a host header

    (the first option is easiest).

    It is also worth remembering that you need to do this for every subdomain as well. If you want to visit www.example.htb and blog.example.htb, they need to be in your hosts file or on a modified HTTP header.

    TazWake

    Note: https://www.nohello.com/

    Happy to help people but PLEASE explain your problem in as much detail as possible! If you say vague things like "It's not working", I cant help. This isn't Twitter so my DMs are always open.

  • Type your comment> @TazWake said:

    @Zerox9137 said:

    It's hard to understand for me, Anyone can answer my question?

    I am sorry, but I am not sure I understand your question.

    In general, HTB machines do not use DNS for hostname resolution. There are exceptions but that is normally down to the specific box (or endgame etc). This means you normally need to add the hostname to the hosts file if you want to access it via hostname.

    As examples. Imagine you are working on a box called EXAMPLE which uses IP 10.10.10.10.

    You can visit in a browser with http://10.10.10.10 and you will get content. But only the default server content (remember a HTTP server can serve different content based on the HOST header).

    However, if you want to visit http://example.htb or if you think it might give different content, you can do one of the following:

    • add 10.10.10.10 example.htb to your hosts file
    • intercept and modify your HTTP requests with burp or similar to add a host header

    (the first option is easiest).

    It is also worth remembering that you need to do this for every subdomain as well. If you want to visit www.example.htb and blog.example.htb, they need to be in your hosts file or on a modified HTTP header.

    Thanks a lot, that's what I need, sir. Wish you have a nice day!

  • @Zerox9137 said:

    Thanks a lot, that's what I need, sir. Wish you have a nice day!

    Awesome - hope you have fun!

    TazWake

    Note: https://www.nohello.com/

    Happy to help people but PLEASE explain your problem in as much detail as possible! If you say vague things like "It's not working", I cant help. This isn't Twitter so my DMs are always open.

Sign In to comment.