Top > XZ > Backdoor
[[XZ]] | [[CVE-2024-3094]]

sshd 自体は liblzma を使っていないが、fedora や debian が systemd 通知の為に、openssh に systemd 対応のパッチを当ててる。libsystemd 経由で liblzma の影響を受ける。そこで liblzma が ssh の暗号デコード関数を横取りする。特定のRSA鍵で sshd の認証を素通りするバックドア。ただし、関数横取りのシンボル検索が重たいのに気づいた人がいてすぐに発見された。最新バージョンを追う Fedora とかパッケージや、Debian 開発者用パッケージへの影響で済んだ模様。

レビューをすり抜ける技術的なトリック。2年半真面目に貢献して油断させた上、第3者ペルソナを介して圧力をかけ原作者を追い込み、コミット権を得るソーシャル的な狡猾さは特筆すべき。

* 機関レポート [#sab461e9]

-  [[CVE-2024-3094]]
- https://isc.sans.edu/diary/30800
- https://www.jpcert.or.jp/newsflash/2024040101.html
// (不正確) - https://www.cybertrust.co.jp/info/2024/0405-xz-utils-vulnerability.html

* まとめ [#s50f4b8a]

- https://tukaani.org/xz-backdoor/

- 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#file-xz-backdoor-md
--- 和訳) https://zenn.dev/codehex/scraps/d93ddd2636bcfb
- Frequently Asked Questions About CVE-2024-3094, A Backdoor in XZ Utils
--  https://www.tenable.com/blog/frequently-asked-questions-cve-2024-3094-supply-chain-backdoor-in-xz-utils

- 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プロジェクト全体を閉鎖している。

-  XZ Utilsの脆弱性 CVE-2024-3094 についてまとめてみた
--  https://piyolog.hatenadiary.jp/entry/2024/04/01/035321
- XZ Utilsに悪意のあるコードが挿入された問題(CVE-2024-3094)について
--  https://www.jpcert.or.jp/newsflash/2024040101.html

- XZ Utilsにバックドア攻撃が行われるまでのタイムラインまとめ
--  https://gigazine.net/news/20240403-timeline-of-xz-open-source-attack/


* コミット [#s0ff22c7]

犯人: "Jin Tan" <jiat0218@gmail.com>
共犯: "Jigar Kumar" (メールアドレス不明?)

- メンテナ追加
--  https://lore.kernel.org/lkml/20240320183846.19475-2-lasse.collin@tukaani.org/
>
I have been the maintainer of the upstream project since I submitted
the code to Linux in 2010 but I forgot to add myself to MAINTAINERS.
Nowadays Jia Tan is the other maintainer.


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

- sandbox 無効化
--  https://git.tukaani.org/?p=xz.git;a=commitdiff;h=328c52da8a2bbb81307644efdb58db2c422d9ba7 (Tue, 27 Feb 2024 00:27:44 +0900)

- 5.0.6 だと backdoor がクラッシュするので調整 (スタックレイアウトがずれてた)
-- https://git.tukaani.org/?p=xz.git;a=commit;h=e5faaebbcf02ea880cfc56edc702d4f7298788ad (Tue, 5 Mar 2024 02:54:30 +0900)
-- https://git.tukaani.org/?p=xz.git;a=commit;h=72d2933bfae514e0dbb123488e9f1eb7cf64175f (Tue, 5 Mar 2024 02:54:30 +0900)
-- https://git.tukaani.org/?p=xz.git;a=commit;h=82ecc538193b380a21622aea02b0ba078e7ade92 (Sat, 9 Mar 2024 10:20:57 +0900)

- exploit code の最終調整
-- https://git.tukaani.org/?p=xz.git;a=commit;h=6e636819e8f070330d835fce46289a3ff72a7b89 (Sat, 9 Mar 2024 11:18:29 +0900)
>
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.

- https://twitter.com/birchb0y/status/1773871381890924872
>
Interesting note on the #xz backdoor: 
If you plot Jai Tan's commit history over time, the cluster of offending commits occurs at an unusual time compared to rest of their activity.
If the dev was pwned, it could be a sign that the threat actor contributed in their own timezone

https://pbs.twimg.com/media/GJ4LpvJWMAALST3?format=jpg&name=small#.jpg

** コミット圧力 [#j8bcd653]

- https://www.mail-archive.com/search?l=xz-devel@tukaani.org&q=Kumar&x=0&y=0 ([https://web.archive.org/web/20240331024134/https://www.mail-archive.com/search?l=xz-devel@tukaani.org&q=Kumar&x=0&y=0 20240331024134])

Jin Tan をコミッターにするよう作者に圧力をかける Jigar Kumar

- https://www.mail-archive.com/xz-devel@tukaani.org/msg00566.html ([https://web.archive.org/web/20230922010844/https://www.mail-archive.com/xz-devel@tukaani.org/msg00566.html 20230922010844])
>
Progress will not happen until there is new maintainer. XZ for C has sparse 
commit log too. Dennis you are better off waiting until new maintainer happens 
or fork yourself. Submitting patches here has no purpose these days. The 
current maintainer lost interest or doesn't care to maintain anymore. It is sad 
to see for a repo like this.

- https://www.mail-archive.com/xz-devel@tukaani.org/msg00557.html ([https://web.archive.org/web/20240329182338/https://www.mail-archive.com/xz-devel@tukaani.org/msg00557.html 20240329182338])
>
Patches spend years on this mailing list. 5.2.0 release was 7 years ago. There 
is no reason to think anything is coming soon.

- https://www.mail-archive.com/xz-devel@tukaani.org/msg00565.html ([https://web.archive.org/web/20240329182326/https://www.mail-archive.com/xz-devel@tukaani.org/msg00565.html 20240329182326])
>
Over 1 month and no closer to being merged. Not a suprise.

- https://www.mail-archive.com/xz-devel@tukaani.org/msg00570.html ([https://web.archive.org/web/20240329182323/https://www.mail-archive.com/xz-devel@tukaani.org/msg00570.html 20240329182323])
>
Is there any progress on this? Jia I see you have recent commits. Why can't you 
commit this yourself?

* 発見の経緯 [#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.

* 解析 [#u07dc3a5]

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

- New XZ backdoor scanner detects implant in any Linux binary
--  https://www.bleepingcomputer.com/news/security/new-xz-backdoor-scanner-detects-implant-in-any-linux-binary/

- xz/liblzma: Bash-stage Obfuscation Explained
--  https://gynvael.coldwind.pl/?lang=en&id=782

- The xz attack shell script
--  https://research.swtch.com/xz-script

* パッケージ [#g6106926]

** Amazon [#m8b21747]

- CVE-2024-3094
--  https://access.redhat.com/security/cve/cve-2024-3094

** Gentoo [#jc9ce023]

- https://bugs.gentoo.org/928134

** Debian [#u45bec94]

- xz backdoor
--  https://lists.debian.org/debian-devel/2024/03/msg00333.html
-  revert to version that does not contain changes by bad actor
-- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1068024

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

**  Kali [#p75e678a]
https://www.kali.org/blog/about-the-xz-backdoor/


** Arch Linux [#p0785d48]
https://archlinux.org/news/the-xz-package-has-been-backdoored/

** 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

** 参考 [#mad9cbf5]

- Urgent Alert: Stealthy Backdoor Discovered in XZ Compression Utilities
--  https://www.cyberkendra.com/2024/03/major-linux-distributions-impacted-by.html

* 記事 [#ca39dfa1]

- xzにバックドアが混入した件のまとめ(CVE-2024-3094)
--  https://qiita.com/log0417/items/7dddf1669d49f3e298dc

- Red HatやDebianなどLinuxディストリビューションの組込み圧縮ツール「XZ Utils」に悪意のあるバックドアが仕掛けられていたことが発覚
--  https://gigazine.net/news/20240401-linux-backdoor-xz-utils/


- 「XZ Utils」にバックドア、オープンソースエコシステム全体の信頼を揺るがす事態に
--  https://forest.watch.impress.co.jp/docs/news/1580604.html

- 広く使用されている「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/

- xzパッケージに仕込まれた3年がかりのバックドア⁠⁠、スケール直前に見つけたのはMicrosoftの開発者
--  https://gihyo.jp/article/2024/04/daily-linux-240402

* libarchive [#h401cf33]

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

こっちでも意図的に脆弱性を入れている疑惑が出ている。

*. [#e557e2a8]

- 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

- https://twitter.com/thegrugq/status/1773827035976405003
>
On the .xz backdoor.
>
It is hard to see how the developer Jia Tan is innocent. The backdoor was added in 5.6.0 by his account. He contacted Fedora to push them to move to 5.6.0. There was a problem with valgrind, they worked with hi to resolve it. He commits the fix in 5.6.1.

- https://twitter.com/mitarashiponta/status/1773977591973871709
>
みたらしJP1
@mitarashiponta
xz-utilsの件、AWSからコメント出てた
要約すると・・・
 ・Amazon LinuxやBottlerocketユーザーは影響を受けず、対応は不要
 ・AWSインフラやサービスは影響を受けない
 ・他のOSを使用しているユーザーは、OSベンダーが提供する情報を参照して対処する必要あり

- https://twitter.com/w4yh/status/1773803097661546633
>
S.Komichevsen Matsuk
@w4yh
xz/liblzmaにバックドア混入でCVSS Base 10.0 Critical 
RHELはセーフ、Fedora 41, Rawhideがアウト
あとSUSE Tumbleweedも影響あり 
Kali Linuxも2024-03-26~29に影響有りとのこと // CVE-2024-3094- Red Hat Customer Portal https://access.redhat.com/security/cve/cve-2024-3094

- https://twitter.com/ActiveTK5929/status/1774070131892928905
>
XZのバックドア(CVE-2024-3094)の件、結構闇が深い。
既にGithub垢が凍結してるけど、攻撃者のJiaT75(Jia Tan)は、2021年にHideMailで登録してから2年間も活発にコミュニティへ貢献していたらしい(常時VPN経由)。
これほど長期的犯行なら、某国政府の下で活動しているのかも。
https://boehs.org/node/everything-i-know-about-the-xz-backdoor

- https://twitter.com/julianor/status/1774835249425350846
>
Juliano Rizzo
@julianor
Reverse engineering by 
@amlweems
 reveals 3 flaws that allows attackers to use the backdoor without the private key, using only a captured message signed for the target host:
1. Lack of replay protection
2. Symmetric encryption with a hardcoded key, 
3. Partially signed commands

- The Mystery of ‘Jia Tan,’ the XZ Backdoor Mastermind
-- https://www.wired.com/story/jia-tan-xz-backdoor/
>
At a glance, Jia Tan certainly looks East Asian—or is meant to. The time zone of Jia Tan’s commits are UTC+8: That’s China’s time zone, and only an hour off from North Korea’s. However, an analysis by two researchers, Rhea Karty and Simon Henniger, suggests that Jia Tan may have simply changed the time zone of their computer to UTC+8 before every commit. In fact, several commits were made with a computer set to an Eastern European or Middle Eastern time zone instead, perhaps when Jia Tan forgot to make the change.

"Jin Tan" は中国人に偽装した東欧or中東のエンジニアではといった推測。

- https://twitter.com/AminovDanielle/status/1774086810974429210?
>
I've been looking into how the xz backdoor works and drew this sketch to make it easier to understand.
I'll update it as new information comes to light ✨

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


* 関連 [#rel]

- [[XZ]]

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