2020年1月30号,sudo爆出目前sudo工具的一个高危漏洞,漏洞编号为:CVE201918634,黑客可通过工具获得Linux的root权限(root具有Linux操作系统的最高权限)。 Linux漏洞 sudo是Unix和Linux操作系统广泛使用的工具,这次漏洞是一个是一个堆栈缓冲溢出bug,这个漏洞在启用了pwfeedback的系统中很容易利用,该漏洞让非特权用户很容易通过缓冲溢出获得root权限,不需要攻击者有Sudo使用权限。 在Sudo上游版本中,pwfeedback没有默认启用,但在下游发行版如LinuxMint和ElementaryOS中,pwfeedback被默认启用了。主要影响的版本:从v1。7。1到1。8。25p1,ubuntu版本不受该漏洞影响,最新的1。8。31已修复了该漏洞,请大家及时更新到最新的版本。 1。查看自己系统是否存在该漏洞 1、先通过sudoversion命令查看当前sudo的版本信息。 sudoversion Sudoversion1。8。25p1 Sudoerspolicypluginversion1。8。25p1 Sudoersfilegrammarversion46 SudoersIOpluginversion1。8。25p1 2、通过sudol查看pwfeedback是否启用,如果存在pwfeedback字样则说明已启用否则没有; sudol MatchingDefaultsentriesformillertonlinuxbuild: insults,pwfeedback,mailbadpass,mailerpathusrsbinsendmail Usermillertmayrunthefollowingcommandsonlinuxbuild: (ALL:ALL)ALL 2。如何利用该漏洞 1、在1。8。26之前的版本 利用该漏洞,不需要登录的用户有sudo权限,可以利用无法写入的伪终端,向sudok传入超长字符串。原文为:Thebugcanbereproducedbypassingalargeinputwithembeddedterminalkillcharacterstosudofromapseudoterminalthatcannotbewrittento。 Forexample,usingthesocatutilityandassumingtheterminalkillcharacterissettocontrolU(0x15): socatpty,linktmppty,waitslaveexec:print((Ax100。chr(0x15))x50) sudoStmppty Password:Segmentationfault(coredumped) 2。在1。8。26之后的版本,只要向sudo传输一个超长字符串 Forsudoversionspriorto1。8。26,andonsystemswithunidirectionalpipes,reproducingthebugissimpler。Here,theterminalkillcharacterissettotheNULcharacter(0x00)sincesudoisnotreadingfromaterminal。ThismethodisnoteffectiveinnewerversionsofsudoduetoachangeinEOFhandlingintroducedin1。8。26。 print((Ax100。chr(0))x50)sudoSkid Password:Segmentationfault(coredumped) 3。解决方法 1、临时解决方法: 修改etcsudoers文件,关闭pwfeedback功能,把该文件中下面这行: Defaultspwfeedback 改为 Defaults!pwfeedback 我们检查一下我们系统: 2、彻底解决方法: 升级系统的sudo,升级到最新的版本1。8。31以上即可。 为了保证安全,请大家尽快修复该漏洞!