CrowdSec - the open-source and participative security solution offering crowdsourced protection against malicious IPs and access to the most advanced real-world CTI.
I experimenting stuff with the scenario "crowdsecurity/auditd-postexploit-exec-from-net". I'm triggering this scenario and have a custom bouncer that will kill the PID of the process when an alert is triggered. Currently, in this scenario, we put in the scope of the alert the "PPID" of the process (for notification I guess), but for the bouncer part, I need the PID of the last event to be killed (and not the PPID).
So I replaced evt.Meta.ppid by evt.Meta.pid in the expression field of the scope section, as below:
scope:
type: pid
expression: evt.Meta.pid
The problem is that four decisions are generated when I trigger the scenario (because four events are in the bucket). But each decisions has the PID of the last event (which is ok for my case, but it is still a bug):
time="05-10-2023 15:30:08" level=info msg="(11c1e4655bc54250b10c4e8d5ee47a22lrT49Y3WOXhIAKdy/crowdsec) crowdsecurity/auditd-postexploit-exec-from-net by pid 2080185 : 1h kill on pid 2080185"
time="05-10-2023 15:30:08" level=info msg="(11c1e4655bc54250b10c4e8d5ee47a22lrT49Y3WOXhIAKdy/crowdsec) crowdsecurity/auditd-postexploit-exec-from-net by pid 2080185 : 1h kill on pid 2080185"
time="05-10-2023 15:30:08" level=info msg="(11c1e4655bc54250b10c4e8d5ee47a22lrT49Y3WOXhIAKdy/crowdsec) crowdsecurity/auditd-postexploit-exec-from-net by pid 2080185 : 1h kill on pid 2080185"
time="05-10-2023 15:30:08" level=info msg="(11c1e4655bc54250b10c4e8d5ee47a22lrT49Y3WOXhIAKdy/crowdsec) crowdsecurity/auditd-postexploit-exec-from-net by pid 2080185 : 1h kill on pid 2080185"
Here is the output of cscl alert inspect (I kept only the interesting fields):
And we can see that the source of the alert is the PID of the last event.
What did you expect to happen?
I would like to be able to specify (in the scenario or maybe in the profile directly) the PID of which event I want in the scope if I want only one decision to be generated. For example, if we do this directly in the scenario, it would be something like this (if I want to generate a decision only on the PID of the last event):
Or it can also be the PID of which events if I want to generate multiple decisions (if I want to generate a decision only for the PID of the first and last event):
```console
$ cscli collections list -o raw
name,status,version,description
crowdsecurity/auditd,"enabled,tainted",0.6,auditd support : parsers and scenarios
crowdsecurity/base-http-scenarios,enabled,0.6,http common : scanners detection
crowdsecurity/http-cve,enabled,2.1,
crowdsecurity/linux,enabled,0.2,core linux support : syslog+geoip+ssh
crowdsecurity/nginx,enabled,0.2,nginx support : parser and generic http scenarios
crowdsecurity/sshd,enabled,0.2,sshd support : parser and brute-force detection
```
Check Releases to make sure your agent is on the latest version.
Details
I am a bot created to help the [crowdsecurity](https://github.com/crowdsecurity) developers manage community feedback and contributions. You can check out my [manifest file](https://github.com/crowdsecurity/crowdsec/blob/master/.github/governance.yml) to understand my behavior and what I can do. If you want to use this for your project, you can check out the [BirthdayResearch/oss-governance-bot](https://github.com/BirthdayResearch/oss-governance-bot) repository.
What happened?
I experimenting stuff with the scenario "crowdsecurity/auditd-postexploit-exec-from-net". I'm triggering this scenario and have a custom bouncer that will kill the PID of the process when an alert is triggered. Currently, in this scenario, we put in the scope of the alert the "PPID" of the process (for notification I guess), but for the bouncer part, I need the PID of the last event to be killed (and not the PPID).
So I replaced
evt.Meta.ppid
byevt.Meta.pid
in the expression field of thescope
section, as below:The problem is that four decisions are generated when I trigger the scenario (because four events are in the bucket). But each decisions has the PID of the last event (which is ok for my case, but it is still a bug):
Here is the output of
cscl alert inspect
(I kept only the interesting fields):And we can see that the source of the alert is the PID of the last event.
What did you expect to happen?
I would like to be able to specify (in the scenario or maybe in the profile directly) the PID of which event I want in the scope if I want only one decision to be generated. For example, if we do this directly in the scenario, it would be something like this (if I want to generate a decision only on the PID of the last event):
Or it can also be the PID of which events if I want to generate multiple decisions (if I want to generate a decision only for the PID of the first and last event):
How can we reproduce it (as minimally and precisely as possible)?
crowdsecurity/auditd
collectioncrowdsecurity/auditd-postexploit-exec-from-net
scenario byevt.Meta.pid
Anything else we need to know?
No response
Crowdsec version
OS version
Enabled collections and parsers
Acquisition config
Config show
Prometheus metrics
Related custom configs versions (if applicable) : notification plugins, custom scenarios, parsers etc.