News for hackers. Stuff that matters.
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by prvit on Friday June 10, 2022 @08:02AM (#31692843)
LD_PRELOAD rootkits are by definition not "ultra-stealthy".

Nothing here looks special, there are a plenty of these:

https://github.com/chokepoint/Jynx2

https://github.com/chokepoint/jynxkit

https://github.com/NexusBots/Umbreon-Rootkit

https://github.com/chokepoint/azazel

https://github.com/unix-thrust/beurk

https://github.com/mempodippy/vlany

https://github.com/nopn0p/rkorova

And presumably tens more I've forgotten about. Highschoolers write stuff like this.

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by farisjarrah on Friday June 10, 2022 @11:48AM (#31695793)
This seems to be different from previous LD_PRELOAD vulnerabilities in that it's using eBPF as part of the mechanism to obfuscate itself.
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by prvit on Friday June 10, 2022 @12:26PM (#31696268)
Sure, but that’s at best a minor implementation detail. Doesn’t meaningfully increase the difficulty of detection.
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by mid-kid on Friday June 10, 2022 @08:51AM (#31693351)
How do you detect one?
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by psacawa on Friday June 10, 2022 @09:01AM (#31693472)
I don't know what the correct thing to do, but you can easily detect processes that have the LD_PRELOAD environment variable defined. This is a rare enough use case for manual inspection. Something like

``` for f in /proc/*/environ ; do sudo strings $f | >/dev/null grep LD_PRELOAD && echo $f; done ```

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by shaded-enmity on Friday June 10, 2022 @09:22AM (#31693785)
1. Can't the process just scrub LD_PRELOAD from its environment? Linker already done it's job at that point.

2. I'd suggest against using `strings` (let alone with sudo) on attacker controlled inputs

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by shaded-enmity on Friday June 10, 2022 @11:47AM (#31695780)
Turns out (1) works:

  #include <stdio.h>
  #include <stdlib.h>

  static void begin() __attribute__((constructor));

  void begin() {
    unsetenv("LD_PRELOAD");
  }
Build with:

  gcc -shared -fpie -o library.so library.c
Test:

  LD_PRELOAD=~/library.so env | grep LD_PRELOAD
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by rurban on Sunday June 12, 2022 @12:26AM (#31711428)
Usually guarded with an #ifndef DEBUG. Disallow LD_PRELOAD in Release builds
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by BenjiWiebe on Friday June 10, 2022 @02:16PM (#31697582)
You could look at the maps of a process instead of the environ. That would show it.

Unless the ld_preload patches the process you are using to read the maps file, and gives you a false maps file.

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by alex_duf on Friday June 10, 2022 @09:46AM (#31694133)
I'm curious about 2, why?
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by GabrielTFS on Friday June 10, 2022 @09:59AM (#31694330)
Some versions of `strings` might try to parse the file as an executable, which could expose one to any vulnerabilities that may be present in the library used to do so.

However, on my Fedora 36 machine at least, it doesn't do so by default and I'd have to specify the `-d` flag for it to do this.

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by shaded-enmity on Friday June 10, 2022 @09:55AM (#31694262)
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by chrismorgan on Friday June 10, 2022 @09:22AM (#31693792)
Just tried it, I have it happening naturally in two places:

• libinput-gestures has spawned a /usr/lib/libinput/libinput-debug-events process with LD_PRELOAD=/usr/lib/coreutils/libstdbuf.so

• Firefox has spawned many /opt/firefox-nightly/firefox-bin processes with LD_PRELOAD=libmozsandbox.so

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by mid-kid on Friday June 10, 2022 @09:20AM (#31693758)
Can't an LD_PRELOAD virus just hijack fopen/fread/etc to modify the contents of the file if its path matches the pattern you described?
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by miohtama on Friday June 10, 2022 @09:53AM (#31694228)
Yes it can. However I would assume the surface to block all diagnostics paths would be quite large and there is always some command/syscall left unblocked to detect any rootkit. Creating 100% stealth malware is possible, but difficult.
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by Cthulhu_ on Friday June 10, 2022 @09:32AM (#31693928)
Wouldn't this malware be able to infect each of these steps and the shell itself to filter itself out of the results?
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by prvit on Friday June 10, 2022 @12:16PM (#31696163)
LD_PRELOAD rootkits are super common, you’re doing it wrong if you’re using dynamically linked binaries to look for malware on Linux.
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by LinuxBender on Friday June 10, 2022 @10:46AM (#31694955)
I see those defined when I use firejail + firefox.

    LD_PRELOAD=libmozsandbox.so
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by josephcsible on Friday June 10, 2022 @09:45AM (#31694110)
One of the easiest ways would be using a statically linked BusyBox. This works because statically linked binaries are unaffected by LD_PRELOAD, and BusyBox has equivalents of several of the tools that would find it if not for its hiding attempts.
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by VoidWhisperer on Friday June 10, 2022 @09:27AM (#31693849)
Side tangent: Why does github let these repos for Malware stay up? I understand some of them use the excuse 'this is for education, i'm not responsible for what you do with it', but some don't even bother with that, and atleast my concern would be that some person could easily pull the code, modify it slightly, and off they go if the IOC/detections for the attack method aren't good yet
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by Cthulhu_ on Friday June 10, 2022 @09:31AM (#31693915)
Personal take: It's better to have malware code stay online and open, than to disappear into obscurity. This being open source also means that anti-malware companies can analyze the code and write detectors and counters to it.

Removing it would just mean it gets hidden from the 'good guys' as well.

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by GekkePrutser on Friday June 10, 2022 @09:50AM (#31694177)
Not just anti malware companies. I work for an enterprise and I regularly use such malware proof of concepts to make sure our antimalware and EDR (endpoint detection and response) systems actually do detect these. Or if we have to sharpen the detection rules to make them work better. These disclosures are invaluable.

Most companies modify their detection rules because generic rules tend to cause false positives that could potentially overwhelm the SOC (security operations center). It really depends on your environment a lot.

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by bediger4000 on Friday June 10, 2022 @11:51AM (#31695834)
The 1990s "antivirus" industry was able to suppress most malware source and executable distribution. You could only find it in small print run zines, or the very occasional book. All that led to was people typing the source in themselves. The result was a proliferation of minor variants.

My guess is the suppression held back the tide of Windows malware a year or two, but also gave MSFT a few years of fat, dumb and happy ignorance. Nimda, Code Red, Word macro viruses, etc hit Windows hard. If jokey small threats had been as available as they are today, MSFT might have been able to ramp up rather than get buried.

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by SV_BubbleTime on Friday June 10, 2022 @10:39AM (#31694843)
> Why does github let these repos for Malware stay up?

Sad state of affairs when people routinely ask for more censorship on what was supposed to be the freest technology to ever exist.

Since Linux is open source, how about not only “allowing” things like this to stay up, but encouraging everyone know about them?

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by jhugo on Friday June 10, 2022 @09:34AM (#31693959)
They could also write it from scratch themselves; having the source code available doesn't make it that much easier. Defence doesn't come from trying to scrub all records of the attackers' methods.
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by NavinF on Friday June 10, 2022 @11:23AM (#31695441)
Taking the repos down would only inconvenience legitimate researchers. All the sketchy users discuss on forums and either post the code inline or upload to a random VPS.
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by DeWilde on Friday June 10, 2022 @10:10AM (#31694473)
Do you think it would make it harder to find for people specialize in making malware like this?
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by dangerface on Friday June 10, 2022 @12:04PM (#31696020)
> my concern would be that some person could easily pull the code, modify it slightly, and off they go if the IOC/detections for the attack method aren't good yet

I did this and it passed every anti virus on virustotal. I could have wrote the virus myself in a weekend but I thought it was funny that anti virus can't detect a virus thats modified ever so slightly I think we just need a better way of scanning for this stuff.

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by surge on Friday June 10, 2022 @10:26PM (#31701413)
Exploit DB etc, already exist. They're used for penetration tests as well, to simulate a real attacker, better to have something that you can work off of as a model to detect then let the attacks be the secrets of criminal organizations and state actors.

You train like you fight, you can't do research and build detections if you don't have some examples.

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by yarg on Friday June 10, 2022 @07:12PM (#31700374)
This sort of thing can be useful for white-hats.
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by u1tron on Friday June 10, 2022 @01:19PM (#31696954)
Have you seen the malware called "bpfdoor"?
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by 323 on Friday June 10, 2022 @10:18AM (#31694548)
LD_PRELOAD equivalent was used in Windows malware circa 2006.

It seems all the old Windows techniques are now recycled on Linux.

Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by prvit on Friday June 10, 2022 @10:28AM (#31694710)
Oh no, first LD_PRELOAD kits for Linux date back to the 90s.
Re:New ultra-stealthy Linux backdoor isn’t your everyday mal... by sophacles on Friday June 10, 2022 @10:29AM (#31694720)
LD_PRELOAD (ish) attacks are older than the web.