Commit Graph

698 Commits

Author SHA1 Message Date
Sverre Boschman
35dc315390 add known k8s service accounts
Signed-off-by: Sverre Boschman
2021-06-04 10:46:09 +02:00
Kaizhe Huang
09e1604fe0 rule update(Debugfs Launched in Privileged Container): fix typo in description
Signed-off-by: Kaizhe Huang <khuang@aurora.tech>
2021-05-27 11:21:30 +02:00
ismail yenigul
2226a1508c exception to privileged container for EKS images
Signed-off-by: ismail yenigul <ismailyenigul@gmail.com>
2021-05-06 02:36:48 +02:00
maxgio92
fd6a1d0d05 clean(rules/falco_rules.yaml): remove deprecated oci image repositories
Signed-off-by: maxgio92 <massimiliano.giovagnoli.1992@gmail.com>
2021-04-29 11:51:35 +02:00
Leonardo Grasso
e95ab26f33 update(rules): stricter detection of man-db postinst exception
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2021-04-19 17:01:10 +02:00
Leonardo Grasso
23a611b343 chore(rules): remove too week macro python_running_sdchecks
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2021-04-19 17:01:10 +02:00
Leonardo Di Donato
2e97d0e27c chore(rules): cleanup old macros
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2021-04-09 18:17:11 +02:00
Leonardo Di Donato
06086df21e chore(rules): re-enable negation of package_mgmt_procs for Write below binary dir rule
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2021-04-09 18:17:11 +02:00
Lorenzo Fontana
194cdf7873 update(rules): revert exceptions in default ruleset for k8s audit
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2021-04-09 18:17:11 +02:00
Lorenzo Fontana
35fe14e691 rules(list user_known_sa_list): revert as an empty list for user overwrite
rules(list known_sa_list): list of known sa moved here from user_known_sa_list

Signed-off-by: Lorenzo Fontana <lo@linux.com>
2021-04-09 18:17:11 +02:00
Lorenzo Fontana
abc79fb548 update(rules): revert exceptions in default ruleset
Exceptions have been introduced in commit 64a231b962
The feature itself is very useful for more complex environments where
the simple conditions are difficult to handle.
However, many users reported that they find them difficult to understand so
we are doing a rollback of them in the default ruleset in favor of the
syntax without exceptions.

Signed-off-by: Lorenzo Fontana <lo@linux.com>
2021-04-09 18:17:11 +02:00
stevenshuang
167c5bc691 fix: update rule description
Signed-off-by: stevenshuang <stevenshuang521@gmail.com>
2021-03-24 18:47:55 +01:00
Kaizhe Huang
7ea80e39b1 rule(Set Setuid or Setgid bit) update: add k3s-agent in the whitelist
Signed-off-by: Kaizhe Huang <derek0405@gmail.com>
2021-03-22 11:36:59 +01:00
Kaizhe Huang
b58f76b268 rule (Debugfs Launched in Privileged Container and Mount Launched in Privileged Container): create
Signed-off-by: Kaizhe Huang <derek0405@gmail.com>
2021-03-22 11:36:59 +01:00
Shane Lawrence
2f0e09b549 rule (Write below monitored dir): Clean up and use glob matching.
Signed-off-by: Shane Lawrence <shane@lawrence.dev>
2021-03-12 10:37:16 +01:00
Spencer Krum
b3693a0b75 chore(rules): Add ibmcloud operator lifecycle manager
Signed-off-by: Spencer Krum <nibz@spencerkrum.com>
2021-02-19 12:35:30 +01:00
Spencer Krum
a54f946135 chore(rules): Rule exceptions for ibm cloud
Whitelist ibm images for connecting to k8s api server

IBM Observability by Sysdig has a vendored sysdig/agent image.

IBM's Kubernetes Service ships with an operator manager. Example:

19:12:45.090908160: Notice Unexpected connection to K8s API Server from
container (command=catalog -namespace ibm-system
-configmapServerImage=registry.ng.bluemix.net/armada-master/configmap-operator-registry:v1.6.1
k8s.ns=ibm-system k8s.pod=catalog-operator-6495d76869-ncl2z
container=4ad7a04fa1e0
image=registry.ng.bluemix.net/armada-master/olm:0.14.1-IKS-1
connection=172.30.108.219:48200->172.21.0.1:443) k8s.ns=ibm-system
k8s.pod=catalog-operator-6495d76869-ncl2z container=4ad7a04fa1e0

IBM's Kubernetes service also ships with a metrics collecting agent

Signed-off-by: Spencer Krum <nibz@spencerkrum.com>
2021-02-19 12:35:30 +01:00
Leonardo Grasso
85db1aa997 fix(rules): correct indentation
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2021-02-19 09:24:55 +01:00
ismail yenigul
37a6caae12 remove commercial images to unblock PR
add endpoint-controller to user_known_sa_list
related event:
    {
        "output": "05:19:25.557989888: Warning Service account created
in kube namespace (user=system:kube-controller-manager
serviceaccount=endpoint-controller ns=kube-system)",
        "priority": "Warning",
        "rule": "Service Account Created in Kube Namespace",
        "time": "2021-02-16T05:19:25.557989888Z",
        "output_fields": {
            "jevt.time": "05:19:25.557989888",
            "ka.target.name": "endpoint-controller",
            "ka.target.namespace": "kube-system",
            "ka.user.name": "system:kube-controller-manager"
        }
    }

Signed-off-by: ismail yenigul <ismailyenigul@gmail.com>
2021-02-19 09:24:55 +01:00
ismail yenigul
2d962dfcb0 rebase to master
update user_known_sa_list with k8s internal sa in kube-system

{
        "output": "10:27:56.539783936: Warning Service account created
in kube namespace (user=system:kube-controller-manager
serviceaccount=replicaset-controller ns=kube-system)",
        "priority": "Warning",
        "rule": "Service Account Created in Kube Namespace",
        "time": "2021-02-15T10:27:56.539783936Z",
        "output_fields": {
            "jevt.time": "10:27:56.539783936",
            "ka.target.name": "replicaset-controller",
            "ka.target.namespace": "kube-system",
            "ka.user.name": "system:kube-controller-manager"
        }
    }

{
        "output": "17:06:18.267429888: Warning Service account created
in kube namespace (user=system:kube-controller-manager
serviceaccount=deployment-controller ns=kube-system)",
        "priority": "Warning",
        "rule": "Service Account Created in Kube Namespace",
        "time": "2021-02-15T17:06:18.267429888Z",
        "output_fields": {
            "jevt.time": "17:06:18.267429888",
            "ka.target.name": "deployment-controller",
            "ka.target.namespace": "kube-system",
            "ka.user.name": "system:kube-controller-manager"
        }
    }

and more..

