Slashdot Mirror


Cryptographically Hiding TCP Ports

JohnGrahamCumming writes "The shimmer project implements a cryptographically-based system for hiding important (e.g. SSH) open ports in plain sight. By automatically forwarding from a range of ports all but one of which are honeypots and by changing the ports every minute only a user knowing a shared secret can determine the location of the real SSH server."

35 of 206 comments (clear)

  1. Neat in theorey, imho. by c0l0 · · Score: 4, Interesting

    Sounds like a neat hack indeed - however, I doubt its practical feasibility.

    I manage quite a bunch of remote systems, each one equipped with OpenSSH for adminning and OpenNTP for syncing system clocks, yet their local clocks still drift a little over time; sometimes easily up to quarter a minute or more. So if the interval of changing ports is too narrow, one would eventually lock himself out of the remote system because of unsynced clocks and a wrongly computed destination port. Sucks big time.

    ... rubbing the crytsal ball even more, I can forsee that if VMWare doesn't fix its abhorrent clockskew problems on Linux guests, and the hype^Wtrend towards virtualization continues, it's going to be a real mess for anyone who's willing to try such a setup in said virtualized environments - though I'll save that rant for a more fitting time, I guess ;)

    At the end of the day, choosing some non-standard port in the 30000+-range for sshd (mostly to save logrotate some work by keeping futile scriptkiddie-login-attempts out, but anyway) and turning off password-authentification in favour of pubkeys still provides enough security for just about anybody. Services that don't allow for such measures may be tunnelled over SSH (or e. g. OpenVPN, for more demanding protocols/apps) with ease, again rendering the project's idea somewhat moot to me.

    --
    :%s/Open Source/Free Software/g

    YTARY!
    1. Re:Neat in theorey, imho. by JohnGrahamCumming · · Score: 3, Informative

      Clock drift is an issue, hence the fact that three overlapping minutes are kept active at once.

    2. Re:Neat in theorey, imho. by egomaniac · · Score: 3, Informative

      I saw that, but I agree with GP that this won't fly in practice. Even with NTP servers it's too easy to have your systems end up out of clock sync, so now you're blacklisted and don't know why or how to fix it.

      --
      ZFS: because love is never having to say fsck
    3. Re:Neat in theorey, imho. by AndyST · · Score: 5, Interesting

      OpenNTP for syncing system clocks, yet their local clocks still drift a little over time; sometimes easily up to quarter a minute or more. Okay two things most people don't get when ntp is involved.

      1. An ntpd not only syncs time, but adjusts the running speed of the kernel clock. Otherwise it would be nothing more than a ntpdate cronjob.

      2. Under GNU/Linux, the local clock may be used to initialize the kernel clock, but those two run independently of each other until shutdown (or manual set). Only then the local clock is set to the kernel time, regardless of what the local clock was doing all the time.

    4. Re:Neat in theorey, imho. by AvitarX · · Score: 4, Interesting

      Perhaps a port knocking pattern on a separate set of ports that are never used otherwise.

      It should theoretically be impossible to snoop the port not (by virtue of it not being used), but it will be there if and when it is needed.

      You could even have it as a seperate 24 hour updating set, long enough that no one should fail it, but still makes snooping it fairly useless.

      Of course with up to 3 minutes to used snooped port pattern it is not completely invisible.

      If security was super high, and there were a limited number of people needing to access, you could have the login give you an 8 digit code and you would enter that into the client next connection, and it would use that to pick the ports to knock. This would make it impossible to access SSH even after snooping an exchange.

      It could also wait 3 minutes before allowing another connection, in the interim running a daemon that accepted and login and spit out "please wait 3 minutes" instead of a real prompt.

      --
      Wow, sent an e-mail as suggested when clicking on "use classic" banner, and got a fast response that addressed my msg
    5. Re:Neat in theorey, imho. by Rob_Ogilvie · · Score: 5, Funny

      If your ntp-enabled systems are drifting 15 seconds out of whack with each other, you have bigger problems than additional SSH security.

      --
      Rob
    6. Re:Neat in theorey, imho. by Sancho · · Score: 2, Insightful

      Port knocking is neat, but it suffers from sniffing attacks. Anyone who can sniff the connection can determine the sequence being used. You can use something like one time passwords to make a new set of sequences each time, but then you have to calculate those sequences (one of the neat things about port knocking is that you can do it from pretty much any machine--not just one with a special client.)

      Honestly, people spend way too much time worrying about hiding their SSH ports. Use public key authentication and disable password authentication, and no one's going to brute-force their way in.

    7. Re:Neat in theorey, imho. by Brian+Gordon · · Score: 3, Interesting

      I don't know, I don't like this at all. It's obviously abuse of TCP/IP, and there's no reason to try to mask what port it's on when SSH is a secure protocol anyway. Also I have my doubts that many OSes TCP/IP stacks can handle so many transient connections, or that it would be implementable at all (cough windows)

    8. Re:Neat in theorey, imho. by spun · · Score: 2, Informative

      If your ntp-enabled systems are drifting 15 seconds out of whack with each other, you have bigger problems than additional SSH security. Yes, it's called Linux on VMWare. There are workarounds, but they involve recompiling the kernel, setting boot options, and VMWare tools settings. Without the workarounds, even with ntp enabled, clocks can skew on the order of seconds every minute. I've seen systems get a minute out of whack in under ten minutes. With some settings, ntp actually makes it worse, as ntp and VMware perform dueling clock-skews.
      --
      - None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
    9. Re:Neat in theorey, imho. by mr_mischief · · Score: 5, Insightful

      I used to run a network with an ssh-only server. All it had facing the world as an actual service was OpenSSH's sshd on a fixed nonstandard port. It also had two fixed and four randomly hopping honeypot ports that added any /24 network that hit them to a 24-hour firewall DROP rule.

      Once someone logged into that server using their own key or pass phrase, the only command they could run was ssh. All the other servers in the network only allowed ssh in from that ssh box, and by policy their keys and pass phrases had to be different on the ssh server than on the internal boxes. Each failed attempt at logging in caused a 5-second wait, and after three a 12-hour wait.

      Is it as secure as having the real port hop around and synchronizing that with the clients via a shared secret? Well, I guess that depends on just how secret the shared secret is. We never had any problems, though, and the only thing our people had to take with them were the name of the server, their private key or passphrase, and the proper port to use. They usually didn't have much problem remembering three of those, and the you have the same issue with private keys no matter what (that being that they're only as secure as the system on which they are stored).

      There's probably some security advantage to the solution presented in TFA, but I'm just not sure it's worth the extra coordination hassle compared to people's home-grown solutions. It seems like every fifth post in the comments is about alternative ways to safeguard ssh ports. Surely not knowing which someone is using provides a bigger hurdle than getting past any single one of them. When you're practicing security by obscurity, which is what this really boils down to, then being more obscure is probably a good thing.

      The best fix for brute force is the old idea you mention of an enforced wait between attempts. It's a pain when you're locked out of a server you're legitimately allowed to use, but it's very useful to keep brute-force attacks down. Giving a couple of chances with a short wait and then imposing a much longer once after 2 to 5 tries seems to be a pretty good balance.

  2. "Obscurity" tag is misleading by egomaniac · · Score: 4, Insightful

    I see this got tagged "obscurity", but this isn't security-through-obscurity. If you actually RTFA, you'll see that hooking up to the wrong port automatically blacklists you. So it's not like you can just try different ports until you find the right one -- any attacker without the shared secret will almost immediately be blacklisted, assuming that they have to reconnect a few times (e.g. to try different SSH passwords).

    Still, requires a shared secret plus synchronized clocks, and any mistake automatically blacklists you. Sounds ridiculously impractical IMHO.

    --
    ZFS: because love is never having to say fsck
    1. Re:"Obscurity" tag is misleading by Loibisch · · Score: 2, Informative

      [...] and any mistake automatically blacklists you. Sounds ridiculously impractical IMHO. Yup, anything that would potentially that easily deny me access to my own machine won't get installed.
      It's all fun and games till you've locked yourself out from an only remotely accessible server...
    2. Re:"Obscurity" tag is misleading by morbiuswilters · · Score: 5, Interesting

      Actually, it seems possible to lock out legitimate users as well, by sending them to a URL like http://example.com:12345/ Since it only appears to be operating at the TCP layer, requests from a web browser would accomplish the goal of blacklisting a target IP. If port 12345 was one of the honeypots at that time, the legitimate user gets blacklisted. Throw it on a malicious web page that uses several XMLHttpRequests to try various ports and you have a pretty good shot at locking the user out.

      --
      I have come here to chew memory and kick ass... and malloc() is returning a null pointer.
    3. Re:"Obscurity" tag is misleading by sumdumass · · Score: 4, Interesting

      Well, this is still security through obscurity. You are in essence hiding a port within many and then attempting to enforce rules based on the many. the problem with security through obscurity is that if the hacker gets lucky then nothing is secure again.

      So to keep this in the same context of the article, what if the hacker picks the correct port right off the bat? No black listing, no honey pot, no security other then what was already there without the system. but better yet, what if there was 1000 ports operated in this manor, Could I effectively find the right port by using 1000 zombie machines to connect and then see the response on a second connect attempt to see when the blacklisting comes about? I'm willing to bet that the first connection that survived the longest without black listing is the correct port. So now I can attempt to exploit the server on that port to gain access.

      I would think it adds a level of security and might stop the average script kiddie but I'm not sure that it is a level of security beyond the equivilent of security through obscurity.

    4. Re:"Obscurity" tag is misleading by sumdumass · · Score: 3, Insightful

      I'm not saying that it wouldn't add a layer of security. But as I understand it, It seems that I could stumble onto the right port in the first place and hack my way in using zombies or not. The key only points you to the right port and then you validate. This is like placing 500 ignition keys to a car in a fish bowl and telling someone they win the car they can pick one key and start the car. So if I was to pick the right port then validate or hack my way in without validating, the security did nothing. The only real security is the random chance I wouldn't find the right port/car key and whatever is normally there to stop my entry. The security key is more or less just convenience so that i can find the right port the first time.

      Now if I am not understanding something correctly and you need the key to even get access to a/the port then I am wrong. I mean if the ports are all blocked and the key opens them for you to attempt authentification? But as I understand it, the port it already there and exposed along with numerous fake ports, you just don't know which one it is without the key and that is obscurity.

      If this is how I am thinking, then combining it with something like port knocking where the ports aren't even available until another challenge succeeds might make it better.

    5. Re:"Obscurity" tag is misleading by mea37 · · Score: 3, Insightful

      There are substantial differences. Enough so that, while the sound similar, they are really nothing alike.

      Frequency hopping has a much broader domain to "hop" across.

      Frequency hopping requires the communication to keep hopping even after it's established. Not only can't you connect without the key, you can't even keep a conversation going without the key. You can't hear or be heard at all, in fact.

      To someone without the key, frequency hopping "looks like" random noise. This works becuse there is random noise on the RF spectrum for the FH signal to "look like". There is no such "noise' in the domain of IP port connections.

    6. Re:"Obscurity" tag is misleading by russotto · · Score: 2, Informative

      To someone without the key, frequency hopping "looks like" random noise.


      No, it doesn't. It looks pretty much like you'd expect -- spikes in power more-or-less uniformly (but discretely, not continuously) distributed over some part of the spectrum.

      Check this link for pictures:

      http://www.metageek.net/docs/sample-recordings/video-baby-monitor
    7. Re:"Obscurity" tag is misleading by GodfatherofSoul · · Score: 2, Insightful

      Well, this is still security through obscurity.

      In that case, isn't cryptography just "security through obscurity" since the real key is buried in known iteration of numbers?

      --
      I swear to God...I swear to God! That is NOT how you treat your human!
  3. Isn't this port knocking by crow · · Score: 5, Insightful

    Isn't this essentially the same as port knocking? Actually, it's not as good, as you can get lucky with this. With port knocking, you have to send a secret sequence of packets (possibly one that changes with time) before the port is available for your host to connect to. And you send UDP packets, so there's no indication from the server that the machine is even powered up unless you are successful. And, of course, there's the variation where you send a single UDP packet with an encrypted payload that instructs the server to open up a port for you.

    So while this is a little different, it's inferior.

    1. Re:Isn't this port knocking by AndyST · · Score: 2, Informative

      And you send UDP packets, so there's no indication from the server that the machine is even powered up unless you are successful. Except for the missing dst host unreachable from the last hop before the target. "Stealth"/DROP instead of "Closed"/REJECT add nothing to security. Same with not replying to pings. People listen to Steve Gibson way to often.
    2. Re:Isn't this port knocking by Dr.+Manhattan · · Score: 2, Interesting

      I did something a lot simpler, using TCP/IP, and much easier on CPU requirements. (I use it on a 16MHz M68K machine.) See the link in my .sig...

      --
      PHEM - party like it's 1997-2003!
  4. Re:Obscurity? by morbiuswilters · · Score: 2, Insightful

    Passwords (or any other shared secret) are not security through obscurity. http://en.wikipedia.org/wiki/Kerckhoffs%27_principle

    --
    I have come here to chew memory and kick ass... and malloc() is returning a null pointer.
  5. Not so smart, though. by VincenzoRomano · · Score: 2, Insightful

    Well, if you use cyphers just to shuffle the TCP ports ... plain SSH with public key authentication would work with the same level of security.
    In both cases you need to keep a crypto key secret otherwise you'll end with secuity hole. A shuffled one, but still a hole.

    --
    Maybe Computers will never be as intelligent as Humans.
    For sure they won't ever become so stupid. [VR-1988]
  6. Re:Obscurity? by bugs2squash · · Score: 2, Informative

    This will probably stop "john" trying to log in from Istanbul as he seems to try 100s of times each day, and I like the C3PO acronym - cute. So far, port knocking has also stopped 'john' and his friends.

    It seems too easy to get locked out as one slip blacklists you.

    I was shocked to read that even with NTP, some servers' clocks drift so far - I thought it could keep them +/- a fraction of a second worst case (ah, when reality bites)

    --
    Nullius in verba
  7. Re:Obscurity? by jmodule · · Score: 2, Informative

    matt4077: "Passwords are security by obscurity, too."

    No, no, no! A password is a *key* and has nothing to do with obscurity. The quote you refer to is using obscurity to mean enhancing an algorithm by "keeping its process a secret." That is not the case here.

    See Security through obsecurity is no security and Security through obscurity

    --
    The jModule
  8. Complete Waste of Time by Chris_Jefferson · · Score: 2, Insightful

    There seems to be two reasons this might be useful:

    1) Another piece of information needed
    2) If your SSH server has a buffer overflow or similar in it.

    And both seem useless.

    1) You are surely going to keep your SSH key in the same place as the code to access this thing. If you wanted a similar level of security, why not hide your SSH key in two pieces?
    2) Now we have to completely test two programs instead of one.

    Seriously, what security problem is this supposed to fix?

    --
    Combination - fun iPhone puzzling
  9. Actually, it gets better than that... by PRMan · · Score: 2, Insightful

    If you are a competitor of these guys, simply forward people silently to one of their ports in a hidden iframe.

    Bingo, permanent ban.

    --
    Peter predicted that you would "deliberately forget" creation 2000 years ago...
  10. not as good as port knocking by vrmlguy · · Score: 2, Informative

    There are 16 ports being listened to, so an attacker has a 1-in-16 chance of finding the correct port. Knocking, using 16 ports and just three knocks, gives an attacker a 1-in-4096 chance of getting through. If you changed the knock pattern every minute, then I could see something like this being useful, but as presented it seems less secure.

    --
    Nothing for 6-digit uids?
  11. Distributing Cracking by Applekid · · Score: 3, Interesting

    This approach pretty much assumes that the brute-force attack wouldn't be happening from many different computers on many different IP addresses each attacking an individual port. If we're talking 1 port in 30000 then all you need is a botnet at least as large as 30000 machines. All except one will waste time with their respective honeypots but one will be getting the job done.

    I wonder if the DDoS would bring the server to its knees first, though. :)

    --
    More Twoson than Cupertino
  12. What are these passwords, kemo-sabi? by igb · · Score: 4, Interesting

    Surely passwords are the wrong answer. I carry the contents of .ssh from my office machine on a tiny USB thingie from pqi. Very handy when I was at my father in law's last month. I also have Windows binaries of ssh on it. Mount the USB disk, use the id_dsa file from it as my key, job done. Yes, a keystroke logger will get my passphrase, but won't get the key. A very targeted attack would be needed. If I were worried about that, I'd tie our SSH listener into our SecureID infrastructure, but that seems a bit keen.

  13. SSH implementations have defects by tepples · · Score: 2, Insightful

    SSH is a secure protocol anyway. Just because the SSH protocol offers security services such as authentication and privacy doesn't mean that all implementations are without defect.
  14. DenyHosts SSH script by HumanCarbonUnit · · Score: 2, Interesting

    This is indeed a nifty hack, however it seems a bit impractical and overly complicated way of protecting SSH.

    I use the software script Denyhosts which runs whenever an SSH connection comes into the system
    http://denyhosts.sourceforge.net/

    You simply set the Account / IP address lockout threshold and so after X number of failed login attempts the system will put the connections source IP address into the hosts.deny file. The IP address stays there until eventually released, or it can stay there forever.

    Thus its easy for me to share the login with friends so they can SSH and SFTP into the system and any / all attempts to guess or force a login are blocked after the threshold is reached.

  15. Re:Newbie Question about SSH Security ... by KillerBob · · Score: 4, Informative

    The only truly secure method is to make it terminal access only and accessible only by passcard or some other physical means. (IOW, to turn SSH off) Not exactly feasible for something you want to access remotely.

    Passkeys can be relatively secure, or they can be relatively insecure. It depends on the level of security you're implementing in them. Another really easy way to secure it is to make it more trouble than it's worth to break into it. I have my SSH on the standard port of 22 on my server, and am not worried about security at all. I subscribe to the mailing list and it's kept up to date every time a new release comes out. More importantly, my SSH server is configured to only allow one user ID to log in, and to only allow one password attempt before disconnecting. It also doesn't disconnect until after you've entered the password, and will give the same error message no matter what, so you've got no way of knowing why it is that you're not getting through. Finally, the user name in particular that's allowed to log in through SSH doesn't have an e-mail account or home directory, and isn't published anywhere.

    No, that isn't going to secure it entirely. It is, however, going to make breaking into it incredibly time consuming and generally not worth it unless you have a personal vendetta or other reason to go after me specifically. Security through obscurity. In this case, get away from Default Pass, and towards Default Reject security model.

    --
    If you believe everything you read, you'd better not read. - Japanese proverb
  16. Time to break out infinities by mattr · · Score: 2, Interesting

    This may sound like tongue in cheek but I assure you I'm serious.

    Clearly some aspects of computers not as sexy as high speed graphics lag behind, as some examples the number of bots, the number of ports, the number of concurrent connections (10K problem) and the data transfer speeds possible by consumer hardware, especially when divided by storage media size, all seem to be relatively small numbers still. A ton of bots can game this game, etc.

    Obviously it is time to break out the heavy math. First imagine if instead of having only measly thousands of ports you could use a floating point number to designate a port. It's not like we have thousands of ports in hardware right? Meaning virtual port addressing. Needs a big botnet to get through that. You could make the system answer on any port, or only answer on those which are being used. Well floating point still may not have a lot of significant bits to hack, so time to break out the math.

    I think Rudy Rucker could have some good ideas for computer security. Not that I'm a mathematician or anything, but if you read his latest book minus 1 there are plenty of descriptions of navigating infinities. If you had a transfinite number of ports I think you might even be able to prove that the obscurity is more secure than anything else in the real world. So while it is a bit of a ticklish idea I'd very much like to see a math-minded hacker think about what would be involved in designating such a number or abstract symbol representing it and using that as a destination address. Thank you.

  17. Use a different network to delete blocks by ccguy · · Score: 2, Interesting

    The best fix for brute force is the old idea you mention of an enforced wait between attempts. It's a pain when you're locked out of a server you're legitimately allowed to use, but it's very useful to keep brute-force attacks down. Giving a couple of chances with a short wait and then imposing a much longer once after 2 to 5 tries seems to be a pretty good balance.
    Add to this a nokia phone and a data cable, gnokii, and a script that when it receives a SMS from a specific phone number with an IP address in the text unblocks it, and you are set. That's what I use and it works pretty well, if I screw up it just costs me a few cents to get back to normal. In fact my (quite trivial) script can do a few other things as well as opening ssh to a particular IP (such as rebooting).