Skip to content

Host Posture: Rule Examples

Complete Host Posture rules, one per probe type and pattern. Every rule on this page is accepted by the host_posture_rule hive with all its tests passing, and runs on sensor 5.4.4 and later. Copy one, change the id to your own prefix, and adapt it.

For how the pieces work, see Writing rules and the Rule language reference.

To store one, put the rule under a rule: key in a file, indented, with an optional scope: beside it:

rule:
  apiVersion: lc-posture/v1
  kind: Signature
  id: acme.linux.net.ip-forwarding
  # ... the rest of the rule
scope:
  exclude_sensor_tags: [k8s-node]
limacharlie hive validate --hive-name host_posture_rule --key acme.linux.net.ip-forwarding --input-file record.yaml
limacharlie host-posture rules set --key acme.linux.net.ip-forwarding --input-file record.yaml --enabled
Example Probe types Shows
A sysctl sysctl absent_is_pass for a missing key, a value compared as text
A registry value registry a missing value that means the default, quoting a registry key
Every value of a registry key registry_values searching a list of value names, has() on an optional field
File ownership and mode file testing permission bits on the mode text
An ini setting in every PHP version config (ini, glob) path globs, last(), one instance per file, per-instance evidence
A JSON setting with an unsafe default config (json), file applies_when on a binary, a missing file that is itself the violation
A flag in a YAML list config (yaml) a selector that ends at a list, one match per element
An nginx directive at any depth config (nginx, discover) bare directive selectors, include context, innermost() in evidence
A minimum package version packages version_cmp, an empty list as evidence of not installed
A kernel module that should not load modules loaded(), blocked() and blacklisted()
An expired certificate that is still trusted certs trusted, days_until() and now in tests
Two catalog items together state a catalog applies_when, a stated by_absence test

A sysctl

This rule reads one sysctl. Container hosts and Kubernetes nodes need forwarding, so keep them out with the record's scope (scope: {exclude_sensor_tags: [k8s-node]}) rather than in the rule.

apiVersion: lc-posture/v1
kind: Signature
id: acme.linux.net.ip-forwarding
version: 1
title: IPv4 forwarding is on
description: >
  With net.ipv4.ip_forward=1 the host routes packets between its interfaces. That is right
  for a router, a VPN gateway or a container host, and wrong for an ordinary server, where it
  can let an attacker reach networks the host is attached to.
severity: medium
platforms: [linux]
requires:
  evaluator: "1.1"
probes:
  fwd: { sysctl: net.ipv4.ip_forward }
violation: '!absent(fwd) && fwd.value == "1"'
evidence:
  ip_forward: fwd.value
absent_is_pass: [fwd]   # no net.ipv4 sysctls: the kernel has no IPv4 stack to forward with
remediation:
  text: Set net.ipv4.ip_forward=0 in a file under /etc/sysctl.d/ and run "sysctl --system".
limitations: >
  Container hosts and Kubernetes nodes need forwarding. Keep them out with the record's scope.
tests:
  - name: forwarding on
    probes: { fwd: { status: ok, value: "1", source: /proc/sys/net/ipv4/ip_forward } }
    expect: fail
    evidence: { ip_forward: "1" }
  - name: forwarding off
    probes: { fwd: { status: ok, value: "0", source: /proc/sys/net/ipv4/ip_forward } }
    expect: pass
  - name: kernel without IPv4
    probes: { fwd: { status: absent } }
    expect: pass
  - name: procfs not mounted
    probes: { fwd: { status: unreadable, reason: mount_missing } }
    expect: error

A registry value

One registry value, read as text. AutoAdminLogon is readable, but the DefaultPassword value next to it is on the deny list: a rule could read it to decide, and its value would still never leave the host.

apiVersion: lc-posture/v1
kind: Signature
id: acme.windows.logon.auto-admin-logon
version: 1
title: Windows logs a user on automatically at boot
description: >
  With AutoAdminLogon set to 1, Windows signs a stored account in at every boot without
  asking for a password. Anyone with physical access gets that account's session.
severity: medium
platforms: [windows]
requires:
  evaluator: "1.1"
