# Backdoor in the xz library (a dependency via some OS/package managers)

**URL:** <https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444>\
**Category:** Chat / Discussions\
**Tags:** security\
**Created:** [April 1, 2024, 5:48pm UTC](https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444 "2024-04-01T17:48:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![AstonJ](https://erlangforums.com/user_avatar/erlangforums.com/astonj/32/9_2.png) [@AstonJ](https://erlangforums.com/u/AstonJ)\
**Post date:** [April 1, 2024, 5:48pm UTC](https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444/1 "2024-04-01T17:48:41Z")

</div>

Cross-posting this from [EF](https://elixirforum.com/t/backdoor-in-the-xz-library-check-your-environments/62627):

> [@iarekk](#):
>
> Just seen this on LinkedIn, and didn’t see any threads here. Looks like a severe problem with anything running xz library (brew lists it as a dependency for elixir/erlang).
> 
> > To determine if you are affected, run the following:
> 
> ```erlang
> % xz --version
> xz (XZ Utils) 5.4.4
> liblzma 5.4.4
> 
> ```
> 
> > If you see `5.6.0` or `5.6.1`, you are vulnerable and you need to downgrade.
> 
> Some more info here:
> 
> [Everything I know about the XZ backdoor](https://boehs.org/node/everything-i-know-about-the-xz-backdoor)
> 
> [How to Use Paraxial.io to Check If You Are Affected by the XZ Backdoor](https://paraxial.io/blog/xz-backdoor)

Also note:

> [@dischoen](#):
>
> As someone already posted somewhere, a version check which involves executing the possibly infected binary is not advisable.  
> Better use the package manager of your Linux distribution, like  
> dpkg -l ‘_xz_’  
> or rpm -qa | grep xz

---

<div class="post-metadata">

**Author:** ![eiji7](https://erlangforums.com/user_avatar/erlangforums.com/eiji7/32/2671_2.png) [@eiji7](https://erlangforums.com/u/eiji7)\
**Post date:** [April 1, 2024, 6:20pm UTC](https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444/2 "2024-04-01T18:20:38Z")

</div>

Also mentioned by bot on devtalk:

> **[Arch Linux: The xz package has been backdoored](https://forum.devtalk.com/t/arch-linux-the-xz-package-has-been-backdoored/149359)**
>
> A new Arch Linux blog post/announcement has been posted! Get the full details here: Arch Linux - News: The xz package has been backdoored

---

<div class="post-metadata">

**Author:** ![AstonJ](https://erlangforums.com/user_avatar/erlangforums.com/astonj/32/9_2.png) [@AstonJ](https://erlangforums.com/u/AstonJ)\
**Post date:** [April 1, 2024, 6:53pm UTC](https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444/3 "2024-04-01T18:53:12Z")

</div>

Pinned on April 1, 2024, 6:53pm UTC



---

<div class="post-metadata">

**Author:** ![jimdigriz](https://erlangforums.com/user_avatar/erlangforums.com/jimdigriz/32/1885_2.png) [@jimdigriz](https://erlangforums.com/u/jimdigriz)\
**Post date:** [April 2, 2024, 8:06am UTC](https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444/4 "2024-04-02T08:06:39Z")

</div>

@AstonJ is there an ‘offtopic’ tag you can use and I can filter on?

---

<div class="post-metadata">

**Author:** ![dischoen](https://erlangforums.com/user_avatar/erlangforums.com/dischoen/32/695_2.png) [@dischoen](https://erlangforums.com/u/dischoen)\
**Post date:** [April 2, 2024, 9:33am UTC](https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444/5 "2024-04-02T09:33:55Z")

</div>

> [@iarekk](#):
>
> > To determine if you are affected, run the following:
> 
> ```erlang
> % xz --version
> 
> ```

As someone already posted somewhere, a version check which involves executing the possibly infected binary is not advisable.  
Better use the package manager of your Linux distribution, like  
dpkg -l ‘\*xz\*’  
or rpm -qa | grep xz

---

<div class="post-metadata">

**Author:** ![AstonJ](https://erlangforums.com/user_avatar/erlangforums.com/astonj/32/9_2.png) [@AstonJ](https://erlangforums.com/u/AstonJ)\
**Post date:** [April 2, 2024, 10:05am UTC](https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444/6 "2024-04-02T10:05:03Z")

</div>

Hi @jimdigriz, usually anything off-topic is posted in our members-only section, however since this has been listed as an Erlang/Elixir dependency it has been posted in Erlang Chat (and pinned on request of @eiji7). I’m away from my computer atm so haven’t checked but if it is not an Erlang dependency in any way then we can move the thread to the Elixir or BEAM Chat section.

---

<div class="post-metadata">

**Author:** ![eiji7](https://erlangforums.com/user_avatar/erlangforums.com/eiji7/32/2671_2.png) [@eiji7](https://erlangforums.com/u/eiji7)\
**Post date:** [April 2, 2024, 12:10pm UTC](https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444/7 "2024-04-02T12:10:19Z")

</div>

```bash
$ equery belongs /usr/bin/xz
 * Searching for /usr/bin/xz ... 
app-arch/xz-utils-5.4.2 (/usr/bin/xz)

```

In `Gentoo` the package responsible for `xz` library is `xz-utils`. It’s not a **direct** dependency of `erlang`, but … 🤔

- it’s required by `sys-libs/gpm` (Console-based mouse driver)
- which is required by `sys-libs/ncurses` - with `gpm` USE FLAG enabled, so I guess most if not all binary releases in other distributions have mouse support enabled
- `sys-libs/ncurses` is a direct dependency of `dev-lang/erlang`

There is a terrible (1065) amount of packages that requires `sys-libs/ncurses` 🤯

> **[sys-libs/ncurses – Gentoo Packages](https://packages.gentoo.org/packages/sys-libs/ncurses/reverse-dependencies)**
>
> Gentoo Packages Database

If you are not familiar with web page then on `Gentoo` you can check it using:

```bash
# adjust depth of dependency tree to be returned (default is 1 i.e. it lists only direct dependencies)
equery depgraph erlang --depth=3 | grep xz-utils

```

While on `Gentoo` more or less you can control what parts of apps and libraries you want to install on binary distributions there is no way that a typical `Erlang` developer never uses `ncurses`-based apps like `htop`, `nano`, `links` and many, many more … Since as far as I know it’s still unclear what are all exact cases in which malicious code is called I would say that’s more than enough to keep it in this category at least from a `Gentoo` user perspective. 👍

That’s said `xz-utils` is only part of the `BDEPEND` inside `sys-libs/gpm`, so it may be not related in binary distributions:

> Build dependencies are used to specify any dependencies that are required to unpack, patch, compile, test or install the package (but see [Implicit System Dependency](https://devmanual.gentoo.org/general-concepts/dependencies/#implicit-system-dependency) for exemptions).
> 
> Source: [Build Dependencies](https://devmanual.gentoo.org/general-concepts/dependencies/#build-dependencies)

Even so the `binary` releases have to be compiled by someone anyway and then there is a chance that pre-compiled binary releases are also affected which is especially important in `Gentoo`-based distributions. 🐛

---

<div class="post-metadata">

**Author:** ![AstonJ](https://erlangforums.com/user_avatar/erlangforums.com/astonj/32/9_2.png) [@AstonJ](https://erlangforums.com/u/AstonJ)\
**Post date:** [April 2, 2024, 7:22pm UTC](https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444/8 "2024-04-02T19:22:50Z")

</div>

I’ve updated the title slightly to make it more specific 😃

Checking homebrew:

```erlang
$ brew deps --tree --installed erlang
erlang
├── openssl@3
│ └── ca-certificates
├── unixodbc
│ └── libtool
│ └── m4
└── wxwidgets
    ├── jpeg-turbo
    ├── libpng
    ├── libtiff
    │ ├── jpeg-turbo
    │ ├── xz
    │ └── zstd
    │ ├── lz4
    │ └── xz
    └── pcre2

$ brew deps --tree --installed elixir
elixir
└── erlang
    ├── openssl@3
    │ └── ca-certificates
    ├── unixodbc
    │ └── libtool
    │ └── m4
    └── wxwidgets
        ├── jpeg-turbo
        ├── libpng
        ├── libtiff
        │ ├── jpeg-turbo
        │ ├── xz
        │ └── zstd
        │ ├── lz4
        │ └── xz
        └── pcre2

```

Also added your comment to the first post @dischoen :023:

> [@dischoen](#):
>
> As someone already posted somewhere, a version check which involves executing the possibly infected binary is not advisable.  
> Better use the package manager of your Linux distribution, like  
> dpkg -l ‘_xz_’  
> or rpm -qa | grep xz

---

<div class="post-metadata">

**Author:** ![eiji7](https://erlangforums.com/user_avatar/erlangforums.com/eiji7/32/2671_2.png) [@eiji7](https://erlangforums.com/u/eiji7)\
**Post date:** [April 2, 2024, 8:44pm UTC](https://erlangforums.com/t/backdoor-in-the-xz-library-a-dependency-via-some-os-package-managers/3444/9 "2024-04-02T20:44:34Z")

</div>

> [@dischoen](#):
>
> Better use the package manager of your Linux distribution, like

Here is a [Package Management Cheatsheet](https://distrowatch.com/dwres.php?resource=package-management) on `DistroWatch` site with 23 package managers grouped by categories. 😈

btw. cheers for Slackware users 😂

```bash
# List installed packages
ls /var/log/packages/

```
