Event publishers incorrectly Active or not, in osquery_registry and osquery_events
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 23.6k
- Forks
- 2.6k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 14
Description
Bug report
To verify the active status of event publishers, it seems you are intended to be able to query osquery_registry, but it only ever shows 1 (active) for every publisher, which I believe is incorrect. The correct values show in osquery_events.
What operating system and version are you using?
version = 10.0.18363
build = 18363
platform = windows
What version of osquery are you using?
version = 4.5.1-32-g2da28bb18
What steps did you take to reproduce the issue?
First I looked at the osquery_events table.
osqueryi.exe --disable_events=false --enable_powershell_events_subscriber
osquery> select * from osquery_events;
+--------------------------+--------------------------+------------+---------------+--------+-----------+--------+
| name | publisher | type | subscriptions | events | refreshes | active |
+--------------------------+--------------------------+------------+---------------+--------+-----------+--------+
| WindowsEventLogPublisher | WindowsEventLogPublisher | publisher | 0 | 0 | 0 | 1 |
| ntfs_event_publisher | ntfs_event_publisher | publisher | 0 | 0 | 0 | 0 |
| ntfs_journal_events | ntfs_event_publisher | subscriber | 0 | 0 | 0 | 1 |
| powershell_events | WindowsEventLogPublisher | subscriber | 0 | 0 | 0 | 0 |
| windows_events | WindowsEventLogPublisher | subscriber | 0 | 0 | 0 | 0 |
+--------------------------+--------------------------+------------+---------------+--------+-----------+--------+
What did you expect to see?
- I expected it to show
1for Powershell events, but maybe it still shows0because it's still inactive because of the required setting to log Powershell scripts. Okay. Misleading but it could be documented. - I did not expect to see the
WindowsEventLogPublisheras active, since the flag--enable_windows_event_publisherwas not set, and this is confirmed by querying theosquery_flagstable. - I expected consistency with the
osquery_eventstable at least, but correctness would be better.
osquery> select * from osquery_registry where registry like "event%";
+------------------+--------------------------+------------+----------+--------+
| registry | name | owner_uuid | internal | active |
+------------------+--------------------------+------------+----------+--------+
| event_publisher | WindowsEventLogPublisher | 0 | 0 | 0 |
| event_publisher | ntfs_event_publisher | 0 | 0 | 0 |
| event_subscriber | ntfs_journal_events | 0 | 0 | 0 |
| event_subscriber | powershell_events | 0 | 0 | 1 |
| event_subscriber | windows_events | 0 | 0 | 0 |
+------------------+--------------------------+------------+----------+--------+
☝🏻 this is what I expected to see (this is not what I see)
What did you see instead?
osquery> select * from osquery_registry where registry like "event%";
+------------------+--------------------------+------------+----------+--------+
| registry | name | owner_uuid | internal | active |
+------------------+--------------------------+------------+----------+--------+
| event_publisher | WindowsEventLogPublisher | 0 | 0 | 1 |
| event_publisher | ntfs_event_publisher | 0 | 0 | 1 |
| event_subscriber | ntfs_journal_events | 0 | 0 | 1 |
| event_subscriber | powershell_events | 0 | 0 | 1 |
| event_subscriber | windows_events | 0 | 0 | 1 |
+------------------+--------------------------+------------+----------+--------+
osquery> select * from osquery_flags where name like "%event%";
+-------------------------------------+--------+-----------------------------------------------------+-----------------------------------+-----------------------------------+------------+
| name | type | description | default_value | value | shell_only |
+-------------------------------------+--------+-----------------------------------------------------+-----------------------------------+-----------------------------------+------------+
| disable_events | bool | Disable osquery publish/subscribe system | false | false | 0 |
| enable_ntfs_event_publisher | bool | Enables the NTFS event publisher | false | false | 0 |
| enable_powershell_events_subscriber | bool | Enables Powershell events | false | true | 0 |
| enable_windows_events_publisher | bool | Enables the Windows events publisher | false | false | 0 |
| enable_windows_events_subscriber | bool | Enables Windows Event Log events | false | false | 0 |
| events_expiry | uint64 | Timeout to expire event subscriber results | 3600 | 3600 | 0 |
| events_max | uint64 | Maximum number of events per type to buffer | 50000 | 50000 | 0 |
| events_optimize | bool | Optimize subscriber select queries (scheduler only) | true | true | 0 |
| logger_event_type | bool | Log scheduled results as events | true | true | 0 |
| logger_snapshot_event_type | bool | Log scheduled snapshot results as events | false | false | 0 |
| ntfs_event_publisher_debug | bool | Debug the NTFS event publisher | false | false | 0 |
| windows_event_channels | string | Comma-separated list of Windows event log channels | System,Application,Setup,Security | System,Application,Setup,Security | 0 |
+-------------------------------------+--------+-----------------------------------------------------+-----------------------------------+-----------------------------------+------------+
In summary, I see a few problems:
enable_windows_events_publisherappears to befalse(the default), but the publisher shows as1in theactivecolumn inosquery_events.enable_powershell_events_subscriberistruebut the subscriber is0in theactivecolumn ofosquery_events.- it looks like
osquery_registryis incorrectly showing all event publishers to beactive.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Windows behavior with the provided osqueryi commands, then compare the active values reported by osquery_registry and osquery_events for event publishers and subscribers. Trace how those tables determine active status and use the listed event flags to check the expected states. Done means the registry and events tables consistently report whether each event component is active.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, sql
- Domain
- observability, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100