Commit Graph

698 Commits

Author SHA1 Message Date
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