snyk.io
Securing Serverless - 

By Breaking In
Guy Podjarny, Snyk
@guypod
snyk.io
About Me
• Guy Podjarny, @guypod on Twitter
• CEO & Co-founder at Snyk
• History:
• Cyber Security part of Israel Defense Forces
• First Web App Firewall(AppShield), Dynamic/Static Tester(AppScan)
• Security: Worked in Sanctum -> Watchfire -> IBM
• Performance: Founded Blaze -> CTO @Akamai
• O’Reilly author, speaker
snyk.io
Serverless Security: The Theory

(talk from ServerlessConf)
https://www.youtube.com/watch?v=CiyUD_rI8D8
https://www.infoq.com/articles/serverless-security
snyk.io
Today - straight to practice!
snyk.io
Agenda
• Show a demo serverless app
• Hack it
• Explain the security flaws and how to fix them
• Summary
• Q&A
snyk.io
Introducing our app…
snyk.io
Vulnerable Libraries
snyk.io
Example: Fetch file & store in s3
(Serverless Framework Example)
19 Lines of Code
2 Direct dependencies
19 dependencies(incl. indirect)
191,155 Lines of Code
snyk.io
snyk.io
Serverless does secure

OS dependencies
Just not app dependencies
snyk.io
1. Beware Vulnerable Libraries

(test during dev, monitor over time)
snyk.io
Side Note:

Snyk isn’t only for Serverless
snyk.io
Denial of Service
snyk.io
2. ReDoS can still be costly

(won’t take you down, but can hike up bill)
snyk.io
Beware

Resource Exhaustion Attacks
Not all your services elastically scale
snyk.io
Secrets
snyk.io
3. Avoid secrets in deployed code

(env variables aren’t enough - Use a KMS!)
snyk.io
Serverless platforms offer a

Key Management System
Just use it!
snyk.io
Granularity
snyk.io
4. Deploy granular functions

(shared function code = greater exposure)
snyk.io
AWS Security Policy
Easier
Policy 3Policy 2
Policy 1
Safer
snyk.io
Permissions
snyk.io
5. Use Granular Policies

(only allow each function its minimum permissions)
snyk.io
A function is a perimeter
That needs to be secured
Perimeter Perimeter
Perimeter
Perimeter
Perimeter
snyk.io
Immutability
snyk.io
6. Don’t rely on immutability

(Lambda - and others - reuse servers)
snyk.io
Serverless user is typically

Low Privilege
Reducing impact substantially, but not eliminating it
snyk.io
7. Worry about all functions

(Every available function increases your attack surface)
snyk.io
Summary
1. Beware vulnerable libraries
2. ReDoS can still be costly
3. Avoid secrets in deployed code
4. Deploy granular functions
5. Use Granular Permissions
6. Don’t rely on immutability
7. Worry about all functions
snyk.io
Serverless Security: The Theory

(talk from ServerlessConf)
https://www.youtube.com/watch?v=CiyUD_rI8D8
https://www.infoq.com/articles/serverless-security
snyk.io
Serverless is defined now.

Let’s build Security in.
Thank You!
Guy Podjarny, Snyk
@guypod

Securing Serverless - By Breaking In