News for hackers. Stuff that matters.
Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @12:06PM (#11855396)
I agree that obscurity has value in security designs --- security is in large part about imposing asymmetric costs on attackers.

I do not believe that port knocking and single-packet authentication are good examples of this; both are sort of textbook examples of cosmetic security mechanisms that are made irrelevant by SSH public key authentication.

Re:Obscurity Is a Valid Security Layer by rsync on Tuesday June 07, 2016 @12:12PM (#11855451)
"I do not believe that port knocking and single-packet authentication are good examples of this; both are sort of textbook examples of cosmetic security mechanisms that are made irrelevant by SSH public key authentication."

If there's a remote-root buffer overflow for sshd that does not involve login at all, doesn't hiding the sshd add quite a bit of value ?

That is, there are attack vectors that we know exist, and that we have seen in the past many times for server daemons, that occur before, and override, any authentication mechanism.

By hiding the service, you take yourself out of that population of low hanging fruit ...

You don't find that valuable ? I personally find it extremely valuable and consider port knocking to be one of the very few security optimizations that has such low cost/complexity for such a pronounced and well defined gain. I would not think of deploying an Internet facing system without port knocking on the daemons that don't need public access.[1]

Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @12:21PM (#11855504)
If you believe that sshd might harbor a preauth RCE --- something that hasn't happened in a very long time --- then deploy real security in front of it: stick it on the other end of a simple encrypted tunnel.
Re:Obscurity Is a Valid Security Layer by rsync on Tuesday June 07, 2016 @01:14PM (#11855916)
I agree that port knocking is not the christ child. It will not solve world hunger nor will it allow the wolves to lay down with the lambs.

But it's something.

Re:Obscurity Is a Valid Security Layer by CiPHPerCoder on Tuesday June 07, 2016 @02:30PM (#11856604)
It's the ROT13 of defense mechanisms.
Re:Obscurity Is a Valid Security Layer by crpatino on Tuesday June 07, 2016 @08:10PM (#11859080)
ROT13 would stop and attacker peeking over everybody's documents, one doc per second, in search for something interesting to actually devote time and resources on.

You have to decide if the tradeoff between a thousand bot's scans and a sole eavesdropper noticing the knocking pattern and marking your host as "(incompetently) trying to hide" is really worth it.

Re:Obscurity Is a Valid Security Layer by vacri on Tuesday June 07, 2016 @05:35PM (#11858094)
One commenter on a previous iteration of this argument said that moving the port (not port knocking per se) made the access logs quieter, and that was reason enough for their use.

Edit: heh, same thing is going on a few comments down :)

Re:Obscurity Is a Valid Security Layer by drudru11 on Tuesday June 07, 2016 @05:22PM (#11857977)
What would you recommend?
Re:Obscurity Is a Valid Security Layer by CiPHPerCoder on Tuesday June 07, 2016 @05:34PM (#11858084)
SSH key with public key auth over VPN.
Re:Obscurity Is a Valid Security Layer by RawInfoSec on Wednesday June 08, 2016 @11:34AM (#11862912)
Restrict SSH access inbound to trusted networks only. Then you don't have to worry about all this hoopla.
Re:Obscurity Is a Valid Security Layer by lima on Wednesday June 08, 2016 @08:03AM (#11861599)
> It's the ROT13 of defense mechanisms.

Not true. Modern port knocking is provably secure and requires network layer attacks to bypass.

Re:Obscurity Is a Valid Security Layer by drudru11 on Tuesday June 07, 2016 @05:21PM (#11857974)
What software is this "simple encrypted tunnel"?
Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @05:35PM (#11858089)
Any of them. Try spiped.
Re:Obscurity Is a Valid Security Layer by lima on Wednesday June 08, 2016 @08:03AM (#11861596)
More attack surface, not less.
Re:Obscurity Is a Valid Security Layer by dchest on Wednesday June 08, 2016 @09:35AM (#11862156)
Picture time!

More surface (both spiped and ssh are accepting connections):

     |
  →  |ssh
     |
  →  |spiped

Less surface (spipe accepts connection, ssh is behind it):

                 |
  →  | spiped  ↝ | ssh
                 |

With proper configuration, spiped sits in front of ssh, authenticating and decrypting traffic and passing it to ssh.

spiped is a tiny program, uses symmetric crypto (small surface). SSH isn't a tiny program, uses more complex asymmetric crypto (larger surface).

To learn more: http://www.daemonology.net/blog/2011-07-04-spiped-secure-pip...

To learn how to put it in front of SSH, see https://github.com/Tarsnap/spiped#example-usage

Re:Obscurity Is a Valid Security Layer by michaelrash on Wednesday June 08, 2016 @10:11AM (#11862364)
There are some similarities between this and SPA:

-> | SPA / fwknop | ssh

There are important differences too though (beyond the fact that SPA is not encrypting/decrypting traffic for SSH itself). SPA is a UDP authenticator so it cannot be scanned.

Design goals: http://www.cipherdyne.org/fwknop/docs/fwknop-tutorial.html#d...

Re:Obscurity Is a Valid Security Layer by tptacek on Wednesday June 08, 2016 @01:19PM (#11863852)
No, SPA is the first picture: both SPA and OpenSSH are directly responsive to attacker communications. I don't think "attack surface" is the dispositive argument here (the fact that SPA doesn't protect OpenSSH connections at all is), but either way: SPA is inferior to spiped.
Re:Obscurity Is a Valid Security Layer by michaelrash on Wednesday June 08, 2016 @01:38PM (#11863998)
Not exactly. OpenSSH gated by SPA can only be interacted with by an attacker that can either hijack an SPA-authenticated connection, or is on the same network as the SPA client if the client must go through a NAT. This is a fairly limited set of possible attackers. For those not in this set, how can they interact with OpenSSH without first breaking SPA?
Re:Obscurity Is a Valid Security Layer by ryanlol on Tuesday June 07, 2016 @02:49PM (#11856763)
>If there's a remote-root buffer overflow for sshd that does not involve login at all, doesn't hiding the sshd add quite a bit of value ?

Then the attacker can just compromise every single sshd on the internet and have enough bandwidth to bruteforce most port knocking setups.

Re:Obscurity Is a Valid Security Layer by justinsaccount on Tuesday June 07, 2016 @12:33PM (#11855604)
> cosmetic security mechanisms that are made irrelevant by SSH public key authentication.

How does public key authentication protect you from a 0day in sshd or something like the Debian OpenSSL Predictable PRNG key issue?

In a perfect world where there will never be a 0day in sshd or any further weak key issues, but we don't live in a perfect world.

The one time I've ever had one of my linux machines compromised was from CVE-2001-0144.

When the Debian key issue first came out all of my keys were vulnerable. None of my hosts were compromised because I used port knocking.

Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @02:34PM (#11856634)
It protects you from every zero day except the very limited set of preauth zero-days.

Look: it is legit to be paranoid about ssh zero-days (I am not, partly because that vulnerability is so valuable that I am very far down on the food chain for it). But if you're paranoid about those, be serious about them. Put an encrypted tunnel in front of sshd, not some goofy authentication scheme.

Remember: if there's a preauth sshd zero day, the SSH connections themselves are attack vectors. TCP is easily hijackable.

Re:Obscurity Is a Valid Security Layer by justinsaccount on Tuesday June 07, 2016 @03:37PM (#11857147)
> Put an encrypted tunnel in front of sshd

Sure.. but now you have to worry about vulnerabilities in whatever software you are using for that. Other than maybe something like a locked down spiped I wouldn't trust anything more than ssh in the first place.

From my perspective the nice thing about something like the 'simple non cryptographic knockd' was that other than decoding ip packet headers it did not read any data from the network.

> if there's a preauth sshd zero day, the SSH connections themselves are attack vectors. TCP is easily hijackable.

Hah, I am not that paranoid :-)

My main concern was always this sort of scenario:

I am on vacation with no internet access, an ssh (or openssl or openvpn) 0day is released, patches are not available. Do I come back from vacation to a compromised host? If I had not been using port knocking when the debian ssh key issue happened, I would have had multiple hosts compromised. So, you can call it goofy, but it made a very real difference in my experience.

Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @03:38PM (#11857152)
You have to worry about that anyways! ZERO is the number of attackers with reliable pre-auth sshd zero-day who can't hijack a TCP connection.

The threat model here simply does not make sense.

Re:Obscurity Is a Valid Security Layer by justinsaccount on Tuesday June 07, 2016 @03:54PM (#11857278)
Honestly, I don't worry about that at all.

I had a machine compromised in 2001 by script kiddies and worms scanning the internet on port 22 and compromising any host they could find with CVE-2001-0144. Not by attackers hijacking TCP connections.

In 2016 I am worried about a 0day being released and scripts kiddies or a worm compromising every host they can find running sshd. This effectively happened to debian systems in 2008. I don't know how you can say that it doesn't make sense when it happened.

Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @05:23PM (#11857985)
I just don't understand the threat model that gives attackers the most valuable RCE vulnerability in a decade, but denies them an ability attackers have had since 1996.
Re:Obscurity Is a Valid Security Layer by AstralStorm on Tuesday June 07, 2016 @02:34PM (#11856639)
Port knocking does not protect you either. A dedicated attacker can wait and discern your knock pattern and if you have an unpatched server, attack it.

In fact, it can give you a false sense of security from such 0-day exploits.

Re:Obscurity Is a Valid Security Layer by zippergz on Tuesday June 07, 2016 @05:32PM (#11858071)
For most of us, the threat is the exact opposite of a dedicated attacker. It's an opportunist (or automated system) that doesn't need to compromise every system on the Internet. It just needs to compromise enough. You can compromise enough for almost any purpose without getting into getting past port knocking schemes.
Re:Obscurity Is a Valid Security Layer by justinsaccount on Tuesday June 07, 2016 @03:17PM (#11856992)
> A dedicated attacker can wait and discern your knock pattern and if you have an unpatched server, attack it.

Really? How are they going to do this?

Re:Obscurity Is a Valid Security Layer by michaelrash on Wednesday June 08, 2016 @08:52AM (#11861877)
An adversary who can watch port knocking sequences is one reason why SPA was developed:

http://www.cipherdyne.org/fwknop/docs/fwknop-tutorial.html#w...

Re:Obscurity Is a Valid Security Layer by Tomte on Tuesday June 07, 2016 @12:11PM (#11855439)
I wouldn't focus on "security" when it comes to port-knocking.

There are benefits beyond security: for example, less strange login attempts mean less clutter in your logs. If you're actually trying to investigate login attempts (don't!), it means less time wasted.

The "security by obscurity" screaming people are usually thinking too narrowly, in my opinion.

Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @12:21PM (#11855509)
In discussions of port knocking and SPA among my security friends, it always comes down to this argument: cleaning up the logs. Why not just alter the way SSH logs? Perhaps it can just log once every couple of minutes, "yes, people are still probing this server".
Re:Obscurity Is a Valid Security Layer by justinsaccount on Tuesday June 07, 2016 @12:40PM (#11855663)
Here's a simple example:

Running sshd on port 22, seeing repeated authentication failures in the logs. conclusion: business as usual for sitting on the internet. signal to noise ratio: almost 0.

Running sshd on port $RANDOM, seeing ANY authentication failures in the logs. conclusion: someone is specifically targeting me or my network, I might want to pay some attention to this. signal to noise ratio: 1.

Re:Obscurity Is a Valid Security Layer by zeveb on Tuesday June 07, 2016 @01:27PM (#11856012)
Running on a random port isn't the same as using port knocking; if you're on a random port you'll get hit anyway (I think it falls under 'business as usual for sitting on the Internet'). Port knocking & single-packet authorisation, though, do provide some protection: if you get a failed login attempt via PK/SPA-protected SSH, then you know you're targeted (and also, your PK/SPA key is bad).
Re:Obscurity Is a Valid Security Layer by haikuginger on Tuesday June 07, 2016 @02:14PM (#11856432)
> if you're on a random port you'll get hit anyway

Nope. At least, not frequently enough to make a lucky guess more likely than a concerted attempt. Not one auth attempt since I switched the SSH port, and this is for a public-facing website, too.

Re:Obscurity Is a Valid Security Layer by justinsaccount on Tuesday June 07, 2016 @01:41PM (#11856132)
> if you're on a random port you'll get hit anyway

No, you really won't.

Re:Obscurity Is a Valid Security Layer by AstralStorm on Tuesday June 07, 2016 @02:45PM (#11856725)
You might. Some attackers scan all ports.
Re:Obscurity Is a Valid Security Layer by ryanlol on Tuesday June 07, 2016 @02:52PM (#11856785)
Not for the whole internet, no.
Re:Obscurity Is a Valid Security Layer by AstralStorm on Tuesday June 07, 2016 @03:09PM (#11856928)
They actually do, just somewhat later than targeted ones. No need to scan whole of internet either, just subnets you haven't violated already. Or use DNS for major targets.
Re:Obscurity Is a Valid Security Layer by ryanlol on Tuesday June 07, 2016 @03:50PM (#11857247)
I've allegedly been involved in operating some of the largest *nix botnets ever, and certainly haven't seen anyone do that.

Scanning every single port on /0 simply takes way too much time even with millions of nodes, you're much better off improving your coverage over the common ports and catching new (and old) equipment coming online.

Of course, this wouldn't necessarily be true with the "preauth opensshd 0day" brought up in TFA. Such an exploit would certainly give you more than enough BW to do whatever you want, and break the internet while doing it.

Re:Obscurity Is a Valid Security Layer by ryanlol on Tuesday June 07, 2016 @02:53PM (#11856795)
You know, there's way less hacky solutions to this problem than SSH logs. Set up iptables to log scan attempts specifically targeting your server.
Re:Obscurity Is a Valid Security Layer by omginternets on Tuesday June 07, 2016 @01:54PM (#11856259)
I think your disagreement stems from a failure (on your part and the author's) to distinguish between targeted and dragnet attacks.

With regards to the former, I emphatically agree with you. If you've been singled out by a competent attacker, you're subject to his statistical probing of your system, which is bound to reveal most (if not all) of the configuration/parametrization info you're trying to hide.

In the case of dragnet attacks, however, I emphatically disagree. There is asymmetric cost imposed upon the attacker: time.

Your door doesn't have to be impenetrable; it just has to be stronger than your neighbor's.

Thoughts?

Re:Obscurity Is a Valid Security Layer by crumpled on Tuesday June 07, 2016 @05:27PM (#11858025)
I agree, for example: When a WordPress vulnerability is found, millions of sites are at risk. The large installation base is enough incentive for people to relentlessly scrutinize WordPress for vulnerabilities.

Your home-made CMS isn't going to attract attackers because the spoils are limited to one site, and the code isn't readily available.

That doesn't mean your CMS is more secure; it probably isn't. But it's going to take a focused effort to attack, and an exploit becomes less likely.

Re:Obscurity Is a Valid Security Layer by zippergz on Tuesday June 07, 2016 @05:38PM (#11858119)
Even making minor changes to the Wordpress URLs from the defaults is enough to avoid getting hit by most (if not all) of the automated exploit I see on a day to day basis.
Re:Obscurity Is a Valid Security Layer by AstralStorm on Tuesday June 07, 2016 @02:41PM (#11856698)
Why would you ever want to be vulnerable to targeted attack while only keeping dragnet ones at bay?

Also such measures do not help any kind of a system that has to be really exposed. Want to hide your http and mail server behind a port knocking mechanism? A rarely supported or proprietary TLS method only?

Re:Obscurity Is a Valid Security Layer by detaro on Tuesday June 07, 2016 @02:43PM (#11856713)
It doesn't make you more vulnerable to targeted attack, so why would you not want to additionally keep dragnet ones at bay?
Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @03:00PM (#11856858)
Because it's not doing anything to stop dragnet attacks either!
Re:Obscurity Is a Valid Security Layer by omginternets on Tuesday June 07, 2016 @04:14PM (#11857421)
Maybe "dragnet" wasn't the best term to use. I'm not talking about the NSA, but rather about automated brute-force attempts (think: random attempted ssh connections from the internet).

With regards to that, not stopping automated attacks in general is fully-independent of being a less appealing target for such attacks. The latter -- even on it's own -- improves security.

Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @05:22PM (#11857979)
It's not doing anything to stop brute-force attempts! SSH keys already stop that attack cold!
Re:Obscurity Is a Valid Security Layer by zippergz on Tuesday June 07, 2016 @05:40PM (#11858135)
So is this an argument that defense in depth is not a worthwhile strategy as long as you have a single "really good" layer of defense?
Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @09:07PM (#11859304)
No, it's an argument not to waste time with pointless layers that impose no significant costs on attackers. Surely, you can't believe that "defense in depth" justifies arbitrary layers, or you'd also advocate for ROT-13 tunnels.
Re:Obscurity Is a Valid Security Layer by zippergz on Tuesday June 07, 2016 @09:33PM (#11859400)
No, but I disagree that running sshd on an alternate port is an arbitrary layer. It is PROVEN that it prevents the automated mass scanners from even attempting to login. This you admit yourself when you mention the reduction in log noise.

You are correct that a properly configured sshd has nothing to worry about with respect to these mass scanners. However, can we guarantee that we'll never make a configuration error? You're also correct that a pre-auth sshd vuln would be a HUGE deal. But can we guarantee one will never happen? Do you disagree that if a misconfiguration or a world-changing vulnerability were to happen, that a little time more to deal with it would be helpful?

If I run something that is in any way vulnerable (whether via bug or misconfiguration) on port 22, it will be found within minutes (based on how often I see that port getting scanned today). Unless I'm being specifically targeted, an sshd running on an arbitrary port isn't going to get hit until/unless someone is running full port scans across the internet looking for it. I don't understand how you can argue that this is worthless. A measure that isn't useful against a determined and targeted attacker can still be useful. The adversaries that most of us face in the real world are looking for the path of least resistance, not access to our specific systems.

Re:Obscurity Is a Valid Security Layer by zippergz on Tuesday June 07, 2016 @09:39PM (#11859423)
By the way, this is the same reason I lock my door even though there’s a glass sidelight right next to it. Any burglar who wants to get into my house can do it in about 5 seconds by breaking that sidelight. But that doesn’t mean there’s no value in keeping out the mischievous neighbor kids who are just rattling doorknobs and looking for a place to steal booze from.
Re:Obscurity Is a Valid Security Layer by wglb on Tuesday June 07, 2016 @10:47PM (#11859650)
I wouldn't think of alternate port as any kind of layer whatsoever. It defends against the horde of ants that are knocking on any open port 22. It does not defend against the kind of attack that you should worry about--that of a sophisticated, patient well funded attacker.

Moving from port 22 to $RANDOM will only net you annoying log bloat from things that you don't really care about.

Re:Obscurity Is a Valid Security Layer by omginternets on Tuesday June 07, 2016 @05:45PM (#11858187)
You're assuming everything is properly configured. A bug-free setup is essentially impossible.

The claim is that obfuscation makes it less likely that a mistake will be spotted by an attacker.

To be clear, I agree with you to the extent that a properly configured SSH server with good keys and no 0-day exploit is more effective than what I'm proposing. My point is rather that such a setup makes a lot of assumptions (key exchange, configuration, secure updates, etc...) and that obfuscation is a complementary security layer for when those things occasionally fail.

Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @06:30PM (#11858517)
"A bug free setup"? Don't use passwords. Done.
Re:Obscurity Is a Valid Security Layer by omginternets on Tuesday June 07, 2016 @07:31PM (#11858893)
Come on, now I'm starting to suspect you're commenting in bad faith.

Just to reiterate, SSH was an example of the general problem that is misconfigured/buggy software. OpenSSH is certainly one of the most secure programs I'm aware of, but the same can't be said for things like wordpress.

Eventually, something gets messed up (if only momentarily), and being nonstandard makes you less susceptible to scripted breaches.

We can debate whether the tradeoff is worthwhile (and in many cases it's not), but it's a valid gosh-darn secruity layer!

Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @09:08PM (#11859306)
If you can't deploy passwordless SSH, you have problems port-knocking can't solve.
Re:Obscurity Is a Valid Security Layer by omginternets on Wednesday June 08, 2016 @08:12AM (#11861634)
I'm at a loss for words. I implore you to re-read this comment thread and try to understand what I'm saying.

You're responding to an argument I haven't made.

Re:Obscurity Is a Valid Security Layer by penguinduck on Tuesday June 07, 2016 @12:34PM (#11855616)
Could you explain why single-packet authorization is cosmetic? This is the first time I've read about these, and while port knocking is clearly broken in multiple ways, I don't immediately see the flaw in SPA, except for the fact that storing hashes of previous packets and comparing against them is inelegant.
Re:Obscurity Is a Valid Security Layer by justinsaccount on Tuesday June 07, 2016 @12:41PM (#11855668)
> port knocking is clearly broken in multiple ways

What are those ways?

Re:Obscurity Is a Valid Security Layer by penguinduck on Tuesday June 07, 2016 @02:35PM (#11856645)
I can copy your knock and get access, I can deny you service by messing up your knocks by sending packets with a fake IP, it is also insanely inefficient in the amount of data and time spent vs the amount of information exchanged
Re:Obscurity Is a Valid Security Layer by justinsaccount on Tuesday June 07, 2016 @03:11PM (#11856948)
> I can copy your knock and get access,

You can? how? I just logged into a server using port knocking. what was my knocking sequence? What do you have access to?

> I can deny you service by messing up your knocks by sending packets with a fake IP

Ok, I'm ready when you are.

> insanely inefficient in the amount of data and time spent vs the amount of information exchanged

I don't even know what this means. How is a few extra packets at the start of a tcp connection "insanely inefficient" ?

Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @03:37PM (#11857149)
Who cares? Serious attackers have access to the actual TCP connection you make to sshd. If there's a preauth vulnerability in sshd, they'll just use that to deliver the payload.

Port knocking is silly. If you're scared of preauth sshd zero-day, deploy an encrypted tunnel.

Re:Obscurity Is a Valid Security Layer by Nokinside on Wednesday June 08, 2016 @12:29PM (#11863430)
How big percentage of attackers have access to TCP connection and can do MITM attack?
Re:Obscurity Is a Valid Security Layer by drudru11 on Tuesday June 07, 2016 @05:25PM (#11858009)
Serious attackers have physical access
Re:Obscurity Is a Valid Security Layer by tptacek on Tuesday June 07, 2016 @05:36PM (#11858105)
1. No.

2. What's your point?

Re:Obscurity Is a Valid Security Layer by penguinduck on Wednesday June 08, 2016 @03:50AM (#11860694)
Now you are being intentionally obtuse. Bye.
Re:Obscurity Is a Valid Security Layer by Nokinside on Wednesday June 08, 2016 @08:32AM (#11861755)
>I can copy your knock and get access,

Replay attacks don't work against proper port knocking.

Take for example, knockknock-daemon. It sends just one SYN packet where packets IP and TCP headers are encrypted request to open a specified port. Port is closed after connection.

https://github.com/moxie0/knockknock/blob/master/knockknock-...

Re:Obscurity Is a Valid Security Layer by penguinduck on Wednesday June 08, 2016 @10:49AM (#11862600)
Entirely possible, as I said this is the first time I read about this, so the port knocking I refer to is the kind described, which is using a sequence of ports as a key.

I don't know python but this implementation seems broken in the same way (or more precisely, under the same circumstances). I just realized, you don't even need to copy the knock. If you have access to the network traffic (which you would need to copy the knock in the first place), you also have access to the TCP sequence numbers. You can just connect from the user's IP after he performs the knock, or even let him connect and inject packets at some later point. This program seems to rely on the TCP authentication of IP address which is completely negated if the attacker can monitor traffic.

Am I misunderstanding how this program works?

Re:Obscurity Is a Valid Security Layer by Nokinside on Wednesday June 08, 2016 @11:41AM (#11862968)
The goal of knocking is to expose running services as little as possible and do it in a stealthy way.

An observer watching packets has no way to know that the SYN packet transmitted is a port knocking request. Even if they know, there is no way to determine which port was requested to open.

Re:Obscurity Is a Valid Security Layer by penguinduck on Wednesday June 08, 2016 @12:03PM (#11863175)
I don't understand what you mean. How would you prevent the attacker from knowing the port, except by only sending the port knock, and then never actually connecting?

Let's say the attacker has no idea you're using port knocking and even somehow missed your port knock packet completely, but after that captures subsequent traffic. He will still see the sequence numbers in the SYN/ACK from the server which is all he needs. Once he has that, he is an equal party to you (the legitimate client) in that connection.

Re:Obscurity Is a Valid Security Layer by Nokinside on Wednesday June 08, 2016 @12:25PM (#11863383)
Ah. I get your point.

Tell me what percentage of attackers on the net have full access to the network traffic and can do full MITM attack?

If the goal is layered defense and minimizing exposure, worst case scenario is not good counterargument.

Re:Obscurity Is a Valid Security Layer by penguinduck on Wednesday June 08, 2016 @12:30PM (#11863442)
You don't need to be able to do a full MITM attack. You just need to be able to read the traffic, not modify it.

And if you believe this is an unreasonable assumption, why did you link me a program which says in its description "The problem with the original concept was that if your port sequence was observed by passive eavesdropping, it was easily replayable." ? It tries to solve this exact problem - a sniffing attacker.

I am just explaining why this program fails to solve the problem you claimed it solved in your original reply. Surely you can understand that.

Re:Obscurity Is a Valid Security Layer by Nokinside on Wednesday June 08, 2016 @01:10PM (#11863782)
Tell me if I understood something wrong:

Without knocking:

Service is listening and accepting new connections in well known port. When client makes connection attempt, attacker can replay the connection attempt and server starts handshake. Even without sniffing attacker can initiate handshake by just requesting connection.

With knocking:

Server/firewall opens requested port for client who knocks. That port is _not_ open for subsequent connection attempts. Simple replay is not going to initiate handshake. You need to block client from sending.

Re:Obscurity Is a Valid Security Layer by penguinduck on Wednesday June 08, 2016 @01:44PM (#11864044)
There is no need for a subsequent connection.

It is irrelevant whether the legitimate client connects or the attacker does if the attacker is sniffing traffic. This is just how IP and TCP work.

If I am sniffing traffic, I can fool the server into thinking I am the client and do what I want, while fooling the client into thinking I am the server and make him happily drop the connection after he sent the initial packet I needed to find out the port.

Basically, in IP protocol you can say you are any IP address you want in your packet. There is no way for the receiver to tell whether you're lying[1]. Then TCP introduces sequence numbers -> if I say I am 1.1.1.1, but I am actually 2.2.2.2, the server will send a sequence number to 1.1.1.1, and expect that number + 1 in response, but as I am not 1.1.1.1 I will not receive his sequence number and be unable to reply with number + 1 - I don't know the number. However, if I am sniffing traffic, I will see the sequence number he sent to 1.1.1.1 anyway, and I will correctly reply with number + 1 while continuing to lie I am 1.1.1.1. So it makes no difference to the attacker whether the server is talking to 1.1.1.1 or 2.2.2.2 (attacker's IP) as long as he can sniff traffic. It also makes no difference whether the legitimate client initiated the connection or the attacker did. It is just packets, it doesn't matter who sent them.

I am not sure if I am understanding what you're asking correctly. Basically, you don't need MITM capability to pretend you're a different IP than you are. Lying about your IP is a basic feature of the IP protocol. And if you are sniffing traffic, it is also not in any way prevented by TCP.

[1] except in special cases when the sender claims something clearly impossible, like claiming to be an IP from a different interface (claiming to be 127.0.0.1 for example) than the one the packet was received on

Re:Obscurity Is a Valid Security Layer by Nokinside on Wednesday June 08, 2016 @02:10PM (#11864258)
Packet sniffing is passive.

If client has already sent connection request, replay is not going to work if only one connection is accepted. You need to be able to block the traffic from legitimate server or be faster (how?) to get there first.

Re:Obscurity Is a Valid Security Layer by penguinduck on Wednesday June 08, 2016 @02:23PM (#11864363)
There is nothing magical about a "connection". It is not some kind of secure tunnel. There are only packets. The attacker can take part in the accepted connection that the legitimate host initiated and the server accepted, and pretend to be the server to the client and pretend to be the client to the server, as long as he has the sequence numbers, which he gets from passive sniffing.
Re:Obscurity Is a Valid Security Layer by michaelrash on Wednesday June 08, 2016 @08:26AM (#11861724)
SPA is applicable to arbitrary services - not just SSH. Essentially it is a lightweight UDP authenticator, and it can be applied to commercial VPN's, webservers, or anything else. Achieving asymmetric costs on attackers is easily achievable for many such services.