Dashbird.io Profile picture
Dec 9, 2021 โ€ข 19 tweets โ€ข 6 min read
"If you migrate to a #serverless architecture, you don't have to worry about anything anymore! โ˜€๏ธ"

That's obviously not true for many points, including security! ๐Ÿ”

How ๐—ฐ๐—ฟ๐—ถ๐˜๐—ถ๐—ฐ๐—ฎ๐—น ๐—น๐—ผ๐—ด๐—ด๐—ถ๐—ป๐—ด helps to secure your application โ†“
๐—ง๐—ต๐—ฟ๐—ฒ๐—ฎ๐—ฑ ๐—ข๐˜ƒ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ ๐Ÿงต

โ€ข It's not all fun & games
โ€ข Why Logging is crucial
โ€ข Invocation/Event Inputs
โ€ข Response Payload
โ€ข Performance Levels
โ€ข Authentication Requests
โ€ข Service Usage Indicators
โ€ข The 4 W's
โ€ข What you should never log ๐Ÿ”ฅ

{ 1 | 17 }
๐—œ๐˜โ€™๐˜€ ๐—ป๐—ผ๐˜ ๐—ฎ๐—น๐—น ๐—ณ๐˜‚๐—ป ๐—ฎ๐—ป๐—ฑ ๐—ด๐—ฎ๐—บ๐—ฒ๐˜€!

Serverless brings in a lot of benefits and helps developers to focus more on actually focusing on writing their apps instead of running and maintaining them

But it's not the holy grail that drops all responsibilities

{ 2 | 17 }
You still need to be aware of your web threats like cross-site scripting and #SQL injections.

And there's more:
โ€ข Broken Authentication
โ€ข Insecure Storage of App Secrets
โ€ข Insecure deployment settings
โ€ข Misuse of permissions
โ€ข Improper exception handling

{ 3 | 17 }
Additionally, serverless brings in unique threats to take care of like #DoSattacks for ๐—ณ๐—ถ๐—ป๐—ฎ๐—ป๐—ฐ๐—ถ๐—ฎ๐—น ๐—ฒ๐˜…๐—ต๐—ฎ๐˜‚๐˜€๐˜๐—ถ๐—ผ๐—ป.

A thing that's often missed out on:
Logging is crucial for your application security as it can lead to huge issues later.

{ 4 | 17 }
No system is 100% secure, but #logging will help to understand the flaws that were used to compromise our system.
We can use this information to fix flaws, build blocklists, or identify compromised accounts.

{ 5 | 17 }
๐—œ๐—ป๐˜ƒ๐—ผ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป/๐—˜๐˜ƒ๐—ฒ๐—ป๐˜ ๐—œ๐—ป๐—ฝ๐˜‚๐˜๐˜€

A first start is to log the inputs that are received by each function - regardless of whether they are internal or external.
It can help to retrace steps that were taken by the attacker or how validations were avoided.

{ 6 | 17 }
๐—ฅ๐—ฒ๐˜€๐—ฝ๐—ผ๐—ป๐˜€๐—ฒ ๐—ฃ๐—ฎ๐˜†๐—น๐—ผ๐—ฎ๐—ฑ

Similar to invocation inputs, logging outputs help to analyze and mitigate security breaches.
In the worst-case - not being able to stop attacks - we can at least identify what information was stolen.

{ 7 | 17 }
๐—ฃ๐—ฒ๐—ฟ๐—ณ๐—ผ๐—ฟ๐—บ๐—ฎ๐—ป๐—ฐ๐—ฒ ๐—Ÿ๐—ฒ๐˜ƒ๐—ฒ๐—น๐˜€

If a function performs badly and now takes 2.5s instead of 250ms to complete a task, we can end up in financial misery as we're paying what we use in #serverless land.

Logging for this purpose depends heavily on the use case.

{ 8 | 17 }
Nevertheless, it's vital to have this in mind when planning the application critical logs.

At Dashbird, we're also collecting & aggregating detailed insights about all of your function's performances. Having this in a single place will save time & money.

{ 9 | 17 } Image
๐—”๐˜‚๐˜๐—ต๐—ฒ๐—ป๐˜๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ฅ๐—ฒ๐—พ๐˜‚๐—ฒ๐˜€๐˜๐˜€

If your app has a protected area, it's important to log for authentication requests, especially failed ones.

