For any defenders out there who want some unsolicited advice about #exploit #detection. I got you. 😄
You might want to use auditd to log all invocations of the fork() and clone() syscalls. All successful calls to system() will result in one of these being called.
If you only monitor calls system() (which is a libc function), it's possible for a payload to just invoke the syscalls directly and you will miss new processes spawning.
The documentation for auditd is decent, but using it effectively does require a bit of knowledge about the #kernel and specifically #syscalls.
In addition to looking for processes, you can also look for files being opened, read, written, and tons of other things of interest.
None of this will stop any attacks, but it can help you know when you've been pwned and do some #forensics after the fact. Of course, to be of any practical value, you'll also need to detect the anomolous behavior via the log messages and ship an alert to another machine as quickly as possible.
The fastest way to do this is usually to ship the logs directly to a syslog server (or two) and do the analysis there.
As you may have guessed by now, I've personally done this. On some machines, it's extremely expensive (in terms of CPU & I/O) because a lot of these so-called cloud native apps want to do SO MANY SYSCALLS! Oh mein Gott! It's complete madness. Those systems take a lot of resources and a lot of work to deal with. If they are mission critical, that sucks.
But if compromising those services only gets the attacker a launchpad, and doesn't compromise anything that is really critical, you can sometimes cheat by lowering the amount of syscall monitoring on that box and focus on #network traffic from/to there.
Hopefully that critical machine doesn't need to talk to tons of arbitrary servers or if it does that is confined to one, untrusted network interface. If not, again, that sucks. Try to split some things up if you can. If not, you'll be in for a lot of work to do a reasonable job at exploit detection.
Remember: When formulating your detection routines don't ask the question of "how could I detect this payload?" Ask the question "How can I detect all payloads?"
You probably won't get to "all" payloads, but that framing helps avoid the problem of keying in on #exploit / #payload specific things that are trivial for the attacker to change. Detecting when the web server tries to access some file outside of the ones it normally messes with, on the other hand... that's harder to bypass (unless your web server can access /dev/sda or something similar, but if that's the case, you have bigger problems!).
I have plenty of suggestions for also thwarting the #attacks too, but this post has gotten long enough. As a teaser: a lot of the protection revolves around locking down permissions and limiting the syscalls that users or processes have access to. Maybe I'll post about that in the future.
#security #infosec #cybersecurity #cyber #cybersec #hacking #BlueTeam 💪
nostr:nevent1qqswwywsvu3ufcy9syvs9k26a3un970gdgldc3s8fp6445nr9ewz2kgpz3mhxue69uhhyetvv9ujumn0wd68ytnzvupzp5cw4x82vh5487g6hylkkv82284n83gxlp75nasq5yu6auq249g3qvzqqqqqqyah7gv6