惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Security Latest
Security Latest
博客园_首页
宝玉的分享
宝玉的分享
人人都是产品经理
人人都是产品经理
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Jina AI
Jina AI
爱范儿
爱范儿
小众软件
小众软件
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
博客园 - Franky
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
NISL@THU
NISL@THU
博客园 - 司徒正美
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
AWS News Blog
AWS News Blog
有赞技术团队
有赞技术团队
V
Visual Studio Blog
雷峰网
雷峰网
C
Cybersecurity and Infrastructure Security Agency CISA
美团技术团队
The Cloudflare Blog
P
Privacy & Cybersecurity Law Blog
Latest news
Latest news
S
Securelist
C
CERT Recently Published Vulnerability Notes
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
V
V2EX
Know Your Adversary
Know Your Adversary
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threat Research - Cisco Blogs
T
Tailwind CSS Blog
J
Java Code Geeks
I
Intezer
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 【当耐特】
Schneier on Security
Schneier on Security

龙笑天下

Dragon 主题:带用户中心和商城系统的博客 CMS 高级 WordPress 主题 V6.2.0 Dragon Lite 主题:WordPress 博客自媒体资讯主题 V1.4.0 一文带您了解怎么优化WP-Cron计划任务,提升WordPress性能,减少服务器负担 WordPress如何更换网页字体?轻松更换主题的字体为任意您喜欢的自定义字体 使用DragonAI给你的博客文章自动生成AI摘要,支持Wordpress和Typecho 使用开源程序RustDesk自建远程桌面控制连接服务,支持Win/Mac/Android/iOS全平台 程响 - 可能 便宜的半年期200天HTTPS单域名/公网IP/通配符SSL证书 WordPress 6.7主题和插件语言翻译加载失效问题解决方法:避免过早调用load_theme_textdomain()和load_plugin_textdomain() 新手从零开始学会使用宝塔面板搭建一个属于自己的Wordpress网站 谷歌浏览器Google Chrome 149.0.7827.103正式稳定版、测试版及开发版本大全 火狐浏览器Mozilla Firefox 151.0.4正式版、ESR长期版及其它版本大全 不显示Wordpress评论列表里超过N天的评论者的网站链接 Linux Shell脚本实时检测Nginx状态 挂掉则立即自动重启 Blossom,一个支持私有部署的云端存储开源日志笔记软件
Debian 12修复OpenSSH远程代码执行高危漏洞:CVE-2024-6387,附Debian系统软件源国内镜像源
龙笑天 · 2024-07-02 · via 龙笑天下

Debian 12 修复 OpenSSH 远程代码执行高危漏洞:CVE-2024-6387,附 Debian 系统软件源国内镜像源

1 前言

服务器系统龙笑天用 CentOS 很多年了,但从上月末(2024 年 6 月 30 日)开始,CentOS 停止维护了。因此,龙笑天提前已经基本将所有服务器的系统都更换为了Debian系统。

昨天,OpenSSH 爆出了一个高危漏洞:CVE-2024-6387,影响所有 linux 服务器系统。具体如下:

CVE-2024-6387

该漏洞是由于 OpenSSH 服务 (sshd) 中的信号处理程序竞争问题,未经身份验证的攻击者可以利用此漏洞在 Linux 系统上以 root 身份执行任意代码。目前该漏洞技术细节已在互联网上公开,该漏洞影响范围较大,建议尽快做好自查及防护。

受影响版本: 8.5p1 - 9.7p1

简而言之,利用此漏洞,你的服务器可以随便被人侵入当为肉鸡...

下面龙笑天在此以 Debian 12 系统为例,为大家送上具体的修复方法。

2 检测是否中了漏洞

输入命令:ssh -V 查看 OpenSSH 版本,如果看到 OpenSSH 的版本在上面列出的“受影响版本”里,就说明中招了!

输入命令后如下图:

Debian 12 修复 OpenSSH 远程代码执行高危漏洞:CVE-2024-6387,附 Debian 系统软件源国内镜像源

可以看到龙笑天的 Debian 12 的 OpenSSH 版本为:9.2p1 Debian-2+deb12u2,而根据 Debian 官方显示(见相关文章 1),9.2p1 Debian-2+deb12u3 或以上才是安全的版本。因此,中招了,下面开始升级 OpenSSH 来修复漏洞。

在升级系统软件包等操作前,一定要打好快照和备份好网站文件和数据库到本地先,以防万一!

3.1 添加 Security 安全源

输入命令:vim /etc/apt/sources.list,然后像里面添加 Debian 官方 Security 安全源:

deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware

添加完成后,可以输入命令:cat /etc/apt/sources.list 来查看是否添加成功,如下图所示:

Debian 12 修复 OpenSSH 远程代码执行高危漏洞:CVE-2024-6387,附 Debian 系统软件源国内镜像源

3.2 更新软件包列表

每次升级软件包前,都必须执行更新软件包列表命令:apt update

3.3 升级 OpenSSH 软件包

