Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×

Overconfidence in SSH Protection 194

nitsudima writes to mention a post on the Informit site about the common misunderstandings surrounding SSH, and how well-intentioned admins may be creating holes in their own security by using it. From the article: "In UNIX, all things are files. To send network traffic, UNIX writes the traffic to the network device file. In this case, the connection to Box A (and that private key used for authentication) is a socket file. This file will shuttle the authentication traffic between Box A and Box P. So what's the risk? Maybe the hacker can't get a copy of the private key through the socket file, but something better (from his/her view) can be done. If the hacker has root on Box D, he or she can point a private copy of the agent forwarding software to that socket file and thereby point the authentication process to the administrator's credentials--the ones kept on the 'safe' intranet. What are the chances that the administrator has configured access to all the DMZ servers he controls?"
This discussion has been archived. No new comments can be posted.

Overconfidence in SSH Protection

Comments Filter:
  • Huh? What? (Score:5, Insightful)

    by XanC ( 644172 ) on Saturday May 27, 2006 @02:49AM (#15414788)
    I consider myself fairly competent as far as this kind of stuff goes, but I just couldn't follow that summary at all. Maybe it's just because it's so late. Can someone post a more sensible summary of an attack?
    • Re:Huh? What? (Score:4, Interesting)

      by limegreen ( 516173 ) on Saturday May 27, 2006 @03:16AM (#15414849) Homepage Journal
      I think part of the article is trying to say that users can enable their own ssh tunnels to home, and thus if their home network is compromised there is an easy route into the office intranet.
      • Re:Huh? What? (Score:4, Insightful)

        by Matey-O ( 518004 ) <michaeljohnmiller@mSPAMsSPAMnSPAM.com> on Saturday May 27, 2006 @09:19AM (#15415562) Homepage Journal
        I think part of the article is trying to say that users can enable their own ssh tunnels to home, and thus if their home network is compromised there is an easy route into the office intranet.
        But how is this not the case for ANY connection from a home network to the office...VPN opens up the same issues too.
        • No they don't, at least not if configured correctly. If you don't allow split tunneling then once the VPN is established all traffic to the rest of the world is disallowed, this is not possible AFAIK with simple SSH. This only applies to driver based VPN solutions not SSL based ones.
          • Right up to and until the machine is infected without using VPN...once they're compromised, bringing up VPN allows that worm to poop out port 80 request through your network all it wants (and hence has two way communication into your soft-chewy center.)
      • Of course, any user sufficiently proficient to set up their own ssh tunnel to home will probably be more concerned with opening an easy route into their home network from the office intranet than the other way around (which says more about the state of many office intranets than the ease of ssh tunneling).

        As for the article, as long as you allow arbitrary connections through the firewall, there simply is no way you can technically prevent tunneling over those connections. You can create an ip tunnel over an
      • Re:Huh? What? (Score:2, Insightful)

        by traenky ( 684896 )
        No, not at all. When you consider the forwarding abilities of both the ssh client and server implementations, it is possible to build what looks to be an insider-initiated tunnel to the outside. Safe, right? Instead, the tunnel is used to force the traffic from the remote server back into the tunnel, and from there, throughout the intranet, including RFC 1918/3330 addresses normally unreachable from the Internet. Let me know if some kind of video file would help explain a very difficult topic in ssh. M
    • Re:Huh? What? (Score:5, Informative)

      by Riku ( 740152 ) on Saturday May 27, 2006 @03:22AM (#15414864)
      Here's a summary for you:

      User A on box foo:
      foo> ssh-agent xterm
      foo> ssh-add
        * enters their pass key *
      User A can now ssh to any box that has their public key in box:$HOME/.ssh/authorized_keys

      User B (evul hacker with root on box foo):
      foo# SSH_AGENT_PID=XXXX; export SSH_AGENT_PID
      foo# SSH_AUTH_SOCK=/tmp/ssh-YYYY/ZZZZ; export SSH_AUTH_SOCK
      User B now can ssh to any box that User A can, as above.
      (where XXXX, YYYY, and ZZZZ are determined by evul hacker)

      • Re:Huh? What? (Score:4, Insightful)

        by Onan ( 25162 ) on Saturday May 27, 2006 @04:28AM (#15414996)
        User B (evul hacker with root on box foo):
        foo# SSH_AGENT_PID=XXXX; export SSH_AGENT_PID
        foo# SSH_AUTH_SOCK=/tmp/ssh-YYYY/ZZZZ; export SSH_AUTH_SOCK
        Uh, this is hardly the only way that someone with root on the machine from which you're authenticating can obtain your credentials. Far more effective than this would be for them to simply take your private key file and grab your passphrase as you enter it; that would allow them to use these credentials forever in the future, rather than being limited to when you have an agent running on their machine.

        So... how does this even remotely approach being news? Yes, if you type your passwords into a machine on which someone else has root, you have given those passwords to them! The horror! I had no idea!

        The best thing I can say about this article summary is that it did not misrepresent the actual piece. The article itself was also muddled tripe, filled with semi-true and completely-irrelevant noise like "in unix, everything is a file..."

        It appears that the author is just a firewall admin who's offended that ssh can be used to thwart his precious acls, and invested in giving the tool a bad name.

        • Re:Huh? What? (Score:5, Informative)

          by Anonymous Coward on Saturday May 27, 2006 @07:06AM (#15415260)
          The article is about a common misconfiguration with regard to agent forwarding. The DMZ hosts aren't supposed to be safe, that's why they're in the DMZ and not in the intranet. The admin must assume that root on these machines is compromised. Consequently he doesn't store his private keys on any of the DMZ machines. But what many overlook, possibly because they don't use the feature, is agent forwarding. Once the admin has logged into a compromised DMZ host, access to his credentials is extended to the DMZ host by that ominous socket. The file itself never leaves the admin's computer, but if agent forwarding is enabled, root on the DMZ host can now point other hosts on the intranet to the authentication facility on the admin's computer. This misconfiguration enables the attacker to hop from the DMZ to the intranet. The correct way to avoid this is to disable agent forwarding (on the admin's computer, not just on the DMZ hosts, of course).
          • "Once the admin has logged into a compromised DMZ host, access to his credentials is extended to the DMZ host by that ominous socket"

            Only if he specifies -A on the command line -- authentication agent forwarding is disabled by default; any documentation referencing -A and agent forwarding also eplains, in the next paragraph, the peril in using -A with an untrusted host. (Duh)
          • Re:Huh? What? (Score:3, Insightful)

            by ultranova ( 717540 )

            This misconfiguration enables the attacker to hop from the DMZ to the intranet. The correct way to avoid this is to disable agent forwarding (on the admin's computer, not just on the DMZ hosts, of course).

            Sorry, doesn't work.

            I'm an 3v1l h4x0r in complete control of untrusted host X. Some poor fool uses SSH to connect to the trusted, firewalled host Haven. At this point, since I'm in complete control of X, I can simply send commands from X to Haven, doing anything the user could - including launching a

            • Re:Huh? What? (Score:2, Informative)

              by Lord Ender ( 156273 )
              DMZ hosts are typically configured so that they can NOT connect out to hosts outside the DMZ. This is enforced by firewall restrictions. As long as this is done, there is no problem.
          • The DMZ hosts aren't supposed to be safe, that's why they're in the DMZ and not in the intranet.

            Which is also why it's generally a lousy idea to allow DMZ hosts to initiate general connections into the intranet in the first place. Defense in depth -- even if the admin screws up and allows agent forwarding to DMZ hosts, an attacker won't immediately be able to use those credentials to ssh from the DMZ into intranet hosts.
        • Re:Huh? What? (Score:3, Insightful)

          by davidsyes ( 765062 )
          "It appears that the author is just a firewall admin who's offended that ssh can be used to thwart his precious acls, and invested in giving the tool a bad name."

          Remember the /. stories that started like, "We're setting up a company and would like to know how you would do xyz with "linux" vs Windows, how long you've been using "linux", how you got approval for it, and how long you have successfully maintained security with the limited headcount you have..." that (if you are cynical) sound like big-company-p
        • Re:Huh? What? (Score:2, Insightful)

          by traenky ( 684896 )
          Being as filled with tripe as you claim, I might have thought I wrote simply enough for you to understand. I guess not? Under agent forwarding, the first hop device doesn't have the private key. You might review the documents on OpenSSH to understand ssh better. In there, you will find big precautions against agent forwarding in an environment that has high potential for compromise. Would you mind posting these enlightening comments of yours on the actual Informit site?
      • Re:Huh? What? (Score:2, Interesting)

        by ipso_facto ( 22710 )
        If someone gets root on one of your boxes, all bets are off as there's a very good chance that they'll get root on another one of them (by keylogging passwords, brute forcing the password on a sudo enabled account, passwordless ssh keys, hijacking a session etc etc)

        Wash, rinse, repeat.

        Before you know it your whole DMZ is rooted (in more than one sense).

        In short:
        - If you find a compromised box on your network, assume there's more than one and order pizza... you're in for a long night.
        - Segregate your network
    • Re:Huh? What? (Score:2, Informative)

      by ladadadada ( 454328 )
      It's not just you. I had to re-read it several times.

      I think the main point (the one the article submitter picked up on) was that if an attacker can compromise your DMZ box (the most vulnerable box your company owns and hence the least trusted box your company owns) that has no private ssh keys stored on it and can't connect to any other trusted box but does have trusted boxes connecting to it, then he can use that to compromise further trusted boxes inside the organisation.

      To put it another way, if you ss
      • Re:Huh? What? (Score:3, Insightful)

        by Kadin2048 ( 468275 )
        Okay, so let me just get this straight. Executive summary, "moral of the story," whatever, is...

        Don't use agent forwarding when connecting to an untrusted box?

        Can you just mandate that as a policy or are there times when you absolutely have to use agent forwarding via an untrusted/DMZed machine? I don't think I've ever used a DMZ machine for agent forwarding, but then again it's not really a feature I've used very heavily.
    • by tm2b ( 42473 )
      As far as I can tell, they're just describing an instance of the well-known problem of the man-in-the-middle attack.

      This is not a vulnerability if you know the other key's hash/residue and compare it each session, as ssh can be configured to do.

      Nothing to see here, move along.
    • Actually it's because the article itself is based entirely on "common misunderstandings about Unix"
  • by Anonymous Coward on Saturday May 27, 2006 @02:50AM (#15414793)
    So all I need to do is to get a root access to a Linux server and I can spy normal users there? Whoah, now this is what I call news.
    • ... and your e-mail administrator can read your e-mail ... ... and your network administrator can see what web sites you're visiting ... ... and your ISP can watch your internet traffic ... ... and the NSA can listen to your phone ...

      So, the real trick is just to live a life so borring none of these people will care to spy on you. Not all that hard, really. Considering you're on /. - you're probably doing okay.
    • No, I think all you need is root on a box that someone ssh into. Under certain configuration, you can then pretend to be that user with respect to other boxes that the particular user can access with the credentials he used to access the box you have root on.
  • Root (Score:3, Insightful)

    by L0rdJedi ( 65690 ) on Saturday May 27, 2006 @02:53AM (#15414800)
    Yep, just gotta get root. Of course, at that point, you probably have more to worry about than someone redirecting your ssh session.
  • by geoff lane ( 93738 ) on Saturday May 27, 2006 @02:54AM (#15414803)
    If you gain access to a system within the DMZ you've already broken in ... ssh has nothing to do with it.

    Any sysadmin who configures sshd to allow direct access to a root account is incompetent and deserves to clean up the resulting mess when they are cracked.

    So what should we worry about again?

    • OpenBSD? (Score:2, Insightful)

      by jawtheshark ( 198669 ) *
      Any sysadmin who configures sshd to allow direct access to a root account is incompetent and deserves to clean up the resulting mess when they are cracked.

      So you are calling the OpenBSD guys incompetent? After all, if you enable SSH in the default installation, you can SSH into that machine including as root.

    • Agreed. This article doesn't appear to say anything insightful. The biggest problem is only alluded to, and that's the monoculture one: if everyone uses SSH to supply encryption/authentication services, a single bug could allow an SSH-worm to achieve critical mass.
    • by FuryG3 ( 113706 ) on Saturday May 27, 2006 @03:15AM (#15414848)
      I agree completely. Remote root login is disabled by default, and system administrators should *not* enable it unless there is some damned good reason. Too often I have seen sysadmins simply enable root login, and twice now I've seen someone do key exchanges so that they can 'seemlessly' ssh as root between all of their servers.

      Duh.
    • Exactly. If you essentially have only one authentication to get into ALL your machines, then anything compromised includes your entire network.

      It's interesting that this site is sponsored by Microsoft:
      http://www.informit.com/ [informit.com]

    • by ladadadada ( 454328 ) on Saturday May 27, 2006 @04:08AM (#15414953) Homepage
      Not quite. If you have broken into the DMZ, that's all you have. Even mildly competent sysadmins know not to trust the DMZ and therefore you do not automatically have access to the rest of the network, nor do you have access to any confidential documents.

      The exploit mentioned in the article doesn't rely on ssh being configured to connect directly to root. It relies on the attacker having gained root access on the box being ssh'd to by the sysadmin. Once the sysadmin has ssh'd to the comnpromised box (as any user) the attacker can then ssh to any other box the sysadmin has configured to use agent forwarding.

      Two solutions to prevent this compromise of the rest of the network:
      1) Don't allow the DMZ box to ssh anywhere; firewall it off. There should be no need to ssh FROM the DMZ box, only TO it.

      2) Use a different public/private key pair for each box. That way, if you didn't firewall the DMZ off it would still fail on the key authentication. The drawback of this is a) the attacker can still ssh to your admin box which contains all of the private keys and b) you lose most of the advantage of agent forwarding; the ability to ssh through a chain of boxes without any but the first needing to store the private key.

      I suppose the underlying message in the article is "You REALLY can't trust anything in a DMZ that may have been compromised. ssh is a tool that can be turned against you if one of your machines is compromised."
      • 1) Don't allow the DMZ box to ssh anywhere; firewall it off. There should be no need to ssh FROM the DMZ box, only TO it.

        Or better yet, don't allow the DMZ host to initiate *any* connection outbound from itself, if the services present on it don't need to do such, or failing that, disallow it initiating any connection that isn't out the internet-only-facing interface(s).

        However, that's still not what the attack is exploiting, and wouldn't prevent the attack.

        The 'attack' is taking an (I)Internal (S)erver, an
        • Now one last thing. The general attack hinges on an attacker's agent Aa being able to make use of the unix domain socket of the administrator's agent, Da. I'm very certain that when I tried this kind of attack on myself way back in 1998 or sooner it plain wasn't possible. If it is now then the (Open, whatever)ssh code has taken a step backwards. Basically some check was done on the origin of the messages on the socket, and if they weren't as expected the request to use the keys in the agent was denied. I th
        • After your description of the exploit attempt I had another, very careful read of the author's description and have come to the conclusion that we were both wrong. He is suggesting that other DMZ hosts would be compromised using the authentication credentials that should be safely behind the firewall. No internal boxes would be compromised.

          From the article: (emphasis mine)

          What are the chances that the administrator has configured access to all the DMZ servers he controls? Altering some environment var

    • Care to explain how a remote root login is any more dangerous than a remote user login when the user can sudo to root?
  • So... (Score:1, Interesting)

    by Anonymous Coward
    If I understand correctly, the author is talking about a complicated man-in-the-middle?

    Isn't that why SSH displays that "Private key SO:ME:WE:IR:DL:ET:TE:RS belongs to IP 127.0.0.1" or whatever?
    • Re:So... (Score:5, Informative)

      by Dan Ost ( 415913 ) on Saturday May 27, 2006 @08:38AM (#15415427)
      No, it's not really a man in the middle attack.
      It's more of a credential hijacking scenario where
      the attacker waits for you to authenticate with
      the compromised machine, forward your credentials
      to that machine, and then the attacker uses those
      credentials to reach other machines that honor those
      credentials.

      This would be more like you signing in, walking
      away from your computer, and someone else walkup up
      to the computer and doing stuff as you except that
      they get to act as you while you're still acting
      as you.

      Did that help?
      • So you're saying this "man" sits between you and the machine service you want to talk to, in order to hijack your credentials? Almost as if he's "in the middle" of the transaction? I wish we had a simple name for this kind of thing.
        • Not between, but rather beside.

          In a man in the middle attack, the attacker intercepts the authentication,
          and then uses that authentication information to authenticate with the
          system that the user thought he was authenticating with in the first place.

          In this attack, the attacker waits for the user to authenticate and
          receive his authentication credentials, and then the attacker uses those credentials
          to connect to other machines as that user. The attacker never intercepts
          anything, so this isn't a true man in t
  • I'm not a security professional, but aren't they talking about man in the middle attacks? And then further down in the article, isn't he talking about generic problems with running old, unpatched software on open servers?

    but honestly, is there anything a bit of courteous knocking on the right door [zeroflux.org] can't fix?
  • by Wovel ( 964431 ) on Saturday May 27, 2006 @03:14AM (#15414843) Homepage
    The key is not transmitted or sent to the socket file. This person does not understand anything about private key authentication and should return all of his certifications, and please stop posting stories by them, it is embarassing.
    • "The key is not transmitted or sent to the socket file."

      No, but it would be possible to get the person's key agent to authenticate you on one of their boxes. Of course, this shouldn't be news to anyone. From man ssh(1):

      Agent forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the agent's Unix-domain socket) can access the local agent through the forwarded connection. An attacker cannot obtain key material from the agent, however they can perfo

      • by cortana ( 588495 ) <sam@[ ]ots.org.uk ['rob' in gap]> on Saturday May 27, 2006 @07:57AM (#15415342) Homepage

        Perhaps the author of the article should have read the source of the text you quoted [openbsd.org]. The preceding paragraph:

        ForwardAgent
        Specifies whether the connection to the authentication agent (if any) will be forwarded to the remote machine. The argument must be "yes" or "no". The default is "no".

        So the only people who will be caught out by this are those who:

        1. Blindly enable ForwardAgent without reading the security considerations mentioned in the manual.
        2. Set up ssh-agent without considering how it will expose their private key.

        Configuring the agent to prompt the user to confirm any signing request can be as complicated as putting the private key on a smart card (which will make the reader prompt for a PIN whenever the card recieves a signing request) or it can be as simple as using the -c option when calling ssh-add; therefore this does not seem like a big deal to me.

    • They're talking about the ssh-agent socket file. You know, $SSH_AUTH_SOCK.

    • "Maybe the hacker can't get a copy of the private key through the socket file..."

      He's saying you can use the authentication agent socket dup to forward your own login attempts to the admin's authentication agent. No keys are sent, but the admin's agent will use the admin's key to allow your own surreptious logins.
  • Not a SSH problem? (Score:3, Interesting)

    by andy753421 ( 850820 ) on Saturday May 27, 2006 @03:15AM (#15414847) Homepage
    Maybe I read the article wrong but it seems to me like a problem with someones design and not with SSH, a little like saying Unix is insecure because a unwitty sysadmin could try to make his life easier by using a blank root password.
    • one problem with SSH is that, at least on my Fedora Core laptop, it allows remote root logon by default... I don't really get why normal users would want this. it is possible to disable just by changing one of the files so that root login = no but i think it should be off by default. The article seems overly complicated so this might be totally unrelated, but i ddn't get it.
  • by perlionex ( 703104 ) * <[joseph] [at] [ganfamily.com]> on Saturday May 27, 2006 @03:16AM (#15414853)

    The submitter didn't summarise anything, he cut out a chunk which didn't make much sense on its own. It didn't help that the article was fairly long-winded. This is what I understand the author is trying to say:

    Administrators use SSH to run scripts (from server A) to patch other servers (B, etc). These scripts are automated and make use of credentials stored in server A to gain access to the other servers (B, etc.).

    If a hacker gains access to server A, he can then use the credentials to access the other servers.

    As others have commented, this is kind of a "duh" moment. What's the next article?
    • As others have commented, this is kind of a "duh" moment. What's the next article?

      If you install and enable Apache, people can download arbitrary files from your web root directory! Also, driving cars requires gas, and plastic surgery made Paris Hilton uglier.

      Shocking stuff.
    • Let's not forget that openssh can very easily be setup to only allow a particular key to execute a particular command.

      Of course, this only adds a layer of obfuscation and effort into an attacker's attack plan, but it's a fairly simple trick to vastly reduce the issues here.

      ash
    • by flooey ( 695860 ) on Saturday May 27, 2006 @04:26AM (#15414990)
      Administrators use SSH to run scripts (from server A) to patch other servers (B, etc). These scripts are automated and make use of credentials stored in server A to gain access to the other servers (B, etc.).

      If a hacker gains access to server A, he can then use the credentials to access the other servers.
      Actually, it was a little more complicated. The scenario is actually that administrators use SSH to run scripts on server A to patch server A using patches from server B. The trick is, without having credentials stored on server A, a hacker who compromised server A could still trick his way into getting server B to allow him to log in if someone was logged into server A and had agent forwarding turned on.

      It's not quite as straightforward of a duh moment (after all, server A on its own can't log into server B), it's basically just saying "when you log into a server and have agent forwarding turned on, you allow anyone with root access on that server to log into anywhere your agent can log into".
      • "when you log into a server and have agent forwarding turned on, you allow anyone with root access on that server to log into anywhere your agent can log into"

        Right, which is why agent forwarding is disabled by default. The only point to this article may be to remind the few users who use an agent and turn forwarding on in their config files that they should use the '-A' flag, instead.
    • At least in most corperate settings. Why? Central user authentication. You have something like LDAP or AD or whatever that makes it so one login works everywhere. Right, so if someone roots a box, all they need to do is su to a user and change that user's password, which will be propagated back to the authentication server. They now have access to everything, or rather they can log in to any computer as that user.

      Just kinda how it goes if you want to have easy management. The only real prevention for this k
      • My understanding (and I don't do network security as a career, but I do hang out with people that do) is that putting root logins into the LDAP or AD server is considered bad practice. System root logins are supposed to be kept at the per-system level, so that if one machine gets broken, the attacker can't use the LDAP/AD system to propagate the break to the entire intranet.

        The admin-types I know all have their regular user accounts on the LDAP system, so they can do single-sign-on like the rest of us (to t
        • From your sig file:

          "If only we could make stupidity more painful..."

          to my sig file:

          "If only we could make poopidity more stainful..."
        • Root is seperate but that doesn't matter in terms of access to a system. You odn't log in to a system with root, you can't, you login as a normal user. So doing as I suggest gets you access to every system, not root access, but still. It is, of course, much easier to find a local exploit to get root than it is purely remote.

          Also, in most cases, you need only find out the root password once. As nice as it is to think amdin can remember 500 different root passwords, they can't. Most of the systems will have o
    • Didn't you KNOW???!!! /. is a DARPA project. They story is a deception piece meant to cull the best of the best among the ./ (yep, ./) crowd on /.

      You will be recruited shortly. Your fate, should you chose not to accept recruitment, is to see your surfing logs forwarded to your employer...
  • Basic Stuff (Score:5, Informative)

    by sodell ( 161952 ) on Saturday May 27, 2006 @03:19AM (#15414860)
    The article illustrated one very convoluted way to break your DMZ security, but failed to make the simple statement: don't trust anyone, not even root, on your DMZ hosts. Allow SSH logins into the DMZ, and allow the DMZ to pull files from private network patching servers, such as apt repositories, but don't allow anyone to SSH from the DMZ to the intranet. Assume the DMZ is cracked wide open and keystroke logging. No one is going to get past the DMZ by watching you type 'apt-get install squid' but they will by watching you type 'ssh root@creditcarddb.int' and then the root password.

    Anyone who tunnels from the DMZ to a trusted host which can execute commands on a sensitive server can't see the forest for the trees. You've learned how to use SSH and tunnel, but you're lacking some basic common sense.

    Also, I don't see what good a socket catching the authentication will do ... you can packet sniff the authentication process all day long and you won't get someone's private key.

    That whole article seemed a bit of voodoo itself. Many incongruous statements, like "If the hacker has root on Box D, he or she can point a private copy of the agent forwarding software to that socket file and thereby point the authentication process to the administrator's credentials--the ones kept on the "safe" intranet."

    What does that mean, exactly? You direct the authentication process to a socket file and point the process to the admin's credentials? If the socket is on the DMZ host, and the credentials are on the private network host, how can you point the authentication process to those credentials?

    Maybe I'm stupid, but the article didn't seem to make a lot of sense.
    • Re:Basic Stuff (Score:4, Informative)

      by flooey ( 695860 ) on Saturday May 27, 2006 @04:33AM (#15415008)
      What does that mean, exactly? You direct the authentication process to a socket file and point the process to the admin's credentials? If the socket is on the DMZ host, and the credentials are on the private network host, how can you point the authentication process to those credentials?

      When the admin logs into the DMZ host with agent forwarding turned on, SSH will create a socket to interact with the agent on the admin's machine. Since the wily hacker has root on the DMZ machine, he can write to and read from that socket with no problem, and thus can ask the agent to authenticate to anywhere that the agent is willing to authenticate to (what he actually would do is just set environment variables for SSH that say "I'm using agent forwarding, my agent is located at {admin's agent forwarding socket}").
  • It might be good but it's not god.

    When ssh is your inter machine security model, you know something *must* be wrong.

    • When you make a nonsense comment like "When ssh is your inter machine security model, you know something *must* be wrong.", you know something must be wrong.
  • Basically the article states that with too clever setups of SSH, you're likely just to fool yourself. I agree in one way, since it's true that SSH allows very complex configurations. On the other way, who trusts _any_ daemon that you can talk to from any host on the internet? I certainly don't. The article doesn't really mention the one thing I worry about SSH, a security hole in the server software itself. That's why I use iptables for a first defence.

    Interesting read though, made me aware of some security
  • by meridian ( 16189 ) on Saturday May 27, 2006 @04:02AM (#15414945) Homepage
    YES Thats correct you can use AgentForwarding.... If you are stupid enough to use agent forwarding to a host you don't trust or you would consider insecure ITS YOUR OWN STUPID FAULT IF YOU GET HACKED. Now for the evil h4x0rz to use agent forwarding on the host you connect to to hack the machine you are coming in from requires quite a number of things to be done on your stupid behalf that sure wouldnt be enabled by default and you would almost need to set them up purposefully. The only real danger with agent forwarding to an insucure host is that evil h4x0rz on that host can use your forwarded authentication agent to connect to boxes that are set up to both allow connections using that ssh-key AND allow tcp connections from any box that the evil h4x0rz have access to. Aside from that it is only as insecure as establishing a telnet session to the box and having some buffer overflow occur back to the client due to poor code on the client side. I am sure not about to stop using ssh for some "simpler" protocol like telnet but I will sure keep disabling AgentForwarding and any kind of portforwarding the hosts I dont trust and I ASSUME EVERYONE ELSE WILL CONTINUE TO DO THAT AS WELL. Otherwise you might as well start posting your root passwords to slashdot which may or may not matter if you have locked your systems down correctly in the first place.
    • by meridian ( 16189 ) on Saturday May 27, 2006 @04:11AM (#15414964) Homepage
      Actually...
      Rather than assume anyone^H^H^H^H^H^Heveryone on slashdot has any brains when it comes to Securing SSH let me give you some tips I/Other people have

      Restricted ssh shell for scp/sftp http://sublimation.org/scponly/ [sublimation.org]
      Patch to lock out IPs brute forcing passwords http://ethernet.org/~brian/src/timelox/ [ethernet.org]

      Can add restrictions to authorized_keys file
      from="hostipaddress",command="/usr/local/sbin/ssh_ command_allow_rsync",no-port-forwarding,no-X11-for warding,no-agent-forwarding,no-pty ssh-rsa AA...= backup_key

      Securing sshd in /etc/ssh/sshd_config
              Protocol 2
              PermitRootLogin without-password
              PasswordAuthentication no
              ChallengeResponseAuthentication no
              ClientAliveInterval 60
              ClientAliveCountMax 30

      The first line says to stop using the old, lower security ssh protocol-1.

      The second line is a hedge that says never allow root logins using the unix password -- always use some other authentication.

      The third line says don't allow skey authentication. It is a good idea to turn this off if you aren't using skey at this time. (Skey implements a series of non-reusable, one-time passwords. If you were using it you would know.)

      The fourth and fifth lines simply make sure that any connection to a client that doesn't respond at least once each half hour gets closed. After editing the sshd file, restart sshd or reboot for the changes to take effect.

      31-12-2004: new rate-limiting feature in -current. This would block hosts that exceed 10 connections per 60 seconds.
          pass in on $ext_if proto tcp to $ext_if port ssh flags S/SA \
                      keep state (max-src-conn-rate 10/60, overload )
          block in on $ext_if proto tcp from to $ext_if port ssh

      Also my previous post to do with limiting user connections to SSH during the scarey SSH port scanning days of not so long ago...
      http://it.slashdot.org/comments.pl?sid=156058&cid= 13084357 [slashdot.org]

      Repeated here for your convenience:
      Ways around SSH Brute forcing (Score:1)
      by meridian (16189) on 11:06 AM July 17th, 2005 (#13084357)
      (http://www.thief.net/)
      There are esentially three ways to fix this problem.
      The first is to patch sshd which is probably the least preferable way as you would need to continually keep patching with each upgrade. But this seems effective allowing you to exec a system command such as iptables.
      http://ethernet.org/~brian/src/timelox/ [ethernet.org] [ethernet.org]

      The second is to use iptables to limit connection attempts from an IP address. One problem with this is people who use scp alot may quickly rack up that connection limit.
      Here is a recent example from the iptables mailing list
      iptables -A INPUT -p tcp --dport 22 -s ! $My_Home_Firewall_IP -m state --state NEW -m recent --name SSH --set --rsource -j SSH_BF
      iptables -A SSH_BF -m recent ! --rcheck --seconds 60 --hitcount 3 --name SSH --rsource -j RETURN
      iptables -A SSH_BF -j LOG --log-prefix "SSH Brute Force Attempt: "
      iptables -A SSH_BF -p tcp -j DROP

      The best in my opinion is a pam module found at http://www.kernel.org/pub/linux/libs/pam/modules.h [kernel.org] tml [kernel.org] called pam_abl
      This does not have the problem of the IPTables method that may mistake multiple fast scps etc as an attack attempt, and will not require coninutal repatching of the kernel such as the timelox patches.
  • by Anonymous Coward on Saturday May 27, 2006 @04:23AM (#15414982)
    Why the developers of ssh have an option to forbid agent forwarding. Isn't it off by default? I cite from "man ssh":

    >>>
                              Agent forwarding should be enabled with caution. Users with the
                              ability to bypass file permissions on the remote host (for the
                              agent's Unix-domain socket) can access the local agent through
                              the forwarded connection. An attacker cannot obtain key material
                              from the agent, however they can perform operations on the keys
                              that enable them to authenticate using the identities loaded into
                              the agent.

    So wha is slashdot running an article about something where there is an explicit one-paragraph long waring in the man page of program at the option in question.

    Yes, no doutbt there are a lot of idiots around, who without understanding,do things which require semantics which leads to a security leak (there is abolutely no way if you want to initiate authenticatication from processes on a machine to avoid root to do the same - as log as you are not asked on the agent's side each time before authentication;
    • by Anonymous Coward
      Agree 100%. To anyone who has read the SSH documentation, this is old news. However, judging from the number of posters in this thread who seem confused about the nature of the attack, I guess that most people either (a) don't read manuals, or (b) never considered how 'ssh-agent' performs its magic. Now. at least, they know.
    • Oh, it's worse. It's like Simson Garfinkel's "UNIX Security" book: he waves his hands at some complex vulnerability without making it clear, and ignores the real risks. For SSH, the real risk is idiots who refuse to use ssh-agent and keep copies of their private key, unencrypted, on insecure machines. Worse, people keep unencrypted private keys on poorly managed NFS shares so that any shmuck who plugs into a local network with a laptop can look in "/home" and get all the SSH keys.

      Even more fun, many sites r
  • Personnaly, I never understood how talented SSH developers came to the conclusion that they needed to invent such a crappy thing : ssh-agent. And I've seen people use it, the same people who put their private keys on USB sticks to ensure that nobody will steal them, but who are not afraid of collegues having root access on their machine ...

    ssh-agent is a solution to grant any process on the system full access to a means of authenticating through your private key. No comment ! There's nothing difficult in ty
    • ssh-agent is a solution to grant any process on the system full access to a means of authenticating through your private key.
      Any process on the system running as you or as root, you mean.
      • mod parent up...

        grand parent either hasn't had multiple terminals open to a half dozen (or more) remote clients, or is completely fine with typing a secure passphrase every single time (s)he wants a terminal... if any host is rooted, nothing's guaranteed after that... perhaps a binary has been been swapped out, or if you're running X11 forwarding, you're putting your own X server at risk, but I don't see what that's got to do with ssh... just don't put more faith in it than it deserves... running ssh isn'
    • ssh-agent is inevitable.
      Suppose you frequently use a program that communicates over ssh connections, e.g. cvs, rsync, svn, or darcs. You wouldn't want to type your key's passpharse each time you run the program. Of course you never want to leave your key's passphrase null. Therefore, you need ssh-agent.
    • Because it's useful? (Score:1, Informative)

      by Anonymous Coward
      ssh-agent is a godsend. My passphrase is > 50 characters in length - yours should be, too - and I don't want to type it more than once per login session. If you often use SSH, and have RTFM, you will be able to use ssh-agent properly, and it will save you a lot of time.

      ssh-agent is a solution to grant any process on the system full access to a means of authenticating through your private key.

      Any process? Presumably this is only if you have deliberately made the socket files world-readable?

      The alter

    • something like a use-agent is useful for clustering. Programs restricted to user X on the DMZ machine can use the user-agent to launch programs on other machines in their network. Does this undermine the security of the local network? Sure. Does this mean its unnecessary? No. The question really is whether you are willing to let the other machines be compromised. If a machine on the internal network needs special protection (ie it holds customer credit card info) then it most likely doesn't need to b
  • /me thinks this article is saying "the tunnel may be encrypted, but mind the ends"...

    which isn't news to anybody who's in the know about security or ssh... ssh isn't going to butter your bread, or do anything outside of securing end-to-end transmissions... I can't see anything new being introduced here...
  • In the end, you must trust the entity on the other end of the wire. This is true whether you are talking about Unix sockets, telegraphy, semaphore, or the one-time pads rolled up in Che Guevara's cigar box.

    The idea of looking at the memory on the ass-end of an SSH connection is stupid. It's one of the ends, where the other trusted party lives. For all you know, your buddy prints your secrets onto nice vellum paper and gives it to the enemy. No electronics can save you if you can't trust the other

  • by biftek ( 145375 ) on Saturday May 27, 2006 @08:24AM (#15415399)
    A few versions ago OpenSSH added a -c "Require confirmation to sign using identities" to ssh-add to take care of this. Or using something like SSHKeychain on OS X so it'll ask for confirmation for multi-hop auth, but not for connections direct from your trusted machine.
    • A few versions ago OpenSSH added a -c "Require confirmation to sign using identities" to ssh-add to take care of this.

      I hadn't heard about this feature before, so I looked it up. All it seems to do is ask you for your passphrase every time a key is used. But SSH does this already if it can't find an agent, so I have to ask: Why would you use the agent with -c?

  • by HangingChad ( 677530 ) on Saturday May 27, 2006 @08:27AM (#15415406) Homepage
    Short of unplugging the machine and locking it in a vault. SSH may not be perfect but it's pretty darn good. And if getting your credentials depends on someone else have administrator rights on one of your nodes, that's not exactly a fatal flaw unless your security demands are extremely high.

    Anyone with the time and resources is going to find a way into your network. Many times security does not have to be bullet proof. Don't have to be faster than the bear, just faster than the large majority of other networks. Unless there's something really compelling on your system, they're likely to pick an easier target.

    I use my home network as an example. I have one copy of XP on my system. What I consider the weak link in the security chain. It's on a NAT'd segment, I don't surf the internet with it and anything sensitive is on a TrueCrypt partition that I only mount when needed. Hardly bullet proof but not bad for Windows.

  • by TomAnthony ( 927466 ) <slashdot@tomantho n y . co.uk> on Saturday May 27, 2006 @08:33AM (#15415418) Homepage
    I've never needed to use ssh-agent, and during reading this I thought I'd read up on it a bit. So I google it and found an article [securityfocus.com], written in 2004, that had this to say:
    So the bad news is that your agent keys are usable by the root user. The good news, however, is that they are only usable while the agent is running -- root could use your agent to authenticate to your accounts on other systems, but it doesn't provide direct access to the keys themselves. This means that the keys can't be taken off the machine and used from other locations indefinitely.

    Is there any way to keep root from using your agent, even though it can subvert unix file permissions? Yes, you can. If you supply the -c option when you import your keys into the agent, then the agent will not allow them to be used without confirmation. When someone attempts to use your agent to authenticate to a server, the ssh-agent will run the ssh-askpass program. This program will pop up on your X11 desktop and ask for confirmation before proceding to use the key.

    At this point you're probably going to realize that we're still fighting a losing battle. The local root account can access your X11 desktop, all your processes, you name it. If you can't trust the root user, you're in trouble.

    However this will prevent root on machines to which you've forwarded the agent from accessing your agent.
  • by Zygamorph ( 917923 ) on Saturday May 27, 2006 @09:18AM (#15415556)
    Don't use SSH to poke a hole in the firewall separating your DMZ from the intranet.
  • 1: Enable an SSH tunnel
    2: L33t Hax0r finds tunnel
    3: L33t Hax0r GETS ROOT
    4: Profit.

    Both steps 2 and 3 in this reductive version seem pretty dubious. If you tunnel in to work, then sure, you're trusting the work network and machine not to be full of malevolent people, but even still, they have to get root on your box. You didn't tunnel in from root, now, did you?
    • I think you have it backwards. The author's concern about people tunnelling from home isn't that a compromised work machine will take-over the remote worker's home machine. He's a firewall admin and could care less about your home machine's health, in and of itself. What he is concerned about is the fact that your previously compromised home box can tunnel right through all of that hard work he's done trying to build a secure firewall and have IP access to attack the internal network's soft underbelly.
  • If a bad guy has the ability to bypass local file permissions (whether because he's root or because you screwed up the permissions) then he can steal your credentials by putting a backdoor in the SSH client, the SSH server, the terminal driver, the file system, shared libraries (glibc, for example, is so huge and complex you could hide a trapdoor, magic hat, rabbit, three cages of pigeons, and a performing elephant there and nobody would notice).

    I've cleaned up boxes that had been rootkitted, and if you can't identify when it happened so you can restore from a known good backup you're best off reinstalling from scratch.

    The same thing is true, to a lesser extent, for local user privileges. Do you check that $PATH doesn't go through ~/bin before /usr/bin before you run ssh?

    Once someone can run unsandboxed code on your computer you're compromised, and any tool you use to examine your computer may be compromised, and ssh-agent make so little difference that it's simply not worth worrying about.
  • by Goodbyte ( 539941 ) on Saturday May 27, 2006 @09:56PM (#15418489) Homepage
    From what I understand of the summary the poster is refearing to the fact that agent forwarding is insecure. Now in the man page for OpenSSH we have:

    -A Enables forwarding of the authentication agent connection. This can also be specified on a per-host basis in a configuration file.

    Agent forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the agent's Unix-domain socket) can access the local agent through the forwarded connection. An attacker cannot obtain key material from the agent, however they can perform operations on the keys that enable them to authenticate using the identities loaded into the agent.

    So what's the news?

    • This is certainly one part of the ssh puzzle. And I'm glad to meet someone else who reads vendor documentation and follows it. That's not always followed. I see a lot of companies adopting ssh as an ftp/telnet replacement. Maybe a business partner only accepts ssh connections. Maybe there's a 'end plaintext' initiative. As many begin studying ssh, they gloss over port forwarding. They enable agent forwarding, and the users love it! If they see that warning, it's tough to understand; so some skip the

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...