当无法通过 apt-get 获得新版本时,如何修复/修复 Ubuntu zlib 包中的 CVE?

Rya*_*her 7 security apt

我有一个正在运行Ubuntu 14.04.2多个云栈,我需要补救的CVE说我在接触到zlib库(特别是zlib1gzlib1g-dev。最后,我需要将这些系统迁移到最新版本的Ubuntu,但是直到我有解决了升级的阻碍因素 我需要缓解现有的 CVE。

  • 升级系统包的最佳实践是什么?
  • 我应该担心什么问题/如何测试功能回归?

我目前正在测试的是从更新版本的 Ubuntu(例如artful)添加源:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.d/artful.list
sudo vim /etc/apt/sources.list.d/artful.list  # replace "trusty" with "zesty"
sudo apt-get update
Run Code Online (Sandbox Code Playgroud)

将所有包固定到trusty

$ cat /etc/apt/preferences

Package: *
Pin: release n=trusty
Pin-Priority: 900

Package: *
Pin: release o=Ubuntu
Pin-Priority: -10
Run Code Online (Sandbox Code Playgroud)

然后使用以下命令升级特定软件包:

apt-get install --only-upgrade <package> -t zesty
Run Code Online (Sandbox Code Playgroud)

我需要升级的包:zlib1g/zlib1g-dev

升级系统包并没有让我得到一个解决了 CVE 的 zlib1g 版本。我需要版本 >=1:1.2.8.dfsg-4最接近的可能1:1.2.11.dfsg-0ubuntu1来自zesty. 看:

$ dpkg -s zlib1g | grep Version:
Version: 1:1.2.8.dfsg-1ubuntu1

$ sudo apt-get update && apt-get upgrade

$ dpkg -s zlib1g | grep Version:
Version: 1:1.2.8.dfsg-1ubuntu1
Run Code Online (Sandbox Code Playgroud)

内容/etc/apt/sources.list

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://archive.ubuntu.com/ubuntu/ trusty universe
deb http://archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates universe

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted

deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted
deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted
deb http://archive.ubuntu.com/ubuntu/ trusty-security universe
deb-src http://archive.ubuntu.com/ubuntu/ trusty-security universe
# deb http://archive.ubuntu.com/ubuntu/ trusty-security multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ trusty-security multiverse
Run Code Online (Sandbox Code Playgroud)

Tho*_*ard 3

如果没有更多关于您想要修补的内容以及该软件位于给定版本的 Ubuntu 存储库的哪个位置的详细信息,就不可能为您提供足够狭窄的完整答案。

但是,我将尝试向您概述如何“修补”Ubuntu 软件包中的安全问题。


Main 中的软件包以及 Universe 中社区贡献的补丁(通过$RELEASE-security存储库)

对于用户在 Universe 软件包中提交供安全团队考虑的软件包中的安全补丁,以及安全团队本身在 Ubuntu Main 软件包中提交的安全补丁,一旦发布,它们就可以从存储库$RELEASE-security(例如xenial-security)和$RELEASE-updates存储库中获取。这样,您只需简单地执行 asudo apt-get update && sudo apt-get dist-upgrade即可获取所有补丁。

通过在CVE 跟踪器中跟踪各个 CVE,您可以了解某个 CVE 是否已在 Ubuntu 中发布了修复程序,以及安全团队对 CVE 优先级的确定以及需要多快的速度解决该问题(无论默认值是“中”) CVE 严重性)。


存储库中未更新的软件包

我们这里有两个问题。首先,Universe 软件包只有在社区提供补丁供安全团队查看和审查时才会获得补丁。其次,导致大量的软件包没有更新。

对于这些问题,您有两种解决方案:要么使用补丁自行重建软件包,要么等待更新进入存储库(或者等待某人为安全团队提交补丁)。

对于第一个解决方案,您必须遵循打包指南中的步骤 1 到步骤 3.9,如果您想将它们提交到存储库,则必须遵循第 6 节中详细说明的步骤,并在系统上本地构建修补的包并安装它们。

根据软件包的不同,实际过程非常非常复杂,因此无法在这里回答。


定制编译软件

您唯一的希望就是自己对软件应用补丁,然后重新编译和安装。这适用于软件未包含在存储库中的任何情况,或者您安装了首先编译的东西的情况。其过程千差万别,因此无法在这里回答。


mur*_*uru 1

如果您有必须修复的 CVE,并且您正在使用的版本的官方存储库中未修复该 CVE,那么您不应该任意未来版本下载并安装软件包。此类软件包可能安装得很好,但不能保证现有的其他现有软件能够与它们互操作。ABI 或 API 可能已发生变化,可能发生了重大变化,也可能没有变化。细微的变化可能足以引发难以调试的错误。(如果库未按预期加载,命令行应用程序可能会抛出文件未找到错误,即使命令的文件明显存在!)

我的建议是:

  1. 检查是否有适用于您正在使用的版本的补丁,无论是在其他地方的 CVE 报告中还是来自上游。
  2. 如果是,则下载并修改该软件包的源码包:如何获取并修改通过apt-get安装的软件包的源码?
    • 用于quilt应用补丁(请参阅Debian wiki此 Debian hwoto)。
    • 我建议您仅更改版本号的最不重要部分(最后一个之后的部分-) - 当然不要更改第一个:(纪元号)之前的部分。
  3. 安装如此构建的包。

这更有可能保持与操作系统其他组件的兼容性(只要修复本身不会破坏某些内容),同时仍然允许您在更新到达您的版本的存储库时进行升级。这样,您还可以保证您想要修复的特定 CVE 据您所知是固定的,而对于某个任意未来版本的软件包来说,情况可能并非如此。