probes:
  auto:
    registry:
      key: 'HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
      value: AutoAdminLogon
violation: '!absent(auto) && auto.value.trim() == "1"'
evidence:
  auto_admin_logon: auto.value
absent_is_pass: [auto]   # no value: automatic logon is off (the default)
remediation:
  text: >
    Set AutoAdminLogon to 0 under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
    and delete the DefaultPassword value if it exists.
limitations: >
  Kiosks and digital signage use automatic logon on purpose. Tag them and exclude the tag in
  the record's scope.
tests:
  - name: automatic logon on
    probes: { auto: { status: ok, value: "1" } }
    expect: fail
    evidence: { auto_admin_logon: "1" }
  - name: turned off
    probes: { auto: { status: ok, value: "0" } }
    expect: pass
  - name: never configured
    probes: { auto: { status: absent } }
    expect: pass
  - name: key cannot be opened
    probes: { auto: { status: unreadable } }
    expect: error

Every value of a registry key

ASR rules are stored as one registry value per rule, named by the rule's GUID. registry_values reads them all at once. It needs requires.evaluator: "1.1". A value whose data does not fit its type has no value field, so the rule tests has(v.value) before reading it. Absence is the violation here (no policy means the rule is not blocking), so there is no absent_is_pass.

apiVersion: lc-posture/v1
kind: Signature
id: acme.windows.defender.asr-lsass-not-blocking
version: 1
title: The ASR rule that blocks credential theft from LSASS is not in block mode
description: >
  The Microsoft Defender attack surface reduction rule "Block credential stealing from the
  Windows local security authority subsystem" stops most tools that read lsass.exe memory.
  This rule reads the Group Policy setting and fails unless the rule is set to block (1).
severity: medium
platforms: [windows]
requires:
  evaluator: "1.1"
probes:
  asr:
    registry_values:
      key: 'HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Windows Defender Exploit Guard\ASR\Rules'
violation: >
  absent(asr) ||
  !asr.values.exists(v, v.name.lowerAscii() == "9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2" &&
    has(v.value) && v.value == "1")
evidence:
  configured: 'absent(asr) ? "no ASR policy" : string(size(asr.values)) + " ASR rules set by policy"'
remediation:
  text: >
    In Group Policy, under Microsoft Defender Antivirus > Microsoft Defender Exploit Guard >
    Attack Surface Reduction, set rule 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2 to 1 (block).
limitations: >
  Reads the Group Policy key only. A rule set through Intune, Defender for Endpoint or
  PowerShell (Set-MpPreference) is stored elsewhere and is not seen.
tests:
  - name: no ASR policy
    probes: { asr: { status: absent } }
    expect: fail
  - name: rule in audit mode
    probes:
      asr:
        status: ok
        values: [{ name: 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2, value: "2" }]
    expect: fail
  - name: rule blocks
    probes:
      asr:
        status: ok
        values:
          - { name: 9E6C4E1F-7D60-472F-BA1A-A39EF669E4B2, value: "1" }
          - { name: d4f940ab-401b-4efc-aadc-ad5f3c50688a, value: "1" }
    expect: pass
  - name: key unreadable
    probes: { asr: { status: unreadable } }
    expect: error

File ownership and mode

file reads metadata only. mode is four octal digits as text, so the write bits for group and others are matched with a regular expression on the last two digits.

apiVersion: lc-posture/v1
kind: Signature
id: acme.linux.cron.crontab-permissions
version: 1
title: /etc/crontab is writable by others or not owned by root
description: >
  cron runs the commands in /etc/crontab as the users it names, root included. A crontab that
  a non-root user can write, or that root does not own, is a way to run code as root.
severity: high
platforms: [linux]
requires:
  evaluator: "1.1"
probes:
  tab: { file: { path: /etc/crontab } }
violation: '!absent(tab) && (tab.uid != 0 || tab.mode.matches("[2367].$|[2367]$"))'
evidence:
  mode: tab.mode
  owner_uid: string(tab.uid)
absent_is_pass: [tab]   # no /etc/crontab: nothing for cron to run from it
remediation:
  text: chown root:root /etc/crontab && chmod 0600 /etc/crontab
