-
Notifications
You must be signed in to change notification settings - Fork 169
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
Unexpected setuid call by non-sudo events contain no details #1630
Comments
thank you for reporting this! do you have a repro to trigger this rule with all |
Hello, We bumped into this issue quite a few times and decided to make a deep-dive. As an example, we get the following log lines from some staging Kubernetes cluster:
What's really weird is that it almost looks like all coreutils trigger this event. 😄 We looked into the container image and the source of the events seems to be the fact that busybox does setuid, even if not needed. (See busybox code.) This can also be verified as follows:
Mkey, so I guess busybox likes to I tried both the Kmod and Modern eBPF driver. The busybox command above generates the following warning:
Judging by the timestamp, both Falco and However, Falco does not seem to report Any clues where to dig further on why Falco reports |
@cristiklein thank you very much for the very detailed investigation!
Yeah it seems weird, we need to investigate more on this, thanks for the pointer!
Thanks to your repro probably we will discover why, it could take some time since we are in the middle of a release but for sure is something we want to investigate! Thank you again for all the precious data! |
Thanks @Andreagit97 for your quick response. I discovered one more thing that will hopefully help narrow down the culprit. If I change the rule's output and add:
Then Falco's output becomes:
Interestingly, it seems like Good luck with the release! Looking forward to it. |
What to do for this issue. Im getting 0.
…On Wed, 18 Oct, 2023, 4:49 pm Cristian Klein, ***@***.***> wrote:
Though I added the above to output, i'm getting blank. [image: image]
<https://user-images.githubusercontent.com/138666148/276120551-f25152c3-eb09-4173-84f1-0806ca985d20.png>
What do you mean? I can clearly see uid=<NA> and info=uid=0 in your
screenshot above. Seems like your offending process is running with uid 0,
which is available to Falco in the lower layers, but not properly
propagated into the event args.
—
Reply to this email directly, view it on GitHub
<#1630>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIRWHSEKLC5T466UAT5UL53X763KZAVCNFSM6AAAAAA3CNKZD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRYGIZTMOJRGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
What version of Falco are you using? (I used Falco 0.35.1.) |
{"default_driver_version":"6.0.1+driver","driver_api_version":"5.0.0","driver_schema_version":"2.0.0","engine_version":"26","falco_version":"0.36.0","libs_version":"0.13.1","plugin_api_version":"3.1.0"}
…On Wed, Oct 18, 2023 at 7:08 PM Cristian Klein ***@***.***> wrote:
What version of Falco are you using? (I used Falco 0.35.1.)
—
Reply to this email directly, view it on GitHub
<#1630>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIRWHSE7WC55JTSATOMPDGDX77LVZAVCNFSM6AAAAAA3CNKZD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRYGQ4DCMZSGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Thanks & Regards
Manoj Deshmukh
Cybersecurity Analyst
CEH Practical v12 | CompTIA CySA+
|
I re-ran my test with Falco 0.36.1. In the meantime, the "Unexpected setuid call" rule was moved to falco-incubating_rules.yaml, so I had to do the following first: $ sudo wget https://raw.githubusercontent.com/falcosecurity/rules/main/rules/falco-incubating_rules.yaml -O /etc/falco/rules.d/falco-incubating_rules.yaml
# Falco 0.36.1 seem to not like the `required_engine_version` key.
$ sudo sed -i -e 's@- required_engine_version@#- required_engine_version@' /etc/falco/rules.d/falco-incubating_rules.yaml
# Also print %evt.args
sudo sed -i -e 's@output: Unexpected setuid.*$@& args=%evt.args@' /etc/falco/rules.d/falco-incubating_rules.yaml Then I ran a busybox image: $ docker run --rm --user 1000 busybox cat
[exits immediately] Falco output the following:
As you can see So it seems like there is a bug in the logic that populates What do you think? |
@cristiklein can you try using |
So, i just tried to repro this with
This was captured while doing in another terminal: Notes:
/cc @jasondellaluce for these 2 issues, perhaps you got some ideas? |
Seems like cklein@minitruee:~$ sudo wget https://raw.githubusercontent.com/falcosecurity/rules/main/rules/falco-incubating_rules.yaml -O /etc/falco/rules.d/falco-incubating_rules.yaml
--2023-10-19 17:27:48-- https://raw.githubusercontent.com/falcosecurity/rules/main/rules/falco-incubating_rules.yaml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.108.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 64418 (63K) [text/plain]
Saving to: ‘/etc/falco/rules.d/falco-incubating_rules.yaml’
/etc/falco/rules.d/falco- 100%[==================================>] 62,91K --.-KB/s in 0,01s
2023-10-19 17:27:48 (5,57 MB/s) - ‘/etc/falco/rules.d/falco-incubating_rules.yaml’ saved [64418/64418]
cklein@minitruee:~$ sudo sed -i -e 's@- required_engine_version@#- required_engine_version@' /etc/falco/rules.d/falco-incubating_rules.yaml
cklein@minitruee:~$ sudo sed -i -e 's@output: Unexpected setuid.*$@& args=%evt.args rawarg_uid=%evt.rawarg.uid@' /etc/falco/rules.d/falco-incubating_rules.yaml
cklein@minitruee:~$ cat /etc/falco/rules.d/falco-incubating_rules.yaml | grep rawarg
output: Unexpected setuid call by non-sudo, non-root program (arg_uid=%evt.arg.uid evt_type=%evt.type user=%user.name user_uid=%user.uid user_loginuid=%user.loginuid process=%proc.name proc_exepath=%proc.exepath parent=%proc.pname command=%proc.cmdline terminal=%proc.tty exe_flags=%evt.arg.flags %container.info) args=%evt.args rawarg_uid=%evt.rawarg.uid
cklein@minitruee:~$ docker run --rm --user 1000 busybox sleep 10 And the output of Falco becomes:
|
#1428 will fix the Also, about:
Instead, |
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 |
it's on my plate, I'm investigating between one thing and another, and hope to come up with a solution soon! |
uhm ok, the issue should be clear now, we need to understand how to tackle it! Running
|
I will move it to https://github.com/falcosecurity/libs since this seems a libsinsp issue |
How to reproduce it with
sudo ./libsinsp/examples/sinsp-example \
-o "user_id=%evt.rawarg.uid user_name=%evt.arg.uid" \
-f "evt.type in (setuid) and evt.dir=> and container.id!=host" --modern_bpf
docker run --rm --user 1000 busybox cat
|
Yep, IMHO this is not a bug: if user 1000 is not existing in the container, it is fine to return NA username, right? Edit: we might add a fallback lookup for the uid/gid on the host when the container has no such uid/gid perhaps. |
Uhm IMO Falco should try to give the right user since it runs on the host and has the possibility to see all the users...
This could be an idea, I am not sure if there are other cases when the user is not defined inside the container but it doesn't correspond to any user on the host, I don't think so 🤔 So the fallback might be ok! @deepskyblue86 WDYT? |
But please note:
I still think |
yeah, docker knows nothing about user 1000 because is a user outside the container, but Falco as an external tool has the knowledge to understand who is the real user...the downside of leaving all as it is is that all the processes inside the containers will have |
I am not sure what
It's not a downside, it is exactly what is happening. Saying that, for example, Found this on stackoverflow:
|
/milestone 0.17.0 |
Is anybody still experiencing issues on Falco 0.37? |
The decision of closing or not this is on us... we identified the issue, if we decide that we are fine with the |
I think so, as i explained earlier it would be wrong to state the opposite since if the user is not existent in the container, it is to all effects |
@FedeDP: The provided milestone is not valid for this repository. Milestones in this repository: [ Use 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. |
@FedeDP: 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. |
In the falco alerts "Unexpected setuid call by non-sudo events contain no details" is comming all
00:40:51.862247143: Notice Unexpected setuid call by non-sudo, non-root program (container_name=host user= user_loginuid=-1 cur_uid=4294967295 parent= command= pid=1224253 uid= container_id=host image=) k8s.ns= k8s.pod= container=host
Environment
{"default_driver_version":"4.0.0+driver","driver_api_version":"3.0.0","driver_schema_version":"2.0.0","engine_version":"16","falco_version":"0.34.1","libs_version":"0.10.4","plugin_api_version":"2.0.0"}
Falco version: 0.34.1 (x86_64)
Linux 5.10.176+
The text was updated successfully, but these errors were encountered: