• The added line is THIS COLOR.
  • The deleted line is THIS COLOR.
[[CVE#xz]]
#contents

- https://nvd.nist.gov/vuln/detail/CVE-2024-3094
>
Malicious code was discovered in the upstream tarballs of xz, starting with version 5.6.0. Through a series of complex obfuscations, the liblzma build process extracts a prebuilt object file from a disguised test file existing in the source code, which is then used to modify specific functions in the liblzma code. This results in a modified liblzma library that can be used by any software linked against this library, intercepting and modifying the data interaction with this library.
>
バージョン 5.6.0 以降の xz の上流の tarball で悪意のあるコードが発見されました。 liblzma ビルド プロセスは、一連の複雑な難読化を通じて、ソース コード内に存在する偽装テスト ファイルからビルド済みオブジェクト ファイルを抽出します。このファイルは、liblzma コード内の特定の関数を変更するために使用されます。これにより、変更された liblzma ライブラリが作成され、このライブラリにリンクされた任意のソフトウェアで使用できるようになり、このライブラリとのデータ対話が傍受および変更されます。 (Google翻訳)

sshd は liblzma を使っていないが、systemd が liblzma を使っていて。そこで liblzma が ssh の暗号デコード関数を横取りする。sshd の認証を素通りするバックドア。ただし、すぐ見つかったので、Fedora とか最新バージョンを追うパッケージや、開発者用パッケージへの影響で済んでる。

* コミット [#s0ff22c7]

犯人: jiat0218@gmail.com

- exploit code の仕込み (test ファイルだけど未使用で、明らかな仕込み)
-- https://git.tukaani.org/?p=xz.git;a=commit;h=cf44e4b7f5dfdbf8c78aef377c10f71e274f63c0

- 5.0.6 だと backdoor がクラッシュするので調整 (スタックレイアウトがずれてた)
-- https://git.tukaani.org/?p=xz.git;a=commit;h=e5faaebbcf02ea880cfc56edc702d4f7298788ad
-- https://git.tukaani.org/?p=xz.git;a=commit;h=72d2933bfae514e0dbb123488e9f1eb7cf64175f
-- https://git.tukaani.org/?p=xz.git;a=commit;h=82ecc538193b380a21622aea02b0ba078e7ade92

- exploit code の最終調整
-- https://git.tukaani.org/?p=xz.git;a=commit;h=6e636819e8f070330d835fce46289a3ff72a7b89
>
Tests: Update two test files.
>
The original files were generated with random local to my machine.
To better reproduce these files in the future, a constant seed was used
to recreate these files.


* 発見の経緯 [#da6e08af]

- https://mastodon.social/@AndresFreundTec/112180083704606941
>
I accidentally found a security issue while benchmarking postgres changes.
If you run debian testing, unstable or some other more "bleeding edge" distribution, I strongly recommend upgrading ASAP.
https://www.openwall.com/lists/oss-security/2024/03/29/4

- Subject: backdoor in upstream xz/liblzma leading to ssh server compromise
--   https://www.openwall.com/lists/oss-security/2024/03/29/4

- https://twitter.com/shapoco/status/1773930645091389937
>
xz-utils の上流バージョンにバックドア仕掛けられてたやつ、発見は偶然だったと。すり抜けなくて良かったな…
https://social.mikutter.hachune.net/@naota344/112182087869113797

https://pbs.twimg.com/media/GJ5BW-xbEAAnlQH?format=png&name=small#.png

- https://twitter.com/r_shioya/status/1774015780868571353
>
攻撃で目的となる関数をフックするために(多分),シンボルテーブルの解析をやってて,これが重かったみたいです
> If the above decides to continue, the code appears to be parsing the symbol tables in memory. This is the quite slow step that made me look into the issue.


* まとめ [#s6219192]

- Everything I Know About the Xz Backdoor
--   https://boehs.org/node/everything-i-know-about-the-xz-backdoor
- FAQ on the xz-utils backdoor
--  https://gist.github.com/thesamesam/223949d5a074ebc3dce9ee78baad9e27


- 詳細まとめ
-- https://twitter.com/Blankwonder/status/1773921956615877110
- https://twitter.com/Blankwonder/status/1773921956615877110
(DeepL.com(無料版)で翻訳)
>
xz-utilsパッケージに関するこの2つのサプライチェーン攻撃ノートを読み終えたところだが、攻撃者は3年間も潜んでいたようである。
要約すると
>
1.攻撃者であるJiaT75(Jia Tan)は2021年にGitHubアカウントにサインアップし、それ以来xzプロジェクトのメンテナンスに積極的に関与し、徐々に信頼とコードを直接コミットする権利を得ている。
>
2.JiaT75はここ数ヶ月の間に、あるコミットにbad-3-corrupt_lzma2.xzとgood-large_compressed.lzmaをひっそりと追加した。これは一見無害なテストバイナリのように見えたが、コンパイルスクリプトでは特定の条件下でこの2つのファイルから読み込むことでコンパイル結果が変更されていた。 しかし、ある条件下では、コンパイルスクリプトがこれら2つのファイルから読み込んでコンパイル結果を修正するため、コンパイル結果と公開されているソースコードとの間に不整合が生じる。
>
3.予備調査によると、注入されたコードは glibc の IFUNC を使用して OpenSSH の RSA_public_decrypt 関数をフックしており、攻撃者は特定の検証データを構築することで RSA 署名検証をバイパスすることができます。 (詳細はまだ解析中です)
>
4.liblzmaとOpenSSHの両方を使用するプログラムが影響を受けます。 最も直接的な標的はsshdで、攻撃者は特定のリクエストを作成することで、リモートアクセスのための鍵認証をバイパスすることができます。
>
5.影響を受けるxz-utilsパッケージはDebian testingにマージされており、攻撃者はfedoraとubuntuにもマージを試みている。
>
6.幸運なことに、注入されたコードには、特定の状況下でsshdのCPU使用率を急上昇させる何らかのバグがあるようだ。 このバグに気づいたセキュリティ研究者が陰謀を発見し、oss-securityに報告したため、事件は収束した。
>
もしこのバグがなかったら、このバックドアがメインストリームのディストリビューションの安定版に組み込まれていた可能性はかなり高く、前代未聞の大規模なセキュリティ事件になっていただろう。
>
さらに、攻撃者が非常に慎重であったことを示す詳細もある:
>
1.攻撃者は、テスト期間中に発見されるまでの時間が短くなることを期待して、ubuntuベータ版フリーズの数日前に新バージョンを組み込もうとした。
>
2.xz-utilsプロジェクトのオリジナルメンテナであるLasse Collin (Larhzu)は、定期的にインターネットを中断する癖があり、最近もそうしていたため、彼がレビューする機会がなく、現在も彼と連絡を取ることができないまま変更が行われている。 これが攻撃者がxz-utilsプロジェクトを選んだ理由の一つかもしれない。
>
GitHubは現在、xzプロジェクト全体を閉鎖している。

* パッケージ [#g6106926]

** Debian [#u45bec94]

- xz backdoor
--  https://lists.debian.org/debian-devel/2024/03/msg00333.html

- https://packages.debian.org/ja/sid/xz-utils

- Subject: backdoor in upstream xz/liblzma leading to ssh server compromise
--   https://www.openwall.com/lists/oss-security/2024/03/29/4
** homebrew [#o4195ec3]

- brew install xz installs the outdated version 5.4.6 instead of 5.6.1 #5243
--   https://github.com/orgs/Homebrew/discussions/5243

* 記事 [#ca39dfa1]

- 広く使用されている「xz」にssh接続を突破するバックドアが仕込まれていた事が判明。重大度はクリティカルでLinuxのほかmacOSにも影響
--  https://softantenna.com/blog/xz-backdoor/

- GitHub Disables The XZ Repository Following Today's Malicious Disclosure
--  https://www.phoronix.com/news/GitHub-Disables-XZ-Repo

- Beware! Backdoor found in XZ utilities used by many Linux distros (CVE-2024-3094)
--  https://www.helpnetsecurity.com/2024/03/29/cve-2024-3094-linux-backdoor/

* libarchive [#h401cf33]

- Added error text to warning when untaring with bsdtar #1609
--  https://github.com/libarchive/libarchive/pull/1609

こっちでも似た事をしてる疑惑。

*. [#e557e2a8]

- https://twitter.com/shapoco/status/1773930645091389937
>
xz-utils の上流バージョンにバックドア仕掛けられてたやつ、発見は偶然だったと。すり抜けなくて良かったな…
https://social.mikutter.hachune.net/@naota344/112182087869113797

https://pbs.twimg.com/media/GJ5BW-xbEAAnlQH?format=png&name=small#.png



- xz-utilsのtarballに不正なコードが混入されていた件(backdoor)
--  https://qiita.com/phoepsilonix/items/eed3d82d89851f330aab

- 広く使用されている「xz」にssh接続を突破するバックドアが仕込まれていた事が判明。重大度はクリティカルでLinuxのほかmacOSにも影響 | ソフトアンテナ
--  https://b.hatena.ne.jp/entry?url=https%3A%2F%2Fsoftantenna.com%2Fblog%2Fxz-backdoor%2F#utm_source=twitter&utm_medium=social&utm_campaign=hatebu

* 関連 [#rel]

- [[XZ]]


Reload   Diff   Front page List of pages Search Recent changes Backup Referer   Help   RSS of recent changes