Preventing Cross-Site Request Forgery(CSRF) attacks - auth0.com/blog/cross-sit…

#security #websecurity #sec #infosec
what is Cross-Site Request Forgery?

it is a type of attack performed on web apps in order to carry out a malicious action without user's explicit consent.
these 'malicious actions' could be anything. for example: changing email address, personal information etc

#websecurity
how it is performed?

* attacker leads the user to perform an action(through email, website etc)

* attacker makes a request on behalf of the user(by using a hidden form, for example)

* vulnerable website sees it as a genuine action(by verifying session cookie)

#CodeNewbie
do CSRF attacks work on token-based auth?

No. token-based auth mechanisms are not vulnerable to as they are stored in either sessionStorage or localStorage.
however, token-based auth systems could be vulnerable to Cross-Site Scripting(XSS) attacks.

#XSS #infosec #webdev
why vulnerable site treats CSRF requests as genuine actions?

that's because authentication is done through session and cookie(session-based auth mechanism). so, when the browser makes a request to the vulnerable (...cntd.)
.... web server(whether from the attacker's website or iframe, it does not matter), it sends the cookie as well. this makes the vulnerable server to think it as a genuine request.

attack performed!

#CodeNewbie #JavaScript #HTML5 #code
preventing CSRF attacks

* use CSRF token in forms
* double submit cookie strategy
* sameSite cookie (in server, `cookie.sameSite = 'strict'`)
* verifying legitimacy of the client (Origin and Referer headers)

#CodeNewbie #programming #code #webdev #Developer #javascript

• • •

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

Keep Current with //

// 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 @CookiesNotFound

18 Oct
==== Caching ====

caching is the process of storing data temporarily. a cache generally lives for a relatively small amount of time. examples: browser cache, DNS caching etc.

reasons to utilize caching: 👇
(thread)

#cache #web #dev #CodeNewbie #100DaysOfCode
* save bandwidth (and reuse resources)
when using cache mechanism in client-side applications, it ensures that cached files won't be downloaded again from the server.

* save processing power
when writing algorithms, it could be optimized using a caching mechanism...

2/n
...caching would help add memorization to that algorithm, enabling it NOT to repeat the same calculations again and again.

* save time
we all visit websites mostly by domain names(and rarely using the IP address). having cached DNS records would let the resolver use...

3/n
Read 7 tweets
8 Oct
What are some database engines that works great with serverless architecture?

#database #CodeNewbie #Serverless #javascript
Note to Self: MongoDB can be used with serverless functions by caching the initial connection.
database engines were designed much before the serverless architecture was a thing.

a connection to the database is always persistent. meaning, it lasts for a really long time.
also, there is a limit(imposed by DBaaS provider) on how many connections a database can have at any given timestamp.

a lambda function is invoked every time a client(generally, browsers) creates a connection. this means a new connection to the database as well.
Read 6 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

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

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!