Signed-off-by: ismail yenigul <ismailyenigul@gmail.com>
2021-02-19 09:24:55 +01:00
Petr Michalec
541845156f rhsm cert updates
Signed-off-by: Petr Michalec <epcim@apealive.net>
Signed-off-by: Petr Michalec <pmichalec@ves.io>
2021-02-18 15:42:06 +01:00
darryk5
0879523776 update: add review suggestions for Rule Sudo Potential Privilege Escalation
Signed-off-by: darryk5 <stefano.chierici@sysdig.com>
Co-authored-by: Leonardo Di Donato <leodidonato@gmail.com>
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
2021-02-17 21:36:51 +01:00
darryk5
81e880b486 Added Rule Sudo Potential Privilege Escalation (CVE-2021-3156)
See #1540

Signed-off-by: darryk5 <stefano.chierici@sysdig.com>
Co-authored-by: Lorenzo Fontana <lo@linux.com>
2021-02-17 21:36:51 +01:00
ismail yenigul
959811a503 add eks:node-manager to allowed_k8s_users list
eks:node-manager  is an Amazon EKS internal service role that performs specific operations for managed node groups and Fargate.
Reference: https://github.com/awsdocs/amazon-eks-user-guide/blob/master/doc_source/logging-monitoring.md
Related falco log

```
{"output":"10:56:31.181308928: Warning K8s Operation performed by user not in allowed list of users
 (user=eks:node-manager target=aws-auth/configmaps verb=get uri=/api/v1/namespaces/kube-system/configmaps/aws-auth?timeout=19s resp=200)","priority":"Warning","rule":"Disallowed K8s User","time":"2021-01-26T10:56:31.181308928Z", "output_fields":
{"jevt.time":"10:56:31.181308928","ka.response.code":"200","ka.target.name":"aws-auth","ka.target.resource":"configmaps","ka.uri":"/api/v1/namespaces/kube-system/configmaps/aws-auth?timeout=19s","ka.user.name":"eks:node-manager","ka.verb":"get"}}
```

Signed-off-by: ismailyenigul <ismailyenigul@gmail.com>
2021-02-04 17:33:54 +01:00
Mark Stemm
49b8f87db4 Make the req. engine version 8 for k8s_audit rules
These define exceptions too.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2021-01-19 10:37:55 +01:00
Mark Stemm
7f4afffe3e Remove old unused macros/lists
Remove old macros/lists that aren't being used by any current rules.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2021-01-19 10:37:55 +01:00
Mark Stemm
64a231b962 Add exceptions fields/comps/values to rules files
Take advantage of the changes to support exceptions and refactor rules
to use them whenever feasible:

- Define exceptions for every rule. In cases where no practical
  exception exists e.g. "K8s <obj> Created/Deleted", define an empty
  exception property just to avoid warnings when loading rules.
- Go through all rules and convert macros-used-as-exceptions that
  matched against 2-3 filter fields into exceptions. In most cases,
  switching from equality (e.g proc.name=nginx) to in (e.g. proc.name
  in (nginx)) allowed for better groupings into a smaller set of
  exception items.
- In cases where the exception had complex combinations of fields, keep
  the macro as is.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2021-01-19 10:37:55 +01:00
James Barlow
7f33b08634 rule(Create Hidden Files or Directories): Exclude exe_running_docker_save
Signed-off-by: James Barlow <james.barlow@finbourne.com>
2021-01-08 19:21:42 +01:00
James Barlow
c2a05b3e64 rule(Mkdir binary dirs): Exclude exe_running_docker_save
Signed-off-by: James Barlow <james.barlow@finbourne.com>
2021-01-08 19:21:42 +01:00
kaizhe
6beb9838d6 rule(list user_known_change_thread_namespace_binaries): add crio and multus to the list
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-12-14 04:16:15 -05:00
kaizhe
0a901e4f52 add exception macro
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-12-04 06:21:34 -05:00
kaizhe
22732e9edb rule(Container Run as Root User): new rule created
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-12-04 06:21:34 -05:00
DingGGu
2b2856299c rule(macro user_known_k8s_client_container): separate list of k8s images
Signed-off-by: DingGGu <ggu@dunamu.com>
2020-11-11 10:22:45 -05:00
DingGGu
ec5b42074e rule(macro user_known_k8s_ns_kube_system_images): add new macro image name inside kube-system namespace
Signed-off-by: DingGGu <ggu@dunamu.com>
2020-11-11 10:22:45 -05:00
DingGGu
0b516b7d42 rule(macro user_known_k8s_ns_kube_system_images): add new macro image name inside kube-system namespace
Signed-off-by: DingGGu <ggu@dunamu.com>
2020-11-11 10:22:45 -05:00
DingGGu
4954593261 rule(macro user_known_k8s_client_container): add node-problem-detector pattern to avoid false positive
Signed-off-by: DingGGu <ggu@dunamu.com>
2020-11-11 10:22:45 -05:00
kaizhe
0852a88a16 rule(macro chage_list): create new macro chage_list as execption in rule Usermgmt binaries
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-11-06 08:43:34 -05:00
divious1
cea9c6a377 adding lkm rule
Signed-off-by: divious1 <josehelps@gmail.com>
2020-11-06 04:57:55 -05:00
Nicolas Marier
c055f02dd0 rule(macro multipath_writing_conf): create and use the macro
`multipath`, which is run by `systemd-udevd`, writes to
`/etc/multipath/wwids`, `/etc/multipath/bindings` and a few other paths
under `/etc/multipath` as part of its normal operation.

Signed-off-by: Nicolas Marier <nmarier@coveo.com>
2020-11-06 04:56:10 -05:00
Christian Zunker
294804daf4 rule(list falco_privileged_images): add calico/node without registry prefix
Signed-off-by: Christian Zunker <christian.zunker@codecentric.cloud>
2020-10-30 09:50:30 +01:00
Mark Stemm
26f2aaa3eb rule(Full K8s... Access): fix users list
Use the right list name in the rule Full K8s Administrative Access--it
was using the nonexistent list admin_k8s_users, so it was just using the
string "admin_k8s_users".

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-10-28 14:09:42 +01:00
Leo Di Donato
bc9a2f38e1 update(falco/rules): re-use spawned_process macro inside container_started macro
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-10-26 14:03:19 +01:00
Lorenzo Fontana
9ea195a0b7 macro(allowed_k8s_users): exclude cloud-controller-manage to avoid false positives on k3s
Signed-off-by: Lorenzo Fontana <fontanalorenz@gmail.com>
2020-10-21 12:54:19 +02:00
kaizhe
47fa7d53c4 rule(Outbound Connection to C2 Servers): Add a new rule to detect outbound connections to c2 servers
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-10-13 16:43:07 -04:00
Marc-Olivier Bouchard
39e6d21449 Added new macro user_known_remote_file_copy_activities
Signed-off-by: Marc-Olivier Bouchard <mobouchard@coveo.com>
2020-10-13 05:13:57 -04:00
Marc-Olivier Bouchard
3418ed64aa Added new macro user_know_remote_file_copy_tools_in_container_conditions
Signed-off-by: Marc-Olivier Bouchard <mobouchard@coveo.com>
2020-10-13 05:13:57 -04:00
Christian Zunker
8b56360f8c rule(list falco_sensitive_mount_images): add images docker.io/falcosecurity/falco and falcosecurity/falco
Fixes #1428