tests:
  - name: debian default
    probes: { tab: { status: ok, mode: "0644", uid: 0, gid: 0, size: 1042, type: regular } }
    expect: pass
  - name: group-writable
    probes: { tab: { status: ok, mode: "0664", uid: 0, gid: 0, size: 1042, type: regular } }
    expect: fail
    evidence: { mode: "0664", owner_uid: "0" }
  - name: owned by a user
    probes: { tab: { status: ok, mode: "0600", uid: 1000, gid: 1000, size: 1042, type: regular } }
    expect: fail
  - name: no crontab
    probes: { tab: { status: absent } }
    expect: pass
  - name: unreadable
    probes: { tab: { status: unreadable } }
    expect: error

An ini setting in every PHP version

A glob in paths reads every php.ini of every installed PHP version and SAPI. php.ini keeps the last value of a key, so the rule uses last(). violation returns the failing files, so each file is its own finding, and the evidence uses instance to report each file's own value. A glob that matches no file gives an empty files list, which is evidence that PHP is not there, not absence.

apiVersion: lc-posture/v1
kind: Signature
id: acme.app.php.expose-php
version: 1
title: PHP advertises its version (expose_php)
description: >
  With expose_php on, PHP adds an X-Powered-By header with its exact version to every
  response, which tells an attacker which PHP bugs to try. PHP's built-in default is on.
severity: low
platforms: [linux]
requires:
  evaluator: "1.1"
probes:
  ini:
    config:
      format: ini
      paths: [/etc/php/*/*/php.ini]   # every SAPI (fpm, apache2, cli) of every installed version
      selectors: [expose_php]
applies_when: '!ini.files.all(f, absent(f))'
violation: >
  ini.files.filter(f, ok(f) &&
    (last(f, "expose_php") == null ||
     last(f, "expose_php").value.lowerAscii() in ["1", "on", "yes", "true"]))
    .map(f, f.path)
evidence:
  value: >
    ini.files.filter(f, ok(f) && f.path == instance)
      .map(f, last(f, "expose_php") == null ? "not set (default on)" : last(f, "expose_php").value)
absent_is_pass: [ini]   # a php.ini that is gone means that PHP is gone
remediation:
  text: Set "expose_php = Off" in each php.ini listed and restart PHP-FPM or the web server.
limitations: >
  Reads Debian and Ubuntu's /etc/php/<version>/<sapi>/php.ini layout. RHEL keeps a single
  /etc/php.ini, which this rule does not read. The cli SAPI never sends headers but is listed
  when it has the setting on.
tests:
  - name: fpm on, cli off
    probes:
      ini:
        status: ok
        discovered: []
        files:
          - path: /etc/php/8.3/fpm/php.ini
            status: ok
            parse_status: ok
            matches: [{ selector: expose_php, found: true, key: expose_php, value: "On", kind: scalar, line: 375, context: "[PHP]" }]
          - path: /etc/php/8.3/cli/php.ini
            status: ok
            parse_status: ok
            matches: [{ selector: expose_php, found: true, key: expose_php, value: "Off", kind: scalar, line: 375, context: "[PHP]" }]
    expect: fail
    instances: ["/etc/php/8.3/fpm/php.ini"]
    evidence: { value: { "/etc/php/8.3/fpm/php.ini": ["On"] } }
  - name: not set at all
    probes:
      ini:
        status: ok
        discovered: []
        files:
          - path: /etc/php/8.3/fpm/php.ini
            status: ok
            parse_status: ok
            matches: [{ selector: expose_php, found: false, line: 0 }]
    expect: fail
    instances: ["/etc/php/8.3/fpm/php.ini"]
  - name: off everywhere
    probes:
      ini:
        status: ok
        discovered: []
        files:
          - path: /etc/php/8.3/fpm/php.ini
            status: ok
            parse_status: ok
            matches: [{ selector: expose_php, found: true, key: expose_php, value: "Off", kind: scalar, line: 375, context: "[PHP]" }]
    expect: pass
  - name: php not installed
    probes:
      ini: { status: ok, discovered: [], files: [] }   # the glob matched no file
    expect: not_applicable
  - name: a php.ini cannot be read
    probes:
      ini:
        status: ok
        discovered: []
        files: [{ path: /etc/php/8.3/fpm/php.ini, status: unreadable }]
    expect: error

