Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only explode registry key if it can be tokenized #6474

Merged

Conversation

Breakwell
Copy link
Contributor

Description

Running "SELECT * FROM registry WHERE (path like ' ')" causes osquery to crash. This is due to the explodeRegistryKey function assuming that whatever string is passed into it is prepended with the registry hive.

Testing

Before:

C:\test>osqueryd.exe --allow_unsafe --S
Using a �[1mvirtual database�[0m. Need help, type '.help'
osquery> SELECT * FROM registry WHERE (path like ' ');

C:\test>

After:

C:\test>osqueryd.exe --allow_unsafe --S
Using a �[1mvirtual database�[0m. Need help, type '.help'
osquery> SELECT * FROM registry WHERE (path like ' ');
osquery>

rHive = toks.front();
toks.erase(toks.begin());
rKey = osquery::join(toks, kRegSep);
if (toks.size()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, do you mind updating this to use if (!toks.empty()) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@Breakwell Breakwell force-pushed the fix-registry-explodeRegistryPath branch from cb2b9b1 to e8a9251 Compare June 1, 2020 14:50
@theopolis theopolis merged commit 3a63e34 into osquery:master Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants