Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Security in serverless world (get.net)

857 views

Published on

AWS has taken over the responsibilities of patching the OS and securing the underlying physical infrastructure that runs your serverless application, so what’s left for you to secure? Quite a bit it turns out.

The OWASP top 10 is as relevant to you as ever; DOS attacks are still a threat even if you can probably brute force your way through it as AWS auto-scales Lambda functions automatically; and did you know attackers can easily steal your AWS credentials via your application dependencies?

In addition to the traditional threats, serverless applications have more granular deployment units and therefore there are more things to configure and secure, and the tools and practices are still catching up with this fast changing world.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Security in serverless world (get.net)

  1. 1. Security in the Serverless World
  2. 2. Yan Cui http://theburningmonk.com @theburningmonk Principal Engineer @
  3. 3. available in Austria, Switzerland, Germany, Japan, Canada, Italy and US
  4. 4. available on 30+ platforms
  5. 5. ~1,000,000 concurrent viewers
  6. 6. We’re hiring! Visit engineering.dazn.com to learn more. follow @dazneng for updates about the engineering team
  7. 7. follow @dazneng for updates about the engineering team We’re hiring! Visit engineering.dazn.com to learn more. WE’RE HIRING!
  8. 8. AWS user since 2009
  9. 9. http://bit.ly/yubl-serverless
  10. 10. Shared Responsibility Model
  11. 11. Shared Responsibility Model
  12. 12. protection from OS attacks Amazon automatically apply latest patches to host VMs
  13. 13. still have to patch your code vulnerable code, 3rd party dependencies, etc.
  14. 14. https://snyk.io/blog/owasp-top-10-breaches
  15. 15. https://snyk.io/blog/owasp-top-10-breaches Known Vulnerable Components cause 24% of the top 50 data breaches
  16. 16. https://snyk.io/blog/77-percent-of-sites-use-vulnerable-js-libraries
  17. 17. http://bit.ly/2topw5I
  18. 18. sanitise inputs & outputs (standardise and encapsulate into shared lib)
  19. 19. http://bit.ly/2gSHtay Broken Access Control Insecure Direct Object Reference Information Leakage GraphQL Injection
  20. 20. http://bit.ly/2uKhGXF
  21. 21. http://bit.ly/2uKhGXF
  22. 22. app dependencies is a attack surface BIGGER than you think
  23. 23. your dependencies
  24. 24. your dependencies transient dependencies
  25. 25. https://david-dm.org/request/request?view=tree
  26. 26. https://snyk.io
  27. 27. security updates are often bundled with unrelated feature and API changes
  28. 28. your security is as strong as its weakest link
  29. 29. OS Application Dependencies physical infrastructure NPM Authors Container runs in runs in runs in has hosted by published by pushes to Developers develops uses Users guardsprotects Networking runs on needs Source Code has maintains
  30. 30. OS Application Dependencies physical infrastructure NPM Authors Container runs in runs in runs in has hosted by published by pushes to Developers develops uses Users guardsprotects Networking needs runs on this is where an attacker will target in a movie Source Code has maintains
  31. 31. OS Dependencies physical infrastructure NPM Authors Container runs in runs in runs in has hosted by published by pushes to Developers develops uses Users guardsprotects Application A9 Networking runs on needs Source Code has maintains A1, A3, …
  32. 32. people are often the WEAKEST link in the security chain
  33. 33. OS Dependencies physical infrastructure NPM Authors Container runs in runs in runs in has hosted by published by pushes to Developers develops uses Users guardsprotects Application phishing… Networking runs on needs Source Code has maintains
  34. 34. OS Dependencies physical infrastructure NPM Authors Container runs in runs in runs in has hosted by published by pushes to Developers develops uses Users guardsprotects Application brute force, known account leaks, … Networking runs on needs Source Code has maintains
  35. 35. OS Dependencies physical infrastructure NPM Authors Container runs in runs in runs in has hosted by published by pushes to Developers develops uses Users guardsprotects Application brute force, known account leaks, … Networking runs on needs Source Code has maintains
  36. 36. http://bit.ly/2sFDwYX …obtained publish access to 14% of npm packages…
  37. 37. http://bit.ly/2sFDwYX debug, request, react, co, express, moment, gulp, mongoose, mysql, bower, browserify, electron, jasmine, cheerio, modernizr, redux, …
  38. 38. http://bit.ly/2sFDwYX total downloads/month of the unique packages which I got myself publish access to was 1 972 421 945, that’s 20% of the total number of d/m directly.
  39. 39. 20% of all monthly NPM downloads…
  40. 40. brute force known account leaks from other sources leaked NPM credentials (github, etc.)
  41. 41. http://bit.ly/2sFDwYX
  42. 42. http://bit.ly/2sFDwYX 662 users had password “123456” 172 — “123” 124 — “password”
  43. 43. WTF!?!?
  44. 44. oh god, that was too easy…
  45. 45. compromised package is a transient dependency sigh…
  46. 46. still “works”…
  47. 47. npmjs.com/~hacktask
  48. 48. rm -rf / !!!
  49. 49. NPM default - get latest “compatible” version, ie. 1.X.X
  50. 50. clean install (eg. on CI server) will download the latest, compromised package without any code change… NPM default - get latest “compatible” version, ie. 1.X.X
  51. 51. use npm shrinkwrap or upgrade to NPM 5 or above
  52. 52. not specific to Node.js or NPM
  53. 53. the attackers are in…
  54. 54. the attackers are in… what now?
  55. 55. Shared Responsibility Model
  56. 56. who can invoke the function?
  57. 57. what can the function access?
  58. 58. Least Privilege Principle
  59. 59. everything here is trusted
  60. 60. sensitive data
  61. 61. http://bit.ly/2zHvbcB
  62. 62. always public access is controlled via IAM
  63. 63. http://bit.ly/2lNInES
  64. 64. adds up to 10s to cold start!! http://bit.ly/2lNInES
  65. 65. compromised servers allow attacker to access all of your sensitive data!
  66. 66. implement authentication for internal APIs
  67. 67. always public implement authentication with API keys, Cognito, or custom authorizer functions
  68. 68. use AWS_IAM authentication for internal APIs
  69. 69. minimise function’s access
  70. 70. requires developer discipline
  71. 71. AWS Lambda docs Write your Lambda function code in a stateless style, and ensure there is no affinity between your code and the underlying compute infrastructure. http://amzn.to/2jzLmkb
  72. 72. S3 AWS IoT DynamoDB RDS EventStore Elasticsearch Couchbase Redshift Neo4j Google BigQuery
  73. 73. secure sensitive data both at rest and in-transit
  74. 74. leverage server-side encryption
  75. 75. http://amzn.to/1N3Twb8
  76. 76. http://amzn.to/1xF41eX
  77. 77. http://amzn.to/2tgvFR2
  78. 78. Least Privilege Principle
  79. 79. Disposability is a virtue
  80. 80. AWS Lambda docs Delete old Lambda functions that you are no longer using. http://amzn.to/2jzLmkb
  81. 81. easier said than done…
  82. 82. identifying component ownership in a big IT organization is challenging
  83. 83. identifying ownership of individual functions is much harder
  84. 84. source: http://www.digitalattackmap.com
  85. 85. more likely to scale through DoS attacks
  86. 86. DoS + per exec billing = Denial of Wallet problem
  87. 87. have to choose between a DoS and a DoW problem…
  88. 88. AWS Shield Advanced also gives you access to the AWS DDoS Response Team (DRT) and protection against DDoS related spikes in your ELB, CloudFront or Route 53 charges.
  89. 89. async sync S3 SNS SES CloudFormation CloudWatch Logs CloudWatch Events Scheduled Events CodeCommit AWS Config http://amzn.to/2vs2lIg Cognito Alexa Lex API Gateway streams DynamoDB Stream Kinesis Stream Lambda handles retries (twice, then DLQ)
  90. 90. http://bit.ly/2v7F2E4
  91. 91. DoS attack 2+ Retries+ ?
  92. 92. DoS attack Regex DoS attack long Lambda timeout 2+ Retries+ ?
  93. 93. Day 1
  94. 94. Day 2
  95. 95. no long-lived compromised servers
  96. 96. containers are reused, avoid sensitive data in /tmp
  97. 97. https://www.puresec.io/function-shield
  98. 98. no accidentally exposed directories
  99. 99. http://bit.ly/2tlGTbc
  100. 100. monitor activities in unused regions using CloudWatch Events
  101. 101. set up billing alarms in unused regions
  102. 102. watertight compartments that can contain water in the case of hull breach or other leaks
  103. 103. Michael Nygard
  104. 104. least privilege principle
  105. 105. per function policies
  106. 106. account level isolation
  107. 107. Recap
  108. 108. app dependencies is a attack surface BIGGER than you think
  109. 109. sanitise inputs and outputs
  110. 110. Least Privilege Principle
  111. 111. here’s your per function policy NEXT!
  112. 112. S3 AWS IoT DynamoDB RDS EventStore Elasticsearch Couchbase Redshift Neo4j Google BigQuery encrypt data at rest
  113. 113. S3 AWS IoT DynamoDB RDS EventStore Elasticsearch Couchbase Redshift Neo4j Google BigQuery and in-transit
  114. 114. delete unused functions.
  115. 115. DoS DoW* * Denial of Wallet
  116. 116. no server* no OS attacks no long lived compromised servers * I know I know, there’s still a server somewhere, but it’s managed and secured by AWS engineers who can do a much better job of it than most of us can; and the servers are ephemeral and short-lived
  117. 117. don’t be an unwilling bit miner
  118. 118. don’t be an unwilling bit miner safeguard your credentials…
  119. 119. prod dev compartmentalise breaches
  120. 120. people are often the WEAKEST link in the security chain
  121. 121. @theburningmonk theburningmonk.com github.com/theburningmonk
  122. 122. API Gateway and Kinesis Authentication & authorisation (IAM, Cognito) Testing Running & Debugging functions locally Log aggregation Monitoring & Alerting X-Ray Correlation IDs CI/CD Performance and Cost optimisation Error Handling Configuration management VPC Security Leading practices (API Gateway, Kinesis, Lambda) Canary deployments http://bit.ly/prod-ready-serverless get 40% off with: ytcui

×