执行命令:apt upgrade openssh-server。命令执行完成后,重启服务器或重启 SSH:systemctl restart ssh

3.4 再次查看 OpenSSH 版本

再次输入命令:ssh -V 查看 OpenSSH 版本,如下图:

Debian 12 修复 OpenSSH 远程代码执行高危漏洞:CVE-2024-6387,附 Debian 系统软件源国内镜像源

可以看到,已经升级到了官方的 OpenSSH 安全版本:9.2p1 Debian-2+deb12u3

3.5 删除上面添加的 Security 安全源

输入命令:vim /etc/apt/sources.list,然后删除里面的第 1 步里添加的那个 Security 安全源即可。

4 小技巧

4.1 安装 vim 命令

在执行 vim 命令时,可能提示命令不存在,那么就需要安装 vim 命令了。Debian 系统执行下面命令安装即可:

apt update
apt install vim -y

4.2 vim 里快速粘贴剪切板内容

在 vim 命令编辑文件时,如果想把一大段内容粘贴进去,同时按一下键盘上的 Shift 和 Insert 这 2 个键就行。

4.3 Debian 系统软件源国内镜像源

腾讯云:https://mirrors.cloud.tencent.com/debian/ 和 https://mirrors.cloud.tencent.com/debian-security
阿里云:https://mirrors.aliyun.com/debian 和 https://mirrors.aliyun.com/debian-security
清华大学:https://mirrors.tuna.tsinghua.edu.cn/debian/ 和 https://mirrors.tuna.tsinghua.edu.cn/debian-security
中国科技大学:https://mirrors.ustc.edu.cn/debian/ 和 https://mirrors.ustc.edu.cn/debian-security/
华为云:https://mirrors.huaweicloud.com/debian/ 和 https://mirrors.huaweicloud.com/debian-security/
更多镜像源:传送门

Debian 官方:http://deb.debian.org/debian 和 http://security.debian.org/debian-security
Debian 全球镜像站:https://www.debian.org/mirror/list

注意:国内源在国内服务器速度快,但其软件包可能不是最新版本。

4.4 Debian 各系统版本的 sources.list 文件示例

输入命令:cat /etc/apt/sources.list,可查看当前 sources.list 文件的配置详情。

Debian 10Debian 11Debian 12Debian 13

deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free

deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free
deb-src http://deb.debian.org/debian-security/ buster/updates main contrib non-free

deb http://deb.debian.org/debian/ buster-updates main contrib non-free
deb-src http://deb.debian.org/debian/ buster-updates main contrib non-free

#deb http://deb.debian.org/debian buster-backports main contrib non-free
#deb-src http://deb.debian.org/debian buster-backports main contrib non-free

然后输入命令:vim /etc/apt/sources.list,可编辑 sources.list 软件源文件。

4.5 系统停止维护软件源失效 404 怎么办?

以 Debian 10 为例,Debian 10 已经停止维护,所以 Debian 10 系统的官方源及各种镜像源已经不可用,建议升级系统到 Debian 最新版!实在要用的话,可以临时使用 Debian 系统的 archive 归档源,具体如下:

1.修改软件源文件为归档源:

deb http://archive.debian.org/debian/ buster main contrib non-free
deb http://archive.debian.org/debian-security/ buster/updates main contrib non-free
deb http://archive.debian.org/debian/ buster-updates main contrib non-free

当然,也可以使用其他第三方镜像归档源,比如阿里云的:https://mirrors.aliyun.com/debian-archive/debian,或者腾讯云的:https://mirrors.cloud.tencent.com/debian-archive/debian。PS:第三方源可能随时失效,且不提供安全更新,存在安全风险。

2.禁用 APT 的过期仓库检查,允许使用已过期的仓库元数据:

apt update -o Acquire::Check-Valid-Until=false

3.如果仍报错,可临时允许未认证的非安全源:

apt -o Acquire::Check-Valid-Until=false -o APT::Get::AllowUnauthenticated=true update

4.6 Docker 镜像源怎么修改?

输入命令:cat /etc/apt/sources.list.d/docker.list,可查看当前 docker.list 文件的配置详情。以 Debian 12 为例,结果如下,看到当前使用的腾讯云 docker 镜像源:

deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.tencent.com/docker-ce/linux/debian bookworm stable

我们可以vim /etc/apt/sources.list.d/docker.list,修改为 Docker 的官方镜像源,如下:

deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable

5 相关文章

1.CVE-2024-6387 - Debian
2.关于 OpenSSH CVE-2024-6387 简单总结 - hostloc
3.ssh 爆漏洞了,手动更新 OpenSSH 教程 - hostloc
4.针对 OpenSSH CVE-2024-6387 漏洞的升级 | Laravel China 社区
5.尽快升级 openssh - 网络安全 - LINUX DO
6.Ubuntu 修复漏洞方法 - v2ex
7.Debian 系统维护时间表:DebianReleases - Debian Wiki
8.Debian Buster 软件源失效问题 _debian10 国内更新源 失效-CSDN 博客