Signed-off-by: Christian Zunker <christian.zunker@codecentric.cloud>
2020-10-06 17:26:29 +02:00
Mark Stemm
879bf37ffd rule(Write below root): require proc.name
Like other rules that rely on a process name for exceptions, don't
trigger an event if the process name is missing e.g. "<NA>".

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-10-01 11:33:45 +02:00
Mark Stemm
fc4355dd15 rule(Delete....shell history): Skip docker progs
Also ignore docker programs which would prevent cases where the path is
expressed within the container filesystem (/.bash_history) vs host
filesystem (/var/lib/docker/overlay/.../.bash_history).

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-10-01 11:33:45 +02:00
Mark Stemm
1c7fca95e4 rule(Delete or rename shell history):fix warning
Move the "and not" checks to the end of the rule so all event type
checks are at the front.

Also break into 3 macros to make the rule easier to read.

This fixes https://github.com/falcosecurity/falco/issues/1418.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-10-01 11:33:45 +02:00
Mark Stemm
33793d233b Rule(Disallowed K8s User): quote colons
It turns out if you read this rules file with falco versions 0.24.0 and
earlier, it can't parse the bare string containing colons:

(Ignore the misleading error context, that's a different problem):

```
Thu Sep 10 10:31:23 2020: Falco initialized with configuration file
/etc/falco/falco.yaml
Thu Sep 10 10:31:23 2020: Loading rules from file
/tmp/k8s_audit_rules.yaml:
Thu Sep 10 10:31:23 2020: Runtime error: found unexpected ':'
---
  source: k8s_audit
    tags: [k8s]
    # In a local/user rules file, you could override this macro to
```

I think the change in 0.25.0 to use a bundled libyaml fixed the problem,
as it also upgraded libyaml to a version that fixed
https://github.com/yaml/libyaml/pull/104.

Work around the problem with earlier falco releases by quoting the colon.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-23 17:48:36 +02:00
Mark Stemm
331b2971be rule(Delete or rename shell history):skip dockerfs
In some cases, when removing a container, dockerd will itself remove the
entire overlay filesystem, including a shell history file:

---
Shell history had been deleted or renamed (user=root type=unlinkat
command=dockerd -H fd://
... name=/var/lib/docker/overlay2/.../root/.bash_history ..
---

To avoid these FPs, skip paths starting with /var/lib/docker.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-23 17:48:36 +02:00
Hiroki Suezawa
5b926386a8 rule(macro consider_packet_socket_communication): change a value to always_true
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2020-09-18 09:47:10 +02:00
Leonardo Grasso
d2dbe64723 update: bump Falco engine version to 7
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-09-13 22:54:00 +02:00
bgeesaman
cb2439d757 Append Slash to Sensitive Mount Path startswith
Make L#1932 equivalent to L#1898

Signed-off-by: Brad Geesaman <bradgeesaman+github@gmail.com>
2020-09-11 14:50:28 +02:00
Leonardo Di Donato
e0f0db96d3 build(rules): fix rules etc dir
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-09-10 15:01:07 +02:00
Mark Stemm
7666bc3f3a rule(System ClusterRole Modified/Deleted): + role
Add system:managed-certificate-controller as a system role that can be
modified. Can be changed as a part of upgrades.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
08d38d8269 Rule(Pod Created in Kube Namespace): add images
Add several images seen in GKE environments that can run in the
kube-system namespace.

Also change the names of the lists to be more specific. The old names
are retained but are kept around for backwards compatibility.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
3fd4464dee rule(Disallowed K8s User): add known users
Seen when using K8s cluster autoscaling or addon manager.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
702d989cd0 rule(Create HostNetwork Pod): add images
Add a set of images known to run in the host network. Mostly related to
GKE, sometimes plus metrics collection.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
de9c8720c0 rule(Launch Privileged Container) add images
Most of these are seen in GKE and are uses for core routing/metrics
collection.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
534cb8e59f rule(Launch Privileged Container): sort/reorg list
Sort the items in the list falco_privileged_images alphabetically
and also separate them into individual lines. Make it easier to note
changes to the entries in the list using git blame.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
9b3adc1373 rule(Read sensitive file untrusted):google_oslogin
Related to https://github.com/GoogleCloudPlatform/guest-oslogin, full
cmdline is google_oslogin_control.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
fb5e13c694 rule(Write below root): add mysqlsh
Let mysqlsh write below /root/.mysqlsh.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
7effc02c60 rule(Write below etc): add calco exceptions
Add several calico images and command line programs that end up writing
below /etc/calico.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
7ae0ce1936 rule(Update Package Repository): restrict files
Previously any write to a file called sources.list would match the
access_repositories condition, even a file /usr/tmp/..../sources.list.

Change the macro so the files in repository_files must be somewhere
below any of repository_directories.

Also allow programs spawned by package management programs to change
these files, using package_mgmt_ancestor_procs.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
891965375d rule(Read sensitive file untrusted): linux-bench
Let programs spawned by linux-bench (CIS Linux Benchmark program) read
/etc/shadow. Tests in the benchmark check for permissions of the file
and accounts in the contents of the file.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Mark Stemm
7a4d790458 rule(Change thread namespace): Require proc name
In some cases, dropped events around the time a new container is started
can result in missing the exec/clone for a process that does a setns to
enter the namespace of a container. Here's an example from an oss
capture:

```

282273 09:01:22.098095673 30 runc:[0:PARENT] (168555) < setns res=0
282283 09:01:22.098138869 30 runc:[0:PARENT] (168555) < setns res=0
282295 09:01:22.098179685 30 runc:[0:PARENT] (168555) < setns res=0
517284 09:01:30.128723777 13 <NA> (168909) < setns res=0
517337 09:01:30.129054963 13 <NA> (168909) < setns res=0
517451 09:01:30.129560037 2 <NA> (168890) < setns res=0
524597 09:01:30.162741004 19 <NA> (168890) < setns res=0
527433 09:01:30.179786170 18 runc:[0:PARENT] (168927) < setns res=0
527448 09:01:30.179852428 18 runc:[0:PARENT] (168927) < setns res=0
535566 09:01:30.232420372 25 nsenter (168938) < setns res=0
537412 09:01:30.246200357 0 nsenter (168941) < setns res=0
554163 09:01:30.347158783 17 nsenter (168950) < setns res=0
659908 09:01:31.064622960 12 runc:[0:PARENT] (169023) < setns res=0
659919 09:01:31.064665759 12 runc:[0:PARENT] (169023) < setns res=0
732062 09:01:31.608297074 4 nsenter (169055) < setns res=0
812985 09:01:32.217527319 6 runc:[0:PARENT] (169077) < setns res=0
812991 09:01:32.217579396 6 runc:[0:PARENT] (169077) < setns res=0
813000 09:01:32.217632211 6 runc:[0:PARENT] (169077) < setns res=0
```

When this happens, it can cause false positives for the "Change thread
namespace" rule as it allows certain process names like "runc",
"containerd", etc to perform setns calls.

Other rules already use the proc_name_exists macro to require that the
process name exists. This change adds proc_name_exists to the Change
Thread Namespace rule as well.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-09-03 18:56:51 +02:00
Loris Degioanni
5d71d70a14 added brakets to three macros to make them less ambiguous
Signed-off-by: Loris Degioanni <loris@sysdig.com>
2020-08-31 18:02:10 +02:00
Chuck Schweizer
d678be5579 Adding user.loginuid to the default falco rules in any place user.name exists
This update will provide information as to which process uid intitiated the event.  This is really important for processes that are started
by a different user name.

Signed-off-by: Chuck Schweizer <chuck.schweizer.lvk2@statefarm.com>
2020-08-28 10:02:19 +02:00
Leonardo Grasso
1f1f7c16b6 chore(rules): add renameat2 to rename macro
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-08-18 11:23:24 +02:00
kaizhe
1bb0a9b44a minor fix
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-08-13 20:34:39 +02:00
kaizhe
ca3c4814fe add sematext images back
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-08-13 20:34:39 +02:00
kaizhe
50832c7990 remove non-oss images in the whitelist
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-08-13 20:34:39 +02:00
kaizhe
4eba59c3f0 keep both w/ docker.io and w/o docker.io for sysdig images
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-08-13 20:34:39 +02:00
kaizhe
3e98c2efc0 macro(user_read_sensitive_file_containers): replace endswiths with exact image repo name
macro(user_trusted_containers): replace endswiths with exact image repo name
macro(user_privileged_containers): replace endswiths with exact image repo name
macro(trusted_images_query_miner_domain_dns): replace endswiths with exact image repo name
macro(falco_privileged_containers): append "/" to quay.io/sysdig
list(falco_privileged_images): add images docker.io/sysdig/agent-slim and docker.io/sysdig/node-image-analyzer
list(falco_sensitive_mount_images): add image docker.io/sysdig/agent-slim
list(k8s_containers): prepend docker.io to images

Signed-off-by: kaizhe <derek0405@gmail.com>
2020-08-13 20:34:39 +02:00
Radu Andries
938ece8f4e macro(exe_running_docker_save): add better support for centos
dockerd and docker have "-current" suffix on centos and rhel. This
macro does not match causing false positives on multiple rules
using it

Signed-off-by: Radu Andries <radu@sysdig.com>
2020-08-13 19:43:48 +02:00
kaizhe
511ef52717 rule (EphemeralContainers Created): add new rule to detect ephemeral container created
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-08-06 22:42:18 +02:00
kaizhe
e2bf87d207 macro(trusted_pod): add new list k8s_image_list
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-07-31 10:40:48 +02:00
kaizhe
571f8a28e7 add macro user_read_sensitive_file_containers
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-07-25 08:53:06 +02:00
kaizhe
6bb0bba68a rules update(Read sensitive file untrusted): add trusted images into whitelist
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-07-25 08:53:06 +02:00
Leonardo Grasso
f1a42cf259 rule(list allowed_k8s_users): add "kubernetes-admin" user
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-07-25 08:51:13 +02:00
Nicolas Vanheuverzwijn
427c15f257 rule(macro falco_privileged_images): add 'docker.io/falcosecurity/falco'
Add 'docker.io/falcosecurity/falco' image to  'falco_privileged_images' macro. This preven messages like this when booting up falco :

```
Warning Pod started with privileged container (user=system:serviceaccount:kube-system:daemon-set-controller pod=falco-42brw ns=monitoring images=docker.io/falcosecurity/falco:0.24.0)
```

Signed-off-by: Nicolas Vanheuverzwijn <nicolas.vanheu@gmail.com>
2020-07-23 20:49:57 +02:00
kaizhe
a9b4e6c73e add sysdig/agent-slim to the user_trusted_images macro
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-07-20 23:41:47 +02:00
kaizhe
b32853798f rule update (macro: user_trusted_containers): add sysdig/node-image-analyzer to macro user_trusted_containers
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-07-20 23:41:47 +02:00
Leonardo Grasso
bca98e0419 update(rules): disable drift detection rules by default
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-07-15 18:01:57 +02:00
Nicolas Marier
32bae35de2 rule(list package_mgmt_binaries): add snapd to list
Snap is a package manager by Canonical which was not in the
`package_mgmt_binaries` list.

Signed-off-by: Nicolas Marier <nmarier@coveo.com>
2020-07-10 10:04:26 +02:00
kaizhe
d8d218230d rules update: create placeholder macros for customization
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-07-03 20:54:36 +02:00
Antoine Deschênes
a5cadbf5fa rule(Disallowed K8s User): whitelist kube-apiserver-healthcheck
kops 1.17 adds a kube-apiserver-healthcheck user: https://github.com/kubernetes/kops/tree/master/cmd/kube-apiserver-healthcheck

Logs are currently spammed with:
```
{"output":"18:02:15.466580992: Warning K8s Operation performed by user not in allowed list of users (user=kube-apiserver-healthcheck target=<NA>/<NA> verb=get uri=/healthz resp=200)","priority":"Warning","rule":"Disallowed K8s User","time":"2020-06-29T18:02:15.466580992Z", "output_fields": {"jevt.time":"18:02:15.466580992","ka.response.code":"200","ka.target.name":"<NA>","ka.target.resource":"<NA>","ka.uri":"/healthz","ka.user.name":"kube-apiserver-healthcheck","ka.verb":"get"}}
```

Signed-off-by: Antoine Deschênes <antoine.deschenes@equisoft.com>
2020-06-30 11:44:11 +02:00
kaizhe
e29a4c8560 rule(list network_tool_binaries): add zmap to the list
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-06-29 18:17:28 +02:00
Leonardo Grasso
27037e64cc chore(rules): remove redundant condition from root_dir macro
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-06-26 19:57:18 +02:00
Leonardo Grasso
1859552834 fix(rules): correct root_dir macro to avoid unwanted matching
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-06-26 19:57:18 +02:00
Nicolas Marier
298ba29c88 rule(Change thread namespace): whitelist protokube, dockerd, tini and aws
These application binaries raise events in the `Change thread namespace`
rule as part of their normal operation.

Here are more details regarding each binary :

- `protokube` : See [this](https://github.com/kubernetes/kops/tree/master/protokube)
- `dockerd` : The `dockerd` process name is whitelisted already in this
  rule, but not if it is the parent, which will happen if you are doing
  docker-in-docker.
- `tini` : See [this](https://github.com/krallin/tini)
- `aws` : This one I noticed because Falco itself uses the AWS CLI to
  send events to SNS, which was triggering this rule.

Signed-off-by: Nicolas Marier <nmarier@coveo.com>
2020-06-24 11:02:12 +02:00
Nicolas Marier
0272b94bb1 rule(macro exe_running_docker_save): add new cmdline
While using Falco, I noticed we were getting many events that were
virtually identical to those that were previously filtered out by the
`exexe_running_docker_save` macro, but where the `cmdline` was something
like `exe /var/run/docker/netns/cc5c7b9bb110 all false`. I believe this
is caused by the use of docker-in-docker.

Signed-off-by: Nicolas Marier <nmarier@coveo.com>
2020-06-24 11:02:12 +02:00
Nicolas Marier
dbd86234ad rule(macro user_expected_terminal_shell_in_container_conditions): create the macro
A macro like this is useful because configuration management software
may need to run containers with an attached terminal to perform some of
its duties, and users may want to ignore this behavior.

Signed-off-by: Nicolas Marier <nmarier@coveo.com>
2020-06-23 21:53:41 +02:00
Nicolas Marier
b69bde6bd4 rule(macro user_known_write_below_binary_dir_activities): Create the macro
This macro is useful to allow binaries to be installed under certain
circumstances. For example, it may be fine to install a binary during a
build in a ci/cd pipeline.

Signed-off-by: Nicolas Marier <nmarier@coveo.com>
2020-06-22 16:19:07 +02:00
Leonardo Di Donato
d2f0ad7c07 fix(rules): exclude runc writing /var/lib/docker for container drift
detected rules

Co-authored-by: Lorenzo Fontana <lo@linux.com>
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-06-22 12:24:59 +02:00
Omer Azaria
70b9bfe1d6 rule(Container Drift Detected): detect new exec created in a container
Signed-off-by: Omer Azaria <omer.azaria@sysdig.com>
2020-06-22 12:24:59 +02:00
kaizhe
dee0cc67f3 rule update (Anonymous Request Allowed): update to checking auth decision equals to allow
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-06-19 15:32:58 +02:00
Leonardo Grasso
578ef7f64d rule(Create files below dev): correct condition to catch openat
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-06-10 12:21:36 +02:00
Leonardo Grasso
a5ce61f03f rule(macro bin_dir_rename): correct condition to catch all variants
Since `evt.arg[1]` does not work for all syscalls, switch to:
 - `evt.arg.path` for `rmdir` and `unlink` (used by `remove` macro)
 - `evt.arg.name` for `unlinkat` (used by `remove` macro)
 - `evt.arg.oldpath/newpath` for `rename` and `renameat` (used by `rename` macro)

That ensures `Modify binary dirs` works properly.

Note that we cannot yet use `renameat2` (not supported by sinsp, see https://github.com/draios/sysdig/issues/1603 )

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-06-10 12:21:36 +02:00
Leonardo Grasso
74ca02d199 rule(macro bin_dir_mkdir): correct condition to catch mkdirat case
Since the dir's path is found:
-  in `evt.arg[1]` for `mkdir`
-  but in `evt.arg[2]` for `mkdirat`
switch to `evt.arg.path` to catch both.
That ensures `Mkdir binary dirs` works properly.

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2020-06-10 12:21:36 +02:00
Nicolas Marier
81e29c55ec rule(macro user_known_set_setuid_or_setgid_bit_conditions): create macro
This macro will be useful because it will make it possible to filter out
events with a higher degree of granularity than is currently possible
for the `Set Setuid or Setgid bit` rule.

For example, if some application is expected to set the setuid or the
setgid bit under a specific condition, like if it's started with a
specific command, then the `user_known_chmod_applications` list is not
enough because we don't want to filter out _all_ events by this
application, only specific ones. This macro allows that.

Signed-off-by: Nicolas Marier <nmarier@coveo.com>
2020-05-26 10:23:31 +02:00
Mark Stemm
d1c9aae881 rule(list allowed_k8s_users): Add vertical pod autoscaler as known k8s users
https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler

Example alert:
---
K8s Operation performed by user not in allowed list of
users (user=vpa-recommender target=vpa-recommender/endpoints verb=update
uri=core/v1/namespaces/kube-system/endpoints/vpa-recommender resp=200)

K8s Operation performed by user not in allowed list of
users (user=vpa-updater target=vpa-updater/endpoints verb=update
uri=core/v1/namespaces/kube-system/endpoints/vpa-updater resp=200)
---

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-05-21 10:57:42 +02:00
Mark Stemm
986ea28279 rule(macro user_known_k8s_client_container): Allow hcp-tunnelfront torun kubectl in containers
https://stackoverflow.com/questions/50349586/what-is-hcp-tunnelfront

Example alert:

---
Docker or kubernetes client executed in container (user=root
parent=run-tunnel-fron cmdline=kubectl
--kubeconfig=/etc/kubernetes/kubeconfig/kubeconfig get secret
tunnelfront --namespace=kube-system --output json --ignore-not-found
image=mcr.microsoft.com/aks/hcp/hcp-tunnel-front)
---

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-05-21 10:57:42 +02:00
Mark Stemm
5266618689 rule(macro lvprogs_writing_conf): Add lvs as a lvm program
Example event. I'm pretty sure the full file in this case is /etc/lvm/cache:

---
File below /etc opened for writing (user=root command=lvs --noheadings
--readonly --separator=";" -a -o
lv_tags,lv_path,lv_name,vg_name,lv_uuid,lv_size parent=ceph-volume
pcmdline=ceph-volume /usr/sbin/ceph-volume inventory --format json file=/etc/lvm/c...
---

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-05-21 10:57:42 +02:00
Mark Stemm
fa3d2eb473 rule(macro trusted_logging_images): Let azure-npm image write to /var/log
"The Azure's NPM is a a daemonset that supports network policies as
defined by the Kubernetes policy specification."

Example event:

---
Log files were tampered (user=root command=azure-npm
file=/var/log/iptables.conf CID1 image=mcr.microsoft.com/containernetworking/azure-npm)
---

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-05-21 10:57:42 +02:00
Mark Stemm
acb3f94786 rule(macro trusted_logging_images): Add addl fluentd image
Openshift specific variant, example alert:

---
Log files were tampered (user=root command=fluentd /usr/bin/fluentd
--no-supervisor file=/var/log/journal.pos CID1 image=registry.redhat.io/openshift3/ose-logging-fluentd)
---

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-05-21 10:57:42 +02:00
kaizhe
d1af7e139f rule update: fix macro reference
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-05-21 10:55:53 +02:00
kaizhe
f27056c394 fix rule naming following naming convention
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-04-28 18:18:06 +02:00
Mark Stemm
357da40fc4 Only use metadata in k8s audit event for secrets
Instead of using the request object to identify service account tokens,
exclude any secrets activity by system users (e.g. users starting with
"system:"). This allows the rules to work on k8s audit events at
Metadata level instead of RequestResponse level.

Also change the example objects for automated tests to ones collected at
Metadata level.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-04-22 21:00:38 +02:00
Mark Stemm
026965bc6a Add rules to detect creating/deleting secrets
New rules K8s Secret Created/K8s Secret Deleted detect creating/deleting
secrets, following the pattern of the other "K8s XXX Created/Deleted"
rules. One minor difference is that service account token secrets are
excluded, as those are created automatically as namespaces are created.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-04-22 21:00:38 +02:00
kaizhe
f7ac7f34b7 rename rule
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-04-21 19:04:14 +02:00
kaizhe
a1145d9841 rule update: add a rule to detect reverse shell
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-04-21 19:04:14 +02:00
Nicolas Marier
91a0b510fa rule(macro user_expected_system_procs_network_activity_conditions): create the macro
It's useful to ignore some system binaries that use the network under
certain conditions, so this should be overridable by the user.

Signed-off-by: Nicolas Marier <nmarier@coveo.com>
2020-04-14 13:22:09 +02:00
Nicolas Marier
76062b93ab rule(list known_system_procs_network_activity_binaries): add a list of known procs for convenience
This makes it more convenient to add more allowed procs and many other
rules have a similar mechanism to whitelist certain processes.

Signed-off-by: Nicolas Marier <nmarier@coveo.com>
2020-04-14 13:22:09 +02:00
Vicente Herrera
9fd08ce3e4 Introduce missing allowed_full_admin_users macro so its corresponding rule is disabled by default
Signed-off-by: Vicente Herrera <vicenteherrera@vicenteherrera.com>
2020-04-14 13:19:14 +02:00
Vicente Herrera
3ce11f093f Removed default K3s admin user from list, clarified comments
Signed-off-by: Vicente Herrera <vicenteherrera@vicenteherrera.com>
2020-04-14 13:19:14 +02:00
Vicente Herrera
e7b3d7a7e0 Added four new rules, to detect k8s operation by an administrator, nodes successfully joining the cluster, nodes unsuccessfully attempt to join, creation ingress without TLS certificate
Signed-off-by: Vicente Herrera <vicenteherrera@vicenteherrera.com>
2020-04-14 13:19:14 +02:00
Vicente Herrera
2c2d126a54 Added two new rules to detect traffic to image outside local subnet and detect traffic that is not to authorized server process and port
Signed-off-by: Vicente Herrera <vicenteherrera@vicenteherrera.com>
2020-04-14 13:19:14 +02:00
Bob Aman
ffa137fc7c rule(Delete Bash History): Fix typo in tags
Signed-off-by: Bob Aman <bob@sporkmonger.com>
2020-04-14 12:54:02 +02:00
Bob Aman
534a642074 rule(Delete or rename shell history): Fix typo in tags
Signed-off-by: Bob Aman <bob@sporkmonger.com>
2020-04-14 12:54:02 +02:00
kaizhe
1548ccbc4f rule(Write below root): use pmatch to check against known root directories
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-04-09 12:32:30 +02:00
kaizhe
6834649fa5 rule(Service Account Created in Kube Namespace): only detect sa created in kube namespace with success
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-03-27 13:02:57 +01:00
kaizhe
e1cb2e9bb0 rule(Detect outbound connections to common miner pool ports): whitelist sysdig/agent and falcosecurity/falco for query miner domain dns
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-03-27 00:33:24 +01:00
Hiroki Suezawa
3067af566e rule(Change thread namespace): fix regression test
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2020-03-12 16:35:46 +01:00
Hiroki Suezawa
742538ac86 rule(Change thread namespace): change condition to detect suspicious container activity
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2020-03-12 16:35:46 +01:00
Vicente Herrera
085009ad93 Fixed use of "tag" instead of "tags" in default rules
Signed-off-by: Vicente Herrera <vicenteherrera@vicenteherrera.com>
2020-03-10 20:51:45 +01:00
kaizhe
4a8d8a049f add comments
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-03-04 09:28:43 +01:00
kaizhe
b4f2fdc439 disable cryptomining rule by default; add exception of localhost and rfc1918 ip addresses
Signed-off-by: kaizhe <derek0405@gmail.com>
2020-03-04 09:28:43 +01:00
Mark Stemm
3693b16c91 Let puma reactor spawn shells
Sample Falco alert:

```
Shell spawned by untrusted binary (user=git shell=sh parent=puma reactor
cmdline=sh -c pgrep -fl "unicorn.* worker\[.*?\]" pcmdline=puma reactor
gparent=puma ggparent=runsv aname[4]=ru...
```

https://github.com/puma/puma says it is "A Ruby/Rack web server built
for concurrency".

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-02-03 16:13:57 +01:00
Mark Stemm
48a0f512fb Let cilium-cni change namespaces
Sample Falco alert:

```
Namespace change (setns) by unexpected program (user=root
command=cilium-cni parent=cilium-cni host CID2 CID1 image=<NA>)
```

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-02-03 16:13:57 +01:00
Mark Stemm
01c9d8ba31 Let runc write to /exec.fifo
Sample Falco alert:

```
File below / or /root opened for writing (user=<NA>
command=runc:[1:CHILD] init parent=docker-runc-cur file=/exec.fifo
program=runc:[1:CHILD] CID1 image=<NA>)
```

This github issue provides some context:
https://github.com/opencontainers/runc/pull/1698

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-02-03 16:13:57 +01:00
Mark Stemm
7794e468ba Alow writes to /etc/pki from openshift secrets dir
Sample falco alert:

```
File below /etc opened for writing (user=root command=cp
/run/secrets/kubernetes.io/serviceaccount/ca.crt
/etc/pki/ca-trust/source/anchors/openshift-ca.crt parent=bash
pcmdline=bash -c #!/bin/bash\nset -euo pipefail\n\n# set by the node
image\nunset KUB...
```

The exception is conditioned on containers.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-02-03 16:13:57 +01:00
Mark Stemm
0d74f3938d Let avinetworks supervisor write some ssh cfg
Sample Falco alert:

```
File below /etc opened for writing (user=root command=se_supervisor.p
/opt/avi/scripts/se_supervisor.py -d parent=systemd pcmdline=systemd
file=/etc/ssh/ssh_monitor_config_10.24.249.200 program=se_supervisor.p
gparent=docker-containe ggparent=docker-con...
```

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-02-03 16:13:57 +01:00
Mark Stemm
e5f06e399f Let mcafee write to /etc/cma.d
Sample Falco alert:

```
File below /etc opened for writing (user=root command=macompatsvc
self_start parent=macompatsvc pcmdline=macompatsvc self_start
file=/etc/cma.d/lpc.conf program=macompatsvc gparent=macompatsvc
ggparent=systemd gggparent=<NA> CID1 image=<NA>)
```

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-02-03 16:13:57 +01:00
Mark Stemm
fa3e48ca1a Add "dsc_host" as a MS OMS program
Sample Falco alert:

```
File below /etc opened for writing (user=<NA> command=dsc_host
/opt/dsc/output PerformRequiredConfigurationChecks 1 parent=python
pcmdline=python
/opt/microsoft/omsconfig/Scripts/PerformRequiredConfigurationChecks.py
file=/etc/opt/omi/conf/omsconfig/con...
```

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2020-02-03 16:13:57 +01:00
Leonardo Di Donato
572ac46d85 build: include GNUInstallDirs module
Co-authored-by: Lorenzo Fontana <lo@linux.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2020-01-17 19:09:31 +01:00
Hiroki Suezawa
cd94d05cd9 rule(list network_tool_binaries): delete ssh from the list
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-16 22:27:12 +01:00
Hiroki Suezawa
23a7203e50 rule(list network_tool_binaries): add network tool names
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-16 22:27:12 +01:00
Hiroki Suezawa
93fdf8ef61 rule(macro user_known_k8s_client_container): Rephrase the comment
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-11 12:53:06 +01:00
Hiroki Suezawa
bcc84c47c6 rule(macro user_known_k8s_client_container): have more strict condition to avoid false positives
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-11 12:53:06 +01:00
Nicolas Marier
13931ab5d7 rule(Write below etc): whitelist automount writing under /etc
This commit allows automount to write under /etc/mtab without flagging
it as an error.

Signed-off-by: Nicolas Marier <nmarier@coveo.com>
2019-12-05 19:27:18 +01:00
Hiroki Suezawa
559b7e1bb1 rule(The docker client is executed in a container): modify condition to reduce false positive
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-05 14:32:22 +01:00
Hiroki Suezawa
fc58ac7356 rule update: modify rule to detect connection to K8S API Server from a container
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-05 10:59:05 +01:00
Jean-Philippe Lachance
418bcf2177 Apply Kaizhe's code review
Signed-off-by: Jean-Philippe Lachance <jplachance@coveo.com>
2019-12-04 03:36:04 +01:00
Jean-Philippe Lachance
f97a33d40a Exclude exe_running_docker_save in the "Update Package Repository" rule
Signed-off-by: Jean-Philippe Lachance <jplachance@coveo.com>
2019-12-04 03:36:04 +01:00
Jean-Philippe Lachance
df7a356e1d Apply Kaizhe's code review
Signed-off-by: Jean-Philippe Lachance <jplachance@coveo.com>
2019-12-04 03:35:11 +01:00
Jean-Philippe Lachance
03e8b7f53d Exclude exe_running_docker_save in the "Modify Shell Configuration File" rule
Signed-off-by: Jean-Philippe Lachance <jplachance@coveo.com>
2019-12-04 03:35:11 +01:00
Jean-Philippe Lachance
146343e5f0 Update the exe_running_docker_save macro to support docker in docker
Signed-off-by: Jean-Philippe Lachance <jplachance@coveo.com>
2019-12-04 02:20:21 +01:00
Hiroki Suezawa
7da245e902 rule update: Modify rule to detect raw packets creation
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-04 00:19:26 +00:00
Hiroki Suezawa
d0e6279bb2 rule update: Modify condition for raw packets creation
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-04 00:19:26 +00:00
Hiroki Suezawa
8b2d4e1fe6 rule update: Fix condition for raw packets creation and renamed
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-04 00:19:26 +00:00
Hiroki Suezawa
ebec520ebc rule update: Add rules to detect raw packets creation
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-04 00:19:26 +00:00
kaizhe
2f8caf99cd rule update: align sensitive mount macro between k8s_audit rules and syscall rules
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-12-03 12:58:21 -08:00
Hiroki Suezawa
0b402e2326 rule update: Rename rule for Cloud Metadata access again
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-03 20:15:33 +00:00
Hiroki Suezawa
54329a64cd rule update: Rename rule for Cloud Metadata access
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-03 20:15:33 +00:00
rung
89d8259860 rule update: Add consider_gce_metadata_access macro for rule to detect GCE Metadata access
Signed-off-by: rung <suezawa@gmail.com>
2019-12-03 20:15:33 +00:00
Hiroki Suezawa
e70febc8db rule update: Add rules for GCE Metadata detection
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-03 20:15:33 +00:00
kaizhe
722ab4f2f9 minor changes
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-12-03 19:37:01 +00:00
kaizhe
6c9bce6f73 update k8s audit rule
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-12-03 19:37:01 +00:00
kaizhe
7c33fafe89 minor changes
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-12-03 19:37:01 +00:00
kaizhe
18acea4a73 minor changes
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-12-03 19:37:01 +00:00
kaizhe
8011fe7ce7 rules update: add more sensitive host path to sensitive_host_mount macro
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-12-03 19:37:01 +00:00
Jean-Philippe Lachance
80d69917ea * Rename the macro to user_known_package_manager_in_container
+ Add a comment to explain how we should use this macro

Signed-off-by: Jean-Philippe Lachance <jplachance@coveo.com>
2019-12-03 00:03:35 +01:00
Jean-Philippe Lachance
3713f7a614 + Add a simple user_known_package_manager_in_container_conditions macro
* Use the user_known_package_manager_in_container_conditions macro in the "Launch Package Management Process in Container" rule

Signed-off-by: Jean-Philippe Lachance <jplachance@coveo.com>
2019-12-03 00:03:35 +01:00
Jean-Philippe Lachance
79cb75dcd1 ! Exclude exe_running_docker_save in the "Set Setuid or Setgid bit" rule
Signed-off-by: Jean-Philippe Lachance <jplachance@coveo.com>
2019-12-02 23:54:53 +01:00
Hiroki Suezawa
c736a843a0 rule update: Add kubelet to user_known_chmod_applications list
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2019-12-01 23:27:04 +01:00
kaizhe
cf8395c7ed minor changes
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-11-08 10:38:47 +01:00
kaizhe
f16c744779 rules update: add hyperkube to the whitelist of rule Set Setuid or Setgit bit
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-11-08 10:38:47 +01:00
kaizhe
4ed581853a rules update: add docker-runc-cur to container_entrypoint macro
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-11-08 10:38:47 +01:00
David de Torres
ed767561ac Added list k8s_client_binaries
Added accidentally deleted lines for the list of k8s client binaries.

Signed-off-by: David de Torres <detorres.david@gmail.com>
2019-11-08 09:49:09 +01:00
David de Torres
98becedebb Added rule to detect k8s client tool in container
The rule detects the execution of the k8s client tool in a container and
logs it with WARNING priority.

Signed-off-by: David de Torres <detorres.david@gmail.com>
2019-11-08 09:49:09 +01:00
kaizhe
b38db99449 rules update: add calico/node to trusted privileged container list; add calico_node_write_envvars macro to exception list of write below etc
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-10-25 15:18:32 +02:00
kaizhe
5c61276695 rules update: expand list allowed_k8s_users
Signed-off-by: kaizhe <derek0405@gmail.com>

add comments

Signed-off-by: kaizhe <derek0405@gmail.com>
2019-10-24 13:46:23 +02:00
Mark Stemm
154dd18c8f JSON/K8s Audit Evts extract multiple typed values
Refactor how JSON event/k8s audit events extract values in two important
ways:

1. An event can now extract multiple values.
2. The extracted value is a class json_event_value instead of a simple
string.

The driver for 1. was that some filtercheck fields like
"ka.req.container.privileged" actually should extract multiple values,
as a pod can have multiple containers and it doesn't make sense to
summarize that down to a single value.

The driver for 2. is that by having an object represent a single
extracted value, you can also hold things like numbers e.g. ports, uids,
gids, etc. and ranges e.g. [0:3]. With an object, you can override
operators ==, <, etc. to do comparisons between the numbers and ranges,
or even set membership tests between extracted numbers and sets of
ranges.

This is really handy for a lot of new fields implemented as a part of
PSP support, where you end up having to check for overlaps between the
paths, images, ports, uids, etc in a K8s Audit Event and the acceptable
values, ranges, path prefixes enumerated in a PSP.

Implementing these changes also involve an overhaul of how aliases are
implemented. Instead of having an optional "formatting" function, where
arguments to the formatting function were expressed as text within the
index, define optional extraction and indexing functions. If an
extraction function is defined, it's responsible for taking the full
json object and calling add_extracted_value() to add values. There's a
default extraction function that uses a list of json_pointers with
automatic iteration over array values returned by a json pointer.

There's still a notion of filter fields supporting indexes--that's
simply handled within the default extraction or custom extraction
function. And for most fields, there won't be a need to write a custom
extraction function simply to implement indexing.

Within a json_event_filter_check object, instead of having a single
extracted value as a string, hold a vector of extracted json_event_value
objects (vector because order matters) and a set of json_event_value
objects (for set comparisons) as m_evalues. Values on the right hand
side of the expression are held as a set m_values.

json_event_filter_check::compare now supports IN/INTERSECTS as set
comparisons. It also supports PMATCH using path_prefix_search objects,
which simplifies checks like ka.req.pod.volumes.hostpath--now they can
be expressed as "ka.req.pod.volumes.hostpath intersects (/proc,
/var/run/docker.sock, /, /etc, /root)" instead of
"ka.req.volume.hostpath[/proc]=true or
ka.req.volume.hostpath[/root]=true or ...".

Define ~10 new filtercheck fields that extract pod properties like
hostIpc, readOnlyRootFilesystem, etc. that are relevant for PSP validation.

As a part of these changes, also clarify the names of filter fields
related to pods to always have a .pod in the name. Furthermore, fields
dealing with containers in a pod always have a .pod.containers prefix in
the name.

Finally, change the comparisons for existing k8s audit rules to use
"intersects" and/or "in" when appropriate instead of a single equality
comparison.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2019-10-15 19:45:31 +02:00
Felipe Bessa Coelho
8353a0b22e Ignore sensitive mounts from ecs-agent
Without this, as ecs-agent starts we get a bunch of errors that look
like this (reformatted for readability):

  Notice Container with sensitive mount started (
    user=root
    command=init -- /agent ecs-agent (id=19d4e98bb0dc)
    image=amazon/amazon-ecs-agent:latest
    mounts=/proc:/host/proc:ro:false:rprivate,$lotsofthings
  )

ecs-agent needs those to work properly, so this can cause lots of false
positives when starting a new instance.

Signed-off-by: Felipe Bessa Coelho <fcoelho.9@gmail.com>
2019-10-09 16:30:36 +02:00
Lorenzo Fontana
c76518c681 update: license headers
Co-Authored-By: Leonardo Di Donato <leodidonato@gmail.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-10-08 16:02:26 +02:00
kaizhe
cdb5d71eb6 rule update: add more comments
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-10-03 10:16:28 +02:00
kaizhe
e81decac13 rule update: fix missing entries
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-10-03 10:16:28 +02:00
kaizhe
a43ae037a9 rules update: add back rule Delete Bash History for backport compatibility
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-10-03 10:16:28 +02:00
kaizhe
79a10ad90e rules update: add fluent/fluentd-kubernetes-daemonset to clear log trusted images
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-09-26 13:56:59 +03:00
Leonardo Di Donato
a019b54fe6 docs: specify labels that apply to each area
If this work as intended PR will automatically get the area labels depending on the files he modified.
In case the user wants it can still apply other areas manually, by slash command, or editing the PR template during the opening of the PR.

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-09-16 10:11:25 +02:00
Lorenzo Fontana
39b51562ed fix(rules): modification of a file should trigger as if it was opened or created
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-08-20 09:45:08 +02:00
Lorenzo Fontana
e229cecbe1 fix(rules): make chmod rules enabled by default
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-08-16 10:23:28 +02:00
Lorenzo Fontana
3ea98b05dd fix(rules/Set Setuid or Setgid bit): use chmod syscalls instead of chmod command
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-08-16 10:23:28 +02:00
kaizhe
1fc509d78b rule update: fine grained sending to mining domain
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-08-12 17:37:01 +02:00
kaizhe
a7ee01103d rule update: add rules for crypto mining
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-08-12 17:37:01 +02:00
Lorenzo Fontana
03fbf432f1 fix: make sure that when deleting shell history the system call is taken into account
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2019-08-07 15:38:22 +02:00
kaizhe
3dbd43749a rule update: add exception for write below rpm (#745)
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-08-01 20:07:24 +02:00
Jonathan McGowan
bcf83057fa Fix for Write below root error triggering on GKE
GKE regularly calls /exec.fifo from both a system level, and within
individual falco pods.  As is this triggers errors multiple times every
hour.  This change adds /exec.fifo to the expected files below root that
will be called.

Signed-off-by: Jonathan McGowan <jonnymcgow7@gmail.com>
2019-07-30 18:27:17 +02:00
ntimo
d7956a2a09 add docker.io/prom/node-exporter to falco_sensitive_mount_images
Signed-off-by: Timo Nowitzki <git@nowitzki.me>
2019-07-24 16:25:47 +02:00
ntimo
9308c1ee55 add docker.io/google/cadvisor to falco_sensitive_mount_images
Signed-off-by: Timo Nowitzki <git@nowitzki.me>
2019-07-24 16:25:47 +02:00
kaizhe
d6c089c917 add netdata/netdata to falco_sensitive_mount_images
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-07-23 18:50:23 +02:00
kaizhe
9ab718c100 rules update:
Add trusted_logging_images macro for rule Clear Log Hisotry as exception

Signed-off-by: kaizhe <derek0405@gmail.com>
2019-07-23 18:50:23 +02:00
Spencer Krum
5acdb16e89 Fix shell_procs macro
Extra parentheses broke the Terminal check

Co-Authored-By: Michael Ducy <michael@ducy.org>
Signed-off-by: Spencer Krum <skrum@us.ibm.com>
2019-07-22 04:43:26 -07:00
Leonardo Di Donato
cb5a3a14e6 new: k8s.gcr.io/kube-proxy addition to falco trusted images
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2019-07-10 16:43:41 +02:00
Mattia Pagnozzi
a32870ae1d Add runc to the list of possible container entrypoint parents
Docker versions >= 18.09 removed the "docker-" prefix, so include runc
in the list.

Signed-off-by: Mattia Pagnozzi <mattia.pagnozzi@gmail.com>
2019-07-09 14:31:49 +02:00
kaizhe
16bd8919ab rule update: fix syntax error
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-07-01 10:33:20 +02:00
kaizhe
6ce17d6fcb add rfc_1918_address macro
Signed-off-by: kaizhe <derek0405@gmail.com>
2019-07-01 10:33:20 +02:00