-
Notifications
You must be signed in to change notification settings - Fork 79
rules: add runc to known_memfd_execution_binaries #268
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
rules: add runc to known_memfd_execution_binaries #268
Conversation
Welcome @ytsssun! It looks like this is your first PR to falcosecurity/rules 🎉 |
f559f18
to
ebccfef
Compare
Rules files suggestionsfalco_rules.yamlComparing Patch changes:
|
/area maturity-stable |
- macro: known_memfd_execution_processes | ||
condition: (proc.name in (known_memfd_execution_binaries)) | ||
condition: > | ||
(proc.name in (known_memfd_execution_binaries)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi there! thanks for opening the PR.
I am not sure though this will work since:
- when we execute from memfd, usually we use the proc filesystem reference to the fd to do so. The process name will be a numeric value such as "3"
- IIRC, Falco doesn't resolve exepath and exe that way
Possibly, the best option would be to tune the rule by using ancestors information, such as proc.pname and proc.aname
Hi @loresuso , if you see my original repro and fix, this worked for me.
There indeed was a case where the proc.name is numerical value. And in that case this worked for them.
The implementation covers both cases. Do you think I still need to update it to include "proc.pname" and "proc.aname"? |
Okay, I took some time to verify how Falco now resolves the memfd binary path and you are correct! When we added the full resolution for exepath, we also got the full resolution of the memfd binaries, implicitly. I would still introduce the exception considering the lineage of the process, so adding proc.pname or proc.aname to match this exact use case accordingly. This will make the rule better, since in theory nobody is preventing an attacker to name his own memfd "runc_cloned", bypassing the rule. If the information about the ancestors is there, the rule turns out to be stronger. I'll also write this in case we need to remember it, it looks like runc recently dropped the memfd execution in more modern systems in favor of an overlayfs sealed execution for performance reasons opencontainers/runc#4448 |
Signed-off-by: Yutong Sun <[email protected]>
ebccfef
to
10a0931
Compare
I appended the condition to also check for
Looking at the PR commit, it looks like this is indeed the optimization they included later on. This change is only included in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
LGTM label has been added. Git tree hash: 1317e51be90ef00ebb0d2b63db6476bebeda3e86
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: leogr, loresuso, ytsssun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@leogr can we get this in a release even if beta? |
This will be shipped with Falco 0.41 (due by May 26th). |
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area rules
Proposed rule maturity level
/area maturity-sandbox
What this PR does / why we need it:
This PR is to extend the
known_memfd_execution_binaries
with runc since in 1.1.15 of runc, it introduced a behavior which would use the memfd approach to execute runc binary. This PR is to include the rule for it so that we don't falsely flag the runc binary.Which issue(s) this PR fixes:
Fixes #3444
Special notes for your reviewer:
I can use come help confirming the change. I was able to verify the override works, see the proof.
But I would need help on verifying that via the first party rules for falco.