-
Notifications
You must be signed in to change notification settings - Fork 910
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
[Discussion] Robust kernel event logging for variable length strings for threat detection use cases (e.g. cmd args padding obfuscation bypasses etc) #2259
Comments
Exploiting applications over "command line attacks" often results in some sort of Consider a simple toy example (using Falco lib's sinsp-example binary for simple and fast experiments):
[1]
[2] Because of the Turing completeness of interpreters there are absolutely no limits in terms of obfuscating suspicious substrings in [1] and making sure that they are not being logged as part of an execve* event. One fair argument is to simply say we don't care, there surely will be some other evidence in Falco somewhere. In practice, noisy environment can however make it hard to reliably detect those and explainability of what actually happened is also greatly reduced. Being able to catch the malicious payload invocation is typically the preferred and fastest detection. For simplicity extended the following scripts based on this post in order to easily experiment with possible cmd args logging improvements. Launch logging
Then launch the
|
This is a more advanced optimization. I think a lot of other things have to happen first before tackling this, but let's keep it on the radar. |
Issues go stale after 90d of inactivity. Mark the issue as fresh with Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with Provide feedback via https://github.com/falcosecurity/community. /lifecycle stale |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. Mark the issue as fresh with Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with Provide feedback via https://github.com/falcosecurity/community. /lifecycle stale |
Stale issues rot after 30d of inactivity. Mark the issue as fresh with Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with Provide feedback via https://github.com/falcosecurity/community. /lifecycle rotten |
Rotten issues close after 30d of inactivity. Reopen the issue with Mark the issue as fresh with Provide feedback via https://github.com/falcosecurity/community. |
@poiana: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Falco enforces upper limits on variable length strings for kernel signals such as cmd args, process environment variables or file names and paths. The primary motivation is to ensure stability in terms of maximum overall event size and maximum field size.
Across tools (including Falco) there are two commonly adopted approaches to for example read cmd args:
The limits enforced by Falco and other tools are typically smaller than the limits enforced by the Linux kernel. The current approach Falco is using is battle proven in production (significant performance and stability benefits) while being robust for >99% of benign cmd args.
However, none of the current approaches is robust to cmd args padding obfuscation bypasses in "command line attacks" - payload not invoked over file or similar. Therefore, kicking off a discussion around how critical edge cases could be supported in future iterations of Falco (if even possible and feasible). More details and example are provided in additional comments below.
One idea could be to feature more sophisticated variable length strings logging only for the most critical threat detection use cases, such as when a string gets interpreted through the
-c
flag. Linux kernel limits likely are rather high and would introduce unnecessary instability. Perhaps some sort of probabilistic sampling of the string at the beginning, middle and end and pushing 3 substrings to userspace that have an upper limit may be worth thinking about? A slight probabilistic approach may help reduce the likelihood of threat actors being able to reliably test bypasses against Falco (attacks often require multiple attempts because of app and system flakiness). However, any approach will have a performance impact and the required refactor may be significant.Other relevant logging improvements / optimization ideas that have been raised are related to this issue:
Looking forward to collect more thoughts from everyone 🙃
The text was updated successfully, but these errors were encountered: