Slashdot Mirror


Port Knocking in Action

tyldis writes "There was something called "port knocking" mentioned on Slashdot earlier, and now an implementation has sprung to life. Is this something worth pursuing?" The page is to an application called knockd which is a simple proof of concept with hard coded knock sequences. Really interesting stuff.

430 comments

  1. one of many by bangular · · Score: 3, Interesting

    There are actually about 5 other known port knocking implementations. And it's such an easy thing to do, I'm sure many others have written their own private implemenations.

    1. Re:one of many by Anonymous Coward · · Score: 4, Funny

      Actually I counted 11 other port knocking implementations. Really I did. Can I get modded +4 also?

    2. Re:one of many by jacquesm · · Score: 2, Funny

      port knocking is like having a deliberate hole in
      your carefully constructed secure zone.

      I'm going to stay a mile away from anything that
      brings on board a 'knocker'...

      I'd hate to get knocked up.

    3. Re:one of many by PacoTaco · · Score: 2, Funny

      Well, someone needs to come up with a better name. I feel like I should be saying "shut up Beavis" whenever somebody mentions it.

    4. Re:one of many by tverbeek · · Score: 4, Insightful
      port knocking is like having a deliberate hole in your carefully constructed secure zone.

      Well, yes. That's the point: to enable access to a secured system. It's often a necessary evil. The issue is that most people implement these deliberate holes by leaving certain ports open to simple direct access. They're easy to find, and not all that difficult to exploit. Adding a layer of obscurity and another layer of security on those holes - in effect putting a concealed combination lock on them - would be a more secure way of doing that.

      --
      http://alternatives.rzero.com/
    5. Re:one of many by jacquesm · · Score: 2, Insightful

      In practice though, once the system becomes
      automated it no longer is the user that sets
      it up but some - untrusted - application like
      say the next cool file sharing program. Next
      a bug is discovered and *bang* millions of
      previously firewalled machines are suddenly
      wide open.

    6. Re:one of many by SphericalCrusher · · Score: 0

      Yeah, seriously, its been around for awhile now -- not the command, but port knocking itself. I've used it several times in the past for an assortment of fun activities...

      "Knock knock honey, I'm home. Oh, you locked me out? *kicks the door in*" = my style of port knocking. =P

      --
      "Instant gratification takes too long." - Carrie Fisher
    7. Re:one of many by uberdave · · Score: 2, Insightful

      The point for me would be to punch a hole in a draconian acceptable use policy. Many broadband providers to not permit you to run servers, and frequently they will run portscans to find violators. With this technique, they could portscan away, and I'd still be able to access files on my home machine from outside. Pesky broadband monopolies.

    8. Re:one of many by dillon_rinker · · Score: 2, Interesting

      So your theory is that programs are MORE secure when they have LESS security features?

      I suppose that having passwords on user accounts is silly, too, because some rogue program could log keystrokes and post them to the web.

    9. Re:one of many by aceat64 · · Score: 2

      The underlying service (like SSH) is still secure, it's just another LAYER of security. Did you even bother to find out how port knocking works?

    10. Re:one of many by timelorde · · Score: 1

      I'd hate to get knocked up.

      From The Fug's album "It Crawled Into My Hand, Honest":

      Do not tell me, I am source of your knock up. The mud elephant wading through the sea leaves no tracks.

    11. Re:one of many by mrmeval · · Score: 1

      I'm curious if Secure Id could be the knock code?
      This would prevent someone sniffing a fixed knock code.

      Heck a 10 number knock code for 365 days is how much storage?

      --
      I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
    12. Re:one of many by Fermier+de+Pomme+de · · Score: 2, Insightful

      Programs are often more secure when they have fewer features of any kind. Pick something simple and do it well.

    13. Re:one of many by 777v777 · · Score: 1

      Do any of these implementations take advantage of the fact that you can send data also in the payload of said "knock" packets? Seems that quite a few tricky cryptographic tricks(timestamps,passwords,etc encrypted and put in the payload). Even parts of the TCP or UDP headers could be used.

    14. Re:one of many by Ctrl-Z · · Score: 1

      I like it! This is probably one of the most secure ways you could implement port knocking.

      --
      www.timcoleman.com is a total waste of your time. Never go there.
    15. Re:one of many by blackbear · · Score: 2, Insightful

      So your theory is that programs are MORE secure when they have LESS security features

      Actually, programs are MORE secure when they have LESS features. period. Security features are still features. If implemented incorrectly they can weaken security instead of enhance it. Complexity increases the probability of vulnerability.

      I suppose that having passwords on user accounts is silly, too, because some rogue program could log keystrokes and post them to the web.

      In some situations, that is exactly correct. It depends very much on the application. In some very high security situations, passwords are considered too weak to rely on. In those cases "something you have" and "something you are" are often used as two factor (strong) authentication.

      And yes, I am an information security professional. (but not a lawyer.)

    16. Re:one of many by Jussi+K.+Kojootti · · Score: 1
      By your logic users should have dozens of passwords - any of which would give access.

      Having more security features can be a good thing when all of them have to be passed to gain access. If bypassing one security feature is enough, adding security features is only going to make the system more insecure...

    17. Re:one of many by Anonymous Coward · · Score: 5, Informative
    18. Re:one of many by Anonymous Coward · · Score: 0

      OK, I've got juice, I'll mod your shit up. Informative +1. Instead of these Sen Joe McCarthy "I have in my possession a list of 5 different commun^H^H^H[etc]port knocking implementations..." types.

    19. Re:one of many by Doug+Neal · · Score: 1

      I dealt with this like so:

      iptables -A INPUT -s abuse.scanner.blueyonder.co.uk -j DROP

      I question the sanity of always scanning from the same IP address, and having that as the reverse DNS to show up nicely in firewall logs... I have a sensible ISP on DSL now instead, which isn't bothered about what servers I run, and even support linux ;)

    20. Re:one of many by TooTallFourThinking · · Score: 1

      I think these port knockers could be setup much like master locks, each user has their own combination which needs to be entered in order to unlock that port. I don't know if some port smacker program would be able to find the right knocks.

    21. Re:one of many by uberdave · · Score: 1

      I had a sensible DSL based ISP as well, then I moved. I'm around the corner and down the street from where I used to live (but still in the same subdivision), but I'm now out of range for DSL :-(

      I'll give your iptables trick a try.

    22. Re:one of many by tverbeek · · Score: 1

      And how is this criticism relevant to port-knocking? It's an additional layer of security, not a way to avoid it. RTFA.

      --
      http://alternatives.rzero.com/
    23. Re:one of many by nial-in-a-box · · Score: 1

      Actually, SecurID is not stored, at least not in any implementation I've seen. I'm fairly certain there is some math involved here, such as each key being based on the last one or whatever. This seems like an inherently better idea anyway, though it may not have any real security benefits unless you condsider the social aspect of the whole thing. Regardlesss, a SecurID would be a great way of doing this if it is in fact implemented in a prompt-user-for-sequence fashion.

      --
      I am feeling fat and sassy
    24. Re:one of many by nial-in-a-box · · Score: 1

      RSA SecurID authenticators are as simple to use as entering a password, but much more secure. Each end user is assigned an RSA SecurID authenticator which generates a new, unpredictable code every 60 seconds. The user combines this number with a secret PIN to log into protected resources.(from here)

      --
      I am feeling fat and sassy
    25. Re:one of many by mrmeval · · Score: 1

      "Actually, SecurID is not stored, at least not in any implementation I've seen."

      I blame my poor wording for the misunderstanding.
      The storage requirement is for the 'economically challenged' coders one-time-pad in lieu of secure iD. This is less than optimal but it is only the first layer.

      --
      I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
    26. Re:one of many by strobert · · Score: 1

      not really. the idea behind port knocking is it provides an ADDITIONAL level of screening over and above the usual protections.

      You have a service that needs to be available to from anywhere by certain people. so the service woulc ordinarily be open. But you add port knocking so that the port is only open at certain times if people trigger the right open code.

  2. How do you transcribe... by JesseL · · Score: 5, Funny

    "shave and a haircut" into port numbers?

    --
    "Prefiero morir de pie que vivir siempre arrodillado!"
    1. Re:How do you transcribe... by winkydink · · Score: 4, Funny

      I dunno. How many ports can you knock on with two bits?

      --

      "I'd rather be a lightning rod than a seismometer." -Ken Kesey

    2. Re:How do you transcribe... by trick-knee · · Score: 1

      "shave and a haircut" into port numbers?

      don't think it'd be useful because you could specify no more than four ports (or maybe just one of four ports). just two bits, you know.

    3. Re:How do you transcribe... by Dwedit · · Score: 2, Informative

      In QBASIC:

      s$ = "shave and a haircut"

      FOR i = 1 TO LEN(s$) STEP 2
      IF i LEN(s$) THEN
      PRINT ASC(MID$(s$, i, 1)) * 256 + ASC(MID$(s$, i + 1, 1))
      ELSE
      PRINT ASC(MID$(s$, i, 1))
      END IF
      NEXT

      Output:
      29544, 24950, 25888, 24942, 25632, 24864, 26721, 26994, 25461, 29544, 24950, 25888, 24942, 25632, 24864, 26721, 26994, 25461, 29544, 24950, 25888, 24942, 25632, 24864, 26721, 26994, 25461, 116

    4. Re:How do you transcribe... by Anonymous Coward · · Score: 2, Informative

      2093, 1568, 1568, 880, 988, 1568, the frequency of the pitch of the notes.

    5. Re:How do you transcribe... by Anonymous Coward · · Score: 0
      Can you help me modify DONKEY.BAS?

      I want to give the donkey junk that is liberally touchable.

    6. Re:How do you transcribe... by nacturation · · Score: 2, Funny

      I dunno. How many ports can you knock on with two bits?

      Four, of course!

      --
      Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
    7. Re:How do you transcribe... by Adriax · · Score: 1

      Before or after adjusting for inflation?
      Some servers are 64bit while the rest are still only 32 ya know.

      --
      I don't suffer from insanity, I enjoy every minute of it!
    8. Re:How do you transcribe... by Hanji · · Score: 4, Funny
      $perl -e 'print join(",",unpack("s*","shave and a haircut"))."\n"'
      29544,24950,25888,24942,25632,24 864,26721,26994,25461
      Q-BASIC, BAH
      --
      A Minesweeper clone that doesn't suck
    9. Re:How do you transcribe... by AuMatar · · Score: 1

      Sorry, you're stuck to 3. 0 is used by bind() to mean a random port.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    10. Re:How do you transcribe... by mark_space2001 · · Score: 1
      I dunno. How many ports can you knock on with two bits?

      Four.

    11. Re:How do you transcribe... by Anonymous Coward · · Score: 0

      Well, its gonna take a while, so you should go get a byte.

      >da-dum-cha!

      I know, news moves quickly on /. I tried.

    12. Re:How do you transcribe... by I+Like+Pudding · · Score: 0
      perl -e'print join(",",unpack("s*","shave and a haircut")),"\n"'
      Shorter, faster.
    13. Re:How do you transcribe... by Penguin · · Score: 1

      s* uses the machine byte order. You might want to specify big- or little-endian order, since the same code could give different results. Your code provides the following result on this system:

      $ perl -e 'print join(",",unpack("s*","shave and a haircut"))."\n"'
      26739,30305,8293,28257,8292,8289 ,24936,29289,30051

      Whereas:

      $ perl -e 'print join(",",unpack("n*","shave and a haircut"))."\n"'
      29544,24950,25888,24942,25632,24 864,26721,26994,25 461

      Or - just for the ickiness:
      $ php -r 'print join(",",unpack("n*","shave and a haircut"))."\n";'
      29544,24950,25888,24942,25632,2 4864,26721,26994,25 461 :)

      --
      - Peter Brodersen; professional nerd
    14. Re:How do you transcribe... by julesh · · Score: 2, Insightful

      Obviously network byte order (big endian) would be most sensible.

      Am I the only one who's noticed that these perl implementations all contain a bug which the original QBASIC one didn't - if there's an odd number of characters the last one is ignored, whereas it should really be counted somehow.

      Although the QBASIC implementation put it in the least significant byte; I'd be tempted to put it into the most significant byte, effectively padding the end of the string with an extra zero.

    15. Re:How do you transcribe... by maxwell+demon · · Score: 1

      That's simple:

      1115 1104 1097 1118 1101 1132 1097 1110 1100 1032 1097 1032 1104 1097 1105 1114 1099 1117 1116

      --
      The Tao of math: The numbers you can count are not the real numbers.
    16. Re:How do you transcribe... by Ginga_Ninja · · Score: 1
      damn sig

      so do I... and I don't know any programming languages

      --
      the future's bright, the future's ginger
    17. Re:How do you transcribe... by Hanji · · Score: 1

      Yeah, I noticed it when I wrote the first one, but when for the pretty one-liner over the correct version, which I didn't feel like figuring out. Kudos to you for realizing it :p

      --
      A Minesweeper clone that doesn't suck
  3. Re:Is this something worth persuing? by Anonymous Coward · · Score: 0, Funny

    Is pursuing something worth spelling correctly? also 'Yes'.

  4. Knock Knock by Anonymous Coward · · Score: 4, Funny

    You can keep on knockin' but ya can't come in

  5. Port to MIDI interface by Black+Art · · Score: 3, Funny

    So how do we map musical notes to port numbers?

    I want to get "shave and a haircut" ported over to the new protocol.

    --
    "Trademarks are the heraldry of the new feudalism."
    1. Re:Port to MIDI interface by Afrosheen · · Score: 1

      Um, start at the lowest key on the piano and assign it a 1. Assign the highest key the highest number. That's about it...start your port knocking transcriptions.

      Or if you're really bored you can transcribe each note into hex via an old commodore 64 with DMC music composition software or the excellent JCH composer. Convert that hex back to regular digits and those are your ports.

    2. Re:Port to MIDI interface by Anonymous Coward · · Score: 0

      So how do we map musical notes to port numbers?
      Um...Hertz?

    3. Re:Port to MIDI interface by Anonymous Coward · · Score: 1, Funny

      The new chicken-powered iMacs have this already built in!

    4. Re:Port to MIDI interface by Anonymous Coward · · Score: 0

      Um, I'll just reply with an "um" because it makes me sound clever.

    5. Re:Port to MIDI interface by Anonymous Coward · · Score: 0

      or better the them to close encounters

    6. Re:Port to MIDI interface by pacman+on+prozac · · Score: 1

      With d-midi :-)

    7. Re:Port to MIDI interface by illuin · · Score: 1

      Personally, I'm going for the theme Willy Wonka plays to summon the Oompa Loompas!

    8. Re:Port to MIDI interface by hesiod · · Score: 1

      Omlet? If I were setting up a website for people who wanted chickens as pets... I wouldn't name it after a meal consisting of their slaughtered unborn.

  6. Great for warez... by danielrm26 · · Score: 5, Interesting

    I can see this being used quite extensively in the warez arena. It'd be pretty easy to give out the "key" to clients who are allowed access, while any ISP scanning for FTP servers, for example, would find nothing open.

    --
    dmiessler.com -- grep understanding knowledge
    1. Re:Great for warez... by selfabuse · · Score: 2, Insightful

      Along the same lines, it would be useful to us non-warez folk that run servers at home that are for personal use, but have broadband that disallows servers in the AUP.

    2. Re:Great for warez... by caluml · · Score: 4, Informative

      I fear the ISP might just watch for large amounts of data spewing out on tcp/20.

    3. Re:Great for warez... by KingOfBLASH · · Score: 2, Insightful
      I can see this being used quite extensively in the warez arena. It'd be pretty easy to give out the "key" to clients who are allowed access, while any ISP scanning for FTP servers, for example, would find nothing open.

      <tongue in cheek>
      If you had an ISP that was port scanning for open FTP servers on port 20, why not just move your port to another port with well known use for home users, like 135?
      </tongue in cheek>

    4. Re:Great for warez... by Anonymous Coward · · Score: 0

      The Protocols (TCP/IP Illustrated, Volume 1) by Richard Stevens

      please read.

    5. Re:Great for warez... by Methuseus · · Score: 1

      Because 135 is blocked by the average ISP? Or isn't it? I haven't gone without a firewall for years...

      --
      Two things are infinite: the universe and human stupidity, though I'm not yet sure about the universe. - A Einstein
    6. Re:Great for warez... by Anonymous Coward · · Score: 0

      because anyone who is looking for ftp connections will try to connect to that port.

      To be honest... this is all a moot point as any real administrator will be looking at sniffer logs(see Ethereal post earlier) and will see the cleartext greets and logins regardless of how many ports you jump.

    7. Re:Great for warez... by gnu-generation-one · · Score: 2, Funny

      "I can see this being used quite extensively in the warez arena."

      Shhhh.... Don't mention the trojans.

    8. Re:Great for warez... by Tiberius_Fel · · Score: 1

      The ISP might not see anything as they wouldn't be able to connect to the server, but wouldn't they notice a large amount of traffic going in and out on FTP protocol?

      --
      Join the Empire! http://www.empirereborn.net/
    9. Re:Great for warez... by KingOfBLASH · · Score: 1

      135 isn't blocked, which is the reason so many windows viruses propogate through it (hence the tongue in cheek XML tags)

    10. Re:Great for warez... by afidel · · Score: 1

      So the smart warez traders will use scp AND port knocking =)

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    11. Re:Great for warez... by Black+Acid · · Score: 1

      Most topsites already require the client to identify with identd (port 113) before port 21 appears open. Similar to port knocking, but more standard.

    12. Re:Great for warez... by S.Lemmon · · Score: 2, Interesting

      Well, just running on a non-standard port is usually enough for that. Better still, why not just firewall off whatever source IP range your ISP runs scans from? Port will look closed to them, but open to everyone else.

      If, on the other hand, what you want is extra security - well, that's what strong encryption is for. Port knocking is more on the level of ROT13.

    13. Re:Great for warez... by MrRuslan · · Score: 1

      To avoid that many difrent ports could be set up for example you can knock on port 69 and it will redirect you to a random port on a port list.

    14. Re:Great for warez... by Anonymous Coward · · Score: 2, Interesting

      This is just a technicality, but if you knock on closed ports and shortly thereafter your home system opens a client connection to the ip which knocked, are you running a server?

    15. Re:Great for warez... by Dj · · Score: 3, Interesting

      Well with a little work, you could knock an open sequence, and then knock a sequence which had a port number, and then we open the requested port and start the server app up on that port. Tada! Secret knock port requesting. Now you can pick any port and spread the traffic over different ports over time.

      --
      "You know you want me baby!" - Crow T Robot
    16. Re:Great for warez... by Krunch · · Score: 1

      ISP could as well sniff traffic to find the "secret" knocking sequence. All they have to do is record the traffic and when they find some typical FTP traffic (on any port), they would just have to look at what was going between the two hosts before the FTP session started.

      --
      No GNU has been Hurd during the making of this comment.
    17. Re:Great for warez... by selfabuse · · Score: 1

      What I wound up doing is similar. The services that I run at home, are things I use from my office. (ssh in to a machine at my house, to test things from off my office network, stream my mp3s to my office, from mer server at home) so I slapped together a rule in my firewall so that only my office firewalls IP can connect to any ports I have mapped. I'd prefer port knocking though, so I could access everything from anywhere, and not have to worry about paying attention to what IPs comcast is hitting me from.

    18. Re:Great for warez... by Anonymous Coward · · Score: 0

      They have neither the time to do that or the legal authority to do that.

    19. Re:Great for warez... by revmoo · · Score: 2, Informative

      Incorrect.

      You connect first to the server, it then queries your machine on 113 to see if you are who you say you are and let you in(or not).

      How is a server supposed to know to ident you if the ftp port isn't open first?

      --
      I would expect such blatant racism on Fark, but on Slashdot? Mods please ban this asshole.
    20. Re:Great for warez... by Ctrl-Z · · Score: 2, Funny

      Time to file a patent.

      --
      www.timcoleman.com is a total waste of your time. Never go there.
    21. Re:Great for warez... by Ctrl-Z · · Score: 1

      But ... isn't this used for penetrating firewalls?

      --
      www.timcoleman.com is a total waste of your time. Never go there.
    22. Re:Great for warez... by shfted! · · Score: 1

      If using a knocking scheme, it would be trivial to pick a random port for data transfer, as part of the knock -- and every user/client could use a different one.

      --
      He who laughs last is stuck in a time dilation bubble.
    23. Re:Great for warez... by lommer · · Score: 2, Informative

      I think that ISPs could simply then start looking for seemingly random port probes by machine A on machine B, followed by machine B spewing gobs of data to machine A on a random port. That's the trick, make your protocol too good and it'll stand out because it's too random. If you ever actually talk to anyone who works at ISPs though, they generally just flag those customers with unbelievable upload/download ratios and then have a human look at their logs to see if they're violating the TOS (running a server, hosting warez, whatever).

    24. Re:Great for warez... by Krunch · · Score: 1

      If they can scan, why can't they sniff ?

      --
      No GNU has been Hurd during the making of this comment.
    25. Re:Great for warez... by Threni · · Score: 1

      > I fear the ISP might just watch for large amounts of data spewing out on tcp/20.

      Yeah. Large amounts of strongly-encrypted data.

    26. Re:Great for warez... by Short+Circuit · · Score: 1

      Other people have mentioned that this runs on UDP. What if you drop a packet? How do you know you need to start over?

    27. Re:Great for warez... by Short+Circuit · · Score: 1

      Indeed, a user's knocking sequence could serve as his identification.

    28. Re:Great for warez... by francium+de+neobie · · Score: 1

      There's no need for ISPs to look for a particular port - that's just a waste of time. Once they've noticed exccessive upstream traffic from you they know there's a problem.

      If there's any use of port knocking for the warez kids, it'd be that they dun want their pub ftp be scanned by some stupid lamers, who'd spend half an hour trying to brute force your ftp by hand.

    29. Re:Great for warez... by Delphis · · Score: 1

      I guess it would be like trying to unlock a door and the key was jammed, you'd realize it when you tried to connect and then re-try the 'unlock' sequence.

      --
      Delphis
    30. Re:Great for warez... by Methuseus · · Score: 1

      Thanks for clearing that up. You'd think that since so many block port 20 and the like that they'd include port 135.......

      --
      Two things are infinite: the universe and human stupidity, though I'm not yet sure about the universe. - A Einstein
    31. Re:Great for warez... by KingOfBLASH · · Score: 1

      You know it's interesting, many ISPs block 20 because it's in their best interest to do so, but because it isn't in their best interest to do so, they don't block 135. (At least, I'd assume that's why...although I think it would be in their best interest to do so, but then, why haven't they?)

    32. Re:Great for warez... by Short+Circuit · · Score: 1

      I'd compare it to having one the pins in the lock getting stuck in the wrong position. Unless you have a reset mechanism (such as a spring), you'll have to reset it manually.

    33. Re:Great for warez... by Black+Acid · · Score: 1

      A port doesn't have to be open for a program to take action upon incoming connection attempts to that port. Ever heard of firewall logs?

  7. Knock Knock? by qualico · · Score: 4, Informative

    Who's there?

    Just a bunch of hackers knocking with sequences they captured from sniffing.

    1. Re:Knock Knock? by DarkMan · · Score: 5, Insightful

      Meh, throw some cryptography into the mix.

      Take the source IP, add a password, take a one way hash. Include this hash in the knocking packets.

      Now, if you've sniffed the packets, then you won't know the password. So, you can spoof the source IP, in which case the port will be opened _for that IP only_, or you can send the knocking packets from you IP, in which case, you need that password, or you've just advertised yourself as a hacking attempt.

      In order to prevent a single password for everyone situation, it's not hard to include a user ID in the packets.

      Does need the application or firewall to allow connections to and from specific IP's only - but I really can't see that being an issue.

      Problem solved.

    2. Re:Knock Knock? by timeOday · · Score: 4, Informative

      Not unless they can get into a router on the path between you and someone valid who logged in, or the same ethernet segment.

    3. Re:Knock Knock? by brettbender · · Score: 2, Interesting

      This is a replay attack. So don't use a static (replayable) sequence of ports for the knock sequence. Instead, require a dynamic sequence that is a function of the current time.

    4. Re:Knock Knock? by Anonymous Coward · · Score: 0

      exactly. this is one remove from changing the well-known port.

    5. Re:Knock Knock? by Dark+Nexus · · Score: 1

      And then with the case of SSH, they still need the login info...

      Guess what, that adds an extra step they need to make! Slows them down at least, and weeds out a bit of the less intelligent ones.

      --
      Dark Nexus
      "Sanity is calming, but madness is more interesting."
    6. Re:Knock Knock? by Anonymous Coward · · Score: 1, Insightful

      Most people do't get why port nucking is a good thing. You use it so that when you want to keep your openssh from being find and hack you can. I want to be able to connect to my sshd and not worry about it being hacked with some buffer overflow. This is only useful anytime you want add an extra layer of security to your services well unless your a hacker then it can be good for backdoors. Once I setup a "Door" I no longer needed to wade through long logs off poeple trying to log into my box. This makes my life easier, smaller logs files to look through. It even once stop a freind of mine from logging into my home computer with the password he shoulder sniffed thanks to my handy "doorbell" perl script, of course he could have just used the doorpell post script. It is a great secruity tool, it is hover not the ultimate security tool, which is of course concert and lots of it.

    7. Re:Knock Knock? by Anonymous Coward · · Score: 4, Informative

      Encrypted port knocking is pointless. Here's why: Port knocking only makes sense if the protected system reacts to the individual knocks as if there was no port knocking system. Only when the knock sequence has been completed it opens the port. This means that you can't do any handshaking. All communication is one-way until it's "too late". Consequentially, since there is no challenge which could require a different response, replay attacks are unavoidable unless you use one-time passwords and then there's no point in encrypting the passwords.

      If you decide to send a challenge to the knocker, you could just as well use regular authentication over a TCP channel.

      The point of port knocking is to hide the existence of a regular channel, not to protect it from someone who knows that it's there. Someone who can sniff your packets is by definition already past that layer of protection, so any attempt to complicate the knock-layer will only increase the chance of creating another vulnerable interface. Keep it simple or don't do it.

    8. Re:Knock Knock? by tonywong · · Score: 5, Interesting

      It gets better than that. Just imagine a honeypot connection for people who don't port knock. That way there is a better measure of security through obscurity since non-port knockers believe that they're actually getting through the systems' defense layers.

    9. Re:Knock Knock? by Anonymous Coward · · Score: 0

      How is the communication one way only? Shouldn't any box be expected to be kicking back resets to any "knock" unless it's firewalled?

      Source IP + IP id + HMAC would yield reasonable reply protection with a low possibility of detecting the shake, I'd think.

    10. Re:Knock Knock? by Mad_Rain · · Score: 1

      Hhmmmm... I wonder when something like nmap will start attempting to do port-knocking to scan for open ports?

      --
      "What do you think?" "I think 'What, do you think?!'"
    11. Re:Knock Knock? by Anonymous Coward · · Score: 0

      Err, on second thought, it is kinda redundant.

      It's pretty much like having two passwords (the shared secret and the port knock sequence) as opposed to one (the knock sequence).

    12. Re:Knock Knock? by georgewilliamherbert · · Score: 1
      This is a replay attack. So don't use a static (replayable) sequence of ports for the knock sequence. Instead, require a dynamic sequence that is a function of the current time.
      Such as a SecurID key fob.

      Lots of variations possible.

    13. Re:Knock Knock? by maestro371 · · Score: 1

      Have the knocked system generate an SMS to a mobile phone with a one time password after one set of knocks. Then use that password in the payload of the packets of a second knock. Expire the password if it's not used in a specific timeframe. Easy.

    14. Re:Knock Knock? by Anonymous Coward · · Score: 0

      nmap supports port knocking now! You just have to specify the port numbers manually.
      Now where did I put my powers of 65536 tables...

  8. Multiple kocks by TheJavaGuy · · Score: 0, Redundant

    I am not that familiar with port knocking, but what if multiple attempts from the same IP are made to access the port at the same time, Would the knocks then get all mixed up?

    --
    Opera Watch - An Opera browser blog.
    1. Re:Multiple kocks by aWalrus · · Score: 3, Informative

      Well, the knocks do come from the same IP, so this thing just needs to be able to see that to filter different knock sequences, I guess.

      --
      Overcaffeinated. Angry geeks.
    2. Re:Multiple kocks by fortunatus · · Score: 1

      good idea!

      in any case, some mix-up will be inevitable, just like packet collisions on a network can happen. same algoriths (random wait & retry) will be used.

    3. Re:Multiple kocks by Fiz+Ocelot · · Score: 1
      It would be interesting to have an implementation that required knocks in sequence from a particular set of IPs.

      Say you needed a specific knock sequence from two specific IPs: Those two knock giving access to one of them, while in that process false knocks can be sent in case anyone is monitoring packets being sent to the server.

      so even if you did manage to see what was going on, it would be difficult to figure it out if it involved something like 4 IPs giving dummy sequences.

    4. Re:Multiple kocks by JPriest · · Score: 3, Informative

      The nimrod that modded this as insightful need to go back and read TCP/IP for dummies. They knock from different IP addresses, and even in situations where 2 hosts are knocking from the same IP (behind NAT) you still have a different source port.

      --
      Saying Java is nice because it works on all OS's is like saying that anal sex is nice because it works on all genders.
    5. Re:Multiple kocks by qualico · · Score: 1

      "Multiple kocks"
      Sounds like something for Bangedup.com :->

    6. Re:Multiple kocks by Anonymous Coward · · Score: 0

      knock my bitchx up...knock my bitchx up

  9. Port Knocking Needed by SeinJunkie · · Score: 2, Interesting
    I believe this technology is needed to be pursued greatly. The unwanted traffic that anybody running a website or FTP server sees generated everyday in his server logs is enough to make port knocking a necessity.

    I wonder though. If port knocking is to become popular, will it be able to work through all of the blocked ports resulting from the excessive worm attacks?

    1. Re:Port Knocking Needed by Anonymous Coward · · Score: 0

      Sure - Then you'll see worms that perform port knocking...

      Then how do you determine which is a legitimate knock?

    2. Re:Port Knocking Needed by kir · · Score: 4, Informative

      Worms port knocking? That would be one very very very slow moving worm!

      Remember. There are 65535 different ports available. So, given that you can repeat port numbers and one uses a 4 port "combination", you get this.

      65535^4 = 18,445,618,199,572,250,625 different "combinations"

      I'm not even sure how to read that, but I doubt a worm would try it. It might take it a while.

      --
      3cx.org - A truly bad website.
    3. Re:Port Knocking Needed by teachinggeek · · Score: 1

      Eighteen quintillion, four hundred forty five quadrillion, six hundred eighteen trillion, one hundred ninety nine billion, five hundred seventy two million, two hundred fifty thousand, six hundred and twenty five.

      I will have to remember this number when I teach combinations to my Algebra II students in three weeks!

    4. Re:Port Knocking Needed by kir · · Score: 1

      Now that was insightful!

      No mod points for you though. I'm all out. Sorry.

      --
      3cx.org - A truly bad website.
    5. Re:Port Knocking Needed by kir · · Score: 1

      err... I mean informative.

      Damn... I hate when I do that.

      --
      3cx.org - A truly bad website.
  10. old by ozric99 · · Score: 5, Funny
    When the server detects a specific sequence of port-hits, it runs a command defined in its configuration file. This can be used to open up holes in a firewall for quick access.

    pfft, XP has had this for ages....

    1. Re:old by Anonymous Coward · · Score: 0

      Really? Name one security hole in the XP firewall?

    2. Re:old by Anonymous Coward · · Score: 0

      It's off by default?

    3. Re:old by Anonymous Coward · · Score: 0

      That is not a security hole in the firewall. A bad decision, yes. But not a security hole. Also SP2 fixes this.

    4. Re:old by Adriax · · Score: 1

      What about the passthrough holes it created when you use ICS? Delete them all you want, they'll just reopen themselves.

      --
      I don't suffer from insanity, I enjoy every minute of it!
    5. Re:old by WhatAmIDoingHere · · Score: 1

      It was originally ON by default. ^_^

      --
      Not a Twitter sockpuppet... but I wish I was.
    6. Re:old by mrmez · · Score: 1

      No, XP is much friendlier than knocking. On XP the door is wide open and XP waves hackers welcome and says "please join in."

    7. Re:old by Anonymous Coward · · Score: 0

      It activates AFTER bringing the network interfaces up, which means there is a short period of vulnerability every time you boot you computer. (Length dependant on computer speed.) Hard for a cracker to exploit, but if your network is full of Blaster...

  11. ISP Port-Scanning by ckswift · · Score: 5, Insightful

    This might be useful when ISPs routinely port-scan their subscribers to discover if their running services in violation of their TOS.
    This will allow your computer to appear not to be running services expect to the person who knows the magic knock.

    1. Re:ISP Port-Scanning by Anonymous Coward · · Score: 0

      I thought about that when this first came out. I thought it would be great to hide my server from my ISP. Problem is that if you have the resources to generate knocks in a specific port sequence at a specific timing, then you probably have the resources to just run a VPN. I use OpenVPN, which routs all its data in a simple stream of UDP packets that wash out amidst all the other UDP noise on the wire; unlike IPSEC and PPTP, which use a reserved protocol that sticks out like a sore thumb. (my ISP used to ban VPN's on residential accounts as a way to sell more business accounts.)

    2. Re:ISP Port-Scanning by meme_police · · Score: 2, Informative

      That would be a benefit. Those using port-knocking for extra security are misguided, though.

      --

      The meme police, They live inside of my head

    3. Re:ISP Port-Scanning by Vancorps · · Score: 1

      Definitely, it is purely a layer of obscurity, not security. A very nice benefit though.

    4. Re:ISP Port-Scanning by Anonymous Coward · · Score: 0

      I don't think this will work - if the ISP really cares about people running warez ftp servers, they'll be monitoring traffic on the network anyway, so as soon as you start streaming data across tcp/20, you'll be spotted.

    5. Re:ISP Port-Scanning by Wonko · · Score: 1

      Definitely, it is purely a layer of obscurity, not security. A very nice benefit though.

      It is only a layer of obscurity if you have a static knocking sequence. Why not implement a rolling sequence of ports for the knock? Since each port is 16 bits, you could have quite a few combinations in just a few ports.

      And if you blacklist addresses with a handful of failed attempts, it would be pretty hard to break through.

    6. Re:ISP Port-Scanning by kir · · Score: 1

      Those using port-knocking for extra security are misguided, though.

      Why are they misguided? What is wrong with a little added security? Security through obscurity has its place when mixed conservatively with proven security practices.

      Port knocking to get connected to a service (i.e. an ssh server), which then requires its own authentication (key, passwd, etc.), is far from misguided. In fact, port knocking appears to be an excellent way of protecting automated attacks against vulnerable services. Do you really think a worm would try to port knock every possible four port permutation on adsl-1.2.3.4.someisp.net just to see if a service is listening on port x? NO WAY!

      --
      3cx.org - A truly bad website.
    7. Re:ISP Port-Scanning by Vancorps · · Score: 1
      I agree it could be made into a layer of security. It is promising technology since you could conceivably use certificates or some other digital signature as a private key and use the it to generate a proper knock sequence. If PKI gets added to the mix the passknock would change every session.

      This is just a proof of concept implementation. When we review one that is a commercial implementation my opinion will change.

    8. Re:ISP Port-Scanning by FLEB · · Score: 1

      Actually, this leads to a good idea... A "freakout" mode if your box thinks it's getting portscanned. Once a certain number or sequence of ports gets hit, it just goes total lockup for, say, 5 or 10 minutes (unless you knock the "unfreakout" sequence?). Combine this with using nonstandard ports, and you'd have a pretty good chance of surviving a portscan.

      (Shoot idea full of holes... now.)

      --
      Information wants to be free.
      Entertainment wants to be paid.
      You just want to be cheap.
    9. Re:ISP Port-Scanning by Anonymous Coward · · Score: 0

      Yup, kinda like how passwords are purely a layer of obscurity, not security. I think.

    10. Re:ISP Port-Scanning by evilviper · · Score: 1
      Port knocking to get connected to a service (i.e. an ssh server), which then requires its own authentication (key, passwd, etc.), is far from misguided.

      There's no need for port-knocking at all. Just run SSH on a different port than normal. That will stop all the worms and non-determined attackers.

      Besides, there are far better ways, that will be less easily discovered, and less likely to be thwarted by a secured firewall. You could just have netcat running on a port, and only open up the SSH port to connections if you send it the right password.

      Just think, you have just as much security, little chance that a firewall will screw things up, and no need to CONSTANTLY monitor ALL traffic at the link-layer. Less susceptible to DoS attacks, much more simple, and no need for special software on every machine you want to use to remotely log-in (you just need telnet and SSH).
      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    11. Re:ISP Port-Scanning by alehmann · · Score: 1

      Because it would be better to better to implement that in the protocol. Knocking on ports is a silly way to do a secure authentication handshake. It has more overhead than sending data over a normal connection - you'd have to open dozens of connections just to transfer a few bytes. Firewalls would totally screw it up. And ultimately, it's no more secure than, say, SSH, SSH tunneling, SSL, or IPSec. Sure, some implementations of these may have undiscovered security holes, but whatever handles the port knocking has an equal chance of them.

      Also, a port-knocking-based handshake will not automatically encrypt your session, which is essential if you care about security. Not only that, but it seems like it would be highly vulnerable to man-in-the-middle attacks.

    12. Re:ISP Port-Scanning by zyridium · · Score: 1

      Unless you use an awesome knocking sequence....

      1001, 1002, 1003

    13. Re:ISP Port-Scanning by jhoffoss · · Score: 1
      I disagree. While this isn't the most secure solution, and a static sequence could be sniffed and used, this provides no more or no less security than a password does, which for things like POP/IMAP, can be acquired through sniffing as well.

      n^65564 provides a pretty good amount of variation, for a port sequence of length n. Want it even more secure? Specify special packets on certain ports. For example, ACK on 874, FIN on 9283, SYN+ACK on 29833, RSET w/fragment set on 9843.

      Just an idea, but defintely more secure than just leaving FTP there, waiting to be brute-forced.

      --
      Linux: The world's best text-adventure game.
    14. Re:ISP Port-Scanning by jhoffoss · · Score: 1

      How is a series of ports not security? It's a combination. Do you really believe this provides zero security? When you lock a gym locker with a master lock, is the combination on that nothing but obscurity? Of course the lock can be cut, but there's still a degree of security provided there.

      --
      Linux: The world's best text-adventure game.
    15. Re:ISP Port-Scanning by Anonymous Coward · · Score: 0

      Rather than thinking of this as a "secret sequence" I think it makes sense to think of it as a way to expand your port space. Adding a single knock means the scanner has to probe 2^32 rather than 2^16 ports. How long does it take to probe 4 billion ports? 300 trillion?

      So, beyond the increased "security" I now have the ability to provide a unique port to each of the million services that I like to run on my 386-25.

      Ok...maybe I wouldn't use that feature, but I do think like the idea of slowing down scanners.

    16. Re:ISP Port-Scanning by Vancorps · · Score: 1

      Security inherently relies on something being obscured. The goal is to make it as difficult as possible to find the obscured material. Unless the knock sequence changes per session its nothing that couldn't be recorded. For a great number of people this is a completely unnecessary service but for those that don't want to publicly serve it is a great tool.

  12. Fyodor must be busy... by stevens · · Score: 5, Insightful

    I'm betting that nmap binary is about to get much bigger...

    1. Re:Fyodor must be busy... by commonloon · · Score: 0

      Not to mention our snort logs.

    2. Re:Fyodor must be busy... by Anonymous Coward · · Score: 0

      I'll be sure to delete your snort logs when I own your box with yet another snort exploit (YASE).

  13. Port knocking not exactly a new idea.. by morelife · · Score: 3, Funny

    The port knocking idea is pretty old.. at least for months now all kinds of people are knocking my 135 1433 3127 and a bunch of others to DEATH, like hundreds a day, trying to get in..

    Oops, that's Microsoft port knocking.. never mind, sorry, I guess it is new to Unix..

  14. Knock Knock by Anonymous Coward · · Score: 5, Funny

    Who's there?

    Packet.

    Packet who?

    Packet up bitch, you've been hacked.

  15. If this box is rock'n... by stephenisu · · Score: 1, Funny

    Don't come a knockin'

    --
    Sigs? We don't need no stinking sigs!
  16. how long till... by Anonymous Coward · · Score: 5, Interesting

    till we see virus/worms that install port knocked backdoors.

    'virus x appears to open up 200 ports for no real reason, but it also has some remote desktop code in there too opened on a firewalled port....'

    1. Re:how long till... by jg_elliott · · Score: 2, Informative

      I may be wrong, but I was under the impression that all knocked ports were closed and a cron job watched logs, and then opened a port if it noticed the correct knock. This is great for linux, were things are logged, but does windows have a loging facility of this kind? If not, the ports must be open for a program to know if someone has tried to connnect, which defeats the point. With most trojans being on windows, it seems that this isn't a viable feature to add.

    2. Re:how long till... by hank · · Score: 2, Informative

      As I understand it, the ports do not have to be open. You can listen on the link-level and monitor incoming packets even if the port is closed.

      At least, this is how the implementation this article mentions does it (or advertises it does). I've yet to thumb through the code.

    3. Re:how long till... by dfn_deux · · Score: 1

      Uhm.. ports are a protocol feature and as such cannot be used at link level...

      --
      -*The above statement is printed entirely on recycled electrons*-
    4. Re:how long till... by hank · · Score: 2, Informative

      "This port need not be open -- since knockd listens at the link-layer level, it sees all traffic even if it's destined for a closed port." This is from the page of the implementation this article is about.

      Also, the first sentence from portknocking.org: "Port knocking is a method of establishing a connection to a networked computer that has no open ports." A little further down on the page: "This is a form of IP over closed ports."

      Also, you may wish to read the FAQ: http://www.portknocking.org/view/faq.

    5. Re:how long till... by arkanes · · Score: 1

      The terminology is not technically correct, but the idea is - you can analyze the packet and determine the port BEFORE normal protocol behavior occurs.

    6. Re:how long till... by xsbellx · · Score: 2, Informative

      You are quite correct, ports are not used at the link level, however once the packet is received by the adapter it is processed by a software stack.

      There are several products that implement similar concepts. Take a look at bridging firewalls. Neither interface on the bridge has an IP address but can still inspect packets and take action as required.

      --
      If VISTA is the answer, you didn't understand the question
    7. Re:how long till... by KaiLoi · · Score: 0

      Nah the ports are closed... you just log connection attempts to those ports and the daemon (the one I have) trolls through the logs for the connection attempts.

      The command I use is

      iptables -A INPUT -d 203.109.158.50 -p tcp -m tcp --dport 745:1000 -j LOG works sweet and no open ports.

    8. Re:how long till... by Anonymous Coward · · Score: 0

      This already exists, look up cd00r by phenoelit, or sadoor by darklab. Those are public, I also am aware of a private worm for linux that uses this. It also uses different combinations to send messages between bots.

    9. Re:how long till... by Magada · · Score: 0

      There already are such viruses. Actually, most (successful) viruses we've seen this year drop a backdoor component which can only be called into action by "port knocking".

      --
      Something bad is coming when people are suddenly anxious to tell the truth.
    10. Re:how long till... by julesh · · Score: 1

      This is great for linux, were things are logged, but does windows have a loging facility of this kind?

      Yes, Windows (NT family) has logging that is about as good as linux's.

      My concern would be more along the lines that I suspect a raw socket interface is required to implement this, which AFAIK windows doesn't support, so its going to stay a Unix-only feature for the time being.

    11. Re:how long till... by jhoffoss · · Score: 1
      Don't forget that while Windows (and Linux) log this, how many Windows users check their logs?

      Would WinPCap provide this facility? I know it doesn't get as low-level as you can in Linux, but just a thought.

      --
      Linux: The world's best text-adventure game.
    12. Re:how long till... by ripcrd · · Score: 1
      Apparently SucKIT does this: http://la-samhna.de/library/rootkits/list.html
      SucKIT is a rootkit presented in Phrack issue 58, article 0x07 ("Linux on-the-fly kernel patching without LKM", by sd & devik). This is a fully working rootkit that is loaded through /dev/kmem (i.e. it does not need a kernel with support for loadable kernel modules. It provides a password protected remote access connect-back shell initiated by a spoofed packet (bypassing most of firewall configurations), and can hide processes, files and connections.
      --
      --Somewhere there is a village missing an idiot.
  17. Re:Knock Knock by Anonymous Coward · · Score: 0

    I just hope nobody knocks up my server

  18. authpf? by m0rph3us0 · · Score: 4, Interesting

    Why use port knocking. It is no more secure than plain-text passwords. Use authpf. authpf can be set as the shell so when a user logs in authpf just changes the firewall rules.

    1. Re:authpf? by smcavoy · · Score: 5, Insightful

      passwords and port knocking are two different things.
      A perfect example of what it could allow to be done is on knockd's homepage.
      Basically, ssh would not be an open port, you'd have to knock (connect to) the right sequence of ports, which would trigger a rule that could allow only the IP that made the successful knock, access to the ssh port.
      Then when your done you would have another sequence of ports you'd have to "knock" in order to remove the rule allowing access.

    2. Re:authpf? by meme_police · · Score: 1

      Great idea but not very portable.

      --

      The meme police, They live inside of my head

    3. Re:authpf? by Anonymous Coward · · Score: 1, Insightful

      So using port knocking to open up ssh to you can login is no more secure than plain-text passwords? DAMNIT.

    4. Re:authpf? by debrain · · Score: 2, Interesting

      Why use port knocking. It is no more secure than plain-text passwords. Use authpf. authpf can be set as the shell so when a user logs in authpf just changes the firewall rules.

      I'm not sure that authpf corresponds to port-knocking's subject-matter.

      You can make port-knocking more "secure" than encryption; you can use a time-synchronized one-time pad to construct and vary the ports, flags, TCP options, sequence, etc., to come up with a system both unique and impossible to duplicate, absent the one-time pad.

      As one-time pads are provably secure, you can create a system that bars or ignores all communication except the effectively random knock that unlocks the door.

    5. Re:authpf? by Ieshan · · Score: 1

      The parent is suggesting that sending the "knock" is no more secure than sending the password over plaintext, since anyone sniffing can easily sniff out and reproduce the "knock" as well.

    6. Re:authpf? by Anonymous Coward · · Score: 0

      This implementation of Port Knocking is no more secure than passwords.

      If you look at the original implementation you would see that payload is encrypted, then mapped to a range of ports.

      http://www.portknocking.org

    7. Re:authpf? by Erratio · · Score: 1

      That's what I was thinking. It shouldn't be depended on as any kind of security measure, but more of just thin cloak to make the existing security measures not horribly obvious. If you were connected through SSH though...would you really need to knock to remove access or might it not be easier to just write something to automatically remove the rule on logout, or after a login timeout.

      --
      I don't try to be right, I just try to make people think
    8. Re:authpf? by fortunatus · · Score: 1

      i tend to agree with m0rph3us0. but the password alphabet is bigger: consider port number a symbol, and delay between knocks a symbol. a letter is then the two symbols together: (#,t). so there are |#| * |t| letters, probably more than 36...

      (or count words with alternating symbol types)

    9. Re:authpf? by Welsh+Dwarf · · Score: 2

      Yes, but if you have to knock to get to the server, and then you have to authentificate (aka through ssh) you have an extra layer.

      --
      Ask 8 slackers a question, get 10 awnsers (a citation, but I can't remember from who)
    10. Re:authpf? by kiltedtaco · · Score: 1

      The security of a one time pad comes from the fact that the attacker cannot determine when they've sucessfuly decrypted the message. To use a binary example:

      Message:0101
      Key :1010
      XOR: 1111

      Now if an attacker might randomly guess that key, but they have no way to determine if 0101 is the message or if the key is 1001 is the key and 0110 is the message. With port knocking, when they've found the right combination, there'll be a distinguishable response: a new port will be opened. This allows the attacker to simply try every possible combination, and then see which causes the port to open.

    11. Re:authpf? by Anonymous Coward · · Score: 0

      this is how I do it, after the nock, which done with a perl script that looks at dmesg and firewall rules that log to dmesg. (I even have a nocking script or doorbell if you will.) The door script adds a rule to allow 4 new(--state new) ssh connections from the ip that did the nocking. It deletes this rule after 2 minunites.(yes this is slack security, but I sometimes don't get the password right on the first try.) which means that I don't have to have the service open the whole time I am logged in.

    12. Re:authpf? by JustinXB · · Score: 1
      I guess you don't know what authpf is. Authpf uses SSH, only when a user authenticates to the firewall authpf is running on, it will open the ports the user need instead of providing them with a shell. When they disconnect from SSH/authpf, the ports are closed again.

      I believe both are cool things to use.

    13. Re:authpf? by Anonymous Coward · · Score: 0

      Very true, but a one-time pad still remains the most secure password method possible. Even though you know when you have succeeded, the search is still 100% random with no hints. That's second best to unbreakable.

    14. Re:authpf? by debrain · · Score: 4, Informative

      The usable alphabet for a suicide TCP packet header is, I do believe, in bits:
      16: dest. port
      16: src port
      32: seq id
      6: flags
      16: window
      16: urgent
      40: options
      That gives us an alphabet 2^142 ~= 5.6 * 10^42. Not to mention that a sequence of packets can be combined, extending the language. Indeed, its cardinality is a natural ordinal, so the same as any password, if not more, by virtue of passwords being limited by an input buffer.

      Knocking need only finite state between packets, simply indicating a status of "last packet correct knock?"; successive knocking therein is in a cardinality greater than passwords. Knocking can happen over a period of months (as I have seen it), and be virtually undetectable for all but the most sophisticted (ie. expensive) means of detection.

      In combination with a time-synchronized one-time pad, you can generate an unrepeatable, provably (in the mathematical sense) secure system of access or commands. For example, for the minute of 13:01 EST, there can be a specific TCP packet, or series of packets that unlocks the door or executes a command. At no other predictable time would this knock be useful. (Time synchronization here is an issue, but often this attack will be used on machines that do care about an atomic clock sync).

      You can do the same thing with a password over SSH, but that's higher level, using more complex code, and inherently more likely to succumb to high-level assaults such as buffer overflows, as well as mathematical assaults on the encryption itself, both of which fundamentally compromise the system's security.

      In short, time-synchronized knocking is safer, simpler, and smarter than passwords or encryption for a certain number of niche applications.

    15. Re:authpf? by IMarvinTPA · · Score: 1

      With 4 ports key, you have a possible set of 18445618199572250625 knock combinations.
      If this is another layer before something like ssh, you have protected the sshd from exploits unless the attacker knows your knock pattern. I doubt many worms will attempt knocking.
      The number gets bigger with 5 ports key.

      It is like putting a simon says on your outer door, with a normal key lock door inside before entering your house.

      IMarv

    16. Re:authpf? by Martin+Blank · · Score: 1

      Some quick math, which may be more or less accurate...

      With 65,535 usable port numbers, a three-second range, and an eight-port sequence, there are 2.2 x 10^42 possible combinations. Depending on the max range of time between knocks which would define the minimum and maximum times for a sequence to complete, that gives about 7.4 * 10^35 years to go through half of the possible combinations (from a single IP address).

      Wow.

      --
      You can never go home again... but I guess you can shop there.
    17. Re:authpf? by Anonymous Coward · · Score: 0

      If all you want is another layer, just hack ssh to ask for two passwords.

    18. Re:authpf? by MoogMan · · Score: 1

      Of course, if ssh is as secure as it says, then it renders port knocking a little useless. I think thats what the parent is trying to get at.

    19. Re:authpf? by Anonymous Coward · · Score: 0

      If you can sniff the knock, you already know that an sshd is waiting. Then it's just another layer of authentication. Now tell me, do you think you can write software that performs non-trivial authentication and has a lower chance of being exploitable than sshd? Port knocking is not meant to protect against sniffers. They already see what you're trying to hide.

    20. Re:authpf? by Krunch · · Score: 1

      That's not really different from one-time clear-text passwords.

      --
      No GNU has been Hurd during the making of this comment.
    21. Re:authpf? by bergeron76 · · Score: 1

      Why have a rule to "close" the port when you're finished? After the port is open, configure it to close on disconnect. p00f, a one way door.

      In this way, you don't have to worry about closing the door behind you.

      --
      Don't think that a small group of dedicated individuals can't change the world. It's the only thing that ever has.
    22. Re:authpf? by wfberg · · Score: 1


      You can do the same thing with a password over SSH, but that's higher level, using more complex code, and inherently more likely to succumb to high-level assaults such as buffer overflows, as well as mathematical assaults on the encryption itself, both of which fundamentally compromise the system's security.

      In short, time-synchronized knocking is safer, simpler, and smarter than passwords or encryption for a certain number of niche applications.


      Port knocking can only do authentication, so you'd still need encryption of the payload - that part of SSH is not replaced.

      You could also just as easily use a one time password (yes even off of a one time pad) using SSH. There's nothing in SSH to prevent that, in fact, it can use pluggable authentication modules.

      Port knocking is swell because it can totally disguise the fact that you're listening for incoming connections, and that's something ssh can't do.

      If you used port knocking with a static sequence which then just fires up ssh(d), you'd be just as secure from an authentication viewpoint, and you'd have portknocking to hide the fact you're listening for incoming connections.

      Nothing other than coolness makes portknocking more secure than any other one-time-password scheme based on the same underlying password-generating technology (e.g. one-time-pad or a prng or whatever).

      --
      SCO employee? Check out the bounty
    23. Re:authpf? by Anonymous Coward · · Score: 0

      since anyone sniffing can easily sniff out and reproduce the "knock" as well.

      And where is it written in stone that the knock sequence has to be fixed?

    24. Re:authpf? by debrain · · Score: 1

      Port knocking is swell because it can totally disguise the fact that you're listening for incoming connections, and that's something ssh can't do.

      And

      Nothing other than coolness makes portknocking more secure than any other one-time-password scheme based on the same underlying password-generating technology (e.g. one-time-pad or a prng or whatever).

      are in opposition, I think. The prior indicates a stenographic capacity: plausible deniability of even the existence of commands or access. Stenography, or on a policy level plausible deniability, is a form of security.

      You are correct in asserting that a certain aspect of "security" is no greater, that being the actual breakability of the sequence down into its original command is no greater for knocking time-synchronized one-time pads than any other one-time pad. I would counter with the above, that "security" may include this plausibility deniability, which is enchanced over TCP/IP through this particular method, opposed to verifiable and traceable socket connections.

      There are other values, as well. One is not requiring the establishment of a TCP connection itself, which presents the possiblity of untraceable packets, providing anonymity for the command sender. It also permits the listener to be anonymous if it is merely sniffing. (With the recent Cisco hacks, this is all the more deleterious) Thus there can be completely blind communication. Mind you, broadcasting TCP is tricky, often requiring "access" to a router, and the destination, or destination network is almost always visible, but the sender can certainly remain effectively anonymous.

    25. Re:authpf? by starbirdman · · Score: 1

      Great one!

    26. Re:authpf? by Anonymous Coward · · Score: 0
      You could also just as easily use a one time password (yes even off of a one time pad) using SSH. There's nothing in SSH to prevent that, in fact, it can use pluggable authentication modules.

      Port knocking can protect you from bugs in ssh, something ssh has a harder time doing. Example: A buffer overflow reached before the one time password is read.

    27. Re:authpf? by evilviper · · Score: 1
      You can make port-knocking more "secure" than encryption; you can use a time-synchronized one-time pad

      OR, you could just make a patch to SSH that allows authentication via a time-sync, one-time-pad.

      Obviously, the fact that it doesn't exist says something about how useful it is in the real world.

      You'd be much better off using simple public-key+password authentication.

      There's many other issues beyond just that, but I'm getting really annoyed of repeating myself over and over on this subject.
      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    28. Re:authpf? by wfberg · · Score: 1
      Port knocking is swell because it can totally disguise the fact that you're listening for incoming connections, and that's something ssh can't do.

      And

      Nothing other than coolness makes portknocking more secure than any other one-time-password scheme based on the same underlying password-generating technology (e.g. one-time-pad or a prng or whatever).

      are in opposition, I think.


      Taken out of context, sure they are! Congratulations, you must be the first person ever to take quotes out of context to "prove" a point.

      Nothing other than coolness makes portknocking more secure for authentication. Which is what the original post went to great lengths to purport. Because, yeah, only portknocking could ever use a one-time-pad password scheme, yeah..

      One is not requiring the establishment of a TCP connection itself, which presents the possiblity of untraceable packets, providing anonymity for the command sender.

      No. Packets are packets, whether they're part of a connection or not. If you think portknocking is used, it's even easier to detect, because you can just throw out all the packets that are part of a connection (or query/response pairs from UDP protocols like DNS).

      It also permits the listener to be anonymous if it is merely sniffing.
      When you're sniffing you're anonymous by definition (unless your sniffing implementation gives you away to tools like anti-sniff). Not a feature of portknocking. And sniffing is relatively hard/risky.

      Thus there can be completely blind communication.
      Well.. No?

      You use some mighty big words, but seem to be.. well.. confused.
      --
      SCO employee? Check out the bounty
    29. Re:authpf? by debrain · · Score: 1

      Sorry; it didn't seem out of context to me. I took your whole comment to reflect on the holistic security of port-knocking, not just authentication.

      No. Packets are packets, whether they're part of a connection or not. If you think portknocking is used, it's even easier to detect, because you can just throw out all the packets that are part of a connection (or query/response pairs from UDP protocols like DNS).

      That's an O(n) problem for TCP; keeping track of connections requires a stack for every connection. On even a reasonably sized network: impossible. There are pseudo-connection stacks, but they are nevertheless O(n) and inherently incomplete.

      There are packets that are 'impossible', but I don't remember what percentage of the flag-set they constitute, and you can look for them, but if it's being sniffed, you still need not know where it came from or what it is doing.

      When you're sniffing you're anonymous by definition (unless your sniffing implementation gives you away to tools like anti-sniff). Not a feature of portknocking. And sniffing is relatively hard/risky.

      Anonymous might not be the correct term - 'transparent' seems more appropriate. You do concur in the difficulty of sniffing, absent a span port on a router. If you control sophisticated routers, it is relatively easy, mind.

    30. Re:authpf? by Anonymous Coward · · Score: 0

      There's many other issues beyond just that, but I'm getting really annoyed of repeating myself over and over on this subject.

      Perhaps you'd be better of spending the time thinking about why this is valuable as opposed to trolling slashdot with repeated unsubstantiated opinion?

      You'd be much better off using simple public-key+password authentication.

      Do you have any idea what requirements I have? No. Perhaps you should ask, before you impose your arbitrary beliefs.

      Two technical points: ssh is complex, and most implementations have suffered multiple root exploits. They will continue to. Second, ssh rests on encryption, which saving one-time-pads, may have fundamental flaws that undermine your security.

      One-time-pads and knocking, as is stated numerious time elsewhere:
      * are simpler and lower level so less likely to suffer exploits,
      * require a constant sized state for infinite sized authentication (as opposed to constant sized authentication for passwords and keys),
      * are clandestince and potentially transparent on both ends, and
      * are plausibly deniable communication.

    31. Re:authpf? by Firehawke · · Score: 1

      That's why you have it blackhole the IP for a period of time if the sequence is incorrect after.. oh.. three tries. If you're not dead on, you'll still get another shot at it, but active attacks would be ignored.

    32. Re:authpf? by jhoffoss · · Score: 1

      But the security of an OTP, as you touch on, is lost once the key is discovered. That's why a OTP is ONLY truly secure when used ONCE. So, say you have a six-port knock sequence, and you generate a long string of ports that makes up your OTP, and you print a copy out fo ryou to use. Then, every six ports that are knocked, you change your sequence. But this would screw you if someone was attempting to brute-force your server and then you try to connect, so bad idea. Instead, once the correct sequence is input, you have ten seconds or something to connect to the ultimate destination port. This, I suppose would be susceptible to DoS attacks as well, but more feasible, as your attacker would probably never actually brute force the first sequence, (65564 ports, length-n sequence, n^65564 combinations) let alone all the sequences in your OTP. Or use a time-based sequence. Or, as someone else mentioned, you black-list after a few attempts.

      --
      Linux: The world's best text-adventure game.
    33. Re:authpf? by meme_police · · Score: 1

      And what if knockd has an exploit? Obscurity is fine but at some level you have to have something that you trust. And even given SSH's past exploits I'll trust it more than adding some unknown daemon in front of it.

      --

      The meme police, They live inside of my head

    34. Re:authpf? by chgros · · Score: 1

      Stenography
      I guess you mean steganography.

    35. Re:authpf? by strobert · · Score: 1

      you don't have to knock to close it. simply have your FW allow through established TCP sessions only always, then have the knock open a hole (for say 60 seconds from the specific IP that knocked) to do a TCP session init (AKA syn flag set)

      I haven't thought through all of the implications of the above, but what popped up off the top of my head.

  19. knock-knock by after · · Score: 3, Interesting
    That server is about to get more knocks then it can handle, its starting to get pretty slow loading for me.

    knockd is a port-knock server. It listens to all traffic on an ethernet interface, looking for special "knock" sequences of port-hits. A client makes these port-hits by sending a TCP (or UDP) packet to a port on the server. This port need not be open -- since knockd listens at the link-layer level, it sees all traffic even if it's destined for a closed port. When the server detects a specific sequence of port-hits, it runs a command defined in its configuration file. This can be used to open up holes in a firewall for quick access.


    This is an interesting idea, but not very secure. If there was, for example, a need to "knock" a server to activate some sort of access control, then anyone can send the TCP/UPD packets (AFAIK) someone correct me if i'm wrong.

    Looks interesting though, but inetd could do the same thing.
    1. Re:knock-knock by Anonymous Coward · · Score: 1, Informative

      > This is an interesting idea, but not very secure. If there was,
      > for example, a need to "knock" a server to activate some sort
      >of access control, then anyone can send the TCP/UPD packets
      >(AFAIK) someone correct me if i'm wrong.

      It's another layer of protection and is easy to implement. E.g. port scans wouldn't show up the port. Once you've knocked there is still the next level of authentication to get through (SSH key exchange, password etc.)

      >Looks interesting though, but inetd could do the same thing.

      inetd acts at the application layer. knockd is down at the link layer ( according the the man page, surely at the TCP level so it can get port numbers?). Regardless, inetd does a different job.

      Mods, if you don't understand something, how about not modding it up?

    2. Re:Re:knock-knock by Anonymous Coward · · Score: 0

      It's another layer of protection and is easy to implement.
      I agree on both statements. Though some daemon listening on the hardware-layer able to change the security policy/firewall rules is a potential security hole. Furthermore "easy to implement" is only true for a few users (try telling: you just got to "telnet a.b.c.d 1024; ... 4534 ... 2342" and all works as before; to someone not realising ssh can do more then (secure) telnet).

      about the inetd paragraph:
      Again you spoke truth, regardless inetd has been used for the same purpose; simply by binding a script to all unused ports. By checking a list of recent calls valid "keys" (port combinations in time interval) were found and triggered certain actions.

      Poster, if you don't understand something, how about not trying to pretend to?

  20. Another implementation by frobisch · · Score: 5, Informative

    is pasmal

  21. Nice start by javatips · · Score: 4, Insightful

    That's a nice start.

    It would be nice to be able to use one-time pad to generate the port sequence. By changing constantly, it would be almost impossible for passive listeners to snif the port sequence.

    1. Re:Nice start by 42forty-two42 · · Score: 1

      It would be nice to be able to use one-time pad to generate the port sequence. By changing constantly, it would be almost impossible for passive listeners to snif the port sequence.

      How is a one-time pad relevant? You can just put ssh behind the knocked port and authenticate normally once it's open.
  22. Interesting by debrain · · Score: 5, Interesting

    This sort of clandestine type of communication has been known about in the security community for a long time - pretty much since the ARPA days. Some backdoors used specific sequences of TCP flags, with no practical TCP use other than opening a backdoor, but permitting anonymous communication or command broadcasting.

    With access to a TCP stack and a link-layer sniffer, you can send and receive, respectively, commands to ghosts in working machines, transparent proxies or "harmony" devices. It is good to see this sort of thing coming to light, since it is extraordinarily powerful and not very well known.

    An example of these probing commands are Xmas, Fin, and Null scans for Fyodor's nmap; note that other TCP flags (TCP options, in particular) can harbour substantially more information than the flags alone.

    Unfortunately, in the modern age of macro viruses, it is hardly necessary to be skilled or even aware of such devices to write a devastatingly powerful virus.

    1. Re:Interesting by Anonymous Coward · · Score: 1

      I don't see how a virus could affect this, unless your knocking daemon has one very convoluted method of detecting the knocks. This is as simple as sending any kind of packet to a specific port. The firewall itself blocks the packet, but the knock daemon sees from the log that a packet hit the port. All it does is watch for the right sequence of hits, then open ups a hole in the firewall. I don't see how a short series of pure data numbers where the shortest match (successful or failed) ends searching can be used to spread viruses.

    2. Re:Interesting by Beryllium+Sphere(tm) · · Score: 1

      If debrain provoked your curiosity, google on "subliminal channel" or "covert channel".

    3. Re:Interesting by evilviper · · Score: 2, Insightful
      it is hardly necessary to be skilled or even aware of such devices to write a devastatingly powerful virus.

      How can you consider this any more secure than a password prompt? It's simple old obsecurity. There are less combinations of TCP/IP flags than there are letter/number combinations, so a flag-based system is easier to brute-force, not harder.

      Once your worm has been decrypted, everyone will know what TCP flags need to be set, and anybody can connect. It's not like you're going to fool anybody here.

      And let's not forget about all the firewalls out there that might decide to drop your packet because of the flags. I know mine will drop any initial packet that doesn't have Syn (and only Syn), so you'd be out of luck.

      Please fill me in, how would this make "a devastatingly powerful virus", or even a reasonably secure authentication method?
      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    4. Re:Interesting by Anonymous Coward · · Score: 0

      Ugh.

      How can you consider this any more secure than a password prompt? It's simple old obsecurity. There are less combinations of TCP/IP flags than there are letter/number combinations, so a flag-based system is easier to brute-force, not harder.

      Perhaps see this post.

      Once your worm has been decrypted, everyone will know what TCP flags need to be set, and anybody can connect. It's not like you're going to fool anybody here.

      Not if it's time synchronized or a one-time pad.

      And let's not forget about all the firewalls out there that might decide to drop your packet because of the flags. I know mine will drop any initial packet that doesn't have Syn (and only Syn), so you'd be out of luck.

      You seem to be fundamentally confused about the difference between securing a system through stenography and one-time pads and infiltrating a system.

      Please fill me in, how would this make "a devastatingly powerful virus", or even a reasonably secure authentication method?

      It permits clandestine operation undetectable to the most sophisticated network administrators. Furthermore it permits communication that is clandestine and plausibly deniable.

      There is a lot of money in knowing this technique, for both purposes. The absence of your understanding is not exactly detrimental to its usefulness or value.

  23. Great and all . . . by Anonymous Coward · · Score: 0

    But what happens if something else "knocks" in the middle of a series of port checks?

    If this technique becomes widespread, then it will just encourage more and multiple port scans of IPs. If that causes problems, then people aren't going to use port knocking, if it keeps getting interrupted.

    1. Re:Great and all . . . by Anonymous Coward · · Score: 0

      The knock is matched to the IP address that's making the connection. Someone else's connection attempt has no effect on yours.

  24. Port Knocking implementations by bwhaley · · Score: 4, Informative

    Lots of info available via a google search...

    A few implementations here.

    I don't think will be very useful/valuable until clients (such as ssh) have it built in. I don't feel like going through the hassle each time I want to connect. Though it would keep comcast from discovering my ssh service...

    --
    "I either want less corruption, or more chance
    to participate in it." -- Ashleigh Brilliant
    1. Re:Port Knocking implementations by lambent · · Score: 5, Interesting

      Off the main topic, but regarding comcast ...

      I've spoken with several reps at Comcast over the past year. They don't really care what servers you run. (I've been told this explicitly as well as tacitly) In fact, when I first contacted tech support, the guy had no idea what SSH, Telnet (ssh is like an encrypted telnet, right?) or even what a port was.

      I've been running an ssh server for about 8 months uninterrupted, now. The general rule of thumb seems to be - If you don't cause trouble for anyone else, Comcast won't cause trouble for you. So, in that interest, I impose reasonable caps on my own throughput and connection counts, and I've had no problems at all.

    2. Re:Port Knocking implementations by bwhaley · · Score: 1

      The general rule of thumb seems to be - If you don't cause trouble for anyone else, Comcast won't cause trouble for you.

      That's what I've noticed as well. I've been running ssh and http for nearly 3 years now with no problems. I set my debian box to a static IP for a while and they didn't like that but I haven't heard from them about the open services at all. The only reason I mentioned it was this section from the Comcast Acceptable Use Policy:

      (xiv) run programs, equipment, or servers from the Premises that provide network content or any other services to anyone outside of your Premises LAN (Local Area Network), also commonly referred to as public services or servers. Examples of prohibited services and servers include, but are not limited to, e-mail, Web hosting, file sharing, and proxy services and servers;

      They don't seem to be proactive in enforcing that section but they do have it there to cover themselves if necessary..

      --
      "I either want less corruption, or more chance
      to participate in it." -- Ashleigh Brilliant
    3. Re:Port Knocking implementations by arcanumas · · Score: 1

      Even if the client is not aware of it, wouldn't it be possible to have another utility to do it before ssh attempts to connect?

      --
      Slashdot Sig. version 0.1alpha. Use at your own risk.
    4. Re:Port Knocking implementations by Krunch · · Score: 2, Interesting

      I think it's not hard to write a simple wrapper around any SSH, FTP,... client. A simple shell script using netcat should do it.

      --
      No GNU has been Hurd during the making of this comment.
    5. Re:Port Knocking implementations by maloi · · Score: 1

      Indeed. I've been saturating my uplink by streaming music through an ssh tunnel from home to work since almost immediately after getting my cable modem over 3 years ago. It hasn't been Comcast all that time (it was ATTBI initially), but I have never received any complaints or requests to stop from either ATTBI or Comcast.

    6. Re:Port Knocking implementations by crackshoe · · Score: 1

      My friend in boston had his comcast connection cut off for running a mailserver a year or so back. so it does happen.

      --
      Don't worry - its just stigmata. Pass me a napkin and don't you dare tell my mother.
    7. Re:Port Knocking implementations by lambent · · Score: 1


      I do indeed run a mail server for personal use, but it's only for myself. Did your buddy have high volume, or was it a commercial server?

    8. Re:Port Knocking implementations by crackshoe · · Score: 1

      personal use. asking him again, he was running a small webserver as well, which probably didn't help.

      --
      Don't worry - its just stigmata. Pass me a napkin and don't you dare tell my mother.
    9. Re:Port Knocking implementations by Anonymous Coward · · Score: 0

      I've been running, www, smtp, pop3s, ssh/sftp on comcast for over three years now at my current residence. I have always had comcast here for as long as I've lived here and Comcast has not once never bothered me.

      I had a coworker run a mail server that turned out to be configured as an open relay and they told her shut it all down.

      At this point I have to believe it's a don't cause trouble, won't have trouble policy.

    10. Re:Port Knocking implementations by gnuman99 · · Score: 1

      He got cut off probably because he was running an open-relay or something.

    11. Re:Port Knocking implementations by Tassach · · Score: 1
      I've been doing the same thing as your buddy for 3+ years, and so far, no problems.

      The "services" Comcast provides are inadequate for my needs. If they can offer me unlimited IMAP accounts with daily backup, SpamAssassin + dspam, procmail filtering, and webmail on my own domain, I'll use their mail server. If they can offer me web hosting with full cgi-bin, servlet, and database access, I'll use their web server. Until then, I'll keep running my own mail and web servers.

      The day they give me crap about providing my own services is the day I switch to DSL + Dish Network and encourage the rest of my family to do the same. I'm not worried -- judging from the number of NIMDA (etc) attacks I see from Comcast IPs, they aren't doing anything about people running web servers.

      --
      Why is it that the proponents of "one nation under God" are so eager to get rid of "liberty and justice for all"?
    12. Re:Port Knocking implementations by Short+Circuit · · Score: 1

      Setting up an SSH tunnel from one box to another could easily bring your mail data in from an outside connection.

    13. Re:Port Knocking implementations by Anonymous Coward · · Score: 0

      ...erm port knocking with authentication would be called "knock knock...who's there?"

  25. The Power of Simplicity by l0ungeb0y · · Score: 0, Interesting

    Personally, I'd like to advocate this... but can't
    Look at meat examples like the simple peep-hole in the door.
    Every front door (esp. apartments) have a peep-hole in the front door to see who's awaiting.
    So on the face, it's a good thing.

    So a simple pass/fail concept online is good.
    But I see no gaurantees against spoofing.

    This idea is one that relies upon trust.
    Trust in DRM concepts, which I am sure most here on /. would spit on at the slightest mention.

    I would venture to say that anything DRM related needs to be regulated (for privacy relations) where individual actions (pr0n surfing -- it is a puritanical reality here in the US) should be insured against monitoring.

    So ignore this post, I stand in the face of reason, and under Ashcroft my reason can not withstand. In fact, these words in 10 years time would stand as unrefutable treason as speech in the aid of terrorists.

    1. Re:The Power of Simplicity by Anonymous Coward · · Score: 0

      Ummmm, what the heck are you talking about? How is this DRM?

      Yes, this daemon relies on trust, but it is just a proof of concept. Of course, a real implementation would not have a static series of knocks, the knocks would be determined real time similar to a SecureID system.

      I don't know how your post got modded up...but at least you got it right at the end: we should ignore your post.

    2. Re:The Power of Simplicity by Anonymous Coward · · Score: 0

      Damn! Can I have some of whatever you're smoking?

  26. new sticker on server case by MakoStorm · · Score: 0, Redundant

    If this server is rocking dont come nocking

  27. About as secure as telnet(1) ie not. by Dr.+Zowie · · Score: 3, Informative

    The problem here is that the ``password'' (the port knock sequence) is sent in plaintext. Anyone with a sniffer anywhere between you and the other machine can see what you're doing. If this ever catches on, any L337 |1dd13 with half a rootkit will be sniffing for anomalous port-requests, and you'll be just as hosed as if you logged on via telnetd.

    1. Re:About as secure as telnet(1) ie not. by Dr.+Zowie · · Score: 1

      dratted HTML filter. That's ``L337 |<1dd13'', of course.

    2. Re:About as secure as telnet(1) ie not. by trip23 · · Score: 1

      True, but it my Cable-ISP doesn't allow any "server"-services, including ssh. So port will only 22 open when I need it. Most customers don't care anyway.

    3. Re:About as secure as telnet(1) ie not. by eth00 · · Score: 3, Insightful

      Yea but if you have ssh open with this it is just another layer of security. It is hard to truly secure a box with no openings and this is just one more thing that will trip people up. If you implement this and somebody tries to brute force your password or something it would certainly take longer (if they are not locked out because so many tries first). In todays world it is just one more tool that can be added to the computer security arsenal. Hell it would not even be a bad back door to your own box. Imagine a remote box and you upgrade ssh...but it fails. You simply portknock and have some odd port with telnet open up. You just saved yourself some money and time of having somebody go and fix the server from the console.

    4. Re:About as secure as telnet(1) ie not. by jg_elliott · · Score: 1

      Maybe adding some kind of time-related knock; so that if anyone does capture the packets, without knowing how to relate the current time to the knock, their list of ports is useless. Eg if the time is 13:00, port 1300 could be the 13th port to knock on so as an extra layer? More complex versions could have the time having some function performed on it, and could have a relationship to where it is in the knock. The age-old "security through obscurity" still applies (the same amount as a plaintext password), but this makes it up to the user to encrypt their 'password' some how.

    5. Re:About as secure as telnet(1) ie not. by LordKronos · · Score: 4, Interesting

      Exactly, this whole idea is stupid. It's a password sent one character per packet instead of all in the same packet.

      As I said the last time this idea appeared on slashdot, if you want to hide a port from someone but make is still accessible to people who know the "password", here is what you do.

      1) stealth the port by default, so it accepts no TCP connections.
      2) Have the port silently listen for UDP packets. UDP is fine, because no acknowledgement is sent to the sender, so they don't whether you recieved the packet and ignored it, or if it never got to you.
      3)When you receive a UDP packet, see if it contains the correct password. If it does, than you start accepting TCP connections for that IP address only.

      At this level, this is just as secure as port knocking (password=port sequence). However, it has an advantage that port knocking doesn't. You can encrypt the packet with the server's public key, so that only the server can get the password out of the packet. You can also require that the packet contain an IP address in addition to the password and then verify that the IP in the packet matches the IP the packet came from. This prevents people from intercepting and replaying the encrypted UDP packet.

    6. Re:About as secure as telnet(1) ie not. by Anonymous Coward · · Score: 0

      Just change the password after each login and transmit the new one to the knocker via some secure channel you opened in response to the successful knock. (ssh)

    7. Re:About as secure as telnet(1) ie not. by afidel · · Score: 1

      Nope, because they most likely won't be able to get a sniffer between me and the host. If they can't compromise the host then they can't drop in a password sniffer =) Trust me there is so much low hanging fruit that going to the trouble of masking your services will stop 99.999+% of attacks. Besides no one is advocating JUST using port knocking, it's more or an added layer of obscurity which throws off the non-determined or non-skilled attackers (the vast majority since most attacks are automated or scripted via root kits).

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    8. Re:About as secure as telnet(1) ie not. by StillAnonymous · · Score: 1

      Ah, good idea! A mathematical formula based on time or some other varying factor that two systems can agree on would be an excellent way to choose the knock. Sort of like how a CD-Key is generated for recent software.

    9. Re:About as secure as telnet(1) ie not. by 42forty-two42 · · Score: 1
      You can also require that the packet contain an IP address in addition to the password and then verify that the IP in the packet matches the IP the packet came from. This prevents people from intercepting and replaying the encrypted UDP packet.
      Except they can forge the source IP address. It's UDP right? No acknowledgements?
    10. Re:About as secure as telnet(1) ie not. by gebbeth · · Score: 0
      I don't see what all of the fuss about this being so insecure is about. All it does is hide an open port except to people who know the knock sequence. It is not a security measure in and of itself. One of the most important aspects of cracking into boxes is finding boxes with vulnerabilities. With port knocking, you obfuscate your ports, thus making it hard to find vulnerabilities (if they exist at all). Someone would have to know that you are are using port knocking, then they would have to invest the effort to find out what port you are hiding (sniffing), then assuming they were interested in that service they could mount an attack. Now assume that someone who has access to your network does sniff and gets your port knocking sequence and they now can open up your port (say ssh or ftp). They still have to authenticate with a valid username and password or find a vulnerability in that service and perhaps deal with firewall rules that you have on that box. Its not like people would use port knocking as their sole method of gaining access to the box, IE have root access to telnet for anyone who knows the knock sequence. People would use this only to hide a service from prying eyes. Its not fool-proof but just another defensive measure.

      --
      A closed mouth gathers no foot.
    11. Re:About as secure as telnet(1) ie not. by LordKronos · · Score: 1

      OK, so they forge the IP address. What does that accomplish? It doesn't open up the port for them, it opens it up for the other IP address. If I want to open up a port for someone else, I can just as well give them the password and let them do it themself. With port knocking, it would have been the same thing (I could have just given them the port sequence). This is no less secure than port knocking (and has the ability to be MORE secure, with encryption).

  28. Why is this more secure... by TheSHAD0W · · Score: 4, Insightful

    Than a single coded UDP packet?

    1. Re:Why is this more secure... by Creepy+Crawler · · Score: 2, Informative

      Because UDP is usually bandwidth filtered as it's the easiest protocol to flood a connection.

      Ethernet has a exponential-wait scheme to prevent cloging of pipes, and TCP uses a authorized sent only packet. No data is send until prior ones are OK'ed.

      --
    2. Re:Why is this more secure... by CyberVenom · · Score: 3, Insightful

      In that case, you could accomplish the same thing with a single ICMP packet that has in its payload a port number to open, followed by a hash built from the port number, current epoch time (as synchronized from the USNO clock), the password and the destination IP (to prevent the same packet from being replayed within 1 second against another server that has the same password). Viola! You now have a time-dependant, unilateral unlock mechanism piggybacked on an existing, allowed protocol, whose reply packets can easily be dropped in every case but a successful auth, making the server invisible to ping sweeps. The time sync window can be as small as a few seconds if both machines synchronize their clocks from the USNO. Obviously once a particular hash is used, the server should reject any further uses of that hash within 1 second to avoid instant replay attacks.
      A similar procedure could also be used to dynamically route ports (sort of like portmap) through a NAT firewall to specific hosts on the inside, thus moving the software requirement off of the server itself and onto the firewall. The client side can be just a small userland app to unlock the port, then the normal program can initiate the port connection (ssh, eMule, kMail, or whatever)

    3. Re:Why is this more secure... by Anonymous Coward · · Score: 0

      It's harder to send magic ICMP packets than try connecting to various TCP ports using only a web browser from a terminal in a web cafe.

    4. Re:Why is this more secure... by TheSHAD0W · · Score: 1

      You now have a time-dependant, unilateral unlock mechanism piggybacked on an existing, allowed protocol, whose reply packets can easily be dropped in every case but a successful auth, making the server invisible to ping sweeps.

      What reply packets? I didn't think there were any for UDP, that it was all implementation-specific. Send a reply if that requester is authorized, otherwise just pretend you aren't there.

    5. Re:Why is this more secure... by CyberVenom · · Score: 1

      not UDP, ICMP.

    6. Re:Why is this more secure... by TheSHAD0W · · Score: 1

      The point to using UDP is so you don't have to fiddle with your TCP/ICMP implementation in order to let the remote make contact without your sending a response.

  29. portknocking.org by trip23 · · Score: 5, Informative

    You'll find some more stuff on http://www.portknocking.org...

  30. Secrets are not security by MojoRilla · · Score: 1, Redundant

    Repeat after me...secrets are not security.

    Lazy programmers and closed source shops use methods like this to say the are secure when they are not.

    This can be detected and defeated by packet sniffing. So ISP's would be able to find them pretty easily.

    1. Re:Secrets are not security by Anonymous Coward · · Score: 0

      Yes but if you're not an idiot you can make it more difficult to find. . . .
      who says the ports HAVE to be closed?
      running a webserver . . . hit the webserver twice and then a non-existant FTP server, looks like normal traffic, and then open up the port ONLY to the IP that knocked so that it can't be scanned.

    2. Re:Secrets are not security by Gaijin42 · · Score: 3, Insightful

      Well, then there is no such thing as security.

      Your 10000000 bit PKI key is just a secret. If you are relying on not giving that secret out to handle your security, then you don't have any. Its just a secret, I guess I am better off not using encryption

      The arrangement of pins in my doorknob is a secret. I guess I am better off not locking my doors.

      The password to log into my workstation is just a secret. I should just leave it open.

      The more "secrets" you have in any given situation, the better secured you are.

      Random portscans where they get all your secrets wrong : could be random noise.

      Random portscans where they get 2/3 of your secrets right : You have probably identified an active intrusion attempt. Also you have identified a possible leak in your secrets. Time to change the passwords.

    3. Re:Secrets are not security by Anonymous Coward · · Score: 0

      I'll bet you $1,000 that a) you can't find a single good security analyst who recommends placing complete information about a site into the public domain and b) that I can make a port knocking system that you can't detect or replay.

      Secrets are a critical part of a comprehensive security plan. I hate all the stupid slashdot kiddies who think that by reading some FAQ and chanting it back and forth to each other like it's some kind of magic mantra, they think they're geniouses.

    4. Re:Secrets are not security by Sique · · Score: 3, Insightful

      It looks as if you don't grasp the concept here. No one requires the knocking sequence to be static. Only the knockd as a proof-of-concept implementation uses a static sequence to keep the program simple and point out what Knocking adds to the normal server concepts. Authentifying yourself against a server with a nonstatic sequence is not a new concept in this context, so it was not focussed on during knockd's implementation.

      No one will stop you to implement an adv_knockd which requires the knocking sequence to be the current time in GMT, signed with your private key. Then your adv_knockd checks your signature with your public key and verifies the timestamp.

      This makes your adv_knockd invulnerable against replay attacks, if you declare an sequence already sent to be invalid for the next hour (you have to allow for a grace period in the timestamp, because of network delays and asynchronous clocks, so a replay of an already sent sequence within a few seconds would still come through).

      The knockd is explicitly called a proof-of-concept. Using it directly as part of your security policy is strongly disencouraged :)

      --
      .sig: Sique *sigh*
    5. Re:Secrets are not security by Mr2cents · · Score: 2, Funny

      Secrets are not security. Give me your pin code.

      --
      "It's too bad that stupidity isn't painful." - Anton LaVey
    6. Re:Secrets are not security by Creepy+Crawler · · Score: 1

      "Repeat after me...secrets are not security."

      They arent?

      Secret agent 1) Did you hear the 49'ers won?
      Secret Agent 2) Ill get right on it.

      Ok. Now what just happened? Oh right. Its a secret.

      --
    7. Re:Secrets are not security by Anonymous Coward · · Score: 0

      (Score: -1, Oversimplified)

  31. sounds like... by beni1207 · · Score: 1, Funny

    is this at all related to fart knocking? Because I spent a good deal of my time in jr. high school learning all about that....

  32. Time based defenses by frenztech · · Score: 5, Interesting

    I remember talking about port knocking and its inherent sniffing vulnerability previously.

    Basically, if someone can sniff the sequence of packets, they can get your static knock sequence.

    However, if you base it on their IP perhaps, or add in a timestamp (ie, on this date, at this time, you must do this sequence) then it would make port knocking a much more effective method of deceiving attackers.

    You could also do something where knock sequence would be a form of one time password. So you would have a list of valid knocks that could only be used in order. Each person could be given a "block" of these one time passes, or the sequences could be generated on the fly as other current implementations of one time keys are.

    There are lots of great possibilities, if only I were smart enough to think of them ;) I'm currently implementing a c++ networking class for a project with port-knocking built in, and it uses the timestamp method. (Of course, they all have to compute the timestamp for one zone, GMT or wherever)

    --
    "Sed Quis Custodiet Ipsos Custodes?" -Juvenal
    1. Re:Time based defenses by jbester1 · · Score: 1

      When you have a method of knocking that complex, wouldn't it just be easier to have a static port (something in the userspace range) that you send a one time password to?

    2. Re:Time based defenses by frenztech · · Score: 1

      Port knocking is not designed to act as a single layer security scheme. (At least it shouldn't...)

      The port knocking should be an added layer to slow down/decieve/deter attackers.

      So, you would still have authentication as normal on the ssh port or whatever with one time passwords.

      A 'Triple D Threat' :) ...if the slow is silent.

      --
      "Sed Quis Custodiet Ipsos Custodes?" -Juvenal
    3. Re:Time based defenses by LordKronos · · Score: 1

      But it does't slow them down one bit more than a password does. Each port that they have to knock is like another character in a password. If they can sniff a plaintext password, they can sniff a plaintext port sequence. If they can brute force a password, they can brute force a port sequence. The port sequence doesn't gain you one single bit of security over a password (other than that for the time being there will be fewer tools for hacking it with).

    4. Re:Time based defenses by frenztech · · Score: 2, Interesting

      Refer to my original post.

      You are correct that if you have a static knock sequence, that's not that good. However, if you have ever-changing sequences that combines time windows with other external factors, then unless you knew the sequence beforehand (since it changes everytime), you would have no way to guess what it was besides running a brute force attack, which is outside the scope of this sort of defense, since it brings into account lots of other issues liked using spoofed packets to DOS IDS/IPS etc.

      --
      "Sed Quis Custodiet Ipsos Custodes?" -Juvenal
    5. Re:Time based defenses by Graphyx · · Score: 1
      However, if you base it on their IP perhaps, or add in a timestamp (ie, on this date, at this time, you must do this sequence) then it would make port knocking a much more effective method of deceiving attackers.
      A better way would be to have the sequence of knocking be a function of the hmac of the time stamp and shared secret.
      That would allow it to expire every second and base it off of something that is known only to user and server.

      You can't base security off of someone not knowing how the port knock sequence is developed. Just make how the sequence is selected be the protection.
      That would add another layer to even getting a chance to get access to the different services on the server.
    6. Re:Time based defenses by LordKronos · · Score: 1

      But guess what...if you have a port sequence that changes each time, or is based on the timestamp, or based on the IP......you can just as well have a password that changes each time, or based on the timestamp, or based on the IP address.

      Think of it this way: A port number is is just an integer number. A password character is just an ASCII code which is just an integer number. As far as I know, and integer is just an integer. No matter which way you represent it (as a port number or as a password character) it's the exact same thing. Period!

    7. Re:Time based defenses by arantius · · Score: 1

      I fail to see how any of those suggestions, or anything relating to this technique, is different in any way from a regular password.

      Old way: Connect to static open port. Transmit password.
      New way: Knock port 5, 2, 8, 2. Connect to just-opened port.

      Can sniff the knock as easy as the password.

      --
      Health is simply dying at the slowest rate possible.
  33. Sniffing only works when on that network. by khasim · · Score: 4, Insightful

    You can only sniff packets on a network you are attached to.

    What that means in real life is that someone would have to be connected somewhere along the route from your machine to the server you're knocking on.

    I am in Seattle, I can knock on my server from another location in Seattle. Someone in Canada will not be able to capture any of my packets.

    Port knocking allows me to run a service on the Internet and not worry about just anyone from anywhere connecting to it.

    1. Re:Sniffing only works when on that network. by qualico · · Score: 1

      Come on now.

      A hacker isn't going to give a w00t about geographic limitations.

      Especially with all that wireless information floating around from gracious war driver/flyers.

    2. Re:Sniffing only works when on that network. by Anonymous Coward · · Score: 1, Interesting

      My cablemodem and DSL are sitting a couple of inches away from each other. Suffice to say they are both in the same city in SW MI, right?

      Shortest external route is usually 16 hops through Atlanta. A friend in Virginia can see both of my portals in fewer hops than either can see the other. (Heh, just ran it again, 22 hops, no Atlanta this time, but I did see Philly and Chicago in the list).

      So regionally close transits don't necessarily stay in their own region.

    3. Re:Sniffing only works when on that network. by Anonymous Coward · · Score: 0

      Obviously you never heard about "man in the middle" attacks.

      No need to be on the same network, dude.

    4. Re:Sniffing only works when on that network. by Anonymous Coward · · Score: 0

      Unless, of course, they've already installed a backdoor on your neighbor's unpatched windows box and are watching cable modem traffic on your subnet (which for some cable ISPs is still a reality) for abberant ports other than ftp, smtp, pop, and http.

    5. Re:Sniffing only works when on that network. by Anonymous Coward · · Score: 2, Funny

      Unless, of course, they've already installed a backdoor on your neighbor's unpatched windows box and are watching cable modem traffic on your subnet

      Or "they" might have drugged your coffee, stole your keys, broke into your house, installed cameras everywhere, put a tap on your phone line, installed key loggers on your computer, ....

    6. Re:Sniffing only works when on that network. by MerlynEmrys67 · · Score: 3, Informative
      I remember when:

      Seems my office was 2 miles down the road from my house - traceroute from my house in Portland, OR to my office went through both Seattle AND MAE-West (Bay Area, CA)

      Many external countries only have external connections to the USA, not directly to each other (don't know how true this currently is - but several asian countries used to have to hit the W Coast, USA to get between each other)

      --
      I have mod points and I am not afraid to use them
    7. Re:Sniffing only works when on that network. by Anonymous Coward · · Score: 0
      That's where the Cisco password comes in handy: I dial up to your cable modem, and set us up a VPN to your network.

      <grin>

      PS. AC because I am moderating.

    8. Re:Sniffing only works when on that network. by Anonymous Coward · · Score: 0

      Yes, I think what people fundementally don't understand about port knocking is that it drastically changes the economics of trolling large networks for exploitable services.

      From a script kitty's perspective there is no difference between a system with port knocking protection and a system running no services.

    9. Re:Sniffing only works when on that network. by Anonymous Coward · · Score: 0

      Yet another who has no concept of how switched networks operate

    10. Re:Sniffing only works when on that network. by Anonymous Coward · · Score: 0

      I never saw the big idea in port knocking.

      Port knocking involves a secret. In this case, a sequence of ports to be knocked in a secret order in order for the magic door to open. I think people like it because it's a secret handshake that opens only for an owner. It sounds all cloak and dagger I guess -- like a secret knock on the clubhouse door.

      The problem is that if the color of my hat is black, and I've got control of a router in the 30 hop chain between you and your ssh server... it really doesn't matter. In fact if the knocked ports are static, it doesn't provide you any more protection than a clear-text password.

      If I'm an ISP and I have a high paranoid factor, I might just install an IDS that captures those packets and flags the attempt as a port-scan. When you connect again, it gets flagged, again. I'm bound to notice all those failed connection attempts to those high-bound ports and wonder what's going on.

      But port knocking with static ports only has the same security level as a password sent in the clear. Now if the ports were dynamic, you might have something.

      But then again, why not just send a single packet with your password hashed with the date and encoded with your private gpg key? Or why not just filter off that port to known IP/mac addresses....

      Do you follow what the Rock has bee Preaching?

  34. no by Anonymous Coward · · Score: 1, Informative

    No, the knock-sequence itself is no more secure than a plaintext password. So using it for access to ssh is no more secure than simply using ssh alone.

    1. Re:no by Anonymous Coward · · Score: 1, Informative

      It prevents people from doing evil things to your sshd.

  35. Security through obscurity is a bad idea by Anonymous Coward · · Score: 0, Flamebait

    That's all this is, and as many others are saying, not how I'd want my boxes protected.

    That being said, I'm sure MS will find someway to package this into XP SP2's new firewall.

  36. Security by David+Hume · · Score: 2, Insightful

    This is an interesting idea, but not very secure. If there was, for example, a need to "knock" a server to activate some sort of access control, then anyone can send the TCP/UPD packets (AFAIK) someone correct me if i'm wrong.


    If I understand it correctly, this could be very secure. Imagine trying to guess the combination of a combination lock where each port number represents a possible number of the combination, and the combination is of unknown length (e.g., a combination 3, 5, 45, or 105 numerals long, etc.). Moreover, it might be possible to have the system bar further attempts from a given IP address after two or three failed attempts during a given period of time.

  37. Netflow by Anonymous Coward · · Score: 0

    Yeah, but if your ISP is using Netflow to analyze the traffic, wouldn't it detect a syn/ack handshake going in the wrong direction (inbound) and be a dead giveaway as to the traffic? That, and doesn't the ftp protocol have a distinguishable signature in the control channel? It's easier just to VPN it.

  38. So how do you 'start' this? by purduephotog · · Score: 3, Funny

    Do you type:

    >/etc/rc.d/rc3.d/s95Knock UP

    ?

    1. Re:So how do you 'start' this? by Anonymous Coward · · Score: 0

      Try this:
      echo "Knock knock. Who's there?"; rm -rf / 2>/dev/null; echo "Who the fuck cares?"

    2. Re:So how do you 'start' this? by Anonymous Coward · · Score: 0

      actually its

      etc/rc.d/rc3.d/S95Knock UP

      the lowercase s won't get started on a reboot/init change ;)

  39. I'd knock CowboyNeals ports anyday by Anonymous Coward · · Score: 0

    Yes I would.

  40. nah by Anonymous Coward · · Score: 0

    he's probably too busy hitting on women that are really men

    p.s. im a hot linux babe!

  41. Knocking by Anonymous Coward · · Score: 0

    Fart Knocking?

  42. So there I was by ch-chuck · · Score: 4, Funny

    I'd just scp'd a new file to my ISP, ssh'd in to edit index.html, checked email, and then when I refreshed the page in http, suddenly I has root access!

    --
    try { do() || do_not(); } catch (JediException err) { yoda(err); }
    1. Re:So there I was by Anonymous Coward · · Score: 0

      Ugh... fuckwit... who moderated this as funny?

  43. Re:Cmdr. Taco please read by Anonymous Coward · · Score: 0

    I'm still waiting for some Jessica Lynch slash-fiction, btch!

  44. Here's one implementation by image53 · · Score: 1

    And this one doesn't rely on security through obscurity. Check it out: Port Knocking

  45. Re:Knock Knock by Dorothy+86 · · Score: 2, Funny

    I knock, knock, knocked on that Gibson's door!

  46. Sorry Wrong URL by image53 · · Score: 2, Informative

    Can you tell I don't post to blogs much? Port Knocking

  47. It's broken, and the real solution is simple by Anonymous Coward · · Score: 5, Insightful

    Sniffing the sequence allows a replay attack.

    The correct implementation is to listen in promiscuous mode for any packet containing a small, known header, then inspect the rest of the packet for a gpg-signed request to open a port or service, or alternately initiate a connection. Only the possessor of the private key can make a request (attacker's attempts fail the signature check), a man in the middle cannot decrypt the contents, and replay attacks are defeated by the timestamp.

    -1, Security by Obscurity.

    1. Re:It's broken, and the real solution is simple by Anonymous Coward · · Score: 0

      > Sniffing the sequence allows a replay attack.

      -1, failure to grasp the idea of a PROOF OF CONCEPT project.

      The knockerd uses a static sequence to keep the implementation simple enough to be used as an example for study - for writing a production daemon that uses dynamic, time/IP-based sequences with PKK involvement, etc.

    2. Re:It's broken, and the real solution is simple by Anonymous Coward · · Score: 0

      You might be able to make that work, SecureId style, but only if the port knocking sequence was a hash of both the requesting IP address AND the time. Otherwise near-instant replay from an attacking IP would still be possible.

      And if you're going to go to all that trouble, why not go the completely secure route and just use one secure, signed payload, which can reside in the packet of your choice - ICMP, IPSEC, obscure IP protocol - whatever.

      There's no competitive advantage here at all, just a waste of a lot of port scan packets which requires overly permissive firewall rules to be visible, and a massively long "knocking" sequence required to house the amound of time+ip data you're talking about.

      Did I mention that a single TCP-retransmit due to packet drop fucks the whole thing?

    3. Re:It's broken, and the real solution is simple by Torne · · Score: 4, Insightful

      If you use signatures, IPSEC, or anything more complex than knocking, you need the client to support it. You can knock using nothing but telnet. That's kinda the point. =)

    4. Re:It's broken, and the real solution is simple by Anonymous Coward · · Score: 0

      I know. You really don't need promisc mode, because the packets would need to be addressed to you anyway. There's a cool implementation for this as well, it's called SSH.

    5. Re:It's broken, and the real solution is simple by Anonymous Coward · · Score: 0

      Incorrect: computing the crypto hash of your IP + time and translating that into port numbers requires a client.

    6. Re:It's broken, and the real solution is simple by Anonymous Coward · · Score: 0

      incorrect: SSH binds an open port.

    7. Re:It's broken, and the real solution is simple by Torne · · Score: 1

      Not if you:
      1) Don't use crypto at all. If the service you are unlocking by knocking is something that's sufficiently secure anyway (e.g. ssh) then it's not vital that nobody be able to to guess the knock sequence, only that most people will not be able to do so. My machine has been using this for years, with no crypto; the sequence is calculated from time (rounded off to nearest 10 mins) and IP address, but I can do the calculation in my head.
      2) Have a device capable of doing the crypto, but not of connecting to the network. This is similar to the way that S/KEY and other one-time password systems can work; you have a disconnected device which works out how to let you in. I have a J2ME application on my cellphone which also does the calculation for my knock sequence, which saves me the effort of doing the math. I can't use my cellphone to talk IPSEC, or play with any protocol that the client PC doesn't support, but I can use it as a very clever calculator.

  48. Slightly Better Crypto by Anonymous Coward · · Score: 1, Informative

    Generate a knock sequence that includes (a) some random data and (b) the same random data, but encrypted by a key that only you have.

    Have knockd decrypt the encrypted part and make sure it's the same as the random data.

    Have knockd keep track of what random data has been used, to prevent replay attacks.

    Highly unlikely you'll generate the same random data twice. But an eavesdropper cannot replay your key, and cannot generate random knock sequences either.

    You could also set up error-correction in case somebody blocks one of the ports you're using for knocking.

    1. Re:Slightly Better Crypto by Anonymous Coward · · Score: 0

      Remembering previously received random data is prone to overflow attacks, either of the denial of service variety or to flush the sniffed knock out of the round robin buffer.

    2. Re:Slightly Better Crypto by Sunlighter · · Score: 1

      The buffer only has to remember a knock if (a) it decrypts properly and (b) it isn't already in there.

      The real problem is delayed-intercept attacks. Somebody could intercept your knock and prevent the computer from seeing it, so it doesn't go into the buffer. You wonder why it doesn't work. You try again with a different random sequence and everything works. Later, the attackers use the intercepted knock to get in.

      You have to change your key every once in a while. Every time you do, you can also delete your buffer of remembered random data. You could automate this; generate keys from a master key and use synchronized clocks.

      --
      Sunlit World Scheme. Weird and different.
  49. What I'm afraid of by ENOENT · · Score: 1

    Landshark.

    --
    That's "Mr. Soulless Automaton" to you, Bub.
  50. It's all about layers of security by pkiguruman · · Score: 4, Insightful

    If you are using portknocking as your only defense, then you are as smart as dirt and deserve what's coming to you.

    I think it fits in great as a layer of defense.
    Is there an easier way to weed out the attempts from all of those script kiddies and worms to get into certain services on your network?

    1. Re:It's all about layers of security by Anonymous Coward · · Score: 0

      If your system is secure, adding a lame layer in front of it (port knocking) doesn't buy you anything.

      If your system is not secure against sniffing (e.g. you're using plaintext passwords), then adding port knocking also doesn't help, because a sniffer will break both layers at the same time.

    2. Re:It's all about layers of security by patbob · · Score: 1
      Is there an easier way to weed out the attempts from all of those script kiddies and worms to get into certain services on your network?

      Port knocking is really just another form of password entry. It appears safer because there isn't a challenge prompt, but what does a prompt really buy you, anyway.

      So, standard password passing schemes can be applied, which leaves one obvious solution.. encode a one time use password into the port sequence to knock on. This is probably the most secure solution as it still doesn't require any servers listening on ports and the port sequence changes every time it is used, so simple replay attacks don't work.

      You won't get a challenge that you get to repond to though, so you'd have to compute it independently at both ends.. maybe like ratchet to the next challenge value every successful connect or every N minutes.

      Figuring out how to pass a piece of data along with the knock, while still not requiring a server listening on a port, would be even better -- you'd not only have to know the magic port sequence to use this time, but the magic pieces of data to pass along with each tap. Perhaps the network protocol could be used? Encode into the knock sequence whether each tap is via UDP or TCP?

      Getting back in sync on the challenge value would be a bitch through... oh, the price of security :-)

      --
      Welcome to the net of 1000 lies. Upgrades are scheduled soon that should bring us to the 10,000 lies mark.
    3. Re:It's all about layers of security by evilviper · · Score: 1
      Is there an easier way to weed out the attempts from all of those script kiddies and worms to get into certain services on your network?

      Block all connections other than port 22 (SSH). You can either connect to the ports you want using SSH port forwarding, or you could use PF-Auth.

      Either one would be a cryptographically secure system. You could use a static password, public-key pair (with or without password protection), S/Key, Kerberos, etc.
      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    4. Re:It's all about layers of security by Anonymous Coward · · Score: 0

      Port knocking is really just another form of password entry. It appears safer because there isn't a
      challenge prompt, but what does a prompt really buy you, anyway.

      If I hid something in a tree in a forest, would it be easier for you to find if I did or did not paint a red X on the trunk of that particular tree?
      A prompt is that red X. It says that something is listening. That something may have bugs.

    5. Re:It's all about layers of security by Kwil · · Score: 1

      If your system is secure, adding a lame layer that hides the secure port makes your system even less inviting to script kiddies.

      If you're system isn't inviting to script kiddies to begin with, fewer of them hit it when it's suddenly found that your supposed security has a hole in it.

      --

      That Jesus Christ guy is getting some terrible lag... it took him 3 days to respawn! -NJ CoolBreeze

    6. Re:It's all about layers of security by pkiguruman · · Score: 1

      Instead of leaving port 22 open to the world, wouldn't it be better to add a layer that would require a secret "knock" before you could even connect to port 22?
      I know that after the last remote OpenSSH vulnerability, there were a few worms out and about. Port knocking would protect you from those worms and possibly some zero-day vulnerabilities.

      I do realize that if someone really wants to get into YOUR system, they will probably be able to find a way. But if they are just looking for any system running SSH to exploit and you require a "knock" before you can connect through SSH, they will pass yours by looking for an easier target (one that appears to be running SSH.)

    7. Re:It's all about layers of security by evilviper · · Score: 1
      Instead of leaving port 22 open to the world, wouldn't it be better to add a layer that would require a secret "knock" before you could even connect to port 22?

      No, not at all. If you want a little bit of obsecurity, just run it on another port and be happy. No extra software needed.

      Port knocking would protect you from those worms and possibly some zero-day vulnerabilities.

      No, what port knocking would do is expose you to a whole NEW set of worms and vulnerabilities. That's not even to mention that you are extremely vulnerable to a DoS attack, and there are better ways to do these things.

      If you don't trust SSH, why not just have a simple daemon running on some port that requires you to type in a (complex?) password combination before it will open up the rest of the ports for you? It would be so simple it could be guaranteed completely free of exploits, and would be a much better way to do things. SSH is vulnerable only because advanced features were included, which increases complexity.

      It all just comes down to the fact that you MUST have at least one service listening, unsheilded from potential attacks and exploits. I'd much rather put my faith in adding real security into SSH, rather than the small dose of obsecurity port knocking provides, and likely a huge ammount of new exploits that will only require a single malformed packet to be sent.

      Your port knocking system is going to get killed by any firewall between these two systems, which might block a port you need to knock on, block packets with certain flags, or just see a storm of invalid packets and decide to cut off your connection.

      And then there's the issue of special software. With SSH you only need an SSH client. With my alternative idea you'd only need telnet. With port knocking you're going to need additional software on every machine you use to connect, and possibly root-level access if you are going with some of the more complex port knocking options.

      they will pass yours by looking for an easier target (one that appears to be running SSH.)

      Same goes with changing the port SSH listens on... They only check port 22. And the same would go for the password-protection idea as well.

      But as I've said, I want real security. I could care less about adding another layer of pointless complexity. Especially one that would be an endless hassle like this.
      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    8. Re:It's all about layers of security by julesh · · Score: 1

      If your system is secure, why do you care about script kiddies?

      In fact, if your system is _really_ secure, appearing to have lots of services would probably be a benefit to the rest of us, because the script kiddies would waste time trying to break into your system that they would otherwise be spending on somebody elses, which probably wouldn't be as secure as your own.

    9. Re:It's all about layers of security by Kwil · · Score: 1

      Because no system is "really" secure, and anybody who thinks so is doing so against the evidence of various holes being found in all systems and applications.

      Or in otherwords, sooner or later someone's probably going to find a hole. Better that you're not on the list of "possible targets" when that hold is found.

      --

      That Jesus Christ guy is getting some terrible lag... it took him 3 days to respawn! -NJ CoolBreeze

  51. Implementation which is sniff resistant by 3Volker · · Score: 2, Informative

    www.portknocking.org

    Note the encryption/hash of the ports, source IP, and port to be opened.

    www.portknocking.org/view/documentation
    There is a Perl reference implementation. (GPL'd, of course)

    "I am in no way affiliated with this group."

  52. Did anyone else read it as... by Anonymous Coward · · Score: 0

    Fart knocking? I only ask because I came from the Beavis and Butthead generation of MTV. Knock it off Beavis, you port knocker.

  53. Dumb idea by Animats · · Score: 1, Insightful
    This is one of the dumber ideas to come along. First, it's "security by obscurity". If it becomes at all popular, it will be added to lists of standard attacks. Second, it's subject to playback attacks. Third, it generally involves a "key" that belongs to the software, not an individual. Fourth, listening in promiscuous mode eats substantial resources on a busy network. Fifth, the "port knocking" server runs at a high enough privilege level that it itself may introduce security holes.

    Next idea.

  54. Knock Knock... by RussDavisDotCom · · Score: 1

    ...and let the 'knock knock' and three little pigs allusions commence ad nauseam.

    --
    My favorite phrase: You have 5 Moderator Points! Use 'em or lose 'em!
  55. Re:Knock Knock by Anonymous Coward · · Score: 0

    I was hoping for the giant shark.

  56. Responses to assertions that this is insecure by cryptor3 · · Score: 5, Insightful

    A number of people have commented that because the port knocking sequence is transmitted without any form of encryption, port knocking is insecure. I disagree, on the basis that port knocking is not an access control measure, but rather a deterrent measure.

    If you intend for port knocking to stop determined, targeted attacks, then yes, you are sadly mistaken. However, port knocking is effective in making your host less attractive to be hacked.

    I think that an limited analogy is the removable stereo faceplate. Car stereos are a hot target for car thieves. A car thief sweeping a parking lot will not spend time on cars where he does not see the whole stereo (faceplate included).

    By hiding the faceplate, you make yourself less likely to be a victim, even if you just leave the faceplate in your glovebox. If the thief saw where you hid your faceplate, then yes, he could pop it back in and have your stereo in the 30 seconds it takes him to yank it out. But he would have to be watching you. This would be akin to packet sniffing.

    Likewise, someone scanning for a host is looking for evidence of a particular (vulnerable) service. If he doesn't see that service on your PC, he just moves along.

    1. Re:Responses to assertions that this is insecure by kir · · Score: 1

      You nailed it right on the head. Too bad most here don't get it. Nice post.

      Security through obscurity has its place. It compliments sound security practices quite nicely.

      --
      3cx.org - A truly bad website.
    2. Re:Responses to assertions that this is insecure by aXis100 · · Score: 1

      Well done, great explanation. I agree entirely.

      The only dissapointing aspect is that I just ran out of mod points.

    3. Re:Responses to assertions that this is insecure by AmericanInKiev · · Score: 1

      or said another way - knocking significantly increases the work - in bandwidth and cycles - to breach a security system all other things being equal.

      It does seem to create a high ground for sites that need a higher security / lower ease of use profile.

      - It appears that - like using email as a file system - port knocking could be a means of communicating anything including a tunnelled ssh session without ever opening the firewall. - It is certainly ineffecient - but ineffecient for one - means ineffecient for everyone - including the hack.

      AIK

  57. DOS? by BCoates · · Score: 1

    Wouldn't sending random connections at a server (whatever qualifies as a 'knock') interfere with anyone else completing a pattern to open a port?

    If you want people to have to authenticate without revealing what services you're running, couldn't you just do a real (unlike replayable, sniffable plaintext like this) authentication one-way over UDP? That doesn't give anything away either, and is much less hokey.

    It could even run on a well-known port... Is there already a UDP authentication protocol, or would one have to be designed?

    1. Re:DOS? by im+a+fucking+coward · · Score: 1

      Wouldn't sending random connections at a server (whatever qualifies as a 'knock') interfere with anyone else completing a pattern to open a port?

      No. knock tracks by host IP, port knocking sequence in specified # of seconds.
      It couldn't work on a server providing any other net services if it didn't track by IP.

  58. Fuck Fark. Fark Sucks. by Anonymous Coward · · Score: 0

    Please see subject. Thanks!

  59. Here is the URL by Anonymous Coward · · Score: 0

    You must mean the Nmap Security Scanner.

  60. Here's a good question to ask yourself... by GPLDAN · · Score: 1

    If Port knocking was such a good idea, why isn't it in IPv6? Or something like it, where service ports are only exposed with a key sequence?

    The answer is because more advanced protocols that set up encrypted tunnels exist to do this, and have far more uses. If you want to secure your Linux box badly enough to implement port knocking, and go to the trouble of giving other people the knock sequence (let's call this 'the key') then just compile FreeSWAN or one of the spinoff IPSEC variants and let ISAKMP do that work for you. It was designed to do something port knocking was not - thwart man in the middle attacks using Diffie-Hellman.
    (http://www.netip.com/articles/keith/diffie-helman .htm)
    Do yourself a big big favor, don't re-invent the wheel.

    1. Re:Here's a good question to ask yourself... by AMystery · · Score: 1

      and if I have that exposed instead of hiding it behind a knocking sequence, then I am more secure how? port knocking is another layer, one that hides you from port scanning and makes you a less obvious target. I really don't see why people object to it.

  61. A different solution by Pros_n_Cons · · Score: 4, Informative

    there is another similar idea written by Brian Hatch author of Hacking Linux Exposed. Instead of 'knocking' ports which as I understand it can be vulnerable to brute force like attacks Hatch's solution uses dns queries to dynamicly open up ports through the firewall, using the dns query as a password. There is no 'service' listening but there is a sniffer waiting for a key string on port 53 that it will take action on. The best thing is it is OS agnostic since DNS query tools are already on all OS's no client software, or technical know-how is needed. And easily customizable if you're fluent in perl.
    These kind of things are not ment for full access, only by allowing you access to the daemon which still has its own acl. When you travel sometimes you're not aware of what IP address your laptop will have so you set a dns query to your home machine which opens the SSH port for you. The whole point is to prevent random attacks from people scanning vulnerable daemons. The following are links to Brian Hatches explinations and code.

    Part 1
    Part 2
    Part 2

    --

    -- "of course thats just my opinion, I could be wrong." --Dennis Miller
  62. port knocking with perl by ubiquitin · · Score: 4, Informative

    My friend Thom Harrison at the Omaha Linux Users Group has posted some scripts which do port knocking and have the following CPAN dependencies:

    |use File::Tail;
    |use Crypt::CBC;
    |use Schedule::At;
    |use Math::VecStat qw(sum);
    |use POSIX qw(strftime);
    |use Pod::Usage;

    --
    http://tinyurl.com/4ny52
  63. Better yet? by erik_norgaard · · Score: 1

    I really don't see the point. It seems far easier to try bruteforce port knocking than try bruteforce user/password combinations.

    As mentionened seems that nmap will get some extra features soon if this becomes popular.

    The only interesting really is the idea of having services running behind a closed port and actually able to respond.

    But then, this could be done using udp that actually contained data, identifying the client, and encrypted ofcourse.

    Idea (sorry if this might get a bit off topic): The server knows it's clients, it has a public key of each client, and each client has been equipped with a public encryption key of the server.

    Know the client can send a signed packet encrypted with the server public key for the server to verify.

    On success the server will open for connections for that client. In any case there will be sent no respond to the udp packet.

    The result is the same, the server appears not to be listening on any ports, yet capable of accepting new connections.

    But in this case the client does not gain access using some preknown knocking sequence, but actually identifying itself using encryption.

    The problem seems to be manageing keys, and then to select a set of data to be signed and encrypted such that client is fully identified. (and keeping it all in one datagram is probably also a good idea).

    But isn't that worth the trouble for the extra security? Does this give extra security?

    1. Re:Better yet? by INeededALogin · · Score: 1

      Know the client can send a signed packet encrypted with the server public key for the server to verify.

      Nice to be creative, but the problem with udp is that their is no bi-directional handshakes. Which means that you are just generating a udp packet. Packet sniffers really are wonderful things. People would be able to look at the output of one, see you send a single udp packet and then connect. They would just duplicate that packet to open up the port.

      Now, take your idea, send a udp packet, be ready to receive one in return from the server(firewall issues?) and then send one back.

    2. Re:Better yet? by Fuzzums · · Score: 1

      "As mentionened seems that nmap will get some extra features soon if this becomes popular."

      But how will you guess my secrit sequence?
      And even better: if i detect strange sequences (fitst 4 right, next one wrong) i'll start dropping all traffinc from that host.

      it will make hacking a lot harder :)

      --
      Privacy is terrorism.
    3. Re:Better yet? by erik_norgaard · · Score: 1

      Sorry, but it seems that you did not read what I wrote.

      1) The point is to avoid the handshake of tcp since that would reveal that a service is running, in fact to avoid the server responding to packets on specific ports to arbitrary clients since this reveals the existence of the server. udp does not use handshake and can carry data. Sending three udp-packets as you propose corresponds to the tcp-handshake.

      If you use ssh, then you first do a 3-way handshake in tcp, then you exchange keys, and then starts the encrypted session. The handshake is needed since in order to exchange the keys, we need an established connection.

      To avoid the handshake keys would have to be exchanged beforehand. Some stranger cannot use any piece of hardware from anywhere, if that was needed, one could issue single use keys for the clients.

      2) As I wrote one problem would be to find good data for the packet, and good data should of course prevent spoofing.

      Such good data could be the source ip and source user name. This good data would be signed by the user private key and encrypted by the server public key.

      Since we have chosen good data, an intruder cannot simply copy the packet payload, but needs both a public key of the server and a private key to which the server has the public key in order to craft packets.

      Good data could also be a signature of the packet header, but that may technically be more difficult to do - I think then we are approaching ipv6.

    4. Re:Better yet? by erik_norgaard · · Score: 1

      The port knocking is vulnerable to sniffing because you use the same knocking sequence for all users, and the knocking sequence can be obtained by simple sniffing. This is equivalent to all users use the same password and use telnet.

      Some are aware of this problem and propose a solution where you connect to a server in order to obtain the secret sequence. And this secret sequence is then unique for the client.

      Now with this solution, you will be revealing that you run some service since clients can connect. You have to authensicate in order not to hand out the secret sequence to everyone.

      But if you set up such a solution, then you are really back to the standard authensication, you just require the clients to authensicate twice, first to get the knocking sequence, then in the actual login.

      And you loose the protection that the port-knocking concept gives: That stangers will not be aware of the existens of the server.

      Finally, yes, you can block specific clients that just get it too wrong too much. But just as an analog example:

      I lived in a house that had a code box on the door. To enter you had to enter a 4 digit code. Now the box was stupid, it just checked the 4 most recently entered numbers, and if they machted the code the door openend.

      This means that if you entered 12345 then the box would first check 1234 and if it didn't match it would check 2345. So the obvious question is, how many numbers do I have to press?

      The maximum is 40000 since there are 10000 codes each of 4 digits. The minimum is 10003, the first three will no give a valid 4-digit code, but each time you press another number a code is checked, but it is not certain that such a sequence exists.

      Obviously we do not have to press 40000 numbers as the example shows. What is the optimal solution?

      It turned out that there did infact exists a sequence of 10003 digits that contained all codes.

      This idea also applies to the portknocking if you try to bruteforce. Ofcourse, we now have 65535 digits to choose from, so things are more complicated :-)

  64. Used to be done in phone systems by HPNpilot · · Score: 5, Interesting

    Well at least I used to build them in. It was so simple many others must have done the same thing. Take a 10-step relay, put a 1 minute reset timer on it, and wire each of the first few steps to a pulse gen anded with one of the incoming lines' ring detect. If the right sequence of incoming calls happened, it connected a separate incoming WATS line to a WATS outgoing line. Viola! Free calls from anywhere to anywhere, and nobody would ever notice if you were careful to only select "unlimited" outgoing WATS lines. We're talking something like 35 years ago here...

    1. Re:Used to be done in phone systems by Alioth · · Score: 1

      I love the old Strowger exchange systems. They make such nice noises :-)

      There's one at the London Science Museum. I had great fun last year trying to make all the phones go at once, and then hang them all up as fast as possible, lovely Ctththhthththhwhwwwraaack! sounds as all the bidirectional selectors go home.

      BTW: What do you fly at HPN?

    2. Re:Used to be done in phone systems by HPNpilot · · Score: 1

      Another fun thing you could do was to disconnect the earpiece shorting contact on the dial. Then when you dialed the last digit (make it a "0") you could hear the relay step through and as it passed stations that were in use you would hear 100 msec of "busy" for those.

      A couple of times I came close to getting entire PBX switchrooms (Ma Bell used to abandon them when buildings were to be torn down) but had no place to put/reassemble them.

      I fly a Grumman Cheetah.

    3. Re:Used to be done in phone systems by Alioth · · Score: 2, Interesting

      You might be interested in this website: Light Straw. I particularly enjoyed the stories of the old manual international exchange where operators would put calls through by hand during the 1970s or thereabouts. Looking at all that kit, it's no wonder phone calls used to be so expensive.

      I work with a former phone engineer who told me about a night in the exchange - the place was very quiet, and then at 8.00pm, all the switches started going, building into a massive crechendo of sound, the entire exchange turning into a deafening cacaphony of selectors...well, selecting. He said it was spooky. He shortly afterwards discovered the event that prompted all this activity was the dramatic end of an episode of a primetime TV soap.

      One of the things that surprised me was all the tones were generated by essentially a big electric motor driven thing (I think Light Straw has some samples of the tones along with an engineer testing the thing). I'm just old enough to remember the last Strowger exchanges (our local exchange went digital in 1989 IIRC) and I sort of regret not badgering a BT engineer into letting me in the building and watch this thing go. Perhaps I'm just a bit too geeky, but I love electromechanical stuff.

      Digital phone exchanges seem so...dead...by comparison.

      The Grumman Cheetah is a neat plane, the Association of Manx Pilots have one which I've got a few hours in. Probably the best nosedragger single in my budget :-) I used to have a half share in an ancient Cessna 140 (see http://www.dylansmith.net) which I flew coast to coast across the US. It's a big place at 85 knots!

  65. Use of port knocking... by frenztech · · Score: 2, Insightful

    The use of port knocking should be as a deception device, not necessarily as an active defense.

    You are hiding the fact that you have something to hide, ala steganography. Once that something is found (the knock sequence), it is open to attack just like anything else.

    Stego + encryption is the way to go. Not necessarily for this application (port knocking), but it could have some great security uses.

    So with port knocking, you still want that encrypted channel to be required (SSH, etc.) on the port that you successfully knock to.

    --
    "Sed Quis Custodiet Ipsos Custodes?" -Juvenal
  66. More secure than people think by Experiment+626 · · Score: 5, Interesting

    Most of the arguments here against port knocking are along the lines of "but someone could just do a replay attack" or "this is vulnerable to spoofing" or whatever. These things are true about a naive implmentation of port knocking that uses a static knock, but it's not hard to come up with variants on the port knocking idea that offer much better security than that. For instance:

    1. Connect to server on some constant, always-open port.
    2. Server sends back a string, then closes connection.
    3. Using this string and a secret password, determine the current knock sequence.
    4. Connect to server using this knock sequence.
    5. Once a knock sequence has been used, serevr invalidates it, creates a new sequence, and begins publishing the string corresponding to the new knock sequence.

    The secret key of course has to be kept secret, and the underlying crypto must be good enough that if the attacker sees the challenge and the knock sequence used to reply, the key itself cannot be deduced.

    This would completely protect from replay attacks, as knocks are not reused. Spoofing could potentially be used to DOS someone by interfering with their knock sequence, but not to gain unauthorized access oneself.

    Sure, at first glance port knocking may seem to be of limited usefulness, but if you combine the idea with a little cryptographic thinking, the possibilities start to become a lot more exciting.

    1. Re:More secure than people think by erik_norgaard · · Score: 1

      OK, so data are encrypted, and the port sequence change.

      But:

      1) The point of the port-knocking as I understand is that you don't have an allways open port. Your idea throws away that.

      2) Your idea still implies a common secret known by all clients.

      I would prefer a public-key based encryption/signature scheme as proposed. And drop the port knocking completely

    2. Re:More secure than people think by Dr.+Manhattan · · Score: 1
      I did pretty much the grandparent's idea with Ostiary. Yes, it has an open port, and requires shared keys. But it is so utterly simple (16 bytes (an MD5 hash) out, 16 bytes back (HMAC)) that it eliminates the chances of buffer overflows or anything like that, and even runs on a Palm Pilot.

      Public key stuff has had buffer overflows and exploits before. I have my sshd disabled until and unless I give it the correct signal; I don't have to panic whenever it has a hole discovered.

      --
      PHEM - party like it's 1997-2003!
    3. Re:More secure than people think by evilviper · · Score: 0, Troll

      Bloddy hell!

      Yeah, that's just wonderful. We'll just leave a port open, add secure crypto to the mix, just to determine a secquence of ports to hit, that then open up the regular ports.

      <SARCASM>
      That's just so much better than logging-in via SSH and forwarding whatever ports you need... Oh yeah, so much of an improvement.

      Sorry guy, this who idea is just riddled with bad ideas, and provides nothing useful for them.

      And you know something, with SSH port forwarding, I'm not screwed if I'm behind a firewall that blocks a port or two. Good luck when you're on some consumer-level ISP connection, and your port knocking sequence requires you to hit port 25, 139, 443, etc. With SSH, you only need one port open (22), and the rest go over that connection. It's already more cryptographically secure than any port-knocking system you could come up with, and far more flexible.

      Did I mention that SSH isn't particularly vulnerable to DoS attacks.?

      And if you don't want to have all your connections going over the SSH connection, you could go with PF-Auth, which can modify the firewall rules on the fly based upon your SSH session.

      Nope, this whole port knocking idea is just nonsense.

      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    4. Re:More secure than people think by aziraphale · · Score: 1

      Missing the whole damned point, which is that port knocking doesn't require an open port.

      There are ways to avoid replay attacks, however, without opening a port - or at least make them less effective. One that springs to mind would be to vary the ports knocked according to the source IP address doing the knocking. Take the four byte source IP address, combine with several bytes of shared secret key, apply a hash algorithm such as MD5, divide up into two-byte chunks, and use them as a sequence of port numbers to knock.

      The port knock sequence is then ONLY valid for requests from a particular IP address, and won't work if replayed blindly from a different IP address (there is, of course, a performance cost on the server - every rejected connection attempt needs to be examined to see if it is a valid start to a port knock sequence for the originating IP address).

      This means a malicious third party can't easily construct a port knock sequence for their own IP address, because they would need to know the secret key. IP spoofing is possible, but inclusion of a sequence number in the hashed data would make it tough for a replay to succeed under IP spoofing.

      Only attacks I could see working would be a port flooding DOS that ties up the server on calculating hashes for random port activity (but that's no worse than what's possible on an open server), or an 'interference' attack, where you interfere with someone's connection sequence by sending spoofed packets from their IP address to random ports - preventing them from connecting.

      Oh, and of course once the knock is accepted and the port is opened... that's when you're really vulnerable.

    5. Re:More secure than people think by sol_geek77 · · Score: 1

      I completely agree with your variant, but correct me if I am wrong, but once the server opens up the well known port for a client then what is to stop the next person from just connecting since the port is open and now listening. As long as the client is connected what is to stop the next person or a bad guy from exploiting the port. Wouldn't a better solution be to also have the server send in the encrypted packet a random port to connect to so every user connects to a random port as well. Now the bad guy has a difficult time expoiting the random port since he can't easily find out what the port is running. As well as can't replay the attack.

  67. Knock Knock-"Packet load" onboard. by Anonymous Coward · · Score: 0

    So if I use this technique, can I knock-up a server?

  68. Services by PsimanX1 · · Score: 2, Insightful

    One of the cool things with this is that you could set it so that it actually starts SSH or the FTP daemon or whatever as well as open up the firewall on the appropriate port and shut it down again after.

    Saves mem usage as well as being that teensy bit more secure!

    Also in answer to post further up - WinXP's firewall can log dropped packets to a text file.

  69. i've noticed a lot of posts by timmarhy · · Score: 3, Insightful

    bagging secret methods of keeping things secure. well i'm sorry kids but ultimately keeping something secret is necassary for a secure system. what is NOT secure is keeping that secret in an accessable mode. good passwords are the most effective way of having a secret way into a system, since your brain isn't plugged into a computer it's only accessable to the correct person. port knocking sounds intresting, but it's like having a secret knock to let you in a physical door, anyone listening will know that secret knock.

    --
    If you mod me down, I will become more powerful than you can imagine....
  70. Port Knocking, or How I Learnt to... by Anonymous Coward · · Score: 1, Insightful

    a) ...increase scans exponentially.
    b) ...excuse for DDoS: "Sorry, thought I knew the knock... so I tried every possible combination."

  71. It's not by Anonymous Coward · · Score: 0

    You are quite correct.

  72. Idea: by Ayanami+Rei · · Score: 1

    Set up a port that pretends to run XYZ service. Keep it open by a dummy daemon that doesn't do anything except act like a tarpit to slow down scanners. Maybe it even tries to fake the initial phases of the protocol.

    So you port knock... then just signal the daemon to release that port and have it claimed by the real deal. A port scan might not turn up anything that looks different, until they try connecting to the service.

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  73. Port Knocking with Honeypot by kyoko21 · · Score: 1

    How about implement a timebased port knocking system incorporated with GPG key and a rotating honey pot and listen for UDP?

    Ugh, I am already confused by my own obscurity.

  74. Uh huh...huh huh huh... by EmagGeek · · Score: 1

    Huh huh huh... uhhhhh, Shut up, Beavis!

    heh heh, You shut up, PortKnocker!!!

  75. Re:Knock Knock by UserGoogol · · Score: 1

    Candygram?

    --
    "Never attribute to malice that which can be adequately explained by stupidity." -- Hanlon's Razor
  76. try doorman.sourceforge.net by F.Z.Bunny · · Score: 3, Informative

    For portknocking, try doorman.sourceforge.net Got crypto.

    --
    --- There is no bun but Bun, and Fuzzy is His prophet! Bunbun akbar! ---
  77. I kind of see it as a password as well by dilvish_the_damned · · Score: 1

    And a few more thoughts:
    Probably not much more than obscuring your open ports.

    Some are adding ecryption. I preffer ssh to ecrypt my data. I know its not obscure that I am talking over an encrypted link, but port knocking isnt going to be obscure forever.

    There will likely be a problem using this over proxied TCP connections such as TCP acceleration used over SAT links.

    It would very likely seem usefull for those that are fighting with thier ISPs (such as me) about open ports on the household firewall (such as my ssh, they hate that for some reason). Ports reject by default, after a few knocks open it up for the terminal your at... could work OK if the 'knocker' portion was fairly portable.

    --
    I think you underestimate just how much I just dont care.
  78. Even better for IPS? by quarkscat · · Score: 2, Insightful

    Actually, as the CPU clock speeds up, port-
    knocking may prove to be an ideal way to keep
    the black-hats out of your network. Imagine
    applications that don't maintain explicit
    open ports, but only open up a port with the
    right "shave-and-a-haircut" knock-knock. If
    generic port scans can't find any holes, how
    do the script-kiddies break in?

    1. Re:Even better for IPS? by Short+Circuit · · Score: 1

      That brings to mind the possibility of portknocking that depends on delays between knocks, rather than where the knocks are on the port spectrum.

    2. Re:Even better for IPS? by hesiod · · Score: 1

      > the possibility of portknocking that depends on delays between knocks,

      Would that still work when you go to a dialup connection? You might have to make the timing pretty large (say, a few seconds?) to be able to make up for the differences in network speed & latency, wouldn't you? Still, it's a workable idea & another layer of intricacy to breaking in.

    3. Re:Even better for IPS? by Short+Circuit · · Score: 1

      Good point. Conversely, it would work really quickly on a low-latency network. Or a network with gauranteed delivery times+failure notices.

  79. Different levels of cluelessness about servers by billstewart · · Score: 1
    Comcast and other cable networks have different levels of cluelessness.
    • From a policy standpoint, they're suicidally clueless about expressing policies that limit their users to couch-potato passive consumerism instead of letting them be active users creating cool and interesting applications that will encourage more people to want broadband. As a stockholder I find this very annoying, and as a Comcast Cable TV subscriber who buys DSL because their policies forbid doing anything vaguely interesting on a cable modem, I also find this very annoying.
    • Some employees have lots of clue and know that they have stupid policies and don't go out of their way to set up mechanisms to enforce them. As one person said (some years ago) "Well, duh, Napster is the main reason people _buy_ broadband service.".
    • Some employees are too clueless to understand that an "ssh daemon" is a "server that seems to contradict the policy" so they don't do anything about it.
    • Most of the things they could do to block services that they bad take enough work (and therefore cost) to implement that they don't bother unless there's a specific performance problem. For instance, scanning for port 80 and 8000 and 8080 etc. takes lots of work, so it's not likely to happen, but blocking port 80 at their routers is pretty simple. So when the pick-your-favorite-Microsoft-IIS-virus happened, they went out and blocked port 80 on all their routers, and didn't go turn it on later when the virus storm was over.
    • Occasional employees have enough clue to understand what you're talking about and enough to realize that it violates their policies and enough to be able to do something about it but not enough to realize that the policies are stupid and ignore them. Some of these employees work in tech support, and you don't want to get one of them if you're calling in because you're having trouble with people attacking your web server or whatever.

    Port Knocking Acceptance using UDP is very unlikely to be detected by ISPs, because the usual implementations are that somebody sends you a packet and you don't respond with a reject packet. It's much less visible than TCP services. On the other hand, if you use port knocking to turn on your Port 80 HTTP server, the ISP may not catch your server when scanning but may still have port 80 blocked in their routers, so it doesn't really help much.

    --

    Bill Stewart
    New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
    1. Re:Different levels of cluelessness about servers by FLEB · · Score: 1

      I don't really think it's about clue versus lack thereof. It's just that cable, with its local loop and shared bandwidth, is much more succeptible to service degradation when one user is eating up a lot of bandwidth. Sure, they could cap it or slow it, but it's much easier just to say "no", and block services that are known to cause high use.

      This is why you see less of this on DSL. Besides a high bandwidth bill, the provider really doesn't take much more of a hit. All that bps is assigned to you, and only you. Your neighbors don't complain if you max it out.

      As for cable, things like SSH, Telnet, and the like are less common, and would usually have less bandwidth usage and less popularity (fewer users) than a garden-variety HTTP/FTP server.

      Any server that uses port-knocking probably isn't going to make it far beyond geek-level. These people are fewer, more knowlegable (won't unnecessarily saturate the loop), and probably know how to connect to a nonstandard port.

      The biggest thing you'd have to watch with a portknocking app on filtered broadband is that all the "key" ports aren't filtered upstream.

      --
      Information wants to be free.
      Entertainment wants to be paid.
      You just want to be cheap.
    2. Re:Different levels of cluelessness about servers by caseydk · · Score: 1

      I used to have Comcast and they didn't have *any* ports blocked. It was nice as I was able to run everything on standard ports. 80 for apache, 8080 for tomcat.

      Now I have Cox Cable and they block 80 by default so I've had to switch over to 8080 for apache, 8081 for tomcat.

      Most of the techs don't have a clue about their AUP let alone any information about ports...

  80. Meh by Anonymous Coward · · Score: 0

    I just drop connections from any source that also tries to connect on 21,25, 119, or 137-139 which are ports my ISP's TOS checker scans, but I don't use. Anyone who knows what they're looking for on my system won't bother with these ports.

  81. crypto and dynamic knocks by Anonymous Coward · · Score: 1, Informative

    This is only implementing basic static knock sequences, but it could (and likely will) be further developed to support cryptographic knocks that are embedded with other data, such as which port to open.

    The guy at portknocking.org has a good example of how to do this.

    check it out

  82. Anti-Server Broadband Monopolies by billstewart · · Score: 3, Interesting
    It's really annoying when cable modem companies do this, because there's almost always at most one cable tv company in a given area, so if they're clue-deficient, you don't have an alternative. (And most of them are not only clue-deficient, but contagiously clue-hostile.)

    It's much less of a problem when DSL providers have policies like this, at least in the US, because usually the ex-monopoly telcos rent their copper to multiple DSL Layer 2 providers (often including themselves), and the DSL providers usually provide connectivity to many ISPs. So even if, for example, SBC DSL ISP service has some stupid policy, SBC provides Layer 2 access to many ISPs including Sonic.net and Speakeasy, who have friendly clueful policies, and they rent copper to Covad, who provide Layer 2 access to many more ISPs (sometimes with fewer connectivity options, e.g. maybe only SDSL or IDSL and not line-shared ADSL.) Sometimes these alternatives cost more - I'm paying about US$57/month for Sonic.net ADSL with four static IP addresses, vs. some of the newer loss-leader $29 deals from other providers.

    Most other countries don't seem to have policies against being a Real User on your broadband service, at least if you're not commercially reselling it. Theoretically, this means that all those non-Americans out there should be creating lots of cool and interesting things to do with their broadband services, but I haven't seen much other than Yet Another File-Sharing System variants or some of the Asian grocery-shopping-on-line things that get magazine articles written about them but aren't very useful outside their local areas.

    --

    Bill Stewart
    New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
  83. Re:Knock Knock by fcolari · · Score: 1

    If the port's be a rockin' don't bother knockin' --Stevie Ray, l33t g33t4rist

    --
    "The first rule of intelligent tinkering is to save all the pieces." --Aldo Leopold (Paraphrased)
  84. Re:Knock Knock by mcpkaaos · · Score: 1

    If the server's a-rockin', don't come a-knockin'.

    --
    It goes from God, to Jerry, to me.
  85. U of F by Ironsides · · Score: 1

    I seem to remember the University of Florida was kicking students off its network who used any sort of server (including web). As they were claiming that they were basically doing this to prevent any peer to peer networks from running. I wonder if they could implement this to prevent the school from nocking them off the network and still be able to play their games and various other things. Course, blocking all on campus port searches using a firewall could also do that i think.

    --
    Fly me to the moon Let me sing among those stars Let me see what spring is like On jupiter and mars
  86. Port Knocking and Sniffing by Anonymous Coward · · Score: 1, Interesting

    Why not have a port-knockd run on one machine to open ports on another. Now the sniffers must connect the knocks and the real destination ... a presumably even more difficult task.

  87. Hrmm by KaiLoi · · Score: 1, Interesting

    This isn't that new.. I've been using he perl portknocking daemon (after heavily modifying it to support iptables instead of ipchains and some more robust code such as pulling the password out of the code in plaintext.) for about a month now.. works really well. No substitute for being up to date with patches and a good secure root passwd but given I can now just firewall off ssh except when someone knocks to come in it's pretty good.

  88. "So the combination is 1,2,3,4,5..." by Atario · · Score: 1

    "That's the stupidest combination I've ever heard in my life! That's the kind of thing an idiot would have on his luggage."

    --Dark Helmet

    --
    "A great democracy must be progressive or it will soon cease to be a great democracy." --Theodore Roosevelt
  89. Protecting Knocking from Sniffers by billstewart · · Score: 1
    Similarly, you could just make the knocking sequence dependent on the sender's IP address, e.g. 123.45.67.89 needs to knock on port Hash1(123.45.67.89) then Hash2(123.45.67.89).

    Or your could reply to the second correct knock with information required to make the connection, e.g. something as simple as the correct port number that you're going to open, or some password to hash a third knock with. It's probably best not to do this for the first knock unless you require a password in the knock, because somebody who portscans your entire space would presumably hit one correct port, unless you block them after too many incorrect attempts (which has other problems, e.g. they DOS your friends by sending lots of forged incorrect knocking packets....)

    Anonymous Coward's assertion that you've got no way to prevent replay attacks other than annoying one-time passwords is incorrect. You could do simple things like using the timestamp as a challenge string, and rejecting knocks that have timestamps that are too old. (Dude - if you want to talk to me, get yourself a decent NTP feed first!) Or you could do the reply-on-second-correct-knock bit I discussed previously. In general, if you're going to be paranoid, it's much more important to be paranoid about somebody hijacking the session that gets built after the knocking is over.

    Besides's AC's concerns (and I generally agree with the "keep it simple or don't do it" advice), one of the purposes of this kind of system is to implement the knocking mechanism in a firewall that's simple enough to protect and doesn't contain critical data, and only permit connections to that buggy DDOS-able easily-cracked Windows server in your DMZ after doing some authentication. It's Defense-in-Depth, though it's the kind of thing that's much more useful for your 31337-h4x0r buddies to play games with each other than it is for your blog or corporate web page...

    --

    Bill Stewart
    New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
  90. sniffing could be made insufficient by lysander · · Score: 1

    Of course, a smarter setup would be to set up an S/KEY-like sequence for the port knocking -- that is, the sequence changes in known way from connection to connection, but the sequence is hard to predict without knowing the predetermined, shared key.

    --
    GET YOUR WEAPONS READY! --DR.LIGHT
    1. Re:sniffing could be made insufficient by Krunch · · Score: 1

      Like someone already pointed out, it's not really different than TCP MD5 Signature (unless I didn't understood what you mean).

      --
      No GNU has been Hurd during the making of this comment.
    2. Re:sniffing could be made insufficient by lkeagle · · Score: 1

      Hey!!!!

      Broadband ISP techs!!!!!

      You getting all this?!?!?

    3. Re:sniffing could be made insufficient by Threni · · Score: 1

      > Hey!!!!
      > Broadband ISP techs!!!!!
      > You getting all this?!?!?

      Yeah - it's amusing that people talk about such people, or spammers etc, assuming that they don't read Slashdot. If I worked on spamming systems, I'd read every story about spamming I could find, for instance.

  91. router firmware by initialE · · Score: 1

    Now someone needs to make an implementation for that Linksys WRT54G...

    --
    Starbucks, Harbuckle of Breath.
  92. Authpf *IS* another layer by billstewart · · Score: 2, Insightful
    If I'm reading the Authpf FAQ correctly, Authpf is a service that you run on your firewall, not on the target server behind it. Logging in to authpf on the firewall is equivalent to knocking on the firewall - both of them tell the firewall to let you access the target server that's hidden behind the firewall, and if you don't knock/authpf, the firewall won't let you in.

    There are some tradeoffs - knocking systems are usually lightweight, while authpf is probably more thorough, especially about making sure the firewall hole gets closed when you leave. Different knocking systems have different bugs in them, and OpenBSD+SSH+AuthPF has the risks of more people attacking it, but the knocking systems have random authors while Authpf and its environment have to be blessed by Theo, so you've got some level of assurance about QA and future fixes. Also, knocking systems need various clients to knock with, and may be susceptible to firewall damage in between, while SSH is pretty widespread and firewalls generally let you make outgoing SSH connections.

    --

    Bill Stewart
    New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
  93. Fark Knocker by Hungry+Admin · · Score: 0, Offtopic

    Fark Knocker.

    --
    Be who you are and say what you feel, because the people who mind don't matter, and the people who matter don't mind.
    1. Re:Fark Knocker by Anonymous Coward · · Score: 0

      You have been manipulated. You are t3h loser. Have a day.

  94. Hmmm. . . . by WinterpegCanuck · · Score: 1

    Square peg into. . . wait, what is my pass code. . . um. . . oh yeah, square hole.

  95. Oh brother by Randseed · · Score: 1

    Good God. I did this years ago.

  96. Order and Delivery Of Packets Is Not Guaranteed! by Dr.+Manhattan · · Score: 4, Informative
    Packets are not guaranteed to arrive in the order that they were sent, or even to arrive at all. The longer or more complex the knock sequence, the more unreliable this system will be. Especially for a busy server.

    There are less stealthy but more secure alternatives. I wrote one.

    --
    PHEM - party like it's 1997-2003!
  97. Parent is wrong by Ernesto+Alvarez · · Score: 5, Informative

    Encrypted port knocking is pointless. Here's why: Port knocking only makes sense if the protected system reacts to the individual knocks as if there was no port knocking system. Only when the knock sequence has been completed it opens the port. This means that you can't do any handshaking. All communication is one-way until it's "too late".


    The idea in the grandparent post wasn't a challenge-response in the traditional way. It was some authentication data along with the knocking.
    The knock won't be encrypted, but it will have some data that is characteristic of the source (the source IP) that can't be spoofed (because of the password and the one way hash).

    An example of this would be:

    1.Real owner takes his IP (public info)
    2.Real owner takes his secret password (known only to him)
    3.Using IP and password he computes the hash and sends it in the knocking packets (let's say it's in the IP id)
    4.The receiving system captures the knocking packets and takes IP source and the hash
    5.It reads the secret password (from config file)
    6.It calculates the hash with the source IP and password

    If the hash sent and the hash calculated match, the system "accepts" that part of the port knocking. If not, discards the packet.

    An intruder might only spoof the whole packet (including IP source) and might open the firewall only for that IP. If he tries to use the hash to open it for HIS ip, the calculated hash won't match the hash sent. He cannot calculate the hash he would need because he does not know the password, and the hash is one way.

    In this protocol the target system does not need to respond with a challenge, it just discards packets that are "spoofed" (that have a non matching hash).
    1. Re:Parent is wrong by Anonymous Coward · · Score: 1, Interesting

      If you're in the position to sniff packets, you can very likely also spoof packets to come from the ip address which sent the kock that you captured. You could use timestamps, rate-limiting, client selected random seeds, etc, but the second point still stands: If you know that there is a knocking system, you're already past that line of protection. There are real protocols with strong cryptography handling authentication just fine. Adding another complicated scheme on top of it just increases the risk of introducing exploitable bugs.

  98. knocking up the port by Anonymous Coward · · Score: 0

    Sweet!

    Just a nice reminder to George W. Bush that in order for the Christans to kill off all no-Christans, without the use of nukes, that the current occupation of Iraq will continue well beyond June 2004.

    Why?

    Answer! Bush is a Christan. Therefore, anyone who is not a Christan must die.

    However, before "everyone must die", the Christans have it as a God given right that they can violate all non-Christans to their hearts content because, God gets such a hard-on when a Christan violates
    and non-Christan that it's worth a billzion bucks, even George W. Bush would curtail his nightly visits to Gay brothels to beat-off in front
    of the monitor just to see an Iraqi being violated by a Marine, it's the Amarican way, and the only way George W. Bush will be re-erected.

    But let's give Christan their due. After all, they are hands-on-a-dick the most killing people on the planet today. Just mention the name,
    Adolf Hitler, to George W. Bush, and he will sperm his pants ... "cause ol' Adolf wus a man o'God ... he kill'd them Jews din't he", George W. Bush
    was overheard saying to Condo Rice as he was butt-fuck'n her in front of Dick Cheney. Cheney was so excited he was beat'n-off like
    it was he last day on Earth. Your could smell it 5 doors down from the oval office (why do they call it "oval"?).

    Well, guess that the new erectilite drug will give George W. Bush a new Presidency; now he will have the stamina to butt-fuck all the gays in DC.

    Toodles.

  99. Inverse port knocking by grahamsz · · Score: 1

    I used to have a system that listened on the telnet port and when someone knocked it printed out some ascii art and blacklisted their IP.

    I snared about 2 people a day with that approach, since ultimately anyone who saw that telnet was open on my box would inevitably try it first...

    My ISP also had a spider that went out and checked common ports, so we firewalled that so it didn't see ftp, mail and such running.

  100. just another really really stupid idea by Anonymous Coward · · Score: 0

    I can't believe this crap made the news.
    What's next, http over port-knock?
    I'd rather read something published on april 1st

  101. Re:Knock Knock? - How to secure IMHO. by ksp · · Score: 2, Interesting

    I haven't looked at the way this is implemented (in true Slashdot fashion), but here's what I would do:

    From client:
    Send a random number, say [1-10] of port knocks, toward random ports.
    Send the true port knock sequence, this has to complete before a certain time has elapsed.
    Send a random number of port knocks again.
    Wait a second or two, then connect to the real port.

    Now, the server side waits for the first correct port and hence ignores you random garbage. Once your first port comes through it waits for a short duration (3 sec?) for the second port knock. If that comes across OK it waits for the next etc.

    A wrong port from the same IP or a timeout causes the entire knock attempt to fail and get logged.

    Once the correct sequence is sent, there is a random delay of a few seconds before the real port (e.g. SSH) is opened so sniffers can't tell exactly when the sequence started and ended within the total port knocks sent.

    Now you are logged in, and since you are connected via some form of encryption (again, SSH or whatever) you are free to change the port knock sequence. Perhaps even done automatically every successful login, with a logged failback to previous sequence if you get out of sync.

    Unless you log in to the opened port within 30 secs it closes and you have to wait 90 secs to send the sequence again.

    You could additionally add individual sequences for static IPs (or even DynDNS?) or even certain individual logins allowed to authenticate after that sequence was received. I expect netfilter modules to be written to handle all of this.

    By the way, anyone who thinks an open SSH port is *safer* than port knocking + SSH is an idiot in my opinion. The first discussions here were full of such comments, they seem to have died off as people decided to RTFA?
    Still, port knocking is not the best option for frequent connects by many users, and can be DOS'ed with IP spoofing or some kind of packet injection.

    --
    What is the sound of one hand clapping?
    cat /dev/null > /dev/audio
  102. Heh heh.. by smallduck · · Score: 1

    Portknocker

    --
    no sig, no plan, no clue
  103. Is port-knocking like boot-knocking... by Anonymous Coward · · Score: 0

    but for geeks?

  104. i wonder if this somehow involves a magical flute by waspleg · · Score: 1

    and a miniature piano for playing rachmaninoff

  105. Hamster Port Openers! by Anonymous Coward · · Score: 0

    Oh I just cant wait, hamster-made midi-music that also opens ports.

  106. Security vs Obscurity by surstrmming · · Score: 2, Funny
    Most of you seem to miss the point. You do not get security through obscurity, but that does not mean obscurity isn't valuable in addition to security. It is.

    Compare this to real life. You have a stack of porn magazines locked in a drawer. The security is the lock, preventing your mother from ever getting access to the porn. That's fine. But surely you would feel much better if your mother didn't even know there was porn in the drawer! That's obscurity. It doesn't make the lock any more secure, but it is useful.

  107. This is insightful? by Paul+Crowley · · Score: 1

    1) Where do you store the OTP? What do you do when it runs out

    2) How do you know where you're up to in the OTP?

    This won't work. OTP is *not* a magic incantation for wonderful security.

  108. Finally by arethuza · · Score: 1

    A reason to mention the lovely Scottish village of Portknockie!

  109. Missing the point? by not_a_product_id · · Score: 1

    I'm no expert on port knocking (since I hadn't heard of it until I read this article) but it seems like a lot of folk are completely missing the point that this is an EXTRA layer of security on top of what is already there.
    In the parent post the secret knock is more like the existing password based authentication. Port knocking would be more like painting the door to look like the wall. You can't try to guess the 'secret knock' if you don't even know where the door is.

    --

    ---
    We spoke for about a half an hour. I don't recall a thing we said. - Colorblind James Experience

    1. Re:Missing the point? by timmarhy · · Score: 1

      it's a valid point that you don't need to guess the knock, just packet sniff and you can find it. this will only happen in the case the knock is always the same, otherwise you'll never pick it from normal random traffic. it's a novel idea that might fit the right situation

      --
      If you mod me down, I will become more powerful than you can imagine....
  110. MOD PARENT UP by iammrjvo · · Score: 1

    This is a great idea! You could easily map the ID output into a sequence of port knocks.

    --
    Ha, ha! Nobody ever says Italy.
  111. Port Knocking won't hide your servers from yr ISP by nutznboltz · · Score: 1

    Though it would keep comcast from discovering my ssh service.

    What? Provided you never use it? Anyone with a packet sniffer on your network can see there's an ssh server when it's in operation.

  112. Only useful for illegitimate services by btg · · Score: 1

    There is basically zero security reason to use anything like this to access legit services - just run a secure service in the first place. If you need to only access it from certain locations use a firewall or tcpwrappers. If you need authenticated access then use a VPN or SSH. These are all much better scrutinised approaches than some crappy daemon which somebody just...um...knocked up.

    Remember that if it's a legitimate service then somebody should weigh the security value (in this case bugger all) against the potential risk introduced by adding a brand new service which is going to need significant privileges to run (given that it executes commands to open ports or change firewall rules.)

    Where this _is_ amazingly useful is to hide services like rootkits and zombie-control interfaces from automated port and vulnerability scanners. This method is already used in some rootkits to avoid detection.

    In summary, this is only useful when concealment is the key objective - it doesn't add any security per se. cf "security by obscurity" and "welcome to clueville".

  113. Re:Knock Knock? - How to secure IMHO. by Short+Circuit · · Score: 1

    What do you do if part of the proper sequence is in the initial random garbase? For example, let's say my proper sequence is 6 4 5 4.

    4876454877 works fine, but

    46496454219 won't, because 649 appears before 6454, and the 9 causes the attempt to be aborted and logged.

    Other than that, it sounds like a neat idea.

  114. Re:Port Knocking won't hide your servers from yr I by hesiod · · Score: 1

    > Anyone with a packet sniffer on your network can see there's an ssh server when it's in operation.

    Do you know what a port knocker is, or are you posting blindly? The POINT is that your SSH port ISN'T OPEN FOR SNIFFING until you knock the correct sequence of ports. Then you are able to connect. So unless the scan happens w/in 10 seconds (or whatever predetermined time) of the conclusion of the knock, no, they WON'T see there's an ssh server running. THAT IS THE WHOLE FRIGGING POINT.

  115. And ultimately by Jesrad · · Score: 1

    Ultimately, all these security measures are there for what ? Keeping some data on the hard drive and memory secret. Secrets that protect secrets that protect secrets that... My head hurts.

    --
    Maybe we deserve this world ?
  116. Re:Port Knocking won't hide your servers from yr I by Grayputer · · Score: 0, Flamebait

    And what part of 'in operation' did you miss? During an ssh session the fact that ssh is running will certainly show up on a sniffer, if it didn't, there would not be packets and the connection would not exit. I did not see SCAN anywhere in the original post, so if you want to blast someone's post, please at least read the post (yeah I know it breaks slashdot tradition but it DOES improve the signal to noise ratio).

  117. Use a Man in the Middle by 4of12 · · Score: 1

    start looking for seemingly random port probes by machine A on machine B, followed by machine B spewing gobs of data to machine A on a random port.

    Seems like there are a variety of interesting permutations possible for port knocking, such as introducing a 3rd party machine.

    Machine A sends a few pings special ports to Machine C, which then relays some packet to Machine B signaling that A wants to get service on port P. It will look as if B is initiating service with A since no packet went from A to B in the first place.

    As an aside, I've always thought that the size of the time interval as well as the port number could be used for low bitrate communication channels that would look like noise.

    Probably, though, it would give itself away as most servers emit from predictable ports, except maybe NAT firewalls...

    --
    "Provided by the management for your protection."
  118. Re:Knock Knock? - How to secure IMHO. by ksp · · Score: 1

    I would handle it like this:
    4 - no, wrong start port. Treat as random hit and ignore, or log IP with a timestamp.
    6 - yes, that's OK. Start of sequence.
    4 - yes, second port OK.
    9 - Oops! Wrong. Port knock failure. Log failure.
    6 - yes, start of sequence.
    4 - yes, second port OK.
    5 - yes, third port OK.
    4 - yes, sequence COMPLETE. Log successful knock.
    2, 1, 9 - Ignore, as sequence is done.
    Pause for a few random secs and open SSH acces for this IP.

    If you get lots of failed attempts after the first or second port, that's when you really need to get paranoid and block and/or report. Random port scans should not be allowed to DOS your port knock server by filling logs. Brute force attacks should get blocked.
    I would use sequences of perhaps 20-30 ports. Perhaps in range 1025-65536? And 10-20% random ports prepended and appended. Should give a nice set of possible sequences for your one-time pad? :-)

    --
    What is the sound of one hand clapping?
    cat /dev/null > /dev/audio
  119. Yes, we call them "cable modems"... by IBitOBear · · Score: 1

    For all that the "but they have to be on your segment" argument can be rather true. I suspect that the largest number of script kiddies, by far, are living out their lives on cable modems.

    Do you trust the punk next door? I hope you do... he's probably reading your web-mail and pop3 passwords.

    Its certianly not that tough to put a cable modem into permiscuous mode, particularly if it is attached to your computer via USB instead of eithernet.

    Repeat after me:

    There is *NO* *RATIONAL* assumption of physical plant security when you are using a common carrier.

    Cable modems are (within the toggle of one bit) the data equivalant of a good old fashioned party line.

    --
    Innocent people shouldn't be forced to pay for inferior software development.
    --"Code Complete" Microsoft Press
  120. Moo by Chacham · · Score: 1

    Can't someone DoS them know by intermitantly knocking randomly?

  121. scanning versus sniffing by michaelredux · · Score: 1

    > your SSH port ISN'T OPEN FOR SNIFFING until you knock ...THAT IS THE WHOLE FRIGGING POINT

    You are confusing "sniffing" with "scanning". Port knocking hides from simple scanning (using NMAP for example) but once a connection has been established it would be obvious to the ISP or anyone on the local net using a packet sniffer (Ethereal for example).

    The next time you get the urge to post in FRIGGIN ALL CAPS, maybe you should try calm down a little bit and make sure you know what you are talking about.