A JSON setting with an unsafe default

Docker's default is the problem here, so a missing daemon.json fails: absence is the violation, and needs no declaration. Without dockerd the rule does not apply, and absent_is_pass: [dockerd] claims that a missing binary means Docker is not installed, so that not_applicable closes old findings. Note the > block for the remediation text: plain YAML text that contains a colon followed by a space must be quoted or folded.

apiVersion: lc-posture/v1
kind: Signature
id: acme.container.docker.icc-enabled
version: 1
title: Docker lets every container on the default bridge talk to every other
description: >
  With inter-container communication (icc) on, which is Docker's default, any container on
  the default bridge network can reach the ports of every other container there. One
  compromised container can then attack the rest.
severity: low
platforms: [linux]
requires:
  evaluator: "1.1"
probes:
  dockerd: { file: { path: /usr/bin/dockerd } }
  dj:
    config:
      format: json
      paths: [/etc/docker/daemon.json]
      selectors: [icc]
applies_when: '!absent(dockerd)'
violation: >
  !dj.files.exists(f, !absent(f) &&
    f.matches.exists(m, m.found && m.value == "false"))
evidence:
  icc: >
    dj.files.filter(f, ok(f)).map(f,
      f.matches.exists(m, m.found) ? f.matches.filter(m, m.found)[0].value : "not set (default true)")
absent_is_pass: [dockerd]   # no dockerd: Docker is not installed
remediation:
  text: >
    Add "icc": false to /etc/docker/daemon.json and restart Docker. Containers that must talk
    to each other go on a user-defined network.
limitations: >
  Reads daemon.json only. A --icc=false flag on the dockerd command line is not seen.
tests:
  - name: docker with no daemon.json
    probes:
      dockerd: { status: ok, mode: "0755", uid: 0, gid: 0, size: 98000000, type: regular }
      dj: { status: ok, files: [{ path: /etc/docker/daemon.json, status: absent }] }
    expect: fail
  - name: icc turned off
    probes:
      dockerd: { status: ok, mode: "0755", uid: 0, gid: 0, size: 98000000, type: regular }
      dj:
        status: ok
        files:
          - path: /etc/docker/daemon.json
            status: ok
            parse_status: ok
            matches: [{ selector: icc, found: true, key: icc, value: "false", kind: scalar, line: 3 }]
    expect: pass
  - name: daemon.json without icc
    probes:
      dockerd: { status: ok, mode: "0755", uid: 0, gid: 0, size: 98000000, type: regular }
      dj:
        status: ok
        files:
          - path: /etc/docker/daemon.json
            status: ok
            parse_status: ok
            matches: [{ selector: icc, found: false, line: 0 }]
    expect: fail
    evidence: { icc: ["not set (default true)"] }
  - name: daemon.json is not valid JSON
    probes:
      dockerd: { status: ok, mode: "0755", uid: 0, gid: 0, size: 98000000, type: regular }
      dj: { status: ok, files: [{ path: /etc/docker/daemon.json, status: invalid, parse_status: syntax_error }] }
    expect: error
  - name: docker not installed
    probes:
      dockerd: { status: absent }
      dj: { status: ok, files: [{ path: /etc/docker/daemon.json, status: absent }] }
    expect: not_applicable

A flag in a YAML list

The API server's flags are a list of strings in its static pod manifest. A selector that ends at that list gives one match per element, so the rule can look for the one flag it needs.

apiVersion: lc-posture/v1
kind: Signature
id: acme.container.k8s.apiserver-profiling
version: 1
title: The Kubernetes API server exposes profiling data
description: >
  The API server's profiling endpoint is on unless it is started with --profiling=false. It
  shows detailed timing and memory data about the control plane and is not needed in
  production.
severity: low
platforms: [linux]
requires:
  evaluator: "1.1"
probes:
  api:
    config:
      format: yaml
      paths: [/etc/kubernetes/manifests/kube-apiserver.yaml]
      selectors: ["spec.containers[0].command"]   # a list of strings: one match per element
