76
Snyk.io Helm Security A Look Below The Hood

Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Helm SecurityA Look Below The Hood

Page 2: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 3: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Matt Farina

Engineer at Samsung SDS@mattfarina

Page 4: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

●●○○○

Page 5: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Helm Is The Package Manager For Kubernetes

Page 6: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

What Is A Package Manager?Package Managers Are Totally Useful

Page 7: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Page 8: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

A Building Block: Integrated Into Other ToolsAn example is https://fluxcd.io/

Page 9: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

What About helm template And Other Cases?We know people stretch Helm beyond its design

$ helm template foo .---# Source: foo/templates/serviceaccount.yamlapiVersion: v1kind: ServiceAccountmetadata: name: foo labels: helm.sh/chart: foo-0.1.0 app.kubernetes.io/name: foo app.kubernetes.io/instance: foo app.kubernetes.io/version: "1.16.0" app.kubernetes.io/managed-by: Helm---# Source: foo/templates/service.yamlapiVersion: v1kind: Service…

Page 10: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Level Set: Hash / Digest

Page 11: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Hash / Digest Example

Page 12: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Justin Cappos Pop Quiz: What Do All Of These

Organizations Have In Common?

Page 13: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Level Set: Provenance

Page 14: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Provenance Example

Page 15: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

What Does This Mean to Helm and Containers?

Page 16: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Downloading

Helm

Page 17: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

$ wget https://get.helm.sh/helm-v3.1.0-linux-amd64.tar.gz--2020-02-14 12:00:34-- https://get.helm.sh/helm-v3.1.0-linux-amd64.tar.gzResolving get.helm.sh... 152.195.19.97Connecting to get.helm.sh|152.195.19.97|:443... connected.HTTP request sent, awaiting response... 200 OKLength: 12267464 (12M) [application/x-tar]Saving to: ‘helm-v3.1.0-linux-amd64.tar.gz’

helm-v3.1.0-linux-amd64.t 100%[===================================>] 11.70M 11.2MB/s in 1.0s

2020-02-14 12:00:36 (11.2 MB/s) - ‘helm-v3.1.0-linux-amd64.tar.gz’ saved [12267464/12267464]

$ wget https://get.helm.sh/helm-v3.1.0-linux-amd64.tar.gz.sha256sum--2020-02-14 12:00:41-- https://get.helm.sh/helm-v3.1.0-linux-amd64.tar.gz.sha256sumResolving get.helm.sh... 152.195.19.97Connecting to get.helm.sh|152.195.19.97|:443... connected.HTTP request sent, awaiting response... 200 OKLength: 97 [application/octet-stream]Saving to: ‘helm-v3.1.0-linux-amd64.tar.gz.sha256sum’

helm-v3.1.0-linux-amd64.t 100%[===================================>] 97 --.-KB/s in 0s

2020-02-14 12:00:41 (1.36 MB/s) - ‘helm-v3.1.0-linux-amd64.tar.gz.sha256sum’ saved [97/97]

$ shasum -a 256 -c helm-v3.1.0-linux-amd64.tar.gz.sha256sumhelm-v3.1.0-linux-amd64.tar.gz: OK

Page 18: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Failure

Example

$ shasum -a 256 -c helm-v3.1.0-linux-amd64.tar.gz.sha256sumhelm-v3.1.0-linux-amd64.tar.gz: FAILEDshasum: WARNING: 1 computed checksum did NOT match

$ echo $?1

Page 19: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Downloading

Helm Signatures

Page 20: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

$ curl https://keybase.io/mattfarina/pgp_keys.asc | gpg --import

$ curl -OL https://get.helm.sh/helm-v3.1.0-linux-amd64.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 11.6M 100 11.6M 0 0 8373k 0 0:00:01 0:00:01 --:--:-- 8377k

$ curl -OL https://github.com/helm/helm/releases/download/v3.1.0/helm-v3.1.0-linux-amd64.tar.gz.asc % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 624 100 624 0 0 1585 0 --:--:-- --:--:-- --:--:-- 1583100 833 100 833 0 0 698 0 0:00:01 0:00:01 --:--:-- 7642

$ gpg --verify helm-v3.1.0-linux-amd64.tar.gz.ascgpg: assuming signed data in 'helm-v3.1.0-linux-amd64.tar.gz'gpg: Signature made Thu Feb 13 11:40:29 2020 ESTgpg: using RSA key 711F28D510E1E0BCBD5F6BFE9436E80BFBA46909gpg: Good signature from "Matthew Farina <[email protected]>" [ultimate]

