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."
Sounds like a neat hack indeed - however, I doubt its practical feasibility.
... 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 ;)
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.
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!
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
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.
Passwords are security by obscurity, too. It's just that the obscurity is neatly focused on a single point and can easily be changed. This scheme is quite like that, actually. But ssh+strong passwords is easier to setup and can be used for honeypots equally well. This only protects against remote exploits, which (as far as we know) don't happen too often.
Fleur de Sel
First came exotic ports (as if using 922 instead of 22 was security -- it just throws off scripted attacks), then port knocking, and now this ?
Whatever happened to just plain good passwords (including a little helper for good measure), TCPWrappers, sensible firewalling and ssh private/public keys?
I could understand this type of security with more brittle services, things that can be hacked, but this is IMHO going way oervboard.
The right to offend is far more important than the right not to be offended. (Rowan Atkinson)
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]
Oddly, Last night i came up with a new way of doing this, and today this appears on slashdot. Here is my idea: UDP packets are are sent in a specified order to specified ports, this scheme can come from some kind of private key. The packets contain a signature file, which may be divided into several segments, each one containing the reply IP. After the sequence is complete, the SSL port uncloaks on a specified port.
What exactly is the difference with password encryption? Would you say that password encryption is also security through obscurity? Because all the points you raise to argument that this works due to obscurity also apply to password encryption, IMHO.
---
"The chances of a demonic possession spreading are remote -- relax."
The way he describes the work there is a chance it will NOT generate 16 distinct ports, since he AES encrypts 0-15 and then takes the result mod N (where N is some number of ports you wish to use) to get port assignments.
AES does not guarantee these numbers will be distinct. Minor error, but these toeholds are how methods are broken. Someone who does not understand these simple items should not be designing security protocols, IMHO.
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
The service itself is not more secure in a mathematical sense; the clock is a rather well-known "secret".
It does however provide a degree of hardening for the *daemon that provides the service*, by reducing its surface area. This is worthwhile to investigate, but automatic blacklisting is problematic. If all of your services depend on the accuracy of the local time server, you now have a single point of failure for every service hardened in this way.
Maybe not quite ready for production environments, but a fascinating idea that has great potential.
And this is better than classic port-knocking how?
Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
I can see a problem, if you use a sniffer and capture enough packets, should be easy enough to see encrypted session on a single port for a length of time, now add in that true randomness doesn't exist in the computer world unless using radioactive decay or some solution, it should be doable to figure out what ports are being used for the SSH connection. I agree with one reader though, this wouldn't be needed if using best practice methods for passwords, firewalls, IDS/IPS, etc.
Comment removed based on user account deletion
It sounds close to the FHSS technique but applied to the Internet. FHSS is often used in military applications to avoid jamming and interceptions. Here, instead of switching carriers, one has to switch ports.
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...
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?
The largest problem w/ the proposed system is that, even though it may make the active port difficult to find, it leaves a large footprint. The open ports may be implemented as honeypots, but if you aren't using the standard tcp stack library it doesn't inconvenience the attacker but instead tells him the target exists. Any vulnerability in the implementation can then be exploited.
I have an alternative proposal. Have a udp or icmp service where, before connecting to a tcp server port, a client must send a packet containing the destination port along with a 32-bit entry code. (This entry code could be, for instance, the first 4 bytes of the SHA1 of a concatenation of a private key plus the client's IP.) Without receiving this packet the server's port would return no data on the attempted initiation of a connection, resulting in a "stealthed" server port.
Maybe i'm missing something here, but the description lists the following steps
/dev/random char device), and second, the hash sets the key anyway. In any event, it seems unnecessary to go through these steps to randomize two bytes.
1. Get the current Unix epoch time to the nearest minute: minute
2. Get the name of the mirage being shimmered: name
3. Get the shared secret: secret
4. Calculate the SHA-256 hash of a combination of minute, name and secret to create a 256-bit Rijndael key that depends on time (changing every minute) and a shared secret: key.
5. Use key to AES encrypt the numbers 0 through 15 to obtain 16 seeds for port numbers: seeds.
6. Map each seed to a port number in the range specified for the mirage using a simple modulus operation to obtain a list of ports: ports.
7. The first port generated (corresponding to the first seed from encrypting 0) is the port that will be forwarded, the other 15 are traps.
Why are steps 4 and 5 required? Why not simply use 0-15 numbers as salts to the hash described in 4.
The only thing that seems useful is a concern that the SHA hash appears less random than the AES ciphertext. First, I'm fairly sure that such an attack is not publicly known (see comments to linux
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
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.
Reminds me of something I wrote once that listens on a UDP port that moves on a time based algorithm, you send a signed message to the UDP port and if your key is right, it opens a random port and tells you what that is. You must be in the auth keys/users list and you must know the time algorithm- otherwise the box sits quiet like it was never there.
Figure out or guess the internal LAN subnet, create your (thousands of) fake TCP-packets and just hit random ports on a server running this. Before you know it everyone will be black-listed and someone has to go locally to the server to clean this up.
Mind you, an IDS will probably see this activity and if there's an IPS it may be able to block the fake packets. Mind you, most places don't have that.
Wearing pants should always be optional.
I don't use an obscure port for SSH; however, I don't allow passwords (only passkeys). How insecure is this?
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.
FWKnop can use signed GPG keys to authenticate both sides (if one side does not match, no open ports). It can pass parameters inside the one package it uses (and it's just one package). Seems more productive and safer. And it only opens the port to service (SSH) which still has it's own security.
To the critics: it's not STO (security through obscurity) as it's not the only form of security. It's called Concealment, it hides the service that have it's own security, it's another layer of protection (much better than password only). FWknop can be time based so it also can suffer from problems with sync but it's an option, not imposed.
The solution proposed in the article is not STO also. The security relies on the password/certificates/whatever authentication SSH uses. It's somethink like One-Time access Port, to compare to One-Time Password.
The proposed solution has some troubles to account for (time) but can also be a promising kind of concealment solution.
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.
It turns out that clock drift is no longer an issue. There is Open Source clock sync software that can get you into the microseconds range of accuracy across the internet using no other hardware than your microprocessor's clock. TSClock
why not simply have one fixed known port that hosts an NTP Server serving the Servers local time... the SSH Client would connect to that first and use it to calculate a time offset from the server to the client
;)
That way it wouldn't matter if the server, the client, or both are totally out of sync with reality!
Still, i don't see any advantage of this to simply using a fixed port that blacklists any client after a set number of failed login attempts. I mean if the attacker tries to guess he would get blacklisted just the same. All it's changing is what the attacker is trying to guess.. a password used in combination with a known fact (to calculate a port) or just a password...
Cryptographically speaking they are both of equal strength since the additional key component is universally known.
but what do i know... sounds like a fun 10 minute oss hack
So it's not like you can just try different ports until you find the right one
If you only have one IP address. Someone with a bunch (botnet anyone) can try all 48 ports,
or even all possible ports....
One can simply open an additional fixed port, which would just broadcast the time on the system in question. Or, even simpler, use a standard unix time service.
K.L.M.
I really think this whole shimmer thing (as it is not an improvement on port knocking, tumbler, or any other best practice) was just an excuse for the author to come up with something to fit that acronym. Good show old chap!
These can accomplish something similar, except more secure and hide the entire address, not just the port. In fact they likely provide the same level of one-time usage without requiring any special clients. Clients merely need to know a secret, fixed DNS name. Of course everyone would have to use IPv6 and there aren't any practical applications available yet.
Info here.
This is not the same, but as others have suggested it helps keep the kiddies at bay; We've implemented a "Failure Penalty Timer" (my term) pam_delay - for SSH. Failing authentication on login makes the user wait a long time (seconds to minutes) before being allowed to try again. For a legitimate user this is at most a slight annoyance. But.. To a scriptkiddie - it generaly makes the target not worth it, and for a bot the same thing. 20 tries a minute - turns into 1 try every 2 minutes or worse. Its not making the server more secure in the purest sense; but in practical terms its akin to locking your doors or a wheel lock - its not going to stop a determined crook, but for a random bandit it will make your asset much less attractive We still get the tries, but only one or two per haxxer;
Instead of going to all this trouble, simply use ssh-faker (http://www.pkts.ca/ssh-faker.shtml) and you'll achieve at least the same level of security with a whole lot less hassle.
/etc/hosts.allow to allow that one particular IP address access to sshd. Then, you connect again using ssh and get sshd instead of ssh-faker, and you log in.
/etc/hosts.allow /etc/hosts.deny for IP granularity access controls. So installing ssh-faker involves a one line change to /etc/hosts.deny and you are done.
/etc/hosts.allow.
With ssh-faker, all ip addresses are denied access to sshd until the connecting machine provides the proper ssh-faker password. At that point, ssh-faker inserts an entry in
Advantages over this system:
A lot simpler to impliment. Sshd already uses tcpd and
No need for any special client software at the remote end in order to be able to connect to your system. You just need a working telnet program and you can insert your current IP address into
Absolutely no "lucky guess" aspect. With 48 ports open, three of which are "valid", a hacker has a 3 in 48 chance of randomly guessing the correct, operational, ssh port, at which time the only security you have remaining is the strength of your passwords (if you allow password based ssh logins).
This can be mitigated by disallowing password based logins, but doing so means you "must" carry your ssh-key data with you everywhere you might need to log in from. Ssh-faker gives you the security of a password-less login sshd without the need to carry your key data with you (and be able to make use of it).
Disadvantages of ssh-faker:
1) You need to have a working perl interpreter on the machine running sshd. No big deal on a full PC box, but might be a problem on low memory embedded systems.
2) You will need to connect twice from where-ever you are, first with a basic telnet to input the ssh-faker password, and a second time with your real ssh client to log in. Not such a big deal for all of the advantages provided.
3) The ssh-faker password is sent as cleartext. This leaves it open to a sniffing attack. But, keep in mind that this shimmer system as a 3 out of 48 chance of random guessing. A sniffing attack requires an actual attacker located on a link along the way sniffing your data to locate your ssh-faker password. If you are being targeted with this level of precision, well, you most likely have bigger problems that neither ssh-faker nor shimmer will cure. Note also that the ssh-faker password is only sent once per each new IP you are using. Once an IP is inserted, you don't need to resend the password. So an adversary must be interested and sniffing exactly when you once enter your ssh-faker password. Any other time, and she is out of luck.
But your Reason 2, SSHd bugs that might be security holes, is the problem this is trying to address. Various deployed-in-the-real-world SSH implementations have had security holes, and crackers and skript kiddies do go hunting for them, and even if your implementation has been patched around the existing holes, you can still get your logfiles cluttered up with scanning events, plus crackers are always trying to scan random ports anyway.
Your Objection 2, that we also have to test this, is correct, but it's relatively simple testing on a relatively simple program that doesn't have any actual powers to grant the attacker except the ability to forward packets to 127.0.0.1:22, as opposed to sshd which lets you login to the host, potentially as root, and has lots more features and therefore lots more potential holes. If it's not buggy, it'll keep 93.3% of the crackers from bothering you once and keep 6.6% of them from bothering you for more than a minute, which makes it a lot harder for them to do successful attacks and cuts down on the junk in your sshd logfiles. (I assume it's got its own logfiles, but you're mostly not going to watch them for more than a week or two.)
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
Listen, I like the idea of default drop as much as the next guy, I use fwknop all the time, but this is ridiculously easy to lock somebody out of. all i have to do is know the ip address you are logging in from and I can send one spoofed packet every 15 minutes to keep you out, and in the meantime, I can be spoofing 16 other ip addresses to brute force your password. sure, it makes me burn up ip addresses real quick (15/16 wind up being blacklisted immediately) but after 15 minutes it's ok again, and in the meantime, you can't do anything to correct the problem. if you want to secure against brute force, use snort- not cheap tricks.
So let me get this straight. It's a dessert topping and a floor wax?
Vista:XPSP2::ME:98SE
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.
You misunderstand the purpose of port hopping. Port knocking is simply a way of telling the server to open a port and let you through. Once that port is open it could be found by port scanning and attacked just like any other static open port, for as long as you keep it open. The longer you hold the port open the less effective the port knocking is security-wise. Port hopping is adding another layer of security through obscurity by moving the open port around randomly according to an algorithm governed by a shared secret, like with one-time pad encryption. Your system always knows which port to use next as long as you stay in time sync with the server.
If a port scanner happens to stumble on the open port at some point it's much less of a problem because that service won't be on that port a minute later. Any subsequent attacks on that port will simply be discarded or logged, and the same port probably wouldn't be reused for at least several hours.
This is basically the same as digital spread spectrum frequency hopping, a technique co-invented in the 1940's by actress Hedy Lamar forty years ahead of its time and meant to increase the security of things such as war-time military communications. DSS is in common use today in cell phones and household cordless phones. With phones you only have a few different frequencies to hop through so it's normally used as less of a security feature and more to keep nearby devices from interfering with each other. With TCP/UDP ports on the other hand you've got around 65,000 to choose from. So if you do a good job blocking any IPs that attempt to run fast port scans on your network it will be almost impossible in the limited amount of time to:
- scan the entire port range on the target system,
- identify open ports,
- identify the service on that port,
- identify the operating system,
- exploit the service successfully, and finally
- successfully run the correct sequence of commands on the exploited system that would give the attacker full access to the system even after the next port hopping cycle begins.
Sure, it may still be technically possible, but it's a lot less likely when using this technique that any attack would ever succeed beyond the part where it crashes the service. You'd have to have an army of computers (at least 30,000 or so) all around the internet and somehow coordinate them all to probe the target network on non-overlapping random ports at the same time. Even doing one scan every few seconds they would probably overwhelm most connections and eventually be detected and blocked.
Another firewall system set between the server and the internet could be set up to block any statically open ports coming from the target server and even to disable any port hopping sequences that don't fit in the currently active port hopping scheme, thus disabling most backdoor exploits from being functional for more than at most 60 seconds or so. So the only attack that could possibly continue to work beyond the initial exploit of the service would be one that manages to discover the port hopping shared secret and become part of the active port hopping scheme. Basic security precautions like giving the shared secret file a random name and location and restricting its permissions should keep that from happening too easily. Every other type of attack just becomes practically impossible, despite being technically po