applies_when: '!api.files.all(f, absent(f))'
violation: >
  !api.files.exists(f, !absent(f) &&
    f.matches.exists(m, m.found && m.value == "--profiling=false"))
evidence:
  flags_read: 'api.files.filter(f, ok(f)).map(f, size(f.matches.filter(m, m.found)))'
absent_is_pass: [api]   # no static pod manifest: not a kubeadm control-plane node
remediation:
  text: Add "--profiling=false" to the command of the kube-apiserver static pod manifest. The kubelet restarts the pod.
limitations: >
  Reads kubeadm's static pod manifest. Managed control planes (EKS, GKE, AKS) run no API
  server on your nodes.
tests:
  - name: kubeadm default
    probes:
      api:
        status: ok
        files:
          - path: /etc/kubernetes/manifests/kube-apiserver.yaml
            status: ok
            parse_status: ok
            matches:
              - { selector: "spec.containers[0].command", found: true, key: "spec.containers[0].command[0]", value: "kube-apiserver", kind: scalar, line: 15 }
              - { selector: "spec.containers[0].command", found: true, key: "spec.containers[0].command[1]", value: "--advertise-address=10.0.0.5", kind: scalar, line: 16 }
    expect: fail
  - name: profiling off
    probes:
      api:
        status: ok
        files:
          - path: /etc/kubernetes/manifests/kube-apiserver.yaml
            status: ok
            parse_status: ok
            matches:
              - { selector: "spec.containers[0].command", found: true, key: "spec.containers[0].command[0]", value: "kube-apiserver", kind: scalar, line: 15 }
              - { selector: "spec.containers[0].command", found: true, key: "spec.containers[0].command[1]", value: "--profiling=false", kind: scalar, line: 16 }
    expect: pass
  - name: not a control-plane node
    probes:
      api: { status: ok, files: [{ path: /etc/kubernetes/manifests/kube-apiserver.yaml, status: absent }] }
    expect: not_applicable
  - name: manifest unreadable
    probes:
      api: { status: ok, files: [{ path: /etc/kubernetes/manifests/kube-apiserver.yaml, status: unreadable }] }
    expect: error

An nginx directive at any depth

A bare directive name matches at any depth. Files in sites-enabled are placed inside http, as nginx includes them, and every match carries its enclosing blocks. The evidence names the block each directive is in.

apiVersion: lc-posture/v1
kind: Signature
id: acme.app.nginx.directory-listing
version: 1
title: nginx lists directory contents
description: >
  "autoindex on" makes nginx return a list of the files in a directory that has no index
  file. Backups, keys and other files left in a web root become easy to find. This rule
  reports one finding per directive, naming the block it is in.
severity: medium
platforms: [linux]
requires:
  evaluator: "1.1"
probes:
  ngx:
    config:
      format: nginx
      paths: [/etc/nginx/nginx.conf]
      discover:
        - { dir: /etc/nginx/conf.d, file_regex: '\.conf$', max: 16 }
        - { dir: /etc/nginx/sites-enabled, file_regex: '.*', max: 16 }
      selectors: [autoindex]   # a bare directive name matches at any depth
violation: >
  ngx.files.filter(f, ok(f) && f.matches.exists(m, m.found && m.value.lowerAscii() == "on"))
    .map(f, f.path)
evidence:
  directives: >
    ngx.files.filter(f, ok(f) && f.path == instance).map(f,
      f.matches.filter(m, m.found && m.value.lowerAscii() == "on").map(m, "line " + string(m.line) +
        (innermost(m) == null ? "" : " in " + innermost(m).name +
          (has(innermost(m).args) ? " " + innermost(m).args : ""))))
absent_is_pass: [ngx]   # no nginx configuration: nginx is not installed
remediation:
  text: Remove "autoindex on" (the default is off), or limit it to a location that holds only public files.
