Lesson 16 of 16 · 3 min read
File Integrity Monitoring and Trusted Baselines
In this lesson
TL;DR: File-integrity monitoring detects differences in selected content or metadata. Its conclusion is limited by the reference's trustworthiness, the properties observed and successful collection. Authorization and recovery need separate evidence.
Before you read
Pick an answer before you read further. The lesson below explains it, and guessing first, right or wrong, helps the explanation stay with you.
1A monitored file matches yesterday's hash, but yesterday's host was already misconfigured. Is the file approved?
Compare an object, a property and a reference
File-integrity monitoring, usually shortened to FIM, observes a selected file or directory and compares properties with earlier state. A content digest detects a difference in bytes. Size, permission bits, ownership and other supported metadata describe different properties. A permission change may alter who can write a configuration without changing any of its bytes. A content-only check will not establish that the permission policy still holds.
Identify the host and filesystem object as well as its path. The same path can exist in several containers, be replaced during deployment or refer to a different mounted filesystem. Record the collection method, observation time and configured properties. A claim about one local file does not establish coverage for every instance of the application.
An observed baseline is not an approval
The observation baseline is the monitoring system's comparison reference. The approval baseline is the state authorized by a release owner, configuration policy or another controlled process. They may agree, but they serve different purposes. An initial scan can record a compromised file perfectly. Rebuilding a database from that file makes subsequent comparisons quieter without making the file legitimate.
Keep expected release information under authority independent of the monitored writer. A hash copied from the same writable directory as the file proves little about provenance. A signed manifest can help establish who published the expected value, provided its key and release authority are checked. The hashes, MACs and signatures foundation explains that distinction.
Expected scope
host, path and properties
Observed state
successful current collection
Comparison
previous recorded state
Authorization
independent approved change
Silence has several explanations
A quiet stream can mean no relevant difference occurred. It can also mean the agent stopped, the path was omitted, the observation is stale, a permission prevented collection, a rule suppressed the result or the downstream parser dropped it. Compare the expected inventory with collection evidence before treating silence as success.
Scheduled scanning observes state at particular times. Event-driven monitoring can shorten the delay for supported events, but it does not make every property continuously visible. Define tests for existing content, metadata, new files and unchanged controls. A transient change between successful observations may not appear in the resulting state comparison. Monitor health and collection failures separately from integrity differences.
A changed file does not identify its writer
A difference can follow an authorized update, an operational error or unauthorized activity. Compare it with a scoped approval and deployment evidence. A maintenance window supplies timing context; it does not authorize every change made during that window. The file's owner is not necessarily the user or process that wrote it. Attribution requires a suitable audit source and defensible correlation.
FIM provides detection evidence. It does not prevent writes, replace application authorization or prove that an unchanged system is uncompromised. Preserve that distinction when describing a control to an interviewer, customer or incident commander. An AI-generated incident summary must not convert a missing field into a confident attribution.
Content differences can disclose content
Some products retain before/after text to help explain an alert. That creates additional sensitive material on the agent, manager, export destination and backups. Review those stores and their readers before enabling the feature. Hash or metadata monitoring can sometimes satisfy the requirement without copying the full text. A hash of a small predictable secret can still be sensitive; limiting contents does not remove the need for access control.
The public OSSEC documentation illustrates the operational distinction between excluding a path's results and suppressing its text diff. Its syscheck option reference is product-specific and was checked in November 2026. Do not transfer its options to a different product or assume a dashboard name establishes identical behavior.
Practice the acceptance decision
This offline example uses fictional observations and explicitly separates successful collection from authorized state. It is not a product emulator or a complete file scanner.
def verdict(collected, observed, approved):
if not collected:
return "coverage unknown"
changed = sorted(k for k in approved if observed.get(k) != approved[k])
return "matches approved properties" if not changed else changed
approved = {"digest": "release-r7", "mode": "0640"}
print(verdict(True, dict(approved), approved))
# => matches approved properties
print(verdict(True, {**approved, "mode": "0666"}, approved)) # => ['mode']
print(verdict(False, dict(approved), approved)) # => coverage unknown
The release label is a synthetic stand-in for a digest. A real decision must authenticate the approved source and verify how the observed values were collected. Continue with the OSSEC operating course to build a scoped configuration, test matrix, investigation and maintenance handover.
Key takeaways
- A baseline records selected properties; its authority is a separate question.
- Metadata changes can matter even when content hashes match.
- Failed or stale collection must remain visible as a coverage gap.
- Resetting history cannot repair a monitored file.
Check yourself
Say or write your answer first, then reveal. Explaining it from memory, in your own words, is the skill an interviewer is checking.
1The content hash matches an approved release, but permissions became broadly writable. What is the verdict?
2An agent is offline and there are no change alerts. How should the report describe the host?