Slide 1

Slide 1 text

AWS User Group Vancouver May 15 2018 Deploy Security Controls for Serverless Apps with Infrastructure as Code Tools Luis Colon ([email protected]) Senior Developer Advocate, AWS CloudFormation © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved

Slide 2

Slide 2 text

Agenda •Serverless security compared to traditional challenges •Top security concerns for serverless, with examples •Monitoring •Additional advice •Tools to harden and automate controls

Slide 3

Slide 3 text

Securing Serverless Applications EC2 Docker/K8s Lambda Data Centers

Slide 4

Slide 4 text

Securing Serverless Applications

Slide 5

Slide 5 text

OWASP Top 10

Slide 6

Slide 6 text

10 Most Critical Security Risks in Server Architectures

Slide 7

Slide 7 text

Insecure 3rd Party Dependencies

Slide 8

Slide 8 text

Insecure 3rd Party Dependencies

Slide 9

Slide 9 text

Insecure 3rd Party Dependencies 2 Direct 19 Indirect ~191k LOC

Slide 10

Slide 10 text

Avoiding Injection

Slide 11

Slide 11 text

Avoiding Injection

Slide 12

Slide 12 text

Avoiding Injection

Slide 13

Slide 13 text

Avoiding Injection Use JSON.parse() instead

Slide 14

Slide 14 text

Flow Manipulation

Slide 15

Slide 15 text

Monitoring and Logging •AWS CloudWatch •AWS CloudTrail •AWS Config •AWS ConfigRules •AWS X-Ray •Amazon Macie •Dashbird •…no need to write your own

Slide 16

Slide 16 text

Monitoring and Logging •AWS CloudWatch •AWS CloudTrail •AWS Config •AWS ConfigRules •AWS X-Ray •Amazon Macie •Dashbird •…no need to write your own

Slide 17

Slide 17 text

Monitoring and Logging •AWS CloudWatch •AWS CloudTrail •AWS Config •AWS ConfigRules •AWS X-Ray •Amazon Macie •Dashbird •…no need to write your own

Slide 18

Slide 18 text

Authentication and Permissions •Reuse existing systems •AWS Cognito •Auth0 •JWT •Least Privilege •No * in IAM policies •No individual permissions (use roles/groups) •Per function •Single responsibility •Protect secrets •Don’t expose in logs, code or alerts •Encryption •Rotate keys to mitigate events

Slide 19

Slide 19 text

Assume the worst • Use the tools at your disposal • Your own audits • Log logins, failed logins, account changes (password changes, email changes), confirm db transactions… • have thresholds on logins from an address, db connections, queries per second • DoW • Chaos engineering • Improve testing • Rotate credentials • Separate credentials and policies for different functions • Remove unused functions • Harden accounts and environments • Automate your controls

Slide 20

Slide 20 text

CIS AWS Foundations

Slide 21

Slide 21 text

CIS Rules •Prowler •Checks CIS •Adds other rules •Check per account/region

Slide 22

Slide 22 text

CIS Benchmark on AWS with CloudFormation

Slide 23

Slide 23 text

CloudWatch: Alarms & Rules

Slide 24

Slide 24 text

CloudWatch: Alarms & Rules

Slide 25

Slide 25 text

Config Rules

Slide 26

Slide 26 text

Config Rules

Slide 27

Slide 27 text

Lambda Functions

Slide 28

Slide 28 text

Summary •With serverless, you have a few less things to worry about, but still plenty of things… •Many standard best practices apply •Improve controls, logging, monitoring, etc. incrementally and on an ongoing basis •Automate your controls •Leverage the many tools available

Slide 29

Slide 29 text

Further Reading •Securing Serverless - a Newbie's Guide •https://www.jeremydaly.com/securing-serverless-a-newbies-guide/ •Yan Cui’s “Many-faced threats to Serverless security” – October 25, 2017 •Hacking Severless Runtimes whitepaper - Andrew Krug and Graham Jones – July 15, 2017 •Serverless Security implications—from infra to OWASP - Guy Podjarny – April 19, 2017 •The Ten Most Critical Security Risks in Serverless Architectures - PureSec – January 17, 2018 •AWS Doc: Lambda Best Practices •https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html

Slide 30

Slide 30 text

Links •Detect vulnerabilities on your dependencies https://snyk.io/ •Prowler for CLI checks: https://github.com/toniblyx/prowler •https://hackernoon.com/many-faced-threats-to-serverless-security-519e94d19dba •CIS Hardening Guidelines: https://aws.amazon.com/blogs/security/announcing-industry- best-practices-for-securing-aws-resources/ •https://github.com/awslabs/aws-security-benchmark •https://medium.com/dashbird/is-your-serverless-as-good-as-you-think-it- is-2baa3d36b1de •https://medium.com/@fastup/aws-iam-for-serverless-development-ba24be03cd2

Slide 31

Slide 31 text

Thanks :) Luis Colon, Sr. Developer Advocate, AWS CloudFormation [email protected]