tests:
  - name: listing in one location
    probes:
      ngx:
        status: ok
        discovered:
          - { dir: /etc/nginx/conf.d, status: absent, count: 0 }
          - { dir: /etc/nginx/sites-enabled, status: ok, count: 1 }
        files:
          - { path: /etc/nginx/nginx.conf, status: ok, parse_status: ok, matches: [{ selector: autoindex, found: false, line: 0 }] }
          - path: /etc/nginx/sites-enabled/default
            status: ok
            parse_status: ok
            matches:
              - selector: autoindex
                found: true
                key: http.server.location.autoindex
                value: "on"
                kind: scalar
                line: 31
                blocks: [{ name: http }, { name: server, args: example.com }, { name: location, args: /downloads }]
    expect: fail
    instances: ["/etc/nginx/sites-enabled/default"]
    evidence: { directives: { "/etc/nginx/sites-enabled/default": [["line 31 in location /downloads"]] } }
  - name: listing off
    probes:
      ngx:
        status: ok
        discovered:
          - { dir: /etc/nginx/conf.d, status: absent, count: 0 }
          - { dir: /etc/nginx/sites-enabled, status: ok, count: 1 }
        files:
          - { path: /etc/nginx/nginx.conf, status: ok, parse_status: ok, matches: [{ selector: autoindex, found: false, line: 0 }] }
          - path: /etc/nginx/sites-enabled/default
            status: ok
            parse_status: ok
            matches:
              - { selector: autoindex, found: true, key: http.server.location.autoindex, value: "off", kind: scalar, line: 31, blocks: [{ name: http }, { name: server, args: example.com }, { name: location, args: / }] }
    expect: pass
  - name: nginx not installed
    probes:
      ngx:
        status: ok
        discovered:
          - { dir: /etc/nginx/conf.d, status: absent, count: 0 }
          - { dir: /etc/nginx/sites-enabled, status: absent, count: 0 }
        files: [{ path: /etc/nginx/nginx.conf, status: absent }]
    expect: pass
  - name: a site file does not parse
    probes:
      ngx:
        status: ok
        discovered:
          - { dir: /etc/nginx/conf.d, status: absent, count: 0 }
          - { dir: /etc/nginx/sites-enabled, status: ok, count: 1 }
        files:
          - { path: /etc/nginx/nginx.conf, status: ok, parse_status: ok, matches: [{ selector: autoindex, found: false, line: 0 }] }
          - { path: /etc/nginx/sites-enabled/default, status: invalid, parse_status: syntax_error }
    expect: error

A minimum package version

Google's own repository ships upstream version numbers, so a version comparison is reliable. Do not compare distribution packages this way: distributions backport fixes without changing the version. Windows sensors read no package list, so this rule is Linux-only.

apiVersion: lc-posture/v1
kind: Signature
id: acme.app.chrome.below-minimum
version: 1
title: Google Chrome is older than the approved minimum
description: >
  The security team's minimum Chrome version is 131.0.6778.85. Chrome from Google's own
  repository carries the upstream version, so comparing versions is reliable.
severity: medium
platforms: [linux]
requires:
  evaluator: "1.1"
probes:
  pkg: { packages: { name_regex: '^google-chrome-(stable|beta)$' } }
applies_when: 'size(pkg.packages) > 0'
violation: >
  pkg.packages.filter(p, version_cmp(p.version, "131.0.6778.85", "generic") < 0)
    .map(p, p.name)
evidence:
  installed: 'pkg.packages.filter(p, p.name == instance).map(p, p.version)'
remediation:
  text: Update Chrome from Google's repository (apt upgrade google-chrome-stable, or dnf upgrade google-chrome-stable).
limitations: >
  Linux only: sensors read no package list on Windows. Chrome installed outside the package
  manager is not seen.
tests:
  - name: old stable
    probes:
      pkg: { status: ok, packages: [{ name: google-chrome-stable, version: "130.0.6723.116-1", scheme: dpkg, source: dpkg }] }
    expect: fail
    instances: [google-chrome-stable]
    evidence: { installed: { google-chrome-stable: ["130.0.6723.116-1"] } }
  - name: current stable
    probes:
      pkg: { status: ok, packages: [{ name: google-chrome-stable, version: "131.0.6778.108-1", scheme: dpkg, source: dpkg }] }
    expect: pass
  - name: chrome not installed
    probes:
      pkg: { status: ok, packages: [] }
    expect: not_applicable
  - name: package database unreadable
    probes:
      pkg: { status: unreadable, reason: dpkg }
    expect: error

