Monday, February 11, 2013

[kugufmlb] Attacking mosh

Before mosh (mobile shell), if you were logged in via SSH over an unreliable network connection, you would have to type your password again to log back in every time your connection died.  With mosh, you don't have to keep typing your password over and over again.

There is no free lunch.  With convenience comes less security.  If an adversary can grab a memory image of a running mosh-client, perhaps while the network is down, then this is temporarily as good as a password to connect to the mosh-server.  A somewhat realistic scenario is your laptop being seized while in hibernation or standby mode.

An open question is whether such hijacking can be done surreptitiously.  The illegitimate mosh-client connects to the server, does its evil, then rewinds the state of the mosh-server so the legitimate mosh-client can connect to the server seemingly uninterrupted.  Note that mosh-server runs with user privileges, so the attacker can easily run gdb on it to grab any server state it wants.

A long idle mosh-server might have gotten swapped out to disk. Such a swap image might be helpful in rewinding state.

A clumsy attack is simply to kill the mosh-server after doing evil. The user, upon trying to connect, will probably assume the mosh-server process just randomly died rather than suspect surreptitious wrongdoing.

No comments :