Page 21: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

$ gpg --verify helm-v3.1.0-linux-amd64.tar.gz.ascgpg: assuming signed data in 'helm-v3.1.0-linux-amd64.tar.gz'gpg: Signature made Thu Feb 13 11:40:29 2020 ESTgpg: using RSA key 711F28D510E1E0BCBD5F6BFE9436E80BFBA46909gpg: BAD signature from "Matthew Farina <[email protected]>" [ultimate]

$ echo $?1

Page 22: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

$ curl https://keybase.io/mattfarina/pgp_keys.asc | gpg --import

$ curl https://mattfarina.com/pgp_key.asc | gpg --import

$ curl https://github.com/helm/helm/blob/master/KEYS | gpg --import $ gpg --locate-keys [email protected]

$ gpg --fingerprint [email protected] rsa4096/0x461449C25E36B98E 2017-11-10 [SC] Key fingerprint = 672C 657B E06B 4B30 969C 4A57 4614 49C2 5E36 B98Euid [ultimate] Matthew Farina <[email protected]>sub rsa4096/0xCCCE67689DF05738 2017-11-10 [E]sub rsa4096/0x9436E80BFBA46909 2017-11-10 [S] [expires: 2022-11-09]

Page 23: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Charts

Page 24: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Charts and Registries

$ helm package fooSuccessfully packaged chart and saved it to: /Users/mfarina/Code/preso/foo-0.1.0.tgz

$ helm repo index .

$ cat index.yamlapiVersion: v1entries: foo: - apiVersion: v2

appVersion: 1.16.0created: "2020-02-18T13:07:23.754331-05:00"description: A Helm chart for Kubernetesdigest: 9f17b96c1f6519c830e91d454cbe4afc845826133fb3a26dde2aea3d4901d62aname: footype: applicationurls:- foo-0.1.0.tgzversion: 0.1.0

generated: "2020-02-18T13:07:23.748982-05:00"

Page 25: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Charts and Registries

$ helm pull demo-repo/foo

$ lsfoo-0.1.0.tgz

Page 26: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Signing Charts

$ helm package --sign --key [email protected] --keyring /path/to/keyring.pgp foo

$ helm plugin install https://github.com/technosophos/helm-gpgInstalled plugin: gpg

$ helm package fooSuccessfully packaged chart and saved it to: /Users/mfarina/Code/preso/foo-0.1.0.tgz

$ helm gpg sign foo-0.1.0.tgzSigning foo-0.1.0.tgz

$ lsfoo foo-0.1.0.tgz foo-0.1.0.tgz.prov

Page 27: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Provenance Files

-----BEGIN PGP SIGNED MESSAGE-----Hash: SHA512

apiVersion: v2appVersion: 1.16.0description: A Helm chart for Kubernetesname: footype: applicationversion: 0.1.0

...files: foo-0.1.0.tgz: sha256:9f17b96c1f6519c830e91d454cbe4afc845826133fb3a26dde2aea3d4901d62a-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEcR8o1RDh4Ly9X2v+lDboC/ukaQkFAl5MRNUACgkQlDboC/ukaQmGCxAAoSGzz33mBQ6P9QGJPnWBiBkRfuImvH8cwqahd6StaMJ70zWwm+h/uIltCKzeWbsyNl/OeR9lSKne+qXskIQ0qaM8IoyX29x4NUK/4QqjQ/WDJ3TKvjV2eTzjJ2GjlboC2Y5tPIjFS0Evi52ZZoC4Wy6p/dBHGTmrRbqBRpuf+4PeyeTJJkmDNwXA0VEVeYib+KMWiqpX0cmWLyUoovAzx3QNVrPvNavUVh8ycjC5dmC143i12KF5nuPRmAa7n4MPMjq58hweTmXPtl+uyhl3T+xGeBhH8vBBKXVca1Ygh0hZe4AWB+eFGH60Ydc+IPVEThOf8PGDRJlJTNwuGXihlLqfJSWDzXg7sh4tTkhzKbwKygtFMQjEfu0slVadsxS9e8HP2JxLNEBbKtPJQsSnDG71vcDuGoZrH+u2EZAl/qKvKO122rxKgRcHADnr6KKZ8lXED18AUvoZz7XE4OzSNFcDOAAIGtahYCUvDA+0NOZQXSeV3m3jT5qq+zD4MHfEORv4mG0rcTaZbbsA6y8eriIS2DNwjubCOd/Z6XIJVtDNYbX4WQYUsaLL+iCiX+aqeif8MXgVXcM47Hz9XkqK0yPW/1DLfyrZg3r7dSGRejPI+VfyF4Aj6eBrvT/fmGKUfGJz+jJJG1jDgsqS8eI++nof7C4LlS75m1BHrlV7uCc==F1Tf-----END PGP SIGNATURE-----