A kernel module that should not load

A blacklist line stops automatic loading only. An install <module> /bin/false line is what blocks a module, and blocked() tests for it. The evidence reports a module that is blacklisted but not blocked, which is the usual half-done fix.

apiVersion: lc-posture/v1
kind: Signature
id: acme.linux.kernel.usb-storage
version: 1
title: USB mass storage can be used
description: >
  When the usb-storage module can load, anyone with physical access can copy data off the
  host or bring in tools on a USB drive.
severity: low
platforms: [linux]
requires:
  evaluator: "1.1"
probes:
  mods: { modules: {} }
violation: >
  loaded(mods, "usb_storage") ||
  ("usb_storage" in mods.available && !blocked(mods, "usb_storage"))
evidence:
  loaded: 'loaded(mods, "usb_storage")'
  blocked: 'blocked(mods, "usb_storage")'
  blacklisted_only: 'blacklisted(mods, "usb_storage") && !blocked(mods, "usb_storage")'
limitations: >
  A modprobe.d file the sensor cannot read is skipped, so an install line in it is not seen
  and the rule can fail a host where the module is in fact blocked.
remediation:
  text: >
    Add "install usb-storage /bin/false" and "blacklist usb-storage" to a file in
    /etc/modprobe.d/, then "modprobe -r usb-storage". A blacklist line alone does not stop
    the module from loading on demand.
tests:
  - name: loadable, no rule
    probes:
      mods: { status: ok, loaded: [ext4], available: [usb_storage, ext4], builtin: [], rules: [] }
    expect: fail
    evidence: { loaded: false, blocked: false, blacklisted_only: false }
  - name: blacklisted only
    probes:
      mods:
        status: ok
        loaded: [ext4]
        available: [usb_storage, ext4]
        builtin: []
        rules: [{ module: usb_storage, kind: blacklist, source: /etc/modprobe.d/usb.conf, line: 1 }]
    expect: fail
    evidence: { blacklisted_only: true }
  - name: blocked with install /bin/false
    probes:
      mods:
        status: ok
        loaded: [ext4]
        available: [usb_storage, ext4]
        builtin: []
        rules: [{ module: usb_storage, kind: install, command: /bin/false, source: /etc/modprobe.d/usb.conf, line: 2 }]
    expect: pass
  - name: kernel without the module
    probes:
      mods: { status: ok, loaded: [ext4], available: [ext4], builtin: [], rules: [] }
    expect: pass
  - name: modules.dep is missing (a kernel whose package was removed)
    probes:
      mods: { status: unreadable, reason: modules_dep }
    expect: error

An expired certificate that is still trusted

trusted is computed by the evaluator across every store, so a certificate that is also in a distrust store (Windows Disallowed, a macOS deny setting) is not trusted. Each failing certificate is an instance named by its store and SHA-256, which stays the same from scan to scan. Every test sets now, since the rule depends on the date.

apiVersion: lc-posture/v1
kind: Signature
id: acme.trust.expired-trusted-root
version: 1
title: A trust store still trusts an expired certificate
description: >
  An expired root in a trust store is a sign of a store that nobody maintains. It also
  breaks TLS for software that still chains to it.
severity: info
platforms: [linux, windows, macos]
requires:
  evaluator: "1.1"
probes:
  roots: { certs: {} }
violation: >
  roots.certificates.filter(c, c.trusted && days_until(c.not_after) < 0)
    .map(c, c.store + " " + c.sha256)
evidence:
  subject: 'roots.certificates.filter(c, c.store + " " + c.sha256 == instance).map(c, c.subject)'
remediation:
  text: Update the operating system's CA package, or remove the certificate from the store it is in.
