This forum is in archive mode. You will not be able to post new content.

Author Topic: How can I hide an Open port from Scanners?  (Read 889 times)

0 Members and 1 Guest are viewing this topic.

Offline hack3rcon

  • Peasant
  • *
  • Posts: 80
  • Cookies: -216
    • View Profile
How can I hide an Open port from Scanners?
« on: September 09, 2015, 06:08:42 PM »
Hello.
I wan to open some ports on my system but I don't like Scanners like Nmap find it, Can anyone show me some tricks about it?
What is your idea about "http://www.portknocking.org/" ?


Thank you.

Offline reeaws

  • Serf
  • *
  • Posts: 25
  • Cookies: 6
    • View Profile
Re: How can I hide an Open port from Scanners?
« Reply #1 on: September 10, 2015, 07:12:16 AM »
i think u did answer ur question, i am using this method on Debian.

Offline kenjoe41

  • Symphorophiliac Programmer
  • Administrator
  • Baron
  • *
  • Posts: 990
  • Cookies: 224
    • View Profile
Re: How can I hide an Open port from Scanners?
« Reply #2 on: September 10, 2015, 12:09:46 PM »
You could do port knocking all the way if it is what you want but there are a few alternatives to try out. It also depends on the service you want to hide. But security through obscurity is shit security. Google on how to bypass port knocking measures. And unless you have alot of scanning attempts on you port and need to have better use of your logs, port moving is also just a simple measure to reduce log clutter.

The better choices are to keep your system updated with the latest security patches and harden any services that need authentication. Here we go;

My choice, though it might be better if its a corporate network, is to hide the service behind a VPN.
Other choice is to do a client-side certificate.
Other choice, use PKI.
And for SSH, fail2ban can be a good choice or any other rate limiting measures.

Don't fear port scans, embrace them.
If you can't explain it to a 6 year old, you don't understand it yourself.
http://upload.alpha.evilzone.org/index.php?page=img&img=GwkGGneGR7Pl222zVGmNTjerkhkYNGtBuiYXkpyNv4ScOAWQu0-Y8[<NgGw/hsq]>EvbQrOrousk[/img]

Offline hack3rcon

  • Peasant
  • *
  • Posts: 80
  • Cookies: -216
    • View Profile
Re: How can I hide an Open port from Scanners?
« Reply #3 on: September 10, 2015, 01:04:15 PM »
You could do port knocking all the way if it is what you want but there are a few alternatives to try out. It also depends on the service you want to hide. But security through obscurity is shit security. Google on how to bypass port knocking measures. And unless you have alot of scanning attempts on you port and need to have better use of your logs, port moving is also just a simple measure to reduce log clutter.

The better choices are to keep your system updated with the latest security patches and harden any services that need authentication. Here we go;

My choice, though it might be better if its a corporate network, is to hide the service behind a VPN.
Other choice is to do a client-side certificate.
Other choice, use PKI.
And for SSH, fail2ban can be a good choice or any other rate limiting measures.

Don't fear port scans, embrace them.


Thank you so much.
I though Port Knocking is just for SSH !!! I use fail2ban too.


Offline proxx

  • Avatarception
  • Global Moderator
  • Titan
  • *
  • Posts: 2803
  • Cookies: 256
  • ФФФ
    • View Profile
Re: How can I hide an Open port from Scanners?
« Reply #4 on: September 10, 2015, 05:00:06 PM »
Just set SSH to some high port and use key negotiation only, pretty much unbreakable, the first exploit is still to be found.
SSH must be one of the most solid daemons out there.

From there you can also do ssh -p 12345 -L 80:somewebserveronyourlan:8000 user@somehost.com
This will give you localhost:8000 and you can connect to the remote locally hosted (web)server if your SSH host has access to it.
I use this on a daily basis, very nifty stuff.
Can be used from putty or any nix or mac box, thus cross platform out-of-the-box, do I need 2 say more?

'Hide' yeah ..
Does it really matter ?

But if you really want to hide just setup an IP filter on the NAT port so only specific hosts can access it, thats as hidden as it gets.
In IPtables it would look something like this:
iptables -I INPUT -p tcp -s REMOTEIPADDR --dport 22 -j ACCEPT

« Last Edit: September 10, 2015, 05:06:59 PM by proxx »
Wtf where you thinking with that signature? - Phage.
This was another little experiment *evillaughter - Proxx.
Evilception... - Phage

Offline hack3rcon

  • Peasant
  • *
  • Posts: 80
  • Cookies: -216
    • View Profile
Re: How can I hide an Open port from Scanners?
« Reply #5 on: September 11, 2015, 09:48:37 AM »
Just set SSH to some high port and use key negotiation only, pretty much unbreakable, the first exploit is still to be found.
SSH must be one of the most solid daemons out there.

From there you can also do ssh -p 12345 -L 80:somewebserveronyourlan:8000 user@somehost.com
This will give you localhost:8000 and you can connect to the remote locally hosted (web)server if your SSH host has access to it.
I use this on a daily basis, very nifty stuff.
Can be used from putty or any nix or mac box, thus cross platform out-of-the-box, do I need 2 say more?

'Hide' yeah ..
Does it really matter ?

But if you really want to hide just setup an IP filter on the NAT port so only specific hosts can access it, thats as hidden as it gets.
In IPtables it would look something like this:
iptables -I INPUT -p tcp -s REMOTEIPADDR --dport 22 -j ACCEPT


It is my iptable rules :





Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere           
REJECT     all  --  anywhere             loopback/8           reject-with icmp-port-unreachable
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
           tcp  --  anywhere             anywhere             tcp dpt:ssh state NEW recent: SET name: DEFAULT side: source
DROP       tcp  --  anywhere             anywhere             tcp dpt:ssh state NEW recent: UPDATE seconds: 180 hit_count: 4 name: DEFAULT side: source
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request
LOG        all  --  anywhere             anywhere             limit: avg 5/min burst 5 LOG level debug prefix "iptables denied: "
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable


Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable


Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere








In your idea can it enough ?


 



Want to be here? Contact Ande, Factionwars or Kulverstukas on the forum or at IRC.