## 漏洞成因: 1.pkexec: for (n = 1; n < (guint) argc; n++) =>n = 1 path = g_strdup (argv[n]); =>argv[1] 是指向 envp[0] ,只要給 argv[1] 賦值能夠修改環境變數 2.g_find_program_in_path(path): 這個函數是用來在 PATH 中搜尋傳遞參數的絕對路徑 g_free(path); argv[n] = path = s; =>將回傳值寫入 argv[1](第一個環境變數) ## h1CVE-2021-4034 的 Patches: 1.pkexec: commit url:https://gitlab.freedesktop.org/polkit/polkit/-/commit/a2bf5c9c83b6ae46cbd5c779d3055bff81ded683 對 argv[n] 進行檢查 =>如果 n = 1 直接 exit 2.execve: commit url:https://github.com/freebsd/freebsd-src/commit/773fa8cd136a5775241c3e3a70f1997633ebeedf 不允許 execve == 0 3.g_find_program_in_path: 檢查後賦予參數 =>如果 argv[n] 不等於 NULL,才會 argv[n]=path
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up