Slashdot Mirror


"Port Knocking" For Added Security

Jeff writes "The process of Port Knocking is a way to allow only people who know the "secret knock" access to a certain port on a system. For example, if I wanted to connect via SSH to a server, I could build a backdoor on the server that does not directly listen on port 22 (or any port for that matter) until it detects connection attempts to closed ports 1026,1027,1029,1034,1026,1044 and 1035 in that sequence within 5 seconds, then listens on port 22 for a connection within 10 seconds. The web site explains it in some detail, and there is even an experimental perl implementation of it that is available for download. I can't think of any easy ways you could get around a system using this security method - let alone even know that a system is implementing it. Another article on port knocking is here."

158 of 950 comments (clear)

  1. Well, there go the logfiles by djh101010 · · Score: 3, Insightful

    Something tells me I'm going to be seeing a lot bigger firewall logs in the future, as this catches on.

    1. Re:Well, there go the logfiles by trompete · · Score: 2, Insightful

      Good luck doing this through NAT. You'd have to configure your machines to act like a NAT device as far as refusing connections or else you could be port scanned to figure out which ports to knock on.

    2. Re:Well, there go the logfiles by mabu · · Score: 2, Interesting

      This isn't going to catch on. It's not more secure and it wastes more resources.

      Why would this be any more secure than listening on a single port for the "unique knock sequence?" Any good admin knows the most secure system is one that is listening on as few ports as possible.

    3. Re:Well, there go the logfiles by Frymaster · · Score: 2, Insightful
      It's not more secure and it wastes more resources

      i submit it could actually be less secure...

      1. dos attacks!
      2. sniff the port knocks

      yikes!

    4. Re:Well, there go the logfiles by aldousd666 · · Score: 4, Interesting

      It doesn't have to be listening on the 'knock' ports, it can be dropping the packets and either logging the drop or setting a flag via some daemon. There are a million ways to tell if someone attempted to access a closed port without having to open the port. All of this, by my calculation, makes port knocking indeed more secure.

      --
      Speak for yourself.
    5. Re:Well, there go the logfiles by RollingThunder · · Score: 5, Interesting

      Actually, an interesting potential of this is to have you "knock" at the NAT gateway. Proper knocking opens up a given service and knock ports to an internal system.

      Different knock patterns at the NAT open you to different internal hosts. Quite interesting possibilities there.

    6. Re:Well, there go the logfiles by Mod+Me+God · · Score: 5, Interesting

      That is the point.

      1. Many ports getting a sequence is much more like noise than one port getting it -> much harder to identify an attempt of intrusion.

      2. If you have a backdoor, as mentioned in the article, how will you know it has not been accessed? It was not listening, it gets activated, does its duty, deactivates. If it is a good backdoor it is invisible to that system (only visible though an additional layer).

      So it is a better way of getting a connection, but not a solve-all for the intruder, and I doubt the intruder cares about any waste of your resources.

      --
      --

      FreeNET user? Comfortable with the adverse selection?
    7. Re:Well, there go the logfiles by rgmoore · · Score: 2, Interesting

      But you're missing the point that this doesn't require any extra ports being open. The listener waits for the correct series of attempted connections to closed ports, and then transiently opens an otherwise closed port. Thus the approach lets you leave a port open temporarily when you would otherwise have to leave it open all the time, so it should add safety by your known good administration practices.

      --

      There's no point in questioning authority if you aren't going to listen to the answers.

    8. Re:Well, there go the logfiles by pegr · · Score: 4, Informative

      Any good admin knows the most secure system is one that is listening on as few ports as possible.


      Is zero secure enough for you? The ports used for knocking are not open. The knock is the connect attempt which is recorded as an event on the server. The client gets nothing, not a NAK not a reset, nothing.

    9. Re:Well, there go the logfiles by Feanturi · · Score: 2, Informative

      Did anybody read the article? No ports are open on the server until the gateway has determined that the correct sequence of blocked attempts have been made in the right amount of time. Until then, scan all you like, you will get nothing.

    10. Re:Well, there go the logfiles by jlaxson · · Score: 3, Insightful

      sniff the port knocks

      I Disagree. If someone sniffs the knocks, they still have to authenticate to whatever application gets opened up. So, for a sniffer, this may not be very effective (at the worst case, it's no different than what you had before). But for a hacker across the net who wants to get at ssh, this effectively locks them out.

      --
      On Apple Input Peripherals: They're okay, I guess, but I was really hoping for a one-key keyboard and a 109-button mouse
    11. Re:Well, there go the logfiles by Esion+Modnar · · Score: 4, Insightful
      Actually, I think this article has been one of the most "nerd-worthy" postings on Slashdot in quite a while...

      And yes, one the most annoying things about sitting behind a NAT is only being able to forward a port to a single host at a time. This would be great if "port knocking" could solve this, though in a very Rube Goldberg fashion.

      --

      They say the first thing to go is your penis. Well, it's either that or your brain. I forget which...
    12. Re:Well, there go the logfiles by diablobynight · · Score: 2, Insightful
      beautiful, now instead of a 1U router I will need a 6U router that will cost 10000$ because it needs to be able to constantly process log files for all security requests.

      Also can you imagine trouble shooting problems on this.
      oh I see the problem, your connection wasn't able to send a knock from your network on port 8019, but it was on 1223,6789,9865 oh but not 7024, oh crap you have another ap on 7024 and when you send requests, it gets bad request errors in the error logs, well lets switch that to 2345. Or other problems to be seen, also now hackers won't just port scan me, they'll port scan me a trillion times, trying to find the right combination to open my ports.

      Beautiful

      --
      Anonymous Cowards - Oh God, How I hate you
    13. Re:Well, there go the logfiles by diablobynight · · Score: 4, Interesting

      does it only open the port for that one IP somehow, using also advanced IP filtering, cause otherwise this is dumb, it would be like unlocking your door for the first customer to knock right, but having to leave it open the whole time the customer is shopping.

      --
      Anonymous Cowards - Oh God, How I hate you
    14. Re:Well, there go the logfiles by pegr · · Score: 2, Interesting

      Sadly, most people who probably think port knocking is great security probably have yet to learn how to use DSA keys.

      Think "in addition to" and not "instead of". No reason why you couldn't do both. In fact, you could rotate your port knocks to be different everytime you connect. That way, if someone does try to fake their way in, you could detect it and react.

    15. Re:Well, there go the logfiles by S.Lemmon · · Score: 5, Interesting

      That doesn't seem right. If the order of the knocks is important, how do you get around that there's never a guarantee in what order network packets arrive? If no packets are sent back at all, how do you know when to send the next knock or even if the knock made it to the server?

    16. Re:Well, there go the logfiles by 3.1415926535 · · Score: 4, Insightful

      How about, "Yeah, NAT breaks stuff, let's fix it" instead?

    17. Re:Well, there go the logfiles by Smidge204 · · Score: 4, Insightful

      Or other problems to be seen, also now hackers won't just port scan me, they'll port scan me a trillion times, trying to find the right combination to open my ports.

      And what stops them from brute-forcing regular password protected access on a known port?

      1) You don't know how many ports are in the knock sequence
      2) You don't know that the range is
      3) You don't know what port will open when you get it right

      Similar to a password, only instead of base 94 (a-z,A-Z,0-9`~-_=+\][|}{';":/.,?>million trillion trillion trials to crack. Then you have to do one more scan to figure out which port actually opened after each trial and hope no other service opened a port for some unrelated reason.

      I'm thinking it's a tad more secure than password authentication alone... and you can always throw password auth in after the client connects, so you can throw in a few false-positives (bogus logins) to keep them busy.

      And a five second window to transmit the sequence is pretty generous. If you wanted to harden it even more against brute forcing, you could require a full 5 second wait and accept all connection attempts from a particular host. That would limit an attacker to 20 attempts per minute max. So it'll take the better part of 32 billion trillion years to crack it.

      At that point, you can consider the end of the universe as "The ultimate connection timeout"
      =Smidge=

    18. Re:Well, there go the logfiles by Penguinshit · · Score: 2, Interesting


      An additional step here would be to have both machines (server, client) seeded with the same randomly-generated number and then, utilizing the same algorithm, generate a random port sequence for knocking. This sequence would be valid for 10 to 30 seconds, at which point the sequence for proper knocking is re-generated.

      I'm guessing this would need to be tied to Time of Day, necessitating accurate time; so either an external GPS device or an NTP connection would be required.

      This is just some off-the-cuff speculation, so don't flame me for the holes.

    19. Re:Well, there go the logfiles by infochuck · · Score: 2, Informative

      does it only open the port for that one IP somehow, using also advanced IP filtering, cause otherwise this is dumb, it would be like unlocking your door for the first customer to knock right, but having to leave it open the whole time the customer is shopping.

      You're not quite right here - all knocking in the correct sequence does is make the specified port AVAILABLE - nowhere was it stated that port would 'just start working'. In the example given, using ssh, a correct ssh login/password pair would ALSO need to be provided - so to correct your metephor, the door is still locked - it's just not camoflauged anymore - now everybody can see the door is there - though they still need a key.

      To correcct my own metaphor - the door, furthermore, according to the example, would only be visible for, say, 10 seconds - at which point it's cloaking device turns on again, waiting to present the keyhole to the first correct secret knock.

    20. Re:Well, there go the logfiles by gnu-generation-one · · Score: 3, Insightful

      "I dind't say it wouldn't be secure, I said it would be irritating for me as the admin, when people tried to crack it."

      It should give you less irritation as an admin, when portscans reveal that every port on your computer is closed, and they go find another target, wondering why you bothered buying a firewall if you seemingly haven't configured it to accept connections.

      A recent nanog (was it nanog?) flamewar mentioned that people ran their servers on non-standard ports and they considered it really secure. Why? Because the viruses only scan one port, and choosing a different one gives you a lot of time to take stock when a vulnerability/virus pair is announced.

      It's obscurity (as a first layer of defence), but it means that an "nmap * -p 22" won't find your server, and anyone running the full scan of 64K ports over the internet is making themselves a lot more visible, and a lot slower.

    21. Re:Well, there go the logfiles by dossen · · Score: 2, Insightful

      One could implement it in such a way that the validity of the keys overlap. Then one could read the key, perhaps even keeping it "locked" on the device for the time it takes to enter it, and then be sure that it is still valid (unless you take a very long time entering it). There would need to ba an overlap in any case, since the network transmission could cause the key to be too old by the time it got to the server.
      But if it is implemented in some soft-/hardware combination, then those timing issues are much smaller. But then why not just use a big-ass public key-pair.

    22. Re:Well, there go the logfiles by infochuck · · Score: 2, Informative

      how does it make the port appear closed after ten seconds, communication is still traversing that port if you open an SSH session you ussually continue to use it for a while don't you?

      Also, how could I be right or wrong, I asked a question. Also you didn't answer if it had a way of allowing that port to be open for just the IP using it, otherwise the port would have to appear open, because it is open.


      A) RTFA - the port doesn't just always close after 10 seconds - it listens for a connection for 10 seconds. It none is made (ie, successful login), the port closes up all hidden again.

      B) You claim, back to back, that (1) you didn't ask a question, and (2) I didn't answer your question. Which is it? It can't be both.

      I'll answer - of course you can specify only the IP that knocked correctly can get in. With linux, your imagination is about the only limit. Are you sure you're in the right place?

      And, again, just because a port is 'open', doesn't mean anyone can just waltz in - that depends entirely on the service running BEHIND the port - in the case of SSH, yes, the port will let you 'get in', but without entering the correct username and password, it kicks you right back out.

    23. Re:Well, there go the logfiles by WNight · · Score: 4, Interesting

      You can also open up inbound ports from specific external IP addresses only, and do many at once. So ten inbound connections can reach ten different internal webservers, and at the next request, reach the same one again.

      This can be done dynamically as a form of load balancing which is a neat hack. Expire the specific forward rule after 30s or something. Means similar requests cluster - less DB traffic.

      But, combine this with knocking and you've got the next step. Secret services on a 'stealthed' IP, where you can request which quake server (for instance) by knocking in a different way.

      Port scanning isn't what it once was. Especially once you factor in time-sensitive keys (easily doable - both machines need a net connect to reach each other, ntp is then trivial) and ID-sensitive keys (so my key isn't like yours, even at the same time). Even if you managed to snoop on a 'knock' you couldn't repeat it.

    24. Re:Well, there go the logfiles by smeenz · · Score: 5, Informative
      When a port is 'open', that means there's a process listening for connections on that port

      When a process is listening for new connections, it doesn't block existing connections from carrying on sending and receving data

      When a port is 'connected', it means that a process has an established connection to another host.

      Therefore, no, just because a port is not listening/open, doesn't prevent an existing connection from sending and receiving data.

      If that was the case, then the first person to telnet/ssh to your box would tie up that port and a second connection would be blocked until the first had freed up the port, however that is not what happens at all.

      All they're saying is that when the portknocking daemon detected the correct knock sequence on closed ports, it starts a process to LISTEN for new connections, ideally from just the host that did the knocking, for a limited period of time (10 seconds). Once a TCP connection is established with the listening host, that host no longer needs to listen, and that's why it stops after 10 seconds.

    25. Re:Well, there go the logfiles by Billly+Gates · · Score: 2, Interesting

      I suppose a way around this would be to have an old 486 running BSD or Linux act as a first layer firewall and knocking device between your nat/router and ISP. You could just keep open port 22 on your nat/router and have the BSD box decide based on knocks which client to forward the packets the packets too.

      Another method I would like is some sort of handshake authentication where the firewall would reconigze who you were after logging in and would open ports up appropriately depending on your private key. I think MS proxy server does this with NTLM authentication but I am not too sure. There is IPSEC but this does not work over the internet or many campus wide networks if your at a unviversity.

      A unix equilivant would be nice with Kerbos, LPAD or Samba support.

      Having a dual firewall this way is rudant but it would work since I use my nat/router more as a hub then just a firewall.

    26. Re:Well, there go the logfiles by Christopher+Whitt · · Score: 2, Insightful

      If you're going to go so far as to require a one-use pad, then you can forget about the whole "port knocking" concept

      I understand your point, but if I understand port-knocking correctly, it will allow you to effectively cloak the existence of a service entirely. Even if you use a 1-time pad authentication scheme, Mr. Evil Cracker can still connect to your server and see that a service is running. Perhaps it is a commonly used service, and a known exploit exists that bypasses the authentication mechanism. Unlikely, I know, but with port-knocking, connection attempts to your server are simply dropped on the floor, until the correct sequence of connection attempts is received.

      Unless Mr. Evil Cracker is sitting somewhere in the middle to sniff a valid connect attempt, he will never even know the service exists.

    27. Re:Well, there go the logfiles by Anonymous Coward · · Score: 2, Informative

      Exactly.

      The idea that a port wouldn't respond until the proper knock had been received might be a good one. But there's no reason to overload the port setting in the TCP header to do this. Include the knock values in the payload of the packets that are sent prior to the server sending back an ACK. It'd be just as secure as this setup (i.e. still vulnerable to sniffing.)

    28. Re:Well, there go the logfiles by Anonymous Coward · · Score: 2, Funny
      which do you think you're more likely to hit on the first try?

      YOUR FACE

  2. not bad by maelstrom · · Score: 5, Insightful

    But it does seem like a layer of obscurity to what should otherwise be a secure port. What if someone is sniffing your network? Unlike an encrypted password, they could easily replay this sequence and gain access to your "hidden" port.

    --
    The more you know, the less you understand.
    1. Re:not bad by Kenja · · Score: 5, Interesting
      "But it does seem like a layer of obscurity to what should otherwise be a secure port. What if someone is sniffing your network? Unlike an encrypted password, they could easily replay this sequence and gain access to your "hidden" port."

      And? It is still more secure. By using "port knocking" they HAVE to sniff out your network traffic and find the port combo. Without "port knocking" they just need to run nmap and see what ports they can try to attack.

      --

      "Have you ever thought about just turning off the TV, sitting down with your kids, and hitting them?"
    2. Re:not bad by LostCluster · · Score: 5, Interesting

      Think of it this way... it's an extra password combined with bonus security-by-obscurity of not having a visible password prompt.

      The "knocking ports" could also be configured that if there are random hits to the standard port without the proper knock, the system could lock down for 30 seconds and even ignore the proper knock so that if somebody's trying to brute force all the possible knocks, they'll never get feedback when they have the right one.

      Yeah, this is no substitute for properly securing the original service, but it's an extra layer that means there's even more that needs to be captured for a successful hack...

    3. Re:not bad by RealityMogul · · Score: 2, Informative

      Of course you could also have a new combination generated every minute for the super paranoid.

      But I don't think the intent is to prevent people sofisticated enough to actually sniff packets from being able to enter the network, but simply stop script kiddies and worms that are rather mindless in their attacks. I am not aware of any worms that would be able to sniff packets and actually interpret what is happening.

    4. Re:not bad by 26199 · · Score: 5, Interesting

      Hmm, lots of people have pointed this out, but it's easy to set up a system of one-time passwords... provided it's done in a cryptographically secure way, there's little point in sniffing for combinations.

      Of course, you can still sniff to see what ports are actually in use...

    5. Re:not bad by mugnyte · · Score: 2, Informative

      No, not really. If the pattern changed each time, or access-counts, no two sequences would be the same. Add in a larger set of sequences, with some salt, and you get something analogous to encryption, it seems.

    6. Re:not bad by orthogonal · · Score: 2, Interesting

      Of course you could also have a new combination generated every minute for the super paranoid.

      No, if you were "super paranoid" you'd have two identical one-time pads, one residing on the computer to be accessed, one in the hands of a single person trying to connect.

      Every minute, the computer would consult its copy of the pad to determine what that minute's secret knock sequence would be.

      The person connecting would look up in his copy of the pad that minute's sequence. You'd need to synchronize both participants' clocks, of course.

      Less secure would be generating a new combination -- using some continuous function -- every minute.

      Less secure than the pad, but more secure than a continuous function, would be a cellular automaton -- life Conway's Game of Life -- where any particular minute's knock sequence could only determined by first determining the previous minute's sequence.

      Of course, to prevent the rules from being extrapolated by anyone analyzing your traffic, you'd have to agree on a new function or automaton to use for the next connection before ending the current connection. To guard against interruption of the connection, agreeing on the next connection's function would be the first thing you'd do after making a connection, and to guard against that being interrupted you'd need some fallback combinations -- which brings us back to the one-time pad.

    7. Re:not bad by ComputerSlicer23 · · Score: 4, Informative
      But it's not as secure as not running SSH.

      Hence, weather or not it is secure, is all a matter of opinion. Personally, I think if you can't run SSH out in the open, you shouldn't run it thru an obscurity filter.

      We have no SSH configured on our outside network. Not with OTP, not from only allowed IP's. Not from only a specific port. Not with KnownHosts only. Not with known RSA keys only.

      You want on, you've gotta be in the building. It'd be nice to fix problems while remote, but it's just not an option because of the security problems it presents. I live within a mile of the building, specifically so not having remote access isn't a big deal. I can go from sleeping in bed, to in the building in less then 10 minutes. It's a pain for small problems. However, it's small issue in comparison to dealing with a full blown network breakin due to SSH.

      On occasion, I believe we have had someone local build an SSH tunnel that we can VPN thru onto our network. However, someone who already had access had to initiate the connection by hand with the correct IP. That's only allowed if we voice authenticate from you.

      Kirby

    8. Re:not bad by tommck · · Score: 2, Funny

      Rather than sniffing her network and replaying sequences, why not just buy her dinner to gain access to her "hidden port"?

      --
      ---- It puts the lotion on its skin or else it gets the hose again. It does this whenever it's told.
    9. Re:not bad by kburkhardt · · Score: 2

      I don't buy it. "Port knocking" feels like more administrative overhead for not much gain.

      a)It causes me to have to remember, code, and administrate another password, which by the way, is common to all users
      b)It is trivial to sniff out anywhere between client and server

      It's akin to hiding your door key under a rock - it's secure until the first time someone sees you retrieving it and opening your door with it.

    10. Re:not bad by Jerf · · Score: 5, Interesting

      ignore the proper knock so that if somebody's trying to brute force all the possible knocks, they'll never get feedback when they have the right one.

      Re "brute forcing"... the number of possible knocks is (ports used for knocking) ** (ports in knock sequence). Yes, that's exponentiation.

      In fact, I'd suggest making the knock sequence much longer then in the article; ten might be good. Then, if you allocate 100 ports to the knocked and randomly select a 10 port sequence for the knocking, you get 100 ** 10 possible knocks, or 100,000,000,000,000,000,000 (100 sextillion) possible knocks.

      With just a few more ports in the sequence and just a modest investment in ports, you can make brute forcing impossible.

      (And if you mix up the ports so they aren't sequential and the attacker has to guess THOSE ports, it goes to approx. (2**16)**(number of knock), so for a 10-port sequence on potentially all TCP ports it's 1,461,501,637,330,902,918,203,684,832,716,283,019, 655,932,542,976 possible knocks, a.k.a. "way the hell more then can be brute-forced".

      (I love posting big numbers on Slashdot.)

      You need to worry about sniffers way more then brute forcers. (And as this is another layer of security, hopefully on top of an already fairly secure protocol like SSH, it's a good thing; now the 'man in the middle' has to have advanced knowlege to even know there's something to get into the middle of!)

    11. Re:not bad by pantycrickets · · Score: 2, Interesting

      It isn't more secure. It's just more obfuscated, because it's more complex. But that doesn't make it more secure, it makes it potentially _less_ secure.

      I think the idea is that an attacker would install a hidden sshd on your system, and you wouldn't know. You wouldn't even see an open port. You wouldn't see concentrations of connections to one "closed" port, but sporatic attempts at a few seemingly random ports. The attacker would use this as a backdoor into your system. I think you got the wrong impression that this would be a keen tool for system administrators for some reason. I didn't RTFA, but jeez.. at least read the summary.

    12. Re:not bad by Roofus · · Score: 3, Interesting

      It's like saying that if sshd asked consecutively for two passwords before granting access, that would be more secure.

      In a way it does. It firsts asks for a username, and then a password. If one of them is incorrect, you don't get access. But SSH doesn't tell you which one was incorrect.

      Port knocking is very similar (but not exactly the same). You need to have both keys (port combination) and login info in order to get access.

      The difference is, without the port combinations, you can't tell if the service is up, or your port combination is wrong.

    13. Re:not bad by jrexilius · · Score: 2, Insightful

      well, he worded his point badly but I agree with no service is more secure than protected service. His scenario works for him but not for all of us.

      I will have servers in datacenters spread around the US and possibly overseas. His solution wont work for me. So cost/benefit/risk compromises come in to play, which is where extra layers comes in.

    14. Re:not bad by LostCluster · · Score: 2, Insightful

      I'm in the camp that all security methods are, at their core, security by obscurity. You're only as safe as your code and key are secret... once that's compromised by either guess and check or outright leak, you're not secure anymore.

    15. Re:not bad by platypus · · Score: 4, Insightful

      Ok, let me rephrase what I wrote in another message.

      Open ports per se are not insecure!

      The whole point behind port knocking is the wrong impression that "open" ports are more insecure than "closed" ports. This is totally bogus.
      It's about the applications behind the open ports, and it's not more complicated to write code which listens to a specific port and drops the connection if it doesn't recieve some secret number as the only payload of the first packet, than it is to write the kernel tcp/ip stack.

      That brings me to another mantra

      Kernel code is not intrinsically more secure than application level code!.

      There are many examples for buggy and overflowing tcp/ip stacks (ping-o-death comes to mind if you're somewhat older).

    16. Re:not bad by C10H14N2 · · Score: 2, Funny

      Great. Just what you want to do is hard-code a quicker way to DoS you system.

      TERRIFIC.

      This will be used only on systems storing highly sensitive Star Trek Fan-fiction.

    17. Re:not bad by jmv · · Score: 2, Insightful

      Note sure I like the idea, but I think it would really be more secure in one case: worms. That's because they can't really sniff the knocking, unlike a real intruder.

    18. Re:not bad by _bug_ · · Score: 2, Insightful

      Of course, you can still sniff to see what ports are actually in use...

      Bingo!

      With a knocking daemon a port scanner is going to see an IP address with no machine on the other end because no response is sent to its connection attempts. It's a great way to conceal the location of a server from broad port-scanning that you currently see on the internet.

    19. Re:not bad by h4x0r-3l337 · · Score: 5, Insightful
      The whole point behind port knocking is the wrong impression that "open" ports are more insecure than "closed" ports. This is totally bogus.

      No it isn't. A closed port does not accept any data, therefore you cannot attack the application "behind it". A port that is open is only as secure as the application listening on that port, which AT BEST is as secure as a closed port, assuming the listening service is absolutely perfect, and has no flaws whatsoever.

      There does seem to be some confusion as to what it means for a port to be "closed", judging from most of the posts I've seen so far. You can close a port, but send "connection denied" replies to anyone trying to connect. This makes the port itself safe, but tells the attacker that there is in fact a machine there on the network (which could be a reason for an attacker to continue to probe and/or attack you in other ways). You can also close the port by not responding to anything directed at it at all. If *all* of your ports are like this, an attacker won't even know if your machine is turned on or off, or if there's even a machine there at all. In a way, you've become invisible. Ideally, that's what you want. Port knocking is simply a way to allow your machine to be invisible while still being able to initiate connections to it from arbitrary IPs.

    20. Re:not bad by Anonymous Coward · · Score: 4, Informative

      It is a common misconception that an attacker can't tell a system which doesn't send reject packets from a system which is disconnected/off. This is not true. The difference lies in the reply from the next hop router. An existing system will not cause a response from the router, but you will get a "Destination unreachable" ICMP packet from said router if the target system is offline. This is because the router times out the target system's ARP entry and then, when the router needs to reach it, can't find the target if it is actually offline. A connected system cannot not answer arp requests (or it doesn't get its packets), so the router always knows where to send the packets and doesn't return "destination unreachable".

    21. Re:not bad by pclminion · · Score: 5, Funny
      In a way it does. It firsts asks for a username, and then a password. If one of them is incorrect, you don't get access. But SSH doesn't tell you which one was incorrect.

      This reminds me of a cgi driven website I visited a loooong time ago (1996?)

      I was creating a user account, and was using the password "beelzebub". However, the system refused to let me create the account. It displayed a page which stated "That password is invalid: It is being used by another user. Please select a unique password."

      Apparently, some genius thought it was good security to ensure that no two users had the same password. I hope you can see the intrinsic flaw in this :-)

    22. Re:not bad by poot_rootbeer · · Score: 3, Insightful

      In fact, I'd suggest making the knock sequence much longer then in the article; ten might be good. Then, if you allocate 100 ports to the knocked and randomly select a 10 port sequence for the knocking, you get 100 ** 10 possible knocks, or 100,000,000,000,000,000,000 (100 sextillion) possible knocks.

      And this number is only relevant if the attempted cracker knows your knock sequence is exactly 10 ports long. Add or subtract a couple steps from the sequence, and the number of possibilities increases factorially.

    23. Re:not bad by kir · · Score: 2, Insightful

      You've got to be kidding. Right?

      You do not allow SSH connectivity for remote administration even from a few identified hosts (even to only a single host in a dmz with non-port forwarding connectivity in to the rest of the network)? Why? Do you also not allow email in to your network? Do you not allow your users to browse the web (particularly with IE)?

      If you're not doing the other things I mentioned, then you're niave. If you are... ummmm...

      --
      3cx.org - A truly bad website.
  3. Invasive Security by Anonymous Coward · · Score: 2, Interesting

    This is secure in the same way 50-character passphrases are secure, sure they are harder to crack but who the hell is goig to remember them. The harder you make something to use, users will start trying to find ways around it.

    whats more, connection attempts are easy to sniff, you might as well be using telnet...THIS THING IS BEGGING FOR A "REPLAY ATTACK".

    1. Re:Invasive Security by Catskul · · Score: 3, Informative

      Also, its not used for the only password. It is added security. Only people who can intercept packets for the host can replay the sequence. This prevents whole sale port scanning being productive.

      --

      Im not here now... Im out KILLING pepperoni
  4. My idea by Catskul · · Score: 4, Interesting

    I though about this along time ago as a way of hiding a trojan. Of course I didnt patent it so no money for me : /

    --

    Im not here now... Im out KILLING pepperoni
  5. Sniffing by Anonymous Coward · · Score: 2, Insightful

    This security is easily defeated if the connection can be sniffed to find the 'secret handshake'.

  6. huff and puff by tombou · · Score: 2, Funny

    little pig little pig...

    let me in

  7. Beavis? by tommck · · Score: 2, Funny

    Am I the only one who heard Beavis say "Port Knocker!"?

    Probably...

    --
    ---- It puts the lotion on its skin or else it gets the hose again. It does this whenever it's told.
  8. Easy enough... by wishus · · Score: 4, Insightful

    I can't think of any easy ways you could get around a system using this security method - let alone even know that a system is implimenting it.

    Sniffing.

    1. Re:Easy enough... by Patrik_AKA_RedX · · Score: 2, Funny
      If you had access to the machine it was running on, then why would you even care about getting access anymore?
      Well, If you happen to be a trojan, you could log all those secret knocks and do trojan horse stuff with it.
  9. Worse? by glpierce · · Score: 4, Interesting

    Right now, script kiddies have their computers automatically try to access other peoples' computers, looking for ones without firewalls, etc.. If this happens, wouldn't you expect them to just send out random knocks in the hopes of getting something? If that happens, you will be more secure personally, but the increased traffic may cause more problems that it solves.

    --
    G
  10. Knock knock... who's there? by bc90021 · · Score: 4, Funny

    Knock knock...

    Who's there?

    Usher.

    Usher who?

    Usher wish I could SSH to your server!

    Sorry... ;)

  11. One-time port knocking? by sleepingsquirrel · · Score: 2, Interesting

    Interesting. So the next step would be to have one-time port knock sequences a-la one-time passwords (to defeat adversaries who are grabbing a copy of all your packets). But it seems like there is a race condition between the delay after the knock and the actual connection. Anyone have a solution to this?

    1. Re:One-time port knocking? by v_1_r_u_5 · · Score: 2, Interesting

      After the knock has been verified, open the desired port for a brief time, but only accept incoming connections to that port from the verified IP address. There's still a slight race condition, but at least 99.99999% of the internet is now ineligible to get access.

    2. Re:One-time port knocking? by sleepingsquirrel · · Score: 2, Informative
      One time key protocols require that the second party communicate a sequence number or nonce or the like to the first party
      That's why you'd use something like this.
  12. Before you complain about "Obscurity" by pclminion · · Score: 5, Insightful
    This adds a layer of obscurity to a security policy. It can't substitute for security, but it certainly can help.

    An analogy would be a military base with a ten-foot-thick steel blast door. This is like having a door that teleports around at random, which can only be frozen in one spot by speaking some magic word. Even if you know the word, you still don't have the key to the door. But if you do have the key, you still can't get in without the magic word because the door keeps teleporting around.

    Obscurity is great, if it is part of a layered security policy which is ultimately based on strong cryptography. This is a really cool idea!

    1. Re:Before you complain about "Obscurity" by skiflyer · · Score: 3, Funny

      It's called a secret knock and that's the best analogy you could come up with? Perhaps it's more like a ten-foot-thick steel blast door, but you can't even see the keyhole unless you knock on it just the right way?

  13. Old stuff by Britz · · Score: 5, Funny

    That is a very old method i developed with my friends. We would only open the door after a "secret" knock sequence. We had seen this on TV and thought this would be cool. We jeopardized the security regularly when we said "wrong knock" after someone else knocked. Usually parents. Then they would say "open up". And we had to comply.

  14. Equivalent to a password by crow · · Score: 3, Interesting

    I was thinking about implementing this a while ago; I guess it's an obvious enough idea that others have been thinking along the same lines. This is equivalent to to putting a password on access to the port.

    Ideally, the implementation will only consider connection attempts originating from the same IP address.

    1. Re:Equivalent to a password by pla · · Score: 4, Interesting

      This is equivalent to to putting a password on access to the port.

      This seems much better than a password, I would think (Though I certainly would still use a password as well).

      As an analogy, if you want to get into a house, and find a locked door, you have a few options... You can try one of those M x N position key blanks, which will take a very very long time (exhaustive search). You can try to pick it (exploit a weakness in the password algorithm). You can try to get ahold of a copy of the real key (packet sniffing, "shoulder surfing", etc). But you have no doubt that somewhere, a key exists that will open that door.

      Now compare that to a solid block of concrete, roughly the size of a house. What does it do? Do helicopters land on it? Does it cover something, or hold something down? Does it have something sealed inside it? You'd never suspect that that, if you utter the magic phrase "Sim sala bim bamba sala do saladim", a door will appear in the side of this large concrete block, allowing those with a key to gain entrance.

      The main difference involves knowing whether or not a way in exists. With just a passworded port, an attacker knows that enough effort will pay off. Adding in port knocking, that attacker doesn't know whether or not their hard work can ever gain them entrance, since a port might well not exist.


      Now, in my opinion, the more interesting question here involves how to hide this from one's ISP (ie, make it snoop-proof).

    2. Re:Equivalent to a password by scrytch · · Score: 2, Insightful

      Those are reasonably good descriptions, but you don't need port knocking for this. Just stuff the key in the SYN packet. Don't accept if it doesn't have the magic word. Same effect, no magic cookie, no open port. This only yields to latency analysis, which isn't reliable over anything but a local LAN.

      The only advantage of portknocking is that it's a hack that's doable in userspace without a modified net stack (you may be able to fashion raw packets, but good luck reading them). But enabling the userspace hack would mean poking so many holes in your firewall that you'd degrade the security of the system that you're trying to lock down with this hack.

      I'd file it under "another cute perl hack".

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
  15. I see an easy way by Apreche · · Score: 4, Insightful

    There is an easy way around it. The problem is you will make yourself very obvious. Simply pick a time at which the server in question is in high use. Hammer the port. Eventually someone will knock on the door opening it for 10 seconds and you put your foot in the door before they do. The other way is if you can get a packet sniffer simply look at the packets that came before and determine the secret knock.

    This is still an interesting idea and definitely has at least a few places in which it would be an effective authentication mechanism.

    --
    The GeekNights podcast is going strong. Listen!
    1. Re:I see an easy way by Anomander · · Score: 3, Informative

      Any heavily accessed server would have to keep track of source IP. If the knock is abandoned by accessing the wrong port nobody would be allowed to enter as a new knock would start before the previous was finished.

      And if you track the source IP it is trivial to only allow connections from that IP to the server.

    2. Re:I see an easy way by ballwall · · Score: 3, Informative

      Unless the port was only open to the source that successfully knocked.

      And the packet sniffer wouldn't be required at all if the port was just open to everyone all the time.

  16. Slashdotted? by Fulkkari · · Score: 5, Funny

    Is the site slashdotted...

    ...or do I have to knock my way in?

    --
    I demand the Cone of Silence!
  17. Re:Password by 26199 · · Score: 4, Insightful

    Except it hides that the port is open at all, which is useful.

  18. Silent Bob by Sanity · · Score: 5, Informative
    A few years ago Freenet implemented something similar to this called "Silent Bob". The name comes from Alice and Bob, the names given to sender and receiver respectively when describing cryptographic protocols.

    The idea was that you didn't want to disclose that you were running a Freenet node unless the person connecting to you already knew your node's public key.

    So when someone wants to establish a connection to you, they must send some encrypted data providing they know your public key. Your node can receive this data and only respond if it is correct. Furthermore, you could let your Freenet node sit on port 25, for example, and forward invalid connection attempts to a mail server on a different port.

    Through this mechanism, your Freenet node could quite effectively hide behind another server, only making itself known to those already part of the Freenet network.

    IIRC this wasn't actually implemented in Freenet, but it is the intention to add it at some point. Still, it is amazing how many ideas were pioneered by Freenet years ago and are only showing up in the wider public conciousness now.

    1. Re:Silent Bob by Abcd1234 · · Score: 2, Insightful

      Err, they were *in* Chasing Amy? Heck, the name "Chasing Amy" comes from a speech Silent Bob gave in the movie regarding some chick he always regretted never going after. A speech which is, incidentally, referenced later in J&SBSB... specifically, after their monkey got kidnapped by the Hollywood Animals people, Silent Bob attempted to tell Jay that their license plate said "Hollywood" on it. So, Bob started miming, and predictably, Jay simply would not clue in. Anyway, at one point Jay said something to the effect "you can tell that damn Amy story all the time, but you can't talk now?".

  19. Re:Oh, really. by Anonymous Coward · · Score: 2, Interesting

    I predict a flood of commenters whining about this being "security through obscurity."

    Yeah, just like passwords are "security through obscurity."

    This is essentially another level of passwords, but sounds useful for hiding those services that could have vulnerabilities *cough* OpenSSH *cough*.

    Will this technique itself have possible vulnerabilities?

  20. NOT security through obscurity by 3Suns · · Score: 5, Interesting

    It should be noted that this is NOT (necessarily) an example of security through obscurity. One could treat the port-knocking sequence as a "key". Long enough keys could make port-scanning impossible for anyone who doesn't know the key. Real mathematical cryptography is based on a similar principle.

    Also, this is only a defense against port-scanning. Even if someone did manage to break the knocking sequence, they would still have to use some kind of exploit against the machine on the port they discovered.

    --

    -3Suns

    ~~~~
    The Revolution will be Slashdotted
  21. Old Idea, Different Use by jsonic · · Score: 5, Informative

    The shady side of hackerdom has been using this very technique to hide their backdoors from port scanning admins. Or, uh, so I've heard...

  22. Not good by glpierce · · Score: 5, Insightful

    "The "knocking ports" could also be configured that if there are random hits to the standard port without the proper knock, the system could lock down for 30 seconds and even ignore the proper knock so that if somebody's trying to brute force all the possible knocks, they'll never get feedback when they have the right one."

    That would just create a new variant to DOS attacks. Instead of taking you offline, they just persistantly knock on random ports, thereby disabling your ability to communicate with trusted sources.

    --
    G
    1. Re:Not good by theLOUDroom · · Score: 4, Informative

      Host 'a' (the server, 192.168.0.1) requires the correct knocking combination to allow access. Host 'b' (random knocker, 192.168.0.2) knocks on random ports attempting to cause a DoS. Host 'a' detects the wrong ports being knocked on and does not grant access from host b Host 'c' (geniune client, 192.168.0.3) knocks on the correct ports, host 'a' allows access from host c (192.168.0.3/32). Host 'b' can continue knocking on random ports, but at the same time, host 'a' does not grant access from the misbehaving host b, but it doesn't have to revoke access from host c either.

      So how does this cause a DoS?


      The ports being knocked are closed. This means that the server can never veify the the knocks coming from 192.168.0.3 are really coming from there, or if they're coming from 192.168.0.2.

      If the server is .1, I'm .2 and you're .3, I just keep knocking ports at random spoofing my ip to say that I'm .3 You can't IP block me, and my knocks look just like your knocks. This keeps screwing up your login and you can never open the connection.

      --
      Life is too short to proofread.
  23. Possible problems by Mr.+McGibby · · Score: 4, Interesting

    What if multiple attempts from the same IP are made to access the port at the same time? Wouldn't the knocks get all mixed up?

    --
    Mad Software: Rantings on Developing So
    1. Re:Possible problems by Mr.+McGibby · · Score: 2, Interesting

      RTFC. That's what I asked. What they *are* from the same IP.

      --
      Mad Software: Rantings on Developing So
  24. Great for SSH by zulux · · Score: 2, Interesting



    OpenSSH is a great peice of sodtware - but it's so huge that I can't help but think that their could be flaws in it (like the one of 6 months ago)

    I would love to layer another peice of security infront of OpenSSH and this seems like a great idea.

    --

    Moneyed corporations, non-working 'poor' and criminal prisoners are turning productive citizens into tax-slaves.

  25. Reverse-knock by Seft · · Score: 5, Interesting

    Has anyone implemented a system where a service would be stopped if the ports next to it were scanned? i.e. if 1024, 1025, 1026, 1027 were scanned, a service running on 1028 would stop.

    1. Re:Reverse-knock by dk.r*nger · · Score: 2, Interesting

      That's easy.. hit three unassigned ports, and you buy your IP-adress a nice firewall rule for an hour or so...

      Your legit users (' software, anyway) usually knows how to connect to the real port first time.

    2. Re: Reverse-knock by rk · · Score: 2, Interesting

      Not at all, and it's not a half-bad idea, but it's also not what the other poster was saying. He was talking about temporarily shutting down a service, which I interpret differently than firewalling a single IP out.

      What I used is really just a variant of your idea, just taken to paranoid extremes. Instead of blocking just port 80, I blocked all of them. Instead of temporarily, it was essentially permanent, except that I was too lazy to work up a "save the updated rules automatically" script, so when I rebooted, those IPs could play again. Since that system had an average uptime of months, those IPs were effectively banned for quite some time.

  26. Implementations? by crow · · Score: 2, Interesting

    Could this be implemented with IP Tables under Linux? I remember seeing a set of rules to detect a port scan; could a similar set of rules be used to unlock a port for a given remote IP number?

    Of course, this won't take off unless there's also knocking support built into the clients (like ssh).

  27. Security through obscurity by Dominic_Mazzoni · · Score: 5, Insightful

    As everyone else is saying, this is just security by obscurity. That doesn't mean that you shouldn't use it, because it probably would help a lot in keeping out script kiddies and casual hackers. But the flip side, as always, is that you're giving yourself and your users a false sense of security when you pretend that measures like this will actually prevent motivated hackers from getting past it.

    The most obvious way to break into a system like this is to compromise a nearby machine first and install a packet sniffer. Once you can see the traffic to the host running this port knocking system, it would be easy to discover the pattern. In fact, port knocking is less secure than a lot of other nonstandard authentication mechanisms because you could figure out the secret simply by looking at packet headers (since they contain the port numbers).

    The other problem I see with this system is that it requires users to either memorize the secret knock, or use a program that automatically knocks for them. Since most people have a hard time even remembering all of their usernames and passwords, you'd see a lot of people writing down the knock, sending it via email, or writing scripts to knock for them. Dozens of opportunities to a hacker, especially one skilled in social engineering, to figure out the knock.

    1. Re:Security through obscurity by radish · · Score: 2, Insightful

      Sure, it's breakable. But once they have broken the knock, they still have to get past the regular, strong, security. It's a layer of obscurity, but it is on top of the existing stuff - whatever happens you will remain at least as secure as you were before.

      The vast majority of s'kiddies will just scan 22, see there's nothing there, and move on to the next host. There will _always_ be far easier targets for them to attack. Why waste their time trying to guess my knock?

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

    2. Re:Security through obscurity by HeelToe · · Score: 2, Interesting

      But if your knock sequence was generated similar to a one time password, the knock sequence would be unique each time and not replayable.

    3. Re:Security through obscurity by prisonercx · · Score: 2, Insightful
      All of your objections have been dealt with in one way or another.

      1) ...compromise a nearby machine first and install a packet sniffer...
      Use a one-time pad system, as mentioned above.

      2) ...you'd see a lot of people writing down the knock...
      If you'd read the Linux Journal article, they address that by saying the program that executes the knock needs to be very secure. Say, like the USB key they mention.

      This isn't a great system for continued, heavy use as this guy pointed out, but it could be used for emergency purposes. For example, if you had to remotely administer a server. You have an emergency USB key that you plug in your local machine, knock, then gain remote access with the opened port (using whatever authentication you would have if the port was simply open).

      I think, at very least, the concept needs to be thoroughly debated and vetted. (Maybe that's what we're doing here, or maybe we're just wanking ;)

      PrisonerCX

    4. Re:Security through obscurity by teeker · · Score: 2, Insightful

      But the flip side, as always, is that you're giving yourself and your users a false sense of security when you pretend that measures like this will actually prevent motivated hackers from getting past it.

      If any admin ever feels secure, they have other problems. Any admin worth their salt is always paranoid.

      The whole point of it is to make things a little more obfustacated. If a cracker already knows you're running a service they are interested in exploiting, you are already at risk anyhow. If somebody with some real skills was taking a shot at compromising your network, then this will not stop them, but it is a little smarter than inviting every script kiddie with a port scanner and their dog to smash at your SSH port.

      It is a reasonable addition to a balanced security breakfast.

      --
      teeker
  28. rotate the knock by CSIP · · Score: 2, Interesting

    one could also change the sequence of ports that are used to be based on some key/progression/timestamp? so the knock is constantly changing... so even if someone sniffs the knock, it wont help.

    --
    "Nyquil - The stuffy, sneezy, why-the-hell-is-the-room-spinning medicine."
  29. Not the point by s20451 · · Score: 4, Insightful

    come on kids. Have we not learned our lessons? Even as a one time pad, this is lame

    You are very much missing the point. Yes, security through obscurity is terrible when it is the only security method you use. However, it can be used to augment a better security system. Even if somebody figured out the secret knock, they would still have to get past your sshd. And if an sshd exploit was found, your secret knock might give you enough time to patch the system before it could be exploited. More security is always a good thing.

    Disbelief in security through obscurity doesn't mean you have to paint a bull's eye on your head and dare people to attack you.

    --
    Toronto-area transit rider? Rate your ride.
  30. hmm... by Kitsune · · Score: 5, Interesting

    Improperly done, the knock sentry could become a security/QOS issue in itself.

    This definitely is security through obscurity and perhaps would work in the same way as a car alarm. There's lots more systems out there that are easier to break into, and if someone does try, just hope that they get fed up and moves on to the next one.

    If you've gone this far, why not do something like they do on radio. Open up severable ports at the same time and multiplex your signal over several of them while sending noise over the ununsed ports randomly switching between ports using a syncronized random selector.

  31. go a step further by Casca · · Score: 5, Interesting

    Implement it in combination with a onetime type password arrangement. You look up what the series of knocks is supposed to be on your secureID card (or whatever), then knock in the combination it tells you to use. Tie it in with the server you want to get into, and the port you actually connect to for ssh can be different every time.

    IE, secureID says sequence is "1234 1441 1114 5123", you knock on the first three, and 5123 is the ssh port activated for you only.

    --
    Casca
  32. Re:Brute Force by HeghmoH · · Score: 5, Informative

    Somebody do the math, but it doesn't look to be that secure. Brute-forcing this would not take long.

    Assuming a 5 'letter' password, you have (2^16 - 1024)^5 possible passwords, which is 1.1 X 10^24. Assuming both the server and the attacker are on fat pipes and the server is implemented in a dumb way so that it doesn't recognize brute-force attempts, you could pull off perhaps 100 attempts per second. So it would take you about 10^22 seconds, or 350 trillion years.

    In security, I think this technique is comparable to a reasonably strong plaintext password. It can be sniffed, but it can't really be brute-forced.

    Today's show was brought to you by Google Calculator.

    --
    Mod down posts with a "Free Mac Mini/iPod" sig, they're spam!
  33. Obscurity IS Security by CedgeS · · Score: 5, Insightful

    There is only one form of security for a publicly accessible interface: obscurity. What is a password? It is a piece of information that you know that someone else doesn't - it is obscurity. The key to your house is something you have that someone else doesn't. If they knew the obscure details of your key they could make one. What is a private key, a key for SSH, a kerberos function? They are all information you know which (hopefully) a potential attacker doesn't. This is obscurity.

    If you have a security system for a public interface (the front door to your house, a computer port, etc...) that does not rely on obscurity you have a system better than any theoretical system anyone has ever thought of. (Biometrics don't count - they are just another piece of information that you have that someone else probably doesn't. That's obscurity.)

    1. Re:Obscurity IS Security by cheezit · · Score: 4, Insightful

      I think you are overreaching here. As far as I'm concerned, the phrase "security through obscurity" means obscurity of system design. If you don't tell anyone about your unprotected resource, that's security through obscurity. All I need to do is discover your resource.

      Most security is based on secrets of one kind or another---that doesn't make it "obscurity."

      --
      Premature optimization is the root of all evil
    2. Re:Obscurity IS Security by TrollBridge · · Score: 2, Interesting
      I don't think he's reaching at all, and I think the great-grandparent post illustrates his point very well.

      In the context of the theoretical shifting door in the wall, part of what makes it secure is that outsiders don't know how the door works; they only know that it moves away when an unauthorized person tries to open it.

      However, people who oppose "security through obscurity", especially when in conjunction with blind open source advocacy, would argue that giving would-be intruders the blueprints of the door system would somehow deter them and make the system more secure.

      --
      There's a Mercedes gap too. I want one and can't afford one, but it's not government's job to do anything about it.
    3. Re:Obscurity IS Security by Xenographic · · Score: 4, Insightful

      We usually call such a thing a secret, not "obscurity" ... at least, when talking about a password.

      So this just makes part of the protocol secret, and one of our assumptions about security protocols is that the protocols are known.

      Yes, it's an interesting and reasonably clever little hack (it is not, however, new), it does tend to hide some information (e.g. that the ports are even open) but if you're going to make the port look closed, anyhow, why not just listen on that port for something that would cause the service to "wake up"? I guess they thought it seemed a bit more clever the other way, who knows?

    4. Re:Obscurity IS Security by Daniel+Boisvert · · Score: 2, Interesting

      Most security is based on secrets of one kind or another---that doesn't make it "obscurity."

      I think that's the point the grandparent is making. The key to this is that folks around here aren't real clear on the difference between "obscurity" and "secrets". One is touted as being worthless by itself, the other is accepted as the cornerstone of electronic security in general (I posit that the cornerstone of physical security is violence).

      the phrase "security through obscurity" means obscurity of system design.

      This is an excellent point, and deserves to be modded up because *way* too many people both here and elsewhere miss this fundamental concept. In my opinion any method that makes accessible hosts look the same as unaccessible hosts to a port scan is a great idea, no matter what folks here choose to call it.

      Dan

    5. Re:Obscurity IS Security by cheezit · · Score: 2, Insightful

      I believe that a secure system is one where "giving would-be intruders the blueprints" does not weaken the protection. This should be provable on paper and could be backed up with practice if necessary.

      Foisting crappy code on the public and hoping that nobody breaks it is a very Darwinian head-in-the-sand approach. I can see your point that "we're against obscurity" provides a justification for that approach.

      It puts the cart before the horse and shouldn't raise anyone's confidence in the code. Proving that one could do so, however, should raise confidence in the code.

      --
      Premature optimization is the root of all evil
    6. Re:Obscurity IS Security by mech_knight · · Score: 3, Insightful

      Actually, security from man-in-the-middle attacks is what cryptography is normally concerned with. Real security is achieved when transmitted information is still "unknowable" despite knowledge about the process of transmission.

      That's the whole point of public and private keys. Statistical impossibility of dechiphering the private key--not obscurity--is its goal.

      --
      "Size matters not. Look at me. Judge me by my size, do you?" --Yoda {whips out green light saber}
  34. Slashdotted by BlueTooth · · Score: 3, Funny

    Does anyone know the secret knock for www.portknocking.org:80 ?

    Thanks.

    --
    SPAM
  35. Knock Knock Honey Pot by ifreakshow · · Score: 5, Interesting

    One interesting way to use this would be to forward incorrect knocks to a honeypot instead of the legitamite service. Then the attacker could never determine if he had indeed knocked successfully and would waste time running around in a fake system giving you valuable data about there intrusion methods and freeing up the actual service for legit users.

  36. Christ people! by Stonent1 · · Score: 4, Informative

    How many people are going to say sniff and repeat the sequence. You still have to get through the service after it opens. The whole point is that they don't know what is going on in the first place. And rotating keys are a good idea anyway. I like this idea for running some kind of server behind your ISP that normally doesn't allow such things. When I had excite@home I would regularly get firewall logs that said "authorizedscan.home.com" portscanning me.

  37. easy way to secure by way2trivial · · Score: 3, Informative

    the 'hammer' will have a different IP than the authorized 'knocker'

    --
    every day http://en.wikipedia.org/wiki/Special:Random
  38. A Question about packet sniffing by Stone316 · · Score: 2, Interesting
    I've always been curious of packet sniffing but really never investigated it indepth. Would the person who wants to sniff your network be on the same subnet or have access to some major hub? ie, How is a guy in Russia going to sniff and find the right port combo if the server is in Seattle?

    Wouldn't he have had to hack a computer closer to his target in order to be successful?

    Wouldn't the best option be to have some type of SecurID based password in order to access the port? Unless there is a bug or hole in the software isn't a randomly changing password that requires a pin about as good as it gets?

    And as they say, Security through obscurity isn't.

    --
    "Thanks to the remote control I have the attention span of a gerbil."
  39. I like this idea by mrdaveb · · Score: 2, Insightful

    Although people are right in saying that packet sniffing can easily defeat this, I think it still improves security.

    It leaves the impression that the machine has no ports open, so script kiddies will leave you alone. Also, an attacker can't just exploit a server bug to crack the system without also being in a suitable location to packet sniff the knock combination to get the port open in the first place.

    --
    Homme petit d'homme petit, s'attend, n'avale
  40. Re:Oh, really. by MCZapf · · Score: 2, Informative

    They gave away half of their "obscurity" by releasing the concept to the world. If they were really interested in the security aspect of port-knocking, they wouldn't have posted the concept on the WWW. As an unobscure authentication system, I feel its value is quite limited.

  41. I thought of this 2 years ago by cr@ckwhore · · Score: 3, Interesting

    Interesting concept... I thought of this 2 years ago and I'm now kicking myself in the balls for not acting on it! (not literally)

    In my version of "port knocking", everything was going to be controled via ICMP echo packets.. aka "ping".

    A single Ping packet can contain arbitrary data of an arbitrary length less than 64k. Through a config file, the system admin could define ping sequences using time, data, and/or packet size, along with a specified script to execute on each successful reception of the ping sequence.

    Then, remotely, people who know the ping sequences could use almost any available ping utility on any machine to open remote ports, etc.

    The concept of executing a script, rather than opening or closing ports, allows for more flexibility. Not only can the admin open and close ports via scripts, but could do other useful things.

    --
    Skiers and Riders -- http://www.snowjournal.com
  42. Re:Oh, really. by orangesquid · · Score: 2, Informative

    Yeah, but you don't send out public packets when opening a combination lock.

    Plus, thing about it this way:
    * someone notices an SSH connection
    * someone portscans, notices port 22 is closed
    * someone thinks, "hm, there was that /. article..."
    * someone waits around for you to re-connect, and watches what closed ports you connect to

    See? that easy.

    --
    --TheOrangeSquid Is it any wonder things seem so awry? We swim in a sea of confusion and don't have to think to survive
  43. Negative knocking by hey · · Score: 3, Informative

    Let's say the correct squence is ports 2000, 2002, 2004. You could add a check that says if there is a knock on port 2001 or 2003 then this guy is locked out for a while.

  44. This was discussed extensively... by amplt1337 · · Score: 4, Informative

    on debian-security a couple of months back.

    Anyway, one of the biggest problems is failure rate. If that "secret knock" fails unless you correctly use the appropriate sequence of knocks, then anyone malicious can implement a trivial denial-of-service attack just by constantly hitting random ports, preventing any knock completion.
    Alternatively, if you ignore non-knockable ports, or ports that aren't part of the knock, then you've dramatically whittled down the strength of your virtual password, and made it that much easier to brute-force.
    Perhaps this would deter some of the lowest levels of sk|21p7 |<1dd13z from getting in, but that would be true only for about two weeks, whereupon new toyz are released that automate these attacks, and you've given the black hats one more weapon (DoS through spoofed noise packets) in the meantime.

    I guess if you really, really wanted to do this, you could have a single accessible port that would listen for access, and then receive an encrypted key that determines which other port your server opens for a possible connection. But basically all you're doing then is adding on another layer of password protection, whose effect will be circumvented when somebody finally decides it's annoying to have to login twice or enter multiple passwords, and sets them both to the same thing, on auto-login, then leaves his laptop sitting around for three minutes. And you've still not fixed the sniffing problem. There are bigger security soft spots to be addressed than trivially hiding access to your ssh port.

    --
    Freedom isn't free; its price is the well-being of others.
  45. freq. hopping analogy- by Samuel+Nitzberg · · Score: 5, Interesting

    This looks similar to how frequency-hopping is used on secure radios.

    Two radios synchronize, based on a key, and both change frequency every so many milliseconds. If you don't know the key, you can't send or receive to either of them.

    I would like to see this extended to a port-hopping system for all ports and services. Sure -- it will burn some clock cycles, but I like the approach.

    - Sam
    http://www.iamsam.com

  46. Already used by backdoor by cytrox · · Score: 3, Informative

    This method is already used by the proof-of-concept linux backdoor cd00r, written in 2000.

  47. Neither. by khasim · · Score: 4, Insightful

    #1. DoS attacks - how is this different from any other DoS attack?

    #2. Sniffing the port knocks - to do this, you would already have to have the upstream compromised or be on some shared network.

  48. Re:Promiscuous mode by crotherm · · Score: 2, Informative
    It is trivial to capture other packets on the same ethernet.


    Not if your network is using a wired switch to connect the hosts. By definition, you should only see broadcast and unicast to your IP, not the whole network. This could be more of an issue if you are using a shared network link 10base2 or 802.11.

    --
    "Those who make peaceful revolution impossible, make violent revolution inevitable" - JFK
  49. Web site is "knocked" down by unigeek · · Score: 3, Funny
    Looks like someone knocked on the wrong port. I believe the idea is to hit a few different ports and then go the secretly opening door. However the technique known as "slashdotting" where the sequence looks sort of like

    site up

    knock 80

    knock 80

    knock 80

    .. (knock 80 about 3 million times in two mintues)

    site down

  50. Re:Open a whole range of ports by ViXX0r · · Score: 5, Informative

    The summary says that the ports to knock on are closed. Portscanning shouldn't reveal which ones are available to be knocked on.

    --
    University - a box of academia nuts.
  51. Re:replay? by hchaos · · Score: 2, Informative
    My question is how much better is it than simply moving your services to non-standard ports?
    Non-standard ports still respond to basic port-scanning. Inactive ports don't respond until the correct sequence of ports is scanned, which will most likely prevent a random attack, and will prevent a directed attack by anyone who can't sniff the packet stream.
  52. not so shady... by Hubert_Shrump · · Score: 4, Interesting

    i've been running SSH on a nonstandard port with this in the way:


    iptables -N ${SSH_TABLE}
    iptables -Z ${SSH_TABLE}
    iptables -A ${SSH_TABLE} -m state --state NEW -m limit --limit 2/minute --limit-
    burst 2 -j DROP
    iptables -A ${SSH_TABLE} -m state --state NEW -m limit --limit 7/hour --limit-bu
    rst 7 -j DROP
    iptables -A ${SSH_TABLE} -m state --state NEW -m limit --limit 10/day --limit-bu
    rst 10 -j ACCEPT
    iptables -A ${SSH_TABLE} -j DROP


    well, I thought it was cool...

    --
    Keep your packets off my GNU/Girlfriend!
  53. Re:Open a whole range of ports by lactose99 · · Score: 4, Insightful

    That depends on the NAT gateway, as per the original poster. If the NAT gateway is dropping all packets that aren't part of a) valid incoming connections or b) a port knocking scheme, a portscan would reveal some or all of the ports utilized in the port knocking scheme. Ports that are closed but part of the knocking scheme would return a connection refused, while all the other (filtered) ports would simply be dropped.

    Granted, most anyone implementing this sort of security setup on their firewall would most likely think about this and either a) open an entire range of ports, only some of which would be used for port knocking (as a previous poster mentioned) or b) simply close everything at the NAT gateway and not drop any packets, thereby not revealing any detail regarding a port knocking scheme.

    I'm sure there are several other ways to deal with this at a NAT gateway, but they just aren't coming to mind at the moment.

    --
    Fully licensed blockchain psychiatrist
  54. Not a new idea by ftzdomino · · Score: 2, Interesting

    I wrote proof of concept code for this a few years ago. Mine is implemented as modified network sniffer code (with promisc disabled), so it doesn't require any weird firewall configs. I was considering some other things which could be useful, such as transmitting data via a fake network scan.

  55. Re:Promiscuous mode by _Sharp'r_ · · Score: 4, Informative

    Most switches have, uhh.... "features" that allow an experienced attacker to trick them into broadcasting traffic to multiple ports.

    Essentially, with a little judicious arp spoofing and a flood or two, the switch can be confused into just "making sure" the packets get to the right destination by broadcasting like a hub when it would normally be switching.

    --
    The party of stupid and the party of evil get together and do something both stupid and evil, then call it bipartisan.
  56. Services listen on ports. by khasim · · Score: 4, Insightful

    It isn't the port. It's the service listening on that port.

    If the port is closed, then it is impossible to attack that service through that port.

    This process closes those ports.

  57. Order, delivery of packets is not guaranteed by Dr.+Manhattan · · Score: 3, Insightful
    Since the client gets no feedback on whether the packets made it, there's no way to check if it worked except to see if the "magic" port has been opened.

    This system is going to be unreliable. No way around it. A single dropped packet and you have to try all over again. If you're really paranoid, like some have proposed, and disable the "knock monitor" temporarily if someone tries to connect unsuccessfully, it will also be horribly slow.

    If you use it on a LAN, maybe the net will be reliable enough, but then you have to worry about sniffers...

    --
    PHEM - party like it's 1997-2003!
  58. Re:Oh, really. by srmalloy · · Score: 3, Funny
    I predict a flood of commenters whining about this being "security through obscurity."
    Well, it worked reasonably well for the speakeasies during Prohibition. Unfortunately, the FBI's DOS attacks were also more effective then...
  59. More layers by Jade+E.+2 · · Score: 2
    If you're really paranoid you could add layers like this for as long as you wanted...

    Require syns to ports A, B, C, and D, which opens port E where you have to send a password, which opens port F from which you must do an HTTP GET for /foobar.html, which opens ports G which when connected sends you the number of random port H, on which an anonymous FTP service is now running to which you must send a SITE STARTIT command then download the number of port I, which will be the SSH service once you've pinged the server 7 times with 42 byte packets. And to make it really challenging, you have maybe 10 seconds to complete the sequence. (Think a lot of terminals just waiting for you to hit 'enter'... The pings would take most of the time.)

    Oh, and if you do anything wrong after the first 3 ports are hit, you can't try again for 30 seconds.

  60. TCP/IP problems with this method. by Vellmont · · Score: 4, Informative

    Everyone has focused on the "does it make you more secure" arguments about this method. I'd be more interested in how it can be implemented properly since no TCP connection is being established using the knocks. I'd assume either a TCP SYN is being sent to the TCP ports, or the protocol uses UDP.

    The problem is of course that since no connection is being established, there's no guaranteed delivery of packets, and no guaranteed delivery of packets in the order they were sent. This could be very problematic across network connections that drop packets, and provide you no feedback as to why you can't open your connection. If only 10 % of my packets get dropped, and I require 10 "knocks", I only have .9^10, or 35% chance of my sequence getting to its destination intact. 5% packet loss would up my chances to about 60%. Increasing amounts of knocks decreases my chances of the sequence arriving intact.

    Is there a clever way to solve this problem, or is the reliability of it tied to a low amount of packet loss on a network?

    --
    AccountKiller
    1. Re:TCP/IP problems with this method. by tedhiltonhead · · Score: 2, Informative

      To solve the problem of packet mis-ordering, the client implementation could wait for the ICMP "Port Unreachable" message before transmitting the next knock. This is assuming active connection rejection by the server, rather than dropping incoming SYNs.

  61. It's _not_ just another password... by jdreed1024 · · Score: 4, Interesting

    I see a lot of comments saying "Well, why not just have two passwords?". It seems that people didn't read the article (the first link is /.ed, the second is not). The whole point is that with this, until you knock, the machine appears as a closed machine. No ports open. All ports will simply drop packets on the floor, meaning that a hacker scanning your subnet will not bother with that machine. The machine essentially appears invisible until knocked. Even with the most secure system, the hacker can still see that you're running, say, sshd, Apache, CUPS, and a few other services. And if a buffer overflow was announced 5 minutes ago for, say, sshd, they know that they can attempt to exploit the machine, since they see port 22 open. If you are using Port Knocking, you can have a vulnerable sshd, and it's a hell of a lot less likely to get exploited since the cracker has no way of knowing that you're running sshd...

    --
    There is no sig, there is only Zuul.
  62. Stop complainin about "security through obscurity" by Tom7 · · Score: 4, Insightful

    God damn, if I hear one more of you go, "this is just security through obscurity!" I am going to puke. This is the same as cleartext passwords, which are pretty secure if (a) you know nobody is sniffing the network and (b) you know nobody is masquerading as the host you want to connect to. Of course those things aren't typically true, so this alone isn't very secure. But it does disguise your exchange which, contrary to what the security-through-obscurity folks are saying, does give you some small measure of security.

    This is just a way of encoding some bit transfer in the IP protocol instead of in the beginning of whatever protocol you're using after the connection. You could also use it to send cryptographic credentials which could be as secure as any other protocol (plus some extra security by obscurity). The only problem with that is that you need a way to send back information via TCP (because most good authentication protocols are two-way), but I think you need that anyway in order to serialize your knocks.

  63. Re:replay? by Tom7 · · Score: 2, Informative

    My question is how much better is it than simply moving your services to non-standard ports?

    Quite a bit better, since it is easy to scan 65k ports serially to see which ones are listening, but much harder to scan a jillion combination of port sequences to see which ones are listening.

  64. Re:VPNs already solved this problem... by Tet · · Score: 2, Interesting
    I already have a solution for this scenario. It's called a VPN.

    Congratulations. You've just extended your "secure" corporate network beyond the physical walls of the office, and into the house of one of your employees. Are you sure that the machine they're using as a VPN client hasn't been rooted? VPNs have their uses, but they're far from solving this problem, and in many ways weaken your overall security. The correct solution is to change the authorisation criteria from things you know (password, "secret handshake") to things you know plus something else, for example, things you have. We do this with one time passwords sent to a user's mobile phone. Once that's been entered, they're prompted for their normal password. Thus even if the box has been rooted, and has keystroke and network sniffers galore, it doesn't matter. So long as the black hats don't have my trusted employee's mobile phone, they're not going to get in (and furthermore, the unexpected passwords being sent to the phone act as an early warning system to let us know someone's trying to break in). Of course, no security measures are perfect, and theoretically, with root access, they could hijack an existing ssh connection once it's been opened, but it's non-trivial, and we've raised the bar considerably.

    --
    "The invisible and the non-existent look very much alike." -- Delos B. McKown
  65. Simpler Implementation by John.P.Jones · · Score: 3, Interesting
    You could, more simply, have your little script listen for messages (UDP) sent to port x. If the message has the following form.

    "open port Y for ip Z using key K"

    if the port opening policy accepts this command then it is opened otherwise it is not. Better yet 'REAL' crypto could be used to protect the ports. Fore example...

    "open port Y for ip Z @ TIMESTAMP" Encrypted by K.

    This simpler implementation (more likely to be correct) will provide equivalent security.

  66. Still vulnerable to packet sniffing by me.nick() · · Score: 3, Interesting

    This is a great way to hinder people from randomly picking to hack your box by scanning for open ports. However, if someone is dedicated to hack YOU specifically, they could still use a man-in-the-middle attack, sniff the packets to see which port sequence you were using, etc, etc.

    Of course, there really is no way to block a skilled hacker who is intent on breaking into a specific network/box by any means necessary.

  67. Re:Promiscuous mode by nr1 · · Score: 2, Informative

    actually, you only really need arp spoofing, or rather poisoning. By sending spoofed arp reply packets you trick the target into thinking your computer is the router and vice versa. You can then forward the traffic between the two, so that it is totally transparent to them. It's the classical man-in-the-middle attack.

    Switched networks are definitely not safe from sniffing, it just makes more "noise" to do so.

  68. All the time the same arguments by phoenix321 · · Score: 5, Interesting

    This is security by obscurity, but it is useful. Don't repeat this mantra just because "the experts" say so.

    Since some still don't understand its use, i'll be speaking metaphorical:

    Assume you need to have a special key to open a certain otherwise secure door. OpenSSH might be that door and your passphrase and your certificate are the key.

    An attacker can still forge the key or attack the lock with a different approach, picking etc. - comparable to "social engineering" to get the password, brute forcing or exploits.

    And that port knocking sequence now effectively hides the lock, leaving an attacker without a first approach to pick or break the lock. It just adds another layer of security. You just don't know where to start your attack. You can't use exploits, you can't try brute force - nothing, heck you don't even know what type of daemon your target is.

    A clean stainless steel door with a covert RFID-detector one square inch in size, hidden somewhere, sure as hell beats the same door with a clearly visible lock. You still need to pick the lock, but you can't poke your lockpicking tools into solid steel and you can't crack something you cannot discern.

    --- Still one addition to say: having a machine connected to the internet with no ports open makes you a prime suspect for the port knocking scheme.

    A good stealth scheme may be implemented, so a potential attacker (excuse for this metaphor again) does not even see the door (or the building, for that matter).

  69. Re:Open a whole range of ports by blazerw11 · · Score: 5, Insightful

    That depends on the NAT gateway

    No, the gateway or direct host has ALL PORTS CLOSED, however it does log port requests. If the log shows the knocking sequence, then and only then, will it open a port.

    --
    A great many people think they are thinking when they are merely rearranging their prejudices. -- William James
  70. gettyps by Michael.Forman · · Score: 3, Informative


    Kris Gleason implemented a similar scheme in his gettyps code back in the 90s (it still available and in most distributions). For the "knock" one would dial into a modem (or any serial port) and let it ring a specified number of times. If the right number of rings was received before disconnect, gettyps would allow the next call to connect.

    Michael.

    --
    Linux : Mac :: VW : Mercedes
  71. B&B by jafiwam · · Score: 2, Funny

    Butthead: "Uhhhha, I am gonna emale you....in the butt.

    Beavis: "Shutup! Port-knocker!

  72. I did this about 5 years ago by Skapare · · Score: 4, Interesting

    I did this about 5 years ago. But my method was a bit different. Instead of using port numbers to contain the information (and that's all it really is, is just information), I sent a single UDP packet, with a source port of 53 (so it looks like a DNS answer), formatted like a DNS answer, that contained the information in the DNS answer data. Then it opened the SSH filter for that IP address to come in (I did it for 5 minutes, not 10 seconds). It still had to fully authenticate via SSH, so even if someone sniffed my DNS packet and tried to fake it, they could at most have a locked door to jiggle the handle on. Next time I do this, it will be to generate an MD5 checksum from the client IP and a secret salt, and send that as an IPv6 address in the packet. Then it can't even be faked from some other IP address.

    --
    now we need to go OSS in diesel cars
  73. Counter Proposal: Port Traps by henrypijames · · Score: 5, Interesting

    What if I turn this whole thing around and install fake services on a number of ports?

    For example, whenever you make a connection to a port between 1025 and 2048 on my system, you're greeted with "OpenSSH ...", and prompted to authenticate. But only behind one among those 1024 ports is the real SSH. On any other port, the fake service takes the username and password you've entered, wait a few seconds (just idling around), and tell you "Authentication failed". If you try too often to connect to faked services, you're put on the black list to avoid DOS, of course.

  74. Why not use a listening socket on UDP+encryption? by jelle · · Score: 3, Interesting

    This is a neat trick, but it does not really increase protection against targeted attacks.

    It really is nothing more than a password to get access to the front gate... When somebody eavesdrops (sniffing), they will know the passwords, thus get access to the gate. They can sucessfully detect the knocking sequence because it is followed by a successfull ssh connection (duh!).

    The password is this 'secret sequence' in this 'port knocking'. Why not just use a daemon that listens on a UDP socket for a packet with an encrypted password in its payload? The payload could even be an RSA-signed and/or encrypted request (that includes a timestamp). That would be unscannable too, because UDP is connectionless, and be a lot more secure because of the real encryption/protection of the request data (the server can verify the identity of the sender of the request from the RSA signature, and can deny the request if one was made earlier with the same time stamp, twarting even sniffing of the UDP packet).

    Except for not having the ssh daemon 'connected' to the internet at all times and thus evading many port-scanning worms/scripts, this port knocking is nothing more than just some security through obscurity: At best it will delay the attacker somewhat, but probably not at all while giving the user a false sense of being secured.

    --
    --- Hindsight is 20/20, but walking backwards is not the answer.
  75. Locked out of your own machine? by SassyDave · · Score: 3, Insightful

    It seems like a malicious user could keep you from connecting to your own machine by sending "malicious knock noise" to multiple ports. Meanwhile, your valid knocks would be disregarded as they are intermingled with malicious knocks. This may not seem like a big deal since the malicious user's connection could probably be stopped easily. But in a crisis it may cost you precious seconds or even minutes before you can eliminate the "malicious knock noise" and log into your system.

  76. Reminds me of xringd by Yeechang+Lee · · Score: 2, Interesting

    Back when I depended on a dialup connection, I used xringd. By having the phone line the modem was on ring in a certain pattern, I could command the computer to dial up (using diald). Then a line in /etc/ppp/ip-up.local would mail me the IP address the PPP server assigned the computer (this was before DynIP or DynDNS). I'd then be able to log into the machine. Pretty darn cool for 1996.

  77. Re:Oh, really. by Pieroxy · · Score: 3, Insightful

    I don't think you get it. This way of securing a port (22 for example) is obscuring in the sense it hide the fact that you have a service up (SSH) to the outside world unless you know the "knock code".

    You can then hide any service that is not to be known from the public (SMTP, POP, SSH, TELNET, whatever...) thus removing the probability that any exploit for these may be exploited: The hacker on the other end doesn't even know the service is running!

  78. Different kinds of "listening", different places. by billstewart · · Score: 2, Interesting
    If your listener program is secure, it's not a risk; the big security question is whether you can make a knocking-listener that's secure enough that it doesn't increase the risk. The less big security question is whether it can make things harder for attackers without breaking too many other things. For instance, if it runs as root (or as a kernel module) and has buffer overflow problems, it's an entertaining target of attack. On the other hand, if all it does is detects connection requests, passes the IP address and port number to a validator program, and sends a TCP or ICMP reject message, it might be safe enough.

    It doesn't actually use significant resources unless it's getting pounded with lots of packets, and you can limit this by only listening on a few ports, blocklisting IP addresses that knock on the wrong ports, and limiting the rate that you actually respond to requests from a given IP address. On the other hand, you have to be careful not to let the attacker spoof a bunch of _bad_ requests, causing you to blocklist a real site. Depending on how much eavesdropping capability the attacker has, this may be easy or hard.

    The security advantage of this method over a single-port method with a password is that there are applications that you run which may have bugs in them, such as your SSH server or SNMP monitors, which you're not going to rewrite, and it lets you block access to them except from authorized users. It's a defense-in-depth strategy, possibly good (though it looks clumsy to me.) It can cut down on lots of the script kiddies.

    Also, this doesn't have to be in your main server. This is the kind of application you could build into your firewall box, so it reduces the number of ports that can pass through the firewall, except when somebody knocked successfully, and the firewall doesn't allow passthough on the knocking ports. Of course, you could accomplish almost the same thing wiht better security by accepting SSL requests to an application on the firewall...

    --

    Bill Stewart
    New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
  79. encoding for noise rejection by firewood · · Score: 4, Interesting

    This is a great idea.

    It adds security to any existing methods (passwords, etc.).

    It can be implemented behind a firewall that doesn't even respond on any port probes, so an attacker can't even tell if the firewall was just unplugged.

    If the firewall stays closed, the protocol can't be used by an exploited machine, unless a method for exploiting the firewall is also known.

    Or the method can be implemented in user space of a machine behind a completely closed firewall, just by pre-arranging for the logging of firewall port probes, and the forwarding of appropriately filtered contents of the firewall logs into user space.

    They key sequence can also be made long enough to make it just as hard to crack as a long pgp private key, e.g. nobody except (3 letter agency) and distributed.net will even bother to try.

    The sequence key can be from a one-time pad, meaning that even if the protocol is completely revealed to a local sniffer, they'll just end up with a useless password.

    And lastly, it's possible to additionally encode the key sequence with a modulation wrapper and enough redundancy to withstand a given signal to noise ratio and mis-sequencing rate, which means one could even make the sequence key usable in the face of probing or an outright DoS attack against the protocol up to a certain attack bandwidth and knowledge of which ports might be in the sequence.

    Where's my coding textbook and patent attorney...

  80. security through obscurity? no sorry by wolfdvh · · Score: 5, Informative
    For all of you arguing that port knocking is security through obscurity, please take a couple minutes and read this article from the site:

    http://www.portknocking.org/view/about/obscurity

    It does a much better job of explaining this than anything yet posted here.

  81. Re:Open a whole range of ports by Bill+Privatus · · Score: 4, Interesting

    Sorry, wrong. There are several messages in this thread that mention REJECT (response to packet) instead of DROP (total silence). With this scheme in place, you need not listen on *any* ports, and you need not respond in any way. You can have a totally silent box, even with 10 or 20 services "listening". Nothing gets through until your iptables/ipchains software allows the traffic through.

    Admittedly, if you're running a public site, you're mixing two kinds of solution --- publicly available vs secured, but analogous statements can be made here - you can't tell a public site using port knocking for some special services from a public site that doesn't support same.

    This is like a void fn() in C (no return status). You knock on the 5, 10, or 25 ports in the right sequence to "send your message". You get nothing back. You then try to open the port that is your ultimate destination - if it's open, you're fine, if it's not, you have issues. This isn't a full-duplex kind of protocol, folks. I love it :-)

    Thus, it is impossible to distinguish a totally silent box (listening on no ports, dropping all packets) that has implemented port knocking from a box that is merely totally silent.

    As a two-laptop user who attaches to corporate LANs and public high-speed networks in hotels, I just love the idea of having all packets dropped until someone sends "shave & a haircut!" - then letting them in for a bit.

    It would certainly be better than my current approach - using ethernet addresses (maclist in Shorewall! :-) to allow ftp and http etc to my linux box.

    --
    Redundancy is good; triple redundancy is twice as good! - Me.
  82. Seem quite vulnerable.. but neat for crypto!? by mattr · · Score: 2, Interesting

    Seems vulnerable to traffic analysis, as someone mentioned you don't use a combination lock that sends packets all over the world. People will want more complicated sequences, but it will take more time to send them and they may have to resend due to TCP packets coming in different order. But even so anybody on your network or the server's network should be able to see what's going on, how secure is that? And if the server ever responds to your ip from any port then you likewise hosed.

    On the other hand this does seem to be an interesting way to one-way send information to the server. I was thinking of playing solitaire using Bruce Schneier's algorithm using a port for each card of a deck.

    IANA cypherpunk, but there seem to be a number of ways to treat the set of all closed ports as a numerical space that would be interesting for encrypted communications.

    For example you could convert a one-time pad, a private key, or a set of communication channels into a list of port numbers. For a short message at least, you could send with pretty good security (although the list of ports, if not their hash values, would be known to the outside world).

    To me this knocking stuff sounds like it only *reduces* security and provides lots of interesting clues to men in the middle. The intriguing part seems to be that you can send a good deal of information through a large number of half-connections in parallel, but this may have already been tried by other people. Of course if the message is simple enough that a single ping to a single prearranged port number is enough to convey it, then you would seem to have a pretty strong system though its existence would certainly be uncovered sooner or later. But if this became popular I suppose the advantage would be in being able to assign certain ports to prearranged values, both for encryption purposes and also to reduce the amount of data you actually need to send.