0

Is there a tool, or a command for linux that can make possible to redirect HTTPS site to another HTTPS site on LAN? i'm using Kali Linux, and all the tools and commands that i found was to redirect HTTP to a local hosted website IP.

I want to make this:

https://www.google.com > https://myblog.com

not this:

http://exampledomain.com > http://192.168.16

3

This is possible with a proxy server (either configured on the client, or an invisible proxy with a MitM positon), or with spoofed DNS. However, in both cases you'll either need a certificate for the target site (such as "google.com" in your example) that is trusted by the client, or you'll need your users to click past a scary browser security warning (and for some sites - those using HSTS or HPKP, including Google - most browsers will refuse to allow the user to click past).

Authenticating the host (server) that you connect to is one of the core features of TLS, the protocol that secures HTTPS. If a client requests foo.com, they won't accept a response - not even just a redirect - from anybody who can't prove themselves to be foo.com. That proof is done using x.509 digital certificates, which are issued by trusted agencies (who verify the identity of the recipient) and cryptographically signed to prevent tampering or spoofing the issuer.


Assuming you either have a cert that will be trusted, or that the security warning is acceptable, there are options.

  • If you control the router connecting the computers, you can intercept and modify packets. This makes it easy to change the DNS requests from the client to point at your own IP address, which runs a HTTPS server with the certificate. DNS spoofing is possible with several included tools in Kali, although the exact situation will determine which tool is best. One such tool is Ettercap.
  • Another alternative is to ignore the DNS requests, but invisibly route requests that are outbound to the target server (on TCP 443, the port used for HTTPS) to your own web server running locally. This can be done using iptables rules.
  • If you don't control the router but are on the same LAN, you can use ARP (Address Routing Protocol) spoofing to make the other machines on the network think that you're the router, so they send their outbound packets to you. You then are, effectively, the router and can use the above attacks. You can use arpspoof for this (and then Ettercap or whatever).
2
  • "Another alternative is to ignore the DNS requests, but invisibly route requests that are outbound to the target server (on TCP 443, the port used for HTTPS) to your own web server running locally." And various browsers now do DNS over HTTPS, so in that case thi will meet with problems. Same for "This makes it easy to change the DNS requests" how do you do this with DOH/DOT if the client checks the remote? – Patrick Mevzek Sep 14 '20 at 14:51
  • @PatrickMevzek To be clear, this whole idea doesn't work with modern browsers unless you either have forged certs or people willing to ignore the warnings and your target site doesn't uses HSTS. Saying "but what about DoH?" is a bit extreme, given that. That said, invisible proxy via MitM still works just fine even with DoH; their packets still route through you and you can still pretend to be the remote host. You could even do that for the DoH requests - not sure how the browser will respond to an invalid cert on those, though - but if you have a MitM position anyway, you don't have to. – CBHacking Sep 15 '20 at 6:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.