Page 28: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Verifying Charts

$ helm pull --prov demo-repo/foo

$ lsfoo-0.1.0.tgz foo-0.1.0.tgz.prov

$ helm gpg verify foo-0.1.0.tgzgpg: Signature made Tue Feb 18 15:35:42 2020 ESTgpg: using RSA key 711F28D510E1E0BCBD5F6BFE9436E80BFBA46909gpg: Good signature from "Matthew Farina <[email protected]>" [ultimate]plugin: Chart SHA verified. sha256:f8a4e6e3ebf8a3fac95396b698f5517d43e0f5275bac3c484b6f38428b90b578

$ helm pull --verify --keyring /path/to/keyring.pgp demo-repo/foo

$ gpg --output keyring.pgp --export [email protected]

Page 29: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Security in Charts

Page 30: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Resource Quotas

Page 31: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Secrets

Page 32: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Secret Types

$ cat foo-test-secret.yamlapiVersion: v1kind: Secretmetadata: name: foo-test-secrettype: com.example.minestringData: foo: bar baz: qux

$kubectl get secrets --field-selector "type=com.example.mine"NAME TYPE DATA AGEfoo-test-secret com.example.mine 2 40s

Page 33: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Encrypting Secrets At Rest

Page 34: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

RBAC

Page 35: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

audit2rbac

Page 36: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Service Accounts

Page 37: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Pod Security Policies

Page 38: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Image Security

Page 39: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Vulnerabilities In Container Images

https://blog.acolyer.org/2017/04/03/a-study-of-security-vulnerabilities-on-docker-hub/

Page 40: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Scan Your

Container Images

And Fix CVEs

Page 41: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Quay (one of many options)

Page 42: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Quay (the adventure continues)

Page 43: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Quay (event notifications!)

Page 44: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Snyk

Page 45: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Snyk

Page 46: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Hayley…

Page 47: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

CNCF’s investment in security

Page 48: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

CNCF’s investment in security

1. Kubernetes Security Audit

Page 49: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

CNCF’s investment in security

1. Kubernetes Security Audit

2. Helm Security Audit

Page 50: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

CNCF’s investment in security

1. Kubernetes Security Audit

2. Helm Security Audit

3. Graduation Requirements

Page 51: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Helm Is The Package Manager For Kubernetes

To Review:

Page 52: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 53: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 54: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 55: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 56: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 57: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

snyk.io/helm-report

Page 58: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

How was the report put together?

Page 59: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

How was the report put together?

Page 60: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

How was the report put together?

Page 61: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

How was the report put together?

Page 62: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

How was the report put together?

Page 63: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 64: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 65: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 66: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 67: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 68: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 69: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 70: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Page 71: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Out of Bounds

Page 72: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Access Restriction Bypass

1. May not check user identity correctly

2. User may be able to get around permissions

3. User’s actions may not be logged correctly

Page 73: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

NULL Pointer Dereference

1. Pointer with value NULL is treated as though it pointed to a valid memory area

2. Can be a security issue, but more likely to be a reliability concern

Page 74: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

snyk.io

Final Helm Chart Security Thoughts

Page 75: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

• Snyk security - https://snyk.io• Helm Security Report - https://snyk.io/helm-report• Container Vulnerability Management -

https://snyk.io/product/container-vulnerability-management/

• Kubecon EU talks

• Helm Security Report (Apr. 1st) - https://sched.co/Zel7• Kubernetes Security Panel (Apr. 1st) - https://sched.co/ZeqF

Resources

Page 76: Helm Security - cncf.io...Snyk.io A Building Block: Integrated Into Other Tools An example is https://fluxcd.io

Snyk.io

Helm Security - Q&AMatt Farina - @mattfarinaHayley Denbraver - @hayleydenbRags - @ragss