Slashdot Mirror


Keep SSH Sessions Active, Or Reconnect?

borjonx writes "Is it safer to log out of an SSH session, and re-establish it later, or just keep the connection open? Like many of you, I use OpenSSH to connect to my Slackware Linux boxes remotely from Linux and WinXP (putty.exe) clients. At home and at work, I wonder if it would be safer to just leave the connection open (my clients are physically secured, the servers limit connections with hosts.allow). Is it more secure to re-establish the connection over an insecure link (big bad internet) where people can sniff that handshaking, or is it more secure to just remain connected? I connect 1 to 4 times per day, most days."

72 of 307 comments (clear)

  1. screen by Singularity42 · · Score: 3, Informative

    Just use the program, "screen", if you want to resume your sessions.

    1. Re:screen by flydpnkrtn · · Score: 4, Informative

      Just use the program, "screen", if you want to resume your sessions.

      That's not what he's asking though... "Is it more secure to re-establish the connection over an insecure link (big bad internet) where people can sniff that handshaking, or is it more secure to just remain connected?"

      With a tinfoil hat on, he's asking if it's OK for the OpenSSH handshake to be happening 1-4 times per day across the big bad interwebs (traffic that could potentially be sniffed). He's not asking how to maintain sessions even if ssh itself is disconnected (which is what screen gives you)

    2. Re:screen by MightyMartian · · Score: 2, Informative

      I actually use screen a lot, particularly when I'm doing big compiles or other operations that are going to be going on for a while. Particularly when I'm working from home, I've been nailed by way too many spurious disconnects. Screen is an awesome little program. I use it when I'm coding in the shell, I can flip between screens a lot faster than I can through any GUI.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    3. Re:screen by flydpnkrtn · · Score: 2, Insightful

      Huh? So you're saying somehow screen keeps listening on a port and lets evil hackers connect to it, exploit it, and continue using your screen session?

      Can you really be sure it's not just some other vulnerability that is letting someone in?

    4. Re:screen by Anonymous Coward · · Score: 5, Funny

      Just drive a blue car if you want it to catch on fire, you mean. The ONLY time I have ever had a car catch on fire it was blue.

    5. Re:screen by StudMuffin · · Score: 4, Informative

      http://www.ubuntu.com/usn/usn-370-1

      Burned by that. Prolly fixed now, but that doesn't mean I am eager to resume :D Call me old fashioned.

      --
      Weaseling out of things is important to learn. It's what separates us from the animals... except the weasel. -
    6. Re:screen by flydpnkrtn · · Score: 2, Informative

      "cstone and Rich Felker discovered a programming error in the UTF8 string handling code of "screen" leading to a denial of service. If a crafted string was displayed within a screen session, screen would crash or possibly execute arbitrary code."

      Wow.... ouch. Especially on a shared host with random other people you don't know...

      OpenVZ VPS's for the win! It's your own personal "box" effectively

    7. Re:screen by MrNaz · · Score: 5, Insightful

      This is the wrong place to ask. I doubt we'll get a single response from a person on the cutting edge of cryptanalysis who can give you a meaningful answer on the relative strength of Diffe-Hellman vs AES, which is what your question comes down to.

      Realistically, it makes no difference. Both mechanisms are highly secure, cutting edge cryptographic systems. I doubt that either have been broken by anyone. If there is someone powerful enough to break those systems *and* keep the discovery secret, they're waaay above the league where they'd be interested in your SSH connections. That is, unless you work for the military of a major world power and are known to be transmitting valuable intel.

      The ability to secretly break DH or AES would be such a huge weapon that they wouldn't use it unless the stakes were high enough to risk losing the advantage if their capability were detected. Somehow, I think your connections to your servers aren't that important.

      --
      I hate printers.
    8. Re:screen by pookemon · · Score: 3, Funny

      The only car I have ever seen on fire (in real life as opposed to on TV) was a Porsche - and it was blue.

      And I currently have two laptops that I amd repairing - both of them have buggered screens.

      Oh, and then there's the "Blue Screen of Death" - though I've only seen one PC burst into flames after a BSOD, so that was probably a coincidence...

      --
      dnuof eruc rof aixelsid
    9. Re:screen by sopssa · · Score: 2, Informative

      Exactly.

      The only thing we can say here is that if your computer is physically secured (you can log out to login screen and leave the sessions running, and encrypt your hdds), it doesn't matter if you leave your session running or not. Your ISP can't "sniff that handshaking" and go on without you getting a security warning. If you do, you just wont accept the connection and try to solve what's going on. Just remember to log out after leaving from computer.

      If NSA or some other organization had a way to break into your SSH session and they cared to use it against you (with the risk of that info leaking), then you have much larger problems than worrying about if you should leave ssh sessions open or reconnect.

    10. Re:screen by louzerr · · Score: 2, Funny

      I've had two cars catch fire ... both blue!!! I think you're on to something ...

      --
      "The large print giveth, and the small print taketh away" -- "Step Right Up", Tom Waits
    11. Re:screen by pthisis · · Score: 5, Insightful

      This is the wrong place to ask. I doubt we'll get a single response from a person on the cutting edge of cryptanalysis who can give you a meaningful answer on the relative strength of Diffe-Hellman vs AES, which is what your question comes down to.

      No, it doesn't.

      Currently, the relative strength of both of those is "much stronger than the chance of some kind of user screwup". Something like typing a password and "enter" into the wrong window, connecting to the wrong server, being tired and cranky about having to get work done and so ignoring a KEY CHANGE warning, etc is far more likely than an attacker breaking AES or Diffie-Hellman to get to your data.

      So, do what you can to minimize the chance of user error. To me, that probably means stay connected (I'm willing to be persuaded otherwise, though, whether in general or for particular work patterns).

      --
      rage, rage against the dying of the light
    12. Re:screen by _Sprocket_ · · Score: 4, Interesting

      Huh? So you're saying somehow screen keeps listening on a port and lets evil hackers connect to it, exploit it, and continue using your screen session?

      Can you really be sure it's not just some other vulnerability that is letting someone in?

      One of the high-profile compromises Slashdot covered in the past involved screen. Screen itself wasn't attacked. But it did provide numerous sessions (including SSH tunnels) that provided access to internal systems through an otherwise pretty hard perimeter.

      Screen rocks; I use it all the time. But one really needs to keep in mind the issues involved in using it. Using it to keep open active SSH sessions would be a practical example of one of those issues.

    13. Re:screen by JustOK · · Score: 2, Funny

      blue, brown and bi-colored all start with the letter b

      --
      rewriting history since 2109
    14. Re:screen by yincrash · · Score: 2, Informative

      you could use a key pair to login rather than a password. then keep the key on physically secured usb storage. that would prevent any password issue.

    15. Re:screen by zippthorne · · Score: 4, Informative

      There is no need to be entering your password in every time. If you're logging in frequently, see man pages for ssh-agent, ssh-keygen, and ssh-add.

      It's not that difficult to set up, although the first time takes few minutes to understand. Your OS may also have integration into its keychain, depending on what you're using.

      --
      Can you be Even More Awesome?!
    16. Re:screen by mysidia · · Score: 2, Informative

      RTFM.

      That's why you set a screen password. Control + A, : password ENTER

      The attach cannot proceed without typing the password. The password cannot be changed (for an already running session) without attaching first.

      From the screen man page:

      password [crypted_pw] Present a crypted password in your ".screenrc" file and screen will ask for it, whenever someone attempts to resume a detached. This is useful if you have privileged programs running under screen and you want to protect your session from reattach attempts by another user masquerad- ing as your uid (i.e. any superuser.) If no crypted password is speci- fied, screen prompts twice for typing a password and places its encryp- tion in the paste buffer. Default is `none', this disables password checking.

    17. Re:screen by tkiesel · · Score: 2, Interesting

      The GNOME encryption utility has this integrated. I established a key for connecting to my server at work in seconds with a few clicks and my remote password.

      So Ubuntu, Fedora, etc.. Linux distributions have this solved.

    18. Re:screen by Anonymous Coward · · Score: 5, Insightful

      Cutting edge cryptanalyst here (PhD in IBE, works for major global security company)

      A disclaimer: Conventional crypto is not my game anymore (post-quantum crypto is the way of the future). As any expert will tell you, I am not an expert, but I'll try to shed some light on some aspects of the discussion here.

      To begin, we first have to make some reasonable assumptions about the choice of keys in SSH2. There exist known weak primes and weak generators in the DH (Diffie-Hellman) protocol that can be exploited. Assuming the SSH key generator algorithm is smart enough not to choose any known weak primes or generators, we can say the following.

      The default OpenSSH implementation uses a 2048-bit prime order field. The security of the DH key exchange protocol is based on the discrete logarithm problem, of which the best known conventional attacks are generally O(sqrt(n)). ie. in laymans terms, roughly equivalent to a keysearch of 2^1024. Quantum computers are another story, but unless you're transferring data that will need to be secure in the order of decades (like you're that important), I doubt you have much to worry about in that regard for a while to come.

      AES (the symmetric cipher used in SSH) uses by default 128 bit keys. There are no known attacks on AES better than brute force (ie. on average a keysearch of 2^127, since on average only half the keys will need to be checked before finding your session key). I would say however that there is a far greater chance of someone in the future strongly breaking AES than someone strongly breaking DH. New techniques for attacking symmetric cryptosystems appear all the time (see: Linear cryptanalysis, Differential Cryptanalysis, Impossible Differential Cryptanalysis, Integral Cryptanalysis, Boomerang attacks etc.) whereas DH is based on a very well known and studied number theory problem. Crypto-God Bruce Schneier seems to think AES will be broken in the future, but not enough to allow practical cryptanalysis of traffic.

      It's hard to make any definite statements about a comparative analysis of the two schemes, due to the constants (or indeed polynomial terms) of the above complexity statements being unknown. From a purely theoretical standpoint, DH is the weakest link due to it having a better attack than brute force. However, when given this specific set of values to be used, the real-world security comparison is generally seen to be in the favour of DH with 2048 bit prime rather than AES-128. One author suggests Regardless, cycling the session key seems to be free (I can't find any known attacks that use past key exchanges). The SecSH RFC suggests session key cycling after a gigabyte of data, however more often can't hurt.

      In short, you don't need to be worried about either DH or AES for a long time to come, but in terms of security, cycling the session key more often than necessary (ie. logging out and back in again) is probably technically more secure. As others have said in this thread however, crypto is very very rarely the weakest link. I'd be looking far more closely at the security of the computers involved than worrying about the crypto being broken.

    19. Re:screen by Antique+Geekmeister · · Score: 4, Insightful

      ssh-agent is its own profound issue: by keeping the key unlocked in a format usable by other shells or software, it makes all your unlocked keys available to anyone who can gain access to the same server as you. This means that I, as an admin, can probably borrow the ssh keys of anyone I've educated in how to use ssh-agent on any of my systems.

      Isn't that _convenient_ for me?

    20. Re:screen by Lord+Kano · · Score: 2, Insightful

      The ability to secretly break DH or AES would be such a huge weapon that they wouldn't use it unless the stakes were high enough to risk losing the advantage if their capability were detected. Somehow, I think your connections to your servers aren't that important.

      If anyone has the capability, it's the NSA. They could use it routinely without anyone else knowing, they're good enough at keeping secrets that no one would know until long after it mattered. These are the people who discovered differential cryptanalysis and didn't let the cat out of the bag until 20 some odd years later when academia discovered it.

      LK

      --
      "Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
    21. Re:screen by JWSmythe · · Score: 4, Interesting

          I think his question went beyond the question of how secure the session is, even though he did say it.

          Which is more secure, to leave a shell opened indefinitely, or to close it?

          Unless he's not a normal person, at some point every day, he'll use the restroom. During the work day, he may even go get some food or drinks.

          He admitted to using a Windows machine. I won't even comment on how many viruses and trojans are running around, which may compromise his desktop. All it takes is one virus that gives remote access to his desktop that would give someone a clear shot to his servers.

          As anyone who's worked in an office long enough would know, once in a great while, you'll get dragged away from your desk, and not lock the console. Maybe someone shoulder surfed your password. Maybe you used the same password for your email account, and it was sniffed in the clear (tisk, tisk, should have used an encrypted method).

          Of course, his information may really be worth something. Maybe that root shell will be worth a fortune. What exactly is a dump of the full Bank Of America database worth on the black market? How many fake credit cards can you print up before they reissue every single BoA credit card in circulation? In that case, it would be worth it to visit his home with force. One bump key to the back door, and one silenced shot to the back of the head, and you'd have hours (or days) before you were discovered. As always, there is no security without physical security, and that isn't only the server side of things.

          I'm sure someone can name the XKCD issue which points this out the brute force flaw in any security system. A $5 wrench will break any security, if applied properly.

          I'll assume his information isn't all that interesting, since he can access remotely without some serious levels of security. I'd believe we're talking about a few low traffic web servers, and a newbie admin impressing himself that he can keep his connection up for days.

      --
      Serious? Seriousness is well above my pay grade.
    22. Re:screen by Antique+Geekmeister · · Score: 4, Informative

      The ability to read your sockets, directly, to steal the passphrase requires access during that action, with root privileges. It also requires a bit of programming knowledge. Conversely, the ssh-agent access merely requires stolen user level privileges at any time during the period that you have the agent loaded up. It's the difference between picking a lock, and looking under the doormat for the key the owner left there.

      A similar issue occurs with administratively privileged sessions without a screen locked, but this is exacerbated by the casual handling of $HOME contents in numerous working environments.

    23. Re:screen by phtpht · · Score: 2, Insightful

      RTFM.

      That's why you set a screen password. Control + A, : password ENTER

      The attach cannot proceed without typing the password. The password cannot be changed (for an already running session) without attaching first.

      From the screen man page:

      password [crypted_pw] Present a crypted password in your ".screenrc" file and screen will ask for it, whenever someone attempts to resume a detached. This is useful if you have privileged programs running under screen and you want to protect your session from reattach attempts by another user masquerad- ing as your uid (i.e. any superuser.) If no crypted password is speci- fied, screen prompts twice for typing a password and places its encryp- tion in the paste buffer. Default is `none', this disables password checking.

      So what does screen actually do to protect the programs inside? I mean with the privileges to attach the screen and not knowing the pw, you usually also have the privileges to debug the bastard and skip the pw check altogether.

    24. Re:screen by pthisis · · Score: 2, Insightful

      I would ask, why would you even allow password-based logins to your server?

      Because requiring key files presents a barrier to the ability to do work, and that penalty is far greater than the small risk of being hacked in a manner that's caused by allowing password-based logins.

      It's not unheard of for things to go wonky when a key employee's on vacation or over at a friend's house or wherever, and the benefit we get from having them be able to download putty, log in, and fix things is a lot higher than the tradeoff.

      In a security-focused sysadmin's world it'd be nice to tell them they should carry a keyfile with them everywhere, but in the real world that doesn't really work out all the time.

      --
      rage, rage against the dying of the light
  2. Wat by sakdoctor · · Score: 4, Informative

    What gives you the impression that the key-exchange in SSH is vulnerable?
    The short answer is: Whatever.

    http://en.wikipedia.org/wiki/Diffie-Hellman_key_exchange

    1. Re:Wat by xZgf6xHx2uhoAj9D · · Score: 4, Informative

      More to the point (since basic Diffie-Hellman is vulnerable to man-in-the-middle attacks), if you already have the "fingerprint" stored for your home machine, that really can't be faked, so you're safe. If you're not storing the "fingerprint" (why not?) then, well, why would anyone do that?

    2. Re:Wat by Anthony+Liguori · · Score: 2, Interesting

      The short answer is: Whatever.

      It's a little more nuanced than that. To the extent that a long term session is more predictable than a short term session (or vice versa), it may matter. See Timing Analysis of Keystrokes and Timing Attacks on SSH.

    3. Re:Wat by hunteke · · Score: 5, Informative

      What gives you the impression that the key-exchange in SSH is vulnerable?

      Answer: The key-exchange is not vulnerable. However, there is an issue the first time you connect to one host from the other. That initial message that most people ignore is a possible MITM (Man in the Middle) avenue a cracker could harness.

      Example message:

      The authenticity of host 'ssh.example.com (123.234.123.234)' can't be established.
      RSA key fingerprint is 96:21:c3:32:3d:cc:18:d5:53:6a:d4:0d:0d:73:c6:1a.
      Are you sure you want to continue connecting (yes/no)?

      While giving the password to the remote server for authentication may be secure, unless you've verified that fingerprint, you don't know to whom you're talking. That is, when you connect the first time, and you blindly accept that fingerprint, if it's a cracker, you are literally typing your password to the rogue machine (that would then turn around and log in "as you" to the real machine).

      Ideally, you would to verify that fingerprint with a version you get through alternate, presumably secure, means. E.g. an over-the-phone conversation with an administrator, or physically accessing the work system and writing it down, or (temporarily) connecting directly to the server with a cross-over cable.

    4. Re:Wat by palegray.net · · Score: 2, Informative

      Precisely. On a Linode Linux VPS, for example, this can be accomplished via the console using the following command:

      ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub

    5. Re:Wat by tobiasly · · Score: 2, Funny

      Ideally, you would to verify that fingerprint with a version you get through alternate, presumably secure, means. E.g. an over-the-phone conversation with an administrator

      So what if this administrator you're having such a secure conversation with has someone holding a gun to his head! Guess you're not so secure now, huh?

    6. Re:Wat by jroysdon · · Score: 2, Informative

      The solution to the first-time key exchange is SSHFP + DNSSEC.

  3. Always mitigate against the most likely risk by pthisis · · Score: 5, Informative

    Is it safer to log out of an SSH session, and re-establish it later, or just keep the connection open?

    Breaking the crypto is almost assuredly not the weakest point in your connection. I'd stay connected, since by far the biggest danger is user errors: you accidentally connecting to the wrong serves, ignoring a cert change alert or something else boneheaded.

    Assuming you're not using SSH1, the client and server should periodically regenerate session keys, so it's not like you'll be encrypting vast sessions with just one key (not that this is likely to be the biggest point of failure in your system even without re-keying).

    --
    rage, rage against the dying of the light
    1. Re:Always mitigate against the most likely risk by massysett · · Score: 4, Insightful

      Breaking the crypto is almost assuredly not the weakest point in your connection. I'd stay connected,

      You're right about the crypto not being a concern, but I think the bigger danger is that he gets up to go to the bathroom or printer or something and he forgets to lock the client machine. Cert change alerts are hard to ignore, at least with OpenSSH. Logout.

    2. Re:Always mitigate against the most likely risk by fm6 · · Score: 3, Informative

      I'd stay connected, since by far the biggest danger is user errors: you accidentally connecting to the wrong serves, ignoring a cert change alert or something else boneheaded.

      User error isn't merely the biggest danger. If you count social engineering exploits and sloppy procedures as "user error" than user error accounts for almost all exploits. Mathematical exploits are few and far between — "breaking the code" is something that pretty much happens only in bad spy movies.

      (And yes, I know how Blechley Park "broke" Enigma. Except Enigma was never broken. Sloppy procedures by Axis radio operators made the code less secure than it should have been. As it was, they needed brilliant mathematics, early computers, and a lot of luck to even read a small portion of Enigma traffic.)

      But why is connecting to the wrong machine a security breach? Because you're sending your password to somebody that shouldn't have it? Passwords themselves are poor security — nobody can remember all the passwords they need to use, and the usual methods of recording them (like the post-it attached to the monitor) are horribly insecure. If you're paranoid enough to use SSH, you should be using SSH's public key authentication.

    3. Re:Always mitigate against the most likely risk by dissy · · Score: 2, Insightful

      If you count social engineering exploits and sloppy procedures as "user error" than user error accounts for almost all exploits. Mathematical exploits are few and far between -- "breaking the code" is something that pretty much happens only in bad spy movies.

      Buffer overflow? Underflow? Stack smashing?

      None of those exploit vectors require even 'user interaction' let alone could be called 'user error'

      I would have to venture a guess that, while probably not anywhere close to the share true user error has, such attack vectors still do have some share none the less.

  4. Neither by nacturation · · Score: 3, Informative

    Both the persistent connection and the handshake protocol to establish a new connection are completely secure for any practical purpose. If both the server and the client are completely secure, and the connection between them is secure (via strong crypto in ssh) then pick whichever method works best for you.

    --
    Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
  5. Re:You're probably not that special.. by Anonymous Coward · · Score: 2, Insightful

    The question of best practices doesn't matter who's important.

  6. Catch 22 by SnoopJeDi · · Score: 2, Interesting

    If it's an "insecure link" (which is the whole reason SSH was developed ANYWAY), then ANY connection is technically compromised. You can't just assume one that was established "sometime before" is more secure than a new one now. If you carry your assumptions through consistently, they're both compromised and you should just disconnect.

  7. Depends... by Monkeedude1212 · · Score: 2, Funny

    Are they using the interwebs to hack the mainframe, or crack the mainframe? You need to consider if they are after your Datasheets or your Hard-Diskette. Theres so many factors to consider. Perhaps they just want to plant a worm that will grow into a virus which will grow into a trojan, if you don't stop it in its Larval stages. You can use cyber worms and cyber Larva in some advanced Phishing techniques, so don't waste them if you come across them. I suppose the only way to be sure 100% secure is to encrypt your entire house on the molecular level. Before you head off to work, you should arrange each everything into 8 mol groups and hash into some kind of cipher, its the only way to be both virtually and physically secure.

  8. Re:Reconnect. by pthisis · · Score: 4, Informative

    SSH doesn't use SSL, and SSHv2 has provisions for rekeying even during a single connection.

    --
    rage, rage against the dying of the light
  9. Neither is "more" secure by Rantastic · · Score: 3, Insightful

    It is good that you are concerned about security. It is bad that you are asking Slashdot for security advice.

    If I told you that it is far more secure to leave your connection open all day, would you take my word for it?

    Do some research on the subject. Learn what terms like IND-CPA, IND-CCA, and IND-CCA2 mean and how to evaluate this situation for yourself. In terms of security, blindly following someone's advice is the less secure choice.

    --
    Ask Slashdot: Where bad ideas meet poor googling skills.
    1. Re:Neither is "more" secure by drinkypoo · · Score: 2, Insightful

      If I told you that it is far more secure to leave your connection open all day, would you take my word for it?

      He didn't ask you, he asked Slashdot. If everyone reputable tells him the same thing, he can probably believe it. If he had time to become a security expert, he probably would have. There are of course no certainties in life, but generally speaking, you can trust the experts most of the time. Amusingly enough, many of the experts seem to have plenty of time to read Slashdot, and even post occasionally :)

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  10. Re:Anonymous Coward by dougmc · · Score: 2, Informative
    Well, yes and no.

    It gives the hacker more chances to sniff the connection, but less time to decrypt whatever was sniffed during the beginning of a connection and use it to take over the connection.

    It could go either way, depending on whatever vulnerabilities may be found in OpenSSH in the future (or are already known, but not public knowledge.)

    Personally, I'd think that going for more, shorter lasting connections would be safer than fewer, longer lasting ones, simply because if they can figure out your password from the key exchange, they can probably do it every time, so it doesn't matter if it's one or many times -- they go it. Of course, this assumes a future vulnerability ...

  11. Re:all of the above by moonbender · · Score: 3, Funny

    Are you crazy? Obviously the two encryptions would cancel out each other!

    --
    Switch back to Slashdot's D1 system.
  12. Re:Sniffing? by ettlz · · Score: 4, Interesting

    If you're worried that the possibility someone is going to perform an MITM attack on you is greater than infinitesimal

    ...or the DNS cache gets poisoned, as I once saw. (Thankfully, SSH does a reverse lookup as well and checks the result matches the input, and bails if they don't.)

  13. How safe is your box? by gmuslera · · Score: 4, Informative

    If you assume that the remote server is safe, and the communication is safe, then the risk could be at your own box.
    Forgetting to set even a screensaver with password in a place where are more people (i.e. kids, or in an office ) or even not people (dont think a cat could hit rm -rf, but is your server, not mine) could make a difference in that question. Could be also an hypotetical risk of some rogue app/trojan (?) sending events to the window that have the ssh session too, but odds are somewhat low.

  14. Re:Anonymous Coward by mysidia · · Score: 2, Interesting

    What if the vulnerability is a cryptanlytic one in the protocol used by OpenSSH for the key negotiation?

    Something like: 2^10 initial key exchanges, reduces the search space for an attacker trying to guess the key

    Or certain nonce values turn out to be vulnerable, but not others.

    Then more session setups helps the hacker to improve their chances of guessing.

  15. Re:gnu screen by mirix · · Score: 2, Interesting

    dtach is tiny screen-like app, well, it does just the detach portion of it. Handy if you're running it on something pathetic (hacked router, fe.), and don't need all of GNU screen's bells and whistles.

    dtach

    --
    Sent from my PDP-11
  16. Key Fingerprint by phantomcircuit · · Score: 4, Informative

    the only thing that is important is that you verify the public key fingerprint presented by your server to prevent MITM attacks. Aside from that there is absolutely no reason to believe the ssh protocol itself has been broken.

  17. Or... by DRAGONWEEZEL · · Score: 2, Funny

    When you cross the two encryption streams you may get total protonic reversal, or you may get 1 REALLY POWERFUL STREAM.

    --
    How much is your data worth? Back it up now.
  18. Don't leave your computer turned on. by Medievalist · · Score: 2, Insightful

    "Is it safer to log out of an SSH session, and re-establish it later, or just keep the connection open?

    It's safer to log out and re-establish. UNLESS you are subverting host key verification - just clicking past the big warning sign that OpenSSH throws up when it sees an unknown host key - in which case you certainly can get MITM'd. Keep copies of your public (not private!) host keys on a thumb drive for use the first time you connect from an outside box.

    Like many of you, I use OpenSSH to connect to my Slackware Linux boxes remotely from Linux and WinXP (putty.exe) clients. At home and at work, I wonder if it would be safer to just leave the connection open (my clients are physically secured, the servers limit connections with hosts.allow). Is it more secure to re-establish the connection over an insecure link (big bad internet) where people can sniff that handshaking, or is it more secure to just remain connected? I connect 1 to 4 times per day, most days."

    I believe the "handshake" is a diffie-hellman key exchange. It can't be sniffed and cracked in realtime. On the other claw, I suppose it's theoretically possible that if you leave the connection open long enough, a determined attacker with titanic resources can brute your session key. In reality, I personally don't think that will ever happen to you, it'd be cheaper for anyone with those kind of resources to use the $5 wrench upside your head method.

    Here's something to consider: If your computer is turned off, it's not being hacked. If your computer is turned off, it's not getting a virus. If your computer is turned off, nobody is sniffing your packets. If your computer is turned off, lightning isn't blowing through the ground line of your UPS like a knife through butter and turning your motherboard into a campfire. If your computer is turned off, a jealous colleague is not sneaking into your office and using it without leaving a login record. If your computer is turned off, it's not part of a botnet. If your computer is turned off, it is immune to zero-day exploits that are absolutely unstoppable by any other means.

    The most secure computer is turned off. Any time you don't need your computer to be turned on, just turn it off. If everyone did this, we'd save millions of dollars (and hopefully, cut off some funding to energy suppliers who hate us).

    1. Re:Don't leave your computer turned on. by gregben · · Score: 2, Informative

      If your computer is turned off, lightning isn't blowing through the ground line of your UPS like a knife through butter and turning your motherboard into a campfire.

      No. The easy, safe, way to protect against lightning strikes is to turn off and unplug the computer so there is no conductive path into it.

  19. Re:One-time pad by Sloppy · · Score: 4, Interesting

    People joke about OTP and say it's infeasible, but seriously: how inconvenient is it to carry around a few gigabytes of pad? It was infeasible 20 years ago but today it sure doesn't sound very burdensome or expensive. The thing is, it's historically so infeasible, that most of today's software doesn't bother to support it. And yet, if our software could use it, I bet plenty of people really would be carrying around randomized flash cards, just for that purpose.

    --
    As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
  20. In your situation by mindstrm · · Score: 4, Insightful

    Reconnect. Leaving the sessions constantly open means if your workstation is compromised, you may have compromised the servers as well.... at least you've increased the risk profile of the servers.

    Connect as needed - use proper key management and passwords, etc.

  21. Boring... by brundlefly · · Score: 2, Funny

    This is exactly the sort of question that Stack Overflow was created for....

  22. Re:One-time pad by fbjon · · Score: 3, Interesting

    It's not the carrying around that's burdensome, it's getting the OTP data to wherever you're connecting.

    --
    True confidence comes not from realising you are as good as your peers, but that your peers are as bad as you are.
  23. Re:One Way to Prevent Session Hijacking by Vairon · · Score: 3, Informative

    The ask slashdot article is about SSH NOT SSL. Session hijacking has nothing to do with SSH.

  24. Restarting makes traffic analysis a little easier. by dweller_below · · Score: 4, Interesting

    I do IT Security for a university. One of my projects is to do some rudimentary traffic analysis of our SSH sessions.

    I look for the negotiation between SSH server and client and log connections. Since the negotiation is port independent, I can log the start of SSH sessions, no matter what port they are on. This allows me to:

    1) Notice if important systems have sprung a new SSH backdoor.
    2) Notice if important systems are SSH'ing out to weird places.
    3) Check with local sys-admins and say things like: 'Looks like the Chinese have found your supersecret SSH port. Again. You have proved that TCP/222 and TCP/2222 are not good choices. Maybe this time you want to borrow my HexDice?'

    Anywho, my rudimentary traffic analysis can be defeated if you change the SSH negotiation. It can be hindered if you just leave the connections running for days at a time.

    So, if you want to annoy people like me, you may want to leave the connections up.

    Miles

  25. Like many of us ... by Lemming+Mark · · Score: 5, Funny

    Like many of you, I use OpenSSH to connect to my Slackware Linux boxes remotely

    If many of us are connecting to your Slackware boxes, reconnecting is not your largest vulnerability!

    (sorry, couldn't resist)

  26. Re:One-time pad by _Sprocket_ · · Score: 2, Insightful

    People joke about OTP and say it's infeasible, but seriously: how inconvenient is it to carry around a few gigabytes of pad? It was infeasible 20 years ago but today it sure doesn't sound very burdensome or expensive. The thing is, it's historically so infeasible, that most of today's software doesn't bother to support it. And yet, if our software could use it, I bet plenty of people really would be carrying around randomized flash cards, just for that purpose.

    Or carry a token.

  27. However... by Junta · · Score: 4, Insightful

    That has no bearing on comparing logout/login vs. staying logged in. Yes, the very very first handshake can be bad (there are methods to mitigate, but that's beyond the scope of this discussion), but once you establish that trust, logging out does not break it.

    --
    XML is like violence. If it doesn't solve the problem, use more.
  28. Re:Better to disconnect by mysidia · · Score: 2, Informative

    The short of it is you need to be the only Administrator of your workstation, in order to really have a connection to the Unix servers that you can verify the security of. You are most "secure" with a standalone workstation, having Windows Firewall enabled, no exceptions enabled, no domain membership, forceGuest set to on, and passwords required for all local access.

    If your organization requires security of the servers, then ensuring no untrusted admin has the technical ability to screw with workstations is critical.

    Just because a naive Windows admin doesn't have a simple way of shadowing your session, doesn't mean it is at all hard.

    One group policy setting to deploy "compliance software" such as 3AMI/MAS Employee Monitoring Software, with keylogging enabled, and.. suddenly your SSH sessions and passwords aren't so secure... Oh, that's just the legal route. Of course, "trojans" or some $5 keylogger can be deployed too, from a system management console, and configured via enforced registry settings.

    If you have software installed by someone else, OR someone else has a valid login to your workstation, OR your computer is a member of a Windows domain, then someone else can run software on your computer, and they can also change the configuration to enable them to shadow your session.

    And yes, most shrink-wrapped management software provide a way to do this. Typically, the technology used is VNC, TightVNC, or UltraVNC.

    There are also some commercial software (remote access) products that do this.

    Most management software allow the running of arbitrary remote programs. It is trivial to deploy registry settings and software via group policy or remote IPC access, from a domain computer.

    Tools included with Windows Server and available through SYSINTERNALs allow this without buying any management suite.

    But DameWare, Hyena SystemTools, Purgos, ScriptLogic, LANRev, ZENWorks, IBM Director, all provide point-and-click interfaces to do this sort of thing.

    The management software itself may provide a simple "one-click link" to quietly shadow your session.

  29. Re:One-time pad by pclminion · · Score: 3, Insightful

    Great, now you have something that will work for 5% of the cases in which people need to remotely connect.

    I never suggested that this is a general crypto solution for the masses. I am pointing out that if you think you do need to security offered by an OTP system, it's not really that hard to communicate the pads securely. If I can't afford a $1000 plane ticket to deliver the pad in person, chances are my data isn't important enough to need that level of security in the first place.

  30. Re:Better to disconnect by mysidia · · Score: 2, Informative

    Addendum: embarrassed that I mentioned UltraVNC without also mentioning Timbuktu can be made to do this.

    VNC normally displays a little icon in the taskbar, but a simple registry setting pushed via login script or group policy can hide it.

    It can also be easily hidden in task manager/process viewer, through other methods, I won't mention, because they are easily abusable tricks I don't wish to encourage, not documented anywhere, and relatively unknown to most developers and to the community. But also not hard to figure out: so, you don't need other people having access to your computer if you want anything close to a security guarantee, you must fully and properly administer and secure your workstations yourself (or have someone trusted due that, without lending access to a large population of admins via domain or central management).

  31. tag: youarentthatimportant - WTF? by wvmarle · · Score: 4, Insightful

    Come on people what is this? Tagging such a story where someone asks about some security where some obscure attack may be possible and then tagging it "you aren't that important"?!

    This is the same messageboard that wants https for everything, even for this board.

    This is the same board that seems to hold privacy above all.

    And on top of it, it is full of nerds that tend to love to go into this kind of obscure detail.

    And then tag it "you aren't that important" implying "what are you worried about", or with a little further stretch "you have nothing to hide, so don't bother". This is quite ridiculous.

    To me I am the most important person in the world, and I would like to live safe and secure. The poster is likely the most important person to himself, and he also wishes to live safe and secure. I wouldn't go as far as poster does, but that's besides the point. He does want to go this far, and has a genuine question that many may consider over the top for personal security but which may have consequences for entities that are under constant attack, where any minute attack vector may mean the difference between safe and 0wned.

    "youarentthatimportant" is the worst tag I have ever seen. It's denigrating at best. It's stupid, and shows lack of respect for other people. I may hope this was intended as a joke and a joke alone.

  32. Re:OK, I grant that you did say "theoretically", b by mysidia · · Score: 2, Informative

    They don't have to crack DHE in general, all they need to crack is diffie-hellman-group1-sha1.

    Since a fixed DH group is used, this could be attacked through precomputing many values for the discrete logarithm.

    If the key negotiation happens to fall into one of the precomputed values, then that session is in trouble.

  33. There is no answer.. by invalid216 · · Score: 2, Insightful

    In my opinion there is no answer to this question. Both scenarios are subject to an equal amount of risk. The most important thing is securing the workstation itself. If done properly, the risks of staying connected or re-connecting are self-canceling. Do what is most convenient for you, just make sure your workstation is as secure as it can be.

  34. More info? by Wovel · · Score: 2, Insightful

    How could anyone really answer your question without knowing the value of the servers you are logged into? If the servers you are connecting to are in a secured bunker and you are leaving the connection open from your house while your not there and the data is something valuable enough for some to break into your house.. Well then no, you should not leave the session logged in. In general it is a bad idea to leave a connection you are not using logged in. If you are locking your workstation (you did not say), than maybe it is still ok.

    Keep strict host key checking on and just log out when you are not using the box. If the key changes and your not expecting it, either someone has already broken into your server, your DNS server (on either end), or it is time to talk to the isps on the endpoints and find out which one is out to get you. The "big bad" Internet is the least likely place for you to have a security problem, it is simply too unpredictable.

  35. Solving the wrong problem. by 1s44c · · Score: 2, Informative

    I use OpenSSH to connect to my Slackware Linux boxes remotely from Linux and WinXP (putty.exe) clients.

    You are fixing a non-problem. You should be fixing the weakest point of attack first, that being the windows machine you are connecting from.

  36. Re:Man-in-the-middle? by MoralHazard · · Score: 2, Informative

    Your concerns are irrelevant, here. SSH fingerprints make man-in-the-middle attacks effectively impossible, as long as the user doesn't habitually ignore the (rather obvious) messages and errors when keys change. I don't know about you, but I have a hard time glossing over a message like "KEY CHANGED--SOMEBODY COULD BE TRYING TO BREAK IN!" and the subsequent error.

    The initial "unknown key" error message isn't quite as loud, and lots of people don't bother validating key fingerprints, but that doesn't matter because initial connections aren't the scenario we're discussing, here. Whether the use decides to make new connections or keep existing ones open, he's already approved the key fingerprints during a previous connection.

  37. Re:You're probably not that special.. by realityimpaired · · Score: 2, Insightful

    Indeed. Speaking from a military standpont (I was in communications in the Canadian Forces, Army), the longer a communications link remains open, the more chance there is that somebody will notice it. Now, the costs are a *lot* higher when you're talking about battlefield communications and the potential for enemy artillery, but the principle remains the same: if you keep an encrypted communications link open 24/7, then the chance that somebody will take notice and try to do something with it are significantly increased. It doesn't matter that you're probably not a valuable target, or that you may not necessarily lose much if your connection is hit, the chance of it happening increases with every minute you spend connected. When talking about SSH, yes, it's encrypted, but there's nothing to stop them from sitting there and logging all of the traffic that passes, and just waiting for the next time the SSH handshake happens.

    Best practice is to open the link, do what you need to do, and close the link.