Look for odd requests or patterns.
Maybe there's a spike in failed requests for emails that aren't even known

{ 10 | 17 }
This could indicate that someone's scanning a list of leaked passwords to find potentially vulnerable accounts in your app

Authentication logging can alert that someone is scouting our app for weak spots.
By that, you can introduce countermeasures before an attack

{ 11 | 17 }
External sources like ๐—›๐—ฎ๐˜ƒ๐—ฒ ๐—œ ๐—ฏ๐—ฒ๐—ฒ๐—ป ๐—ฃ๐˜„๐—ป๐—ฒ๐—ฑ can be very helpful here

Preemptively search for compromised accounts & lock them, asking for a password reset.
Your customers will love to receive a preventive serverless security alert

haveibeenpwned.com

{ 12 | 17 }
๐—ฆ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฐ๐—ฒ ๐—จ๐˜€๐—ฎ๐—ด๐—ฒ ๐—œ๐—ป๐—ฑ๐—ถ๐—ฐ๐—ฎ๐˜๐—ผ๐—ฟ๐˜€

It's always a good idea to log service usage indicators
Even with carefully planned costs & pricing structures, there could be things that went unseen
Maybe mistakes were made at dimensioning costs & pricing of our app

{ 13 | 17 }
Maybe there are cost spikes as some authorization logics are bypassed and someone is free-riding on our backs.

Logs will help to
โ€ข narrow down contributing services
โ€ข who was contributing to the cost spikes
โ€ข where services abused in a way we didn't expect?

{ 14 | 17 }
๐—ง๐—ต๐—ฒ ๐Ÿฐ ๐—ช'๐˜€

Based on OWASP Logging Cheat Sheet Recommendations, we should be logging:

โ€ข When
โ€ข Where
โ€ข Who
โ€ข What

...in every function invocation!
This applies to all items that we discussed.

cheatsheetseries.owasp.org/cheatsheets/Loโ€ฆ

{ 15 | 17 }
We at Dashbird.io help you with all of them by providing the observability that lacks your serverless environment while providing monitoring & alerting

Spend less time debugging with detailed, noise-free insights and always be on top of what's going on

{ 16 | 17 } Image
A last reminder to complete this thread:

User-related information like personal or sensitive data should ๐—ป๐—ฒ๐˜ƒ๐—ฒ๐—ฟ be logged!
Make sure to filter these out as it might get you in big trouble, not only with regulatory authorities.

{ 17 | 17 }
Thank you for reading!

You can find the complete article and more serverless-related tutorials, news, and insights at @thedashbird blog โœ๏ธ

dashbird.io/blog/serverlesโ€ฆ

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Dashbird.io

Dashbird.io Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @thedashbird

Jun 28
Regardless if youโ€™re an AWS Lambda expert or youโ€™re new to Lambda, thereโ€™s ๐—ฎ๐—น๐˜„๐—ฎ๐˜†๐˜€ ๐˜€๐—ผ๐—บ๐—ฒ๐˜๐—ต๐—ถ๐—ป๐—ด ๐—ป๐—ฒ๐˜„ ๐˜๐—ผ ๐—น๐—ฒ๐—ฎ๐—ฟ๐—ป ๐Ÿ“š

Topic for Today: ๐—Ÿ๐—ฎ๐—บ๐—ฏ๐—ฑ๐—ฎ ๐—˜๐—ฟ๐—ฟ๐—ผ๐—ฟ ๐—›๐—ฎ๐—ป๐—ฑ๐—น๐—ถ๐—ป๐—ด ๐Ÿ›

Differences in Lambda & Step Functions โ†“
๐—ข๐˜ƒ๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„ ๐Ÿงต

โ€ข Lambda Retry Behaviour
โ€ข Consequences
โ€ข Idempotency
โ€ข Error Handling at Step Functions
โ€ข Wrap up
Lambda functions can fail ๐—ฎ๐—ป๐—ฑ ๐˜๐—ต๐—ฒ๐˜† ๐˜„๐—ถ๐—น๐—น.
When they do, it's of these situations:

โ€ข ๐—Ÿ๐—ฎ๐—ฐ๐—ธ ๐—ผ๐—ณ ๐—บ๐—ฒ๐—บ๐—ผ๐—ฟ๐˜† - your process exceeded the functions allocated memory and will exit with "Process exited before completing the request."
Read 19 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(