tests:
  - name: expired root in the system bundle
    now: "2026-11-29T00:00:00Z"
    probes:
      roots:
        status: ok
        truncated: false
        certificates:
          - { store: /etc/ssl/certs/ca-certificates.crt, sha256: "aa11", sha1: "bb22", subject: "C=US, O=Example, CN=Old Root", issuer: "C=US, O=Example, CN=Old Root", serial: "01", not_before: "2006-01-01T00:00:00Z", not_after: "2026-01-01T00:00:00Z", is_ca: true, is_self_signed: true, parse_error: false, trusted: true }
          - { store: /etc/ssl/certs/ca-certificates.crt, sha256: "cc33", sha1: "dd44", subject: "C=US, O=Example, CN=Current Root", issuer: "C=US, O=Example, CN=Current Root", serial: "02", not_before: "2020-01-01T00:00:00Z", not_after: "2040-01-01T00:00:00Z", is_ca: true, is_self_signed: true, parse_error: false, trusted: true }
    expect: fail
    instances: ["/etc/ssl/certs/ca-certificates.crt aa11"]
    evidence: { subject: { "/etc/ssl/certs/ca-certificates.crt aa11": ["C=US, O=Example, CN=Old Root"] } }
  - name: expired but distrusted
    now: "2026-11-29T00:00:00Z"
    probes:
      roots:
        status: ok
        truncated: false
        certificates:
          - { store: 'LocalMachine\Disallowed', sha256: "aa11", sha1: "bb22", subject: "C=US, O=Example, CN=Old Root", issuer: "C=US, O=Example, CN=Old Root", serial: "01", not_before: "2006-01-01T00:00:00Z", not_after: "2026-01-01T00:00:00Z", is_ca: true, is_self_signed: true, parse_error: false, trusted: false }
    expect: pass
  - name: a certificate does not parse
    now: "2026-11-29T00:00:00Z"
    probes:
      roots:
        status: ok
        truncated: false
        certificates:
          - { store: /etc/ssl/certs/ca-certificates.crt, sha256: "ee55", sha1: "ff66", parse_error: true, trusted: true }
    expect: error

Two catalog items together

applies_when restricts the rule to Secure Boot hosts. On a BIOS host the Secure Boot variable is absent, and the rule does not claim that absence as evidence, so that test states by_absence: true: the result is not_applicable and closes no finding. That is correct here, since a BIOS host never had a finding from this rule.

apiVersion: lc-posture/v1
kind: Signature
id: acme.linux.kernel.lockdown-off
version: 1
title: Kernel lockdown is off on a Secure Boot host
description: >
  With Secure Boot on, kernel lockdown is what stops root from loading unsigned code into
  the kernel (through /dev/mem, kexec or unsigned modules). A host that boots with Secure
  Boot but runs with lockdown "none" loses most of what Secure Boot protects.
severity: medium
platforms: [linux]
requires:
  evaluator: "1.1"
probes:
  sb: { state: linux.efi.secure_boot }
  lock: { state: linux.lsm.lockdown }
applies_when: '!absent(sb) && sb.value == "1"'
violation: 'absent(lock) || lock.value.contains("[none]")'
evidence:
  lockdown: 'absent(lock) ? "lockdown LSM not built in" : lock.value'
remediation:
  text: >
    Boot with lockdown=integrity on the kernel command line, or use a distribution kernel
    that enables lockdown when Secure Boot is on.
tests:
  - name: secure boot on, lockdown none
    probes:
      sb: { status: ok, value: "1", source: /sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c }
      lock: { status: ok, value: "[none] integrity confidentiality", source: /sys/kernel/security/lockdown }
    expect: fail
    evidence: { lockdown: "[none] integrity confidentiality" }
  - name: secure boot on, integrity
    probes:
      sb: { status: ok, value: "1" }
      lock: { status: ok, value: "none [integrity] confidentiality" }
    expect: pass
  - name: secure boot off
    probes:
      sb: { status: ok, value: "0" }
      lock: { status: ok, value: "[none] integrity confidentiality" }
    expect: not_applicable
  - name: lockdown file unreadable
    probes:
      sb: { status: ok, value: "1" }
      lock: { status: unreadable }
    expect: error
  - name: BIOS host, no EFI variable
    probes:
      sb: { status: absent }
      lock: { status: ok, value: "[none] integrity confidentiality" }
    expect: not_applicable
    by_absence: true

See Also