Sysinternals / SysmonForLinux

MIT License
1.71k stars 181 forks source link

ProcessGUIDs are not necessarily unique, especially for non-PIEs #84

Open inickles opened 1 year ago

inickles commented 1 year ago

One can reliably create ProcessGUID collisions from different ProcessCreate events by launching non-Position Independent Executables (PIE) within a second. This has been an issue for me, trying to correlate events.

It looks like ProcessGUIDs are created by combining a few pieces of information:

  1. 32 bits for machine ID
  2. 32 bits for process start in Unix time in seconds
  3. 64 bits for the memory address of the end of the text segment, for a process. https://github.com/Sysinternals/SysmonForLinux/blob/main/ebpfKern/sysmonProcCreate.c#L144-L147

Although most executables on Linux distributions are compiled as PIE, it's not a guaranteed and it's not obvious that Sysmon GUID generation could produce duplicates in this scenario.

Perhaps instead of just using something like the text segment location, other data could be packed into the ProcessKey as well. There's 64 bits to work with and these addresses for PIEs will only have ~28 bits of randomness (measured on default Ubuntu systems with paxtest).