Unusually Long Uptime Likely Missing Patches

osquery
Indicative of a machine that probably needs a reboot for operating-system patches
Author

Chainguard

Published

January 29, 2025

Description

ODK (osquery-defense-kit) is unique in that the queries are designed to be used as part of a production detection & response pipeline. The detection queries are formulated to return zero rows during normal expected behavior, so that they may be configured to generate alerts when rows are returned.

Query

-- Indicative of a machine that probably needs a reboot for operating-system patches
--
-- tags: persistent state
-- platform: posix
SELECT
  os_version.name AS os_name,
  os_version.version AS os_version,
  kernel_info.version AS kernel,
  days AS uptime_days
FROM
  kernel_info,
  os_version,
  uptime
WHERE
  uptime.days > 89;

tags: SStagSS

Reference

https://github.com/chainguard-dev/osquery-defense-kit