警告!Linux用戶憑藉高UID值可逕執行systemctl系統命令
- 發布單位:TWCERT/CC
- 更新日期:2019-04-03
- 點閱次數:554
CVE編號
內文
●概述:
據數位鑑識專家Rich Mirch分析,多數流行Linux發行版,如Red Hat、Debian、Ubuntu、CentOS,皆有共同漏洞,讓未授權用戶得以執行系統指令,癥結在於應用工具組PolicyKit,儘管PolicyKit目的在於控制權限分配,但遇到特別的帳號,其UID大於INT_MAX(2147483647),亦即變數儲存上限值(0x7FFFFFFF),則該帳號擺脫授權驗證機制,若某新建帳號UID為3000000000,則用戶搖身一變為管理者,能執行systemctl指令,搭配各種參數,控制OS各項背景程式、工具、函式庫,決定全部service啟動與否,目前僅Debian系列已釋出policykit-1改良版,餘尚未獲得全面修補方案,系統管理者請檢查可疑帳號UID,並關注更新進度。
●編註:
(1)高UID值帳號bypass驗證
在類Unix作業系統中,有個預先安裝的應用工具組PolicyKit(polkit),PolicyKit負責定義政策,控制OS內權限分配,以及替各個process(無論需求權限高低)建立聯繫,另OS內有個廣泛用於程式運作的參數INT_MAX,其16進位值固定為0x7FFFFFFF(十進位2147483647),INT_MAX目的在限制所有變數儲存值之上限,當創建帳號之UID低於0x7FFFFFFF,則接受正常權限控管機制,若UID值高過0x7FFFFFFF,該帳號用戶可避開PolicyKit元件存取授權驗證,獲致系統級權力,能恣意執行systemctl命令。
(2)systemctl指令用途
在大多數Linux發行版,皆部署service啟動機制systemd,幫助作業系統管理背景程式、工具、函式庫,而systemd僅能透過名為systemctl的指令,處理全體service行為,簡介相關指令參數如下:
start:立刻啟動後置service單元,例:systemctl start httpd.service
stop:立刻停止後置service單元,例:systemctl stop httpd.service
restart:立刻重啟httpd.service,等同stop再start,例:systemctl restart httpd.service
enable:下次開機時,後置httpd.service會啟動,例:systemctl enable httpd.service
disable:下次開機不啟動httpd.service,例:systemctl disable httpd.service
status:針對特定service單元,列出是否正在執行、開機預設執行、登錄資訊狀態,例:systemctl status httpd.service
is-active :檢查httpd.service目前運作狀態,例:systemctl is-active httpd.service
影響產品
解決辦法
(2)Debian Linux用戶可參考https://sources.debian.org/src/policykit-1/,取得policykit-1 0.105-18+deb9u1或較新版本。
相關連結
- https://www.youtube.com/watch?v=GTIwS9zzuhk
- https://www.securitynewspaper.com/2018/12/08/linux-users-with-limited-privileges-could-execute-any-c
- https://thehackernews.com/2018/12/linux-user-privilege-policykit.html
- https://packetstormsecurity.com/files/150686/Debian-Security-Advisory-4350-1.html
- https://security-tracker.debian.org/tracker/DSA-4350-1
- https://security-tracker.debian.org/tracker/CVE-2018-19788
- https://www.debian.org/security/2018/dsa-4350
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915332
- https://people.canonical.com/~ubuntu-security/cve/2018/CVE-2018-19788.html
- https://gitlab.freedesktop.org/polkit/polkit/issues/74
- https://github.com/systemd/systemd/issues/11026
- https://github.com/mirchr/security-research/blob/master/vulnerabilities/CVE-2018-19788.sh
- http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-19788
- https://linux.cn/article-5926-1.html
- http://linux.vbird.org/linux_basic/0560daemons.php#systemctl_cmd
- http://man.linuxde.net/systemctl
- https://www.anquanke.com/vul/id/1419341
- https://www.securitynewspaper.com/snews-up/2017/03/Linux.png