Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Auditbeat/fim/fsnotify]: tiny time window that loses file events #39125

Closed
pkoutsovasilis opened this issue Apr 22, 2024 · 3 comments · Fixed by #39133
Closed

[Auditbeat/fim/fsnotify]: tiny time window that loses file events #39125

pkoutsovasilis opened this issue Apr 22, 2024 · 3 comments · Fixed by #39133
Assignees
Labels
Auditbeat bug Team:Security-Linux Platform Linux Platform Team in Security Solution

Comments

@pkoutsovasilis
Copy link
Contributor

pkoutsovasilis commented Apr 22, 2024

So if my analysis is correct the following can happen in audibeat file_integrity module with fsnotify backend with recursive mode enabled.

The code of interest is here.

So we got an event that a path was created and we invoke the addRecursive to essentially walk the new file and if it is a dir also walk its contents.

However, there is a scenario here that we may end up losing events; So the path is the dir and there is a tiny time window where if a child file get's created right after the internal dir contents snapshot of filepath.Walk and before we add the path to the fsnotify watcher, this file is now off the radar.

@andrewkroh does the above make sense to you?

cc @dliappis

For confirmed bugs, please report:

  • Version: all versions
  • Operating System: Ubuntu 22.04.4 LTS
  • Steps to Reproduce: Related buildkite failed runs due to the above 1, 2, 3
@pkoutsovasilis pkoutsovasilis added bug discuss Issue needs further discussion. Team:Security-Linux Platform Linux Platform Team in Security Solution labels Apr 22, 2024
@pkoutsovasilis pkoutsovasilis self-assigned this Apr 22, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform)

@andrewkroh
Copy link
Member

Unfortunately your analysis makes perfect sense.

@dliappis
Copy link
Contributor

Thanks @pkoutsovasilis for the quick fix via #39133 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auditbeat bug Team:Security-Linux Platform Linux Platform Team in Security Solution
Projects
None yet
4 participants