6

Ubuntu Dirty Sock 本地权限提升

 3 years ago
source link: https://y4er.com/post/ubuntu-dirty-sock/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
1 min read

Ubuntu Dirty Sock 本地权限提升

2019-02-16

在2019年1月,由于snapd API中的错误,多个版本的Ubuntu被发现本地权限提升漏洞。

默认情况下,Ubuntu附带了snapd,但是如果安装了这个软件包,任何发行版都应该可利用。运行以下命令,如果你snapd是2.37.1或更高,你是安全的。

$ snap version
snap    2.34.2
snapd   2.34.2
series  16
ubuntu  16.04
kernel  4.15.0-29-generic
  • Ubuntu 18.10
  • Ubuntu 18.04 LTS
  • Ubuntu 16.04 LTS
  • Ubuntu 14.04 LTS

poc链接:https://github.com/initstring/dirty_sock

先在Ubuntu SSO创建账号,然后本地生成密钥:

ssh-keygen -t rsa -C "<you email>"

然后把当前用户下/.ssh/目录下的id_rsa.pub(公钥)拷到你账户的ssh-keys中。

执行第一个poc

python3 dirty_sockv1.py -u "[email protected]" -k "id_rsa的路径"

出现错误,因为没有开启ssh服务。

sudo apt install openssh-server

重新执行下

如果成功,sudo -i即可获取root权限。

直接执行poc

python3 ./dirty_sockv2.py

如果成功,会创建一个账号密码都为dirty_sock的用户,su命令切换过去,然后通过sudo就可以切换为root了。

如果遇到了No passwd entry for user 'dirty_sock'的问题,则查看下图中的任务进度,等到doing任务执行完之后再进行尝试,如果仍不行,请使用方法一。

https://usn.ubuntu.com/3887-1/

https://wiki.ubuntu.com/SecurityTeam/KnowledgeBase/SnapSocketParsing

https://github.com/initstring/dirty_sock


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK