How to defuse XZ Backdoor (or alike) in SSH Daemon

XZ Backdoor in SSH

Background

Someone planted a backdoor in XZ compression, which is believed to affect SSH. More details can be found. Although it was never shipped to production version of any distro. Even if you are using unaffected version I suggest you defuse any similar backdoors.

The Kill Switch

The backdoor has a kill switch, it does not activate if it detects that someone is observing it (debugger attached...etc). An easy way to defuse the backdoor is to just define TERM environment variable causing the backdoor to think it's being observed and it would disable itself hopefully this is not specific to this backdoor but any similar one. 
  mkdir /etc/systemd/system/sshd.service.d/
  echo -e "[Service]\nEnvironment=TERM=xterm" > /etc/systemd/system/sshd.service.d/10-xz-kill-switch.conf
  
Then you can restart your sshd
systemctl cat sshd
systemctl restart sshd
NOTE: replace "sshd.service" with "ssh.service" for Debian/Ubuntu systems.

Why?

We got lucky and caught this one. We don't know all similar backdoors. The suspect have been contributing to many projects for more than 2.5+ years.



Quote

While not scaremongering, it is important to be clear that at this stage, we got lucky, and there may well be other effects of the infected liblzma.


Quote
There are concerns some other projects are affected (either by themselves or changes to other projects were made to facilitate the xz backdoor). I want to avoid a witch-hunt but listing some examples here which are already been linked widely to give some commentary. 

Comments

Popular posts from this blog

Making minimal graphical operating system

Bootstrapping Alpine Linux QCow2 image