<@U024LMZPDT9> if you are running osquery as sudo/...
# windows
f
@Utsav Shah if you are running osquery as sudo/root it should be able to pull from any SID in HKEY_USERS
u
hmm. I am noticing that users seem to be disappearing from HKEY_USERS from time to time. maybe they're disappearing for other reasons
f
are these local or domain accounts?
u
type=local
. i'm filtering out the
roaming
accounts
it was my theory that logged out users are disappearing from
HKEY_USERS
because it claims to have only actively loaded profiles but I could be wrong (https://docs.microsoft.com/en-us/troubleshoot/windows-server/performance/windows-registry-advanced-users)
m
The users' registry hives are not mounted when they are logged out, so they are not accessible from the Registry tree.
u
thank you @Mike Myers, that's what I suspected
i'm guessing it's a terrible idea to manually trying to mount registry hives of users
so i wonder if there's any other way to read user registry keys when they're logged out
p
darn for some reason i thought HKEY_USERS contained all of the user keys 🙁 regardless of logon status it looks like the only way to parse the other reg hives i think is to parse the registry files manually? 🤕 i was actually working on a raw reg parsing feature for osquery originally the focus was going to be on amcache :) but it may be worth expanding it to making sure it works on all reg files
m
Directly loading the hive of a logged off user is possible, and has been discussed before occasionally. It would enable a wide variety of tables that want to access per-user values stored in each user's registry keys. Doing this could hypothetically interfere with the system also trying to load the registry hive, but since the
RegLoadKey
API exists I assume it can be used safely (requires Admin permission and a process with Backup permissions on its process token and maybe some other stuff).
👍 2
It shouldn't be necessary to use this, but I'm sharing the link because it's interesting https://docs.microsoft.com/en-us/windows/win32/devnotes/about-the-offline-registry-library
👍 2