It turns out that OSQuery cannot query the CURRENT_USER hives. As a workaround, it is recommended to use a specific user's SID and then query the users
table or HKEY_USERS
.
But I can't find any examples of someone actually implementing this workaround. My question is, can someone point me or help me do this?
My current idea is to grab the SID from logged_in_users
but I'm not sure if I'm making the assumption that the user that installed the OSQuery will be the only one logged in?
My WIP queries:
# take this query
SELECT sid FROM logged_in_users;
# and get all this user's registry entries
# I'm using bash/zsh/cli syntax to demonstrate what I want
SELECT * FROM registry WHERE key LIKE '%$(SELECT sid FROM logged_in_users)%'