Osquery is an endpoint visibility tool that represents device state as queryable tables. Security teams use SQL-like statements to inspect software, configuration, and runtime conditions, which makes it useful for investigations, compliance checks, and fleet-wide validation.
Expanded Definition
Osquery is best understood as a visibility and verification layer for endpoints, not as a control that changes device state. It exposes operating system facts as tables, allowing defenders to ask questions about processes, loaded modules, users, listening ports, installed software, startup items, and other runtime conditions through SQL-like queries. In NHI and agentic environments, that makes osquery useful for confirming whether a host that holds secrets, runs an agent, or executes privileged automation still matches policy.
Definitions vary across vendors on whether osquery should be treated as EDR, compliance tooling, or endpoint inventory, but the practical distinction is that it is query-first and evidence-driven. It complements sources such as NIST Cybersecurity Framework 2.0 by supporting continuous assessment of asset state and configuration drift rather than one-time audits. For NHI governance, that matters because the endpoint often becomes the place where tokens, certificates, and service credentials are actually used.
The most common misapplication is treating osquery as a replacement for prevention controls, which occurs when teams rely on visibility queries instead of enforcing baseline hardening, privilege reduction, and secret protection.
Examples and Use Cases
Implementing osquery rigorously often introduces operational overhead, because broad endpoint visibility can create query noise, data volume, and tuning work that security teams must balance against faster detection and better verification.
- Confirming whether a service account is running on a server that should have been decommissioned, then correlating that host state with offboarding records from the Ultimate Guide to NHIs.
- Querying for processes that load credential-handling libraries, then validating whether the host is exposing secrets in memory or via insecure local files.
- Checking whether approved agent binaries, startup services, and scheduled tasks match known-good baselines after a deployment or incident response event.
- Using endpoint tables to verify whether a fleet has drifted from patch, package, or configuration policy before granting broader access to internal systems.
- Investigating a suspected compromise by combining osquery output with guidance from the Ultimate Guide to NHIs and event telemetry to understand where an NHI credential may have been used.
These use cases are especially relevant where NIST Cybersecurity Framework 2.0 calls for stronger asset understanding and continuous monitoring.
Why It Matters in NHI Security
Osquery matters because NHI failures often hide in plain sight on endpoints that are assumed to be healthy. If a workload identity is overprivileged, a token is left on disk, or an agent is silently modified, the problem may not be visible in a central vault or IAM console. Endpoint queryability gives investigators a way to prove what was actually present on the machine when the NHI was used.
NHIMG research shows that only 5.7% of organisations have full visibility into their service accounts, and 97% of NHIs carry excessive privileges. That combination means endpoint-level evidence is often the difference between guessing and knowing. Osquery can help reduce that gap by making local state inspectable across a fleet, especially when paired with broader governance guidance in the Ultimate Guide to NHIs.
Organisations typically encounter the operational necessity of osquery only after a credential leak, unauthorized process change, or incident response review, at which point endpoint evidence becomes operationally unavoidable to address.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0 and NIST AI RMF set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST CSF 2.0 | ID.AM | Osquery supports asset and configuration visibility across endpoints. |
| OWASP Non-Human Identity Top 10 | NHI-06 | Endpoint visibility helps validate where NHIs run and how they are used. |
| NIST AI RMF | Runtime observability supports AI system monitoring and risk detection. |
Use endpoint queries to detect unauthorized agent changes and risky runtime state.
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on June 24, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org