9 ms·
I think I'm missing something. Step one is getting you to use a compromised server. Which either means the server your home directory is on is compromised (I’
by jedberg 8y ago
I think I'm missing something. Step one is getting you to use a compromised server. Which either means the server your home directory is on is compromised (I’m assuming you have a login on the box, separate from your local home dir), in which case scp is the least of your worries, or they get you to bounce through a MITM server, in which case you have to accept an incorrect host key.
If you're accepting incorrect host keys, then you're completely breaking the ssh security model anyway.
I guess I don't understand how this is actually any worse than how ssh already worked?
Edit: To clarify, I understand why you’d want to fix this, for a good depth of defense. I’m just saying I don’t feel any urgency in fixing this.
- bryanrasmussen 8y agoreminds me of this raymond chen post https://blogs.msdn.microsoft.com/oldnewthing/20121207-00/?p=5893 https://blogs.msdn.microsoft.com/oldnewthing/20121207-00/?p=... with the quote "It's not really a vulnerability that you can do anything you want once you pwn the machine."
- bryanrasmussen 8y agoof course, if Windows used a capability based security model then it would still be a vulnerability that you could do anything you want once you pwn the machine.
- Dylan16807 8y agoThis is getting [partial] control of every machine that merely downloads a file from the one you took over.
- joelthelion 8y agoI think what it's saying is that in the event you connect to a malicious server, that server is able to do more damage to the client than it ought to. Should be fixed, but clearly not the worse vulnerability ever.
- dmurray 8y agoThat's the definition of, for example, all browser security issues.
- rhizome 8y agoWhich either means the server your home directory is on is compromised, in which case scp is the least of your worries Well but what if the server doesn't tell you it's compromised?
- leni536 8y ago> Which either means the server your home directory is on How did you arrive to the conclusion that the server has your home directory? The threat model: It's a server that you can authenticate to, retrieve files from there but otherwise you don't trust. It has nothing to do with your home directory. The PoC attack just shows the danger of invoking scp from the client's home directory.
- jedberg 8y agoI see so in the case that I scp from an untrusted host, I could have added risk that it is silently overwriting filed in my local home dir. That makes sense I suppose. I never scp files from untrusted hosts, nor can I think of a use case to do so, so it hadn’t really crossed my mind.
- willvarfar 8y agoYou should not trust the server. The server may have been compromised.
- pbhjpbhj 8y agoThe client may have also been compromised, you may have, you might be in the Truman show ... /s If I'm reading the OP right, whilst directory permissions can be modified, traversal is not possible, so it can't overwrite outside the directory you're writing to. But if you wrote to your home directly then your .bashrc could be modified ... and it sounds like other vulnerabilities allow the actual processing to be hidden (spoofed console output). Seems like the sort of thing that could be used in a spear-fishing scenario. I wonder if you could write a StackExchange answer with instructions to scp files from such-and-such server ...
- ajdlinux 8y agoThere are plenty of use cases where the host you're connecting to isn't completely untrusted but rather it's semi-trusted. Web hosting provider, university machine, etc - all multi-tenant environments which have a tendency to get compromised.
- reacweb 8y agoI accept incorrect host keys a couple of time per year because the IT has changed an IP adress or when a server is replaced. I do not always bother to check that I have a mail notifying me that the change was planned. Knowing this new vulnerability, I will take care to not perform a scp toward my home directory and I will double check PATH when logging to a new account (check that PATH does not contain "." before /usr/bin and /bin). IMHO, this is a major vulnerability for unix users.
- walrus01 8y agoThe risk mitigation part here is that you know in advance a server has moved before you try to SSH to it. The real risk is less than cautious people who might choose 'yes' to accept a new host key when sshing towards a sshd that they have no prior knowledge of having changed IPs, or having been re-imaged, etc.
- jedberg 8y agoUnix has usually been pretty good about giving you plenty of rope to hang yourself. :) Tools don’t usually protect from their own misuse — in this case not verifying a changed host key.
- rocqua 8y ago> the server your home directory is on is compromised The attack presumes your home directory is client side, and you use SCP to connect to any kind of server, whilst ~ is the client side open directory. Thus, any server you might SCP to could write to your local home dir. In university, I did this with compute clusters, servers of my association and other servers. This breaks the SCP security model because it means a server has covert access to your local working path. Whereas normally you know which files SCP touched, so you can verify they are as intended.
- jedberg 8y agoRight I get all that (I updated to clarify that I understand the attack is against your local home dir, but I assume you have one on the remote side). I just don’t understand the use case of scp’ing from an untrusted host.
- simias 8y agoIf somebody manages to hack into a server somehow they can then contaminate hosts that attempt to scp from it. It's not the easiest exploit ever made but it's definitely pretty bad.
- rocqua 8y agoI copied over results files from a university cluster to my local home dir. It wouldn't surprise me if it were possible for another user of the cluster to affect the server-side SCP program. I trust the cluster enough to give me those results. I don't trust it with write access to .bash_aliases . Thats why I did scp file@host . rather than scp *@host .
- yzb 8y agoThat's because you don't work with systems.
- kurlberg 8y agoThroughout the years my employers have reinstalled servers and consequently changed host keys. I believe many users just accept the new key without realizing what they might get themselves into. Ideally your organization should keep updated (public) host keys somewhere, say on some https-protected website so you can double check yourself. How common is this? (I mainly use ssh for interactive/tunneling use, but with a bit of bad luck the host key would change just in time for scp. BTW, don't rsync/unison use scp sometimes?)
- eof 8y ago> Step one is getting you to use a compromised server. This is not at all uncommon. Consider I need to send you files, either once or on a batch schedule. You say, "give me your key, you can drop them on this server" I feel safe since I am just writing files to your server, not expecting you are going to drop arbitrary code that will run next time I open my terminal.
- jedberg 8y agoUnless I’m mistaken you’d still be safe. The vuln would only work if you were pulling files from an untrusted host, not pushing to it. But if I wanted to share files with you, I’d just put them on the web, unless we already have a relationship where you can ssh somewhere that I have access to. In which case I assume we’re trusted or you’ve at least verified the host key.
- ATsch 8y agoWell, it's basically a privilege escalation vulnerability. If you've owned some server, you now have a possibility to get access to the admins local machine too, likely giving you admin access to the whole infrastructure. If you "trust" any of these things is irrelevant, as that trust might be misplaced and the security model should keep you safe with compromised servers regardless.
- Cpoll 8y agoIt's the reverse, but it's almost the same. "Give me your key, and then take these files from my server." I feel safe, because I think I'm going to cat a text file, not execute it.
- vectorEQ 8y agoyou could do a simple arp mitm or so to have a client connect to you instead of the target server. if they didn't connect before from that client they will be prone to accepting the certificate. subsequently the malicious server can own the client. after that is happen, in the example given, the next login on the victim box runs further commands via bash. why you would want to fix this; client needs to verify the input it receives from server and not trust it's the right thing. malicious servers is just like how browsers get owned u know. it's not magic and very risky considering how many people have ssh / scp servers in their internal networks, which is just the kind of environment you can get away with a mitm attack on..
- z3t4 8y agoThe worst security threat is a human in-front of a terminal... eg. the user can be tricked to do something that is normally unsuspicious, like copy some files off some server.
- h1d 8y agoIn my honest opinion, delegating the trust model down to the user to figure out which host key is trusted or not is the broken model. I always blindly accept the key because I have no way of knowing what is good or bad by looking at the prompt with random letters telling me it could be bad and in my life 100% of those alerts are false positives and I got used to accepting those alerts.
- Kovah 8y agoCould someone elaborate on how to find out the correct key of a host that was recently setup, like a new Digitalocean instance? Is there even a method?
- tedunangst 8y agoDoes your cloud dashboard not tell you? Last resort, login on console and look at it.
- detaro 8y agoYou can provide a pregenerated key to the instance during setup, e.g. using cloud-init. Or supply it with a way to report its key once it is generated. Or use out-of-band access, e.g. a host-provided console, to connect once and extract the key.
- amelius 8y agoOk, but shouldn't ssh require the user to type in the entire key then, rather than to type yes/no?
- detaro 8y agoWhy?/How does that relate to my answer? It'd make it harder to just accept a changed key instead of leaving the decision to the user, and would make use cases where the user doesn't want/need to authenticate the server harder (one can probably debate each scenario for that if the decision to not authenticate was "right"). Although I find it a bit weird there's not even an option to pass a host key to SSH instead of editing the KnownHosts file.
- hkt 8y agoHonestly, I revisited my old sdf.org shell account last night - this could have got a lot of people on shell providers and similar down the years. Keys wouldn't need to change in the event of a compromise.
- cat199 8y ago> Which either means or, it means the otherwise previously trusted server has been compromised, and the sshd has been replaced with a malicious one.
- mikeash 8y agoIf someone takes over my web server, this vulnerability means they can leverage that into taking over my personal computer? That’s catastrophic.
- mcv 8y agoThis sounds like the most plausible scenario in which this bug can cause havoc. Even if the web server is quickly restored to its original state, any user who happened to connect at the wrong time may still have a compromised PC. And you may not even notice that the web server has been compromised until compromised PCs start acting up.
- runn1ng 8y agoThe vulnerability is not that serious From what I understand - if you scp any file from a remote server to your home directory, malicious remote server can copy anything else into your home directory without you knowing it, which can lead to remote code execution. However, (1) the server needs to be malicious or compromised (or mitmd and you accept the new cert), (2) you need to copy into your home folder, not anywhere else, directory traversal is impossible
- XCabbage 8y agoWhat you're missing is very simple: downloading files from a server need not imply that you trust the server even slightly. That's true whether you're downloading them via HTTPS (e.g. to view this web page) or via SCP. Many of us have jobs in which we typically only use SSH to connect to servers that we trust and control. But that assumption is no more baked into the security model of SSH than it is into the security model of HTTPS. The argument that "you trusted this server enough to connect to it and download a file, therefore you clearly should trust it enough to permit it to execute arbitrary executables on your machine" is false in both cases.
- nathan_long 8y ago> The argument that "you trusted this server enough to connect to it and download a file, therefore you clearly should trust it enough to permit it to execute arbitrary executables on your machine" is false in both cases. Great point. Also, imagine that you control the server and you know that it was compromised. Surely you want to be able to download logs and other files from it for inspection without having your own machine compromised.
- toyg 8y ago> Surely you want to be able to download logs Uhm, nope: you want to shut it down and perform forensics on the disk. Once it's rooted, I wouldn't touch it with a barge pole.
- XCabbage 8y agoI've been a web developer for over 5 years and never once worked somewhere where I'd have any imaginable way of physically accessing the disk of a server. Everything's been cloud-based. I don't know the exact ratios, but I'd expect my experience not to be unusual.
- detaro 8y agoYou can't physically access the disk, but you often can download a snapshot or disk image, which is created at the hypervisor level.
- eecc 8y agoUhm, the attacker might not be able to compromise your systems beyond the exploit that gave out your server, but might use this to reach out into your admin box and steal the keys to the kingdom.
- CGvQpmp7kiLUTn 8y agoThis is precisely why i use firejail as a precaution against zero-days on ssh and other executable running from my Home account. https://wiki.archlinux.org/index.php/firejail https://wiki.archlinux.org/index.php/firejail
- athenot 8y ago> Edit: To clarify, I understand why you’d want to fix this, for a good depth of defense. I’m just saying I don’t feel any urgency in fixing this. If you exclusively SCP to servers you control, this is admittedly a low priority issue. However some companies use SCP extensively as a way to exchange data files (as an upgrade from using FTP, and out of frustration from dealing with implicit/explicit FTPS modes). Healthcare and finance come to mind for those use cases.
- zurn 8y agoWhen someone breaks into your servers, it's still kind of bad. Consider, for one, that the admins risk their laptops getting pwned when getting logs from said boxes. Easy to get from "one compromised server" to bigger problems this way.