Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IndexedDB vs Cookie Security

As you know, IndexedDB and Cookie are both used for persistent storage on web browser.

Cookie-related security task has some aspects, which are Session Fixation or Session Hijacking. Attackers often use the below methods to achieve these.

  • Cross-site Scripting (XSS)

  • Cross-site Request Forgery (CSRF)

  • Man in the Middle (MitM)

I've been doing some research about IndexedDB security. However, there are not so many documents about this stuff.

My questions are:

  • When I use IndexedDB instead of cookie, will I face the same security tasks? Why?
  • How can I make IndexedDB more secure?
like image 211
user3925697 Avatar asked Feb 15 '15 08:02

user3925697


People also ask

How safe is IndexedDB?

The short answer is IndexedDB is vulnerable to malware and physical takeover attacks. It's better than many options because cryptography is done outside the browser execution environment, but it's not totally secure.

Why is it better to use IndexedDB instead of localStorage?

IndexedDB offers several benefits over localStorage. For instance, IndexedDB doesn't block the DOM when used with a worker, unlike localStorage. However, localStorage is slightly faster than IndexedDB. The API of localStorage is also much easier to get started with, making it the more popular choice.

Which is more secure localStorage or cookies?

Conclusion. Both cookies and localStorage are vulnerable to XSS attacks. However, cookie-based token storage is more likely to mitigate these types of attacks if implemented securely. The OWASP community recommends storing tokens using cookies because of its many secure configuration options.

Should you use IndexedDB?

While IndexedDB makes is possible to store large, nested objects as a single record (and doing so is admittedly quite convenient from a developer perspective), this practice should be avoided.


1 Answers

When I use IndexedDB intead of cookie, will I face the same security tasks? Why?

Consider that a cookie is sent to the server with the request whereas IndexedDB is only read once a page has loaded.

If you DO find some resources where people more knowledgeable than me have discussed the issues you raise please respond with them here.

like image 199
dgrogan Avatar answered Oct 02 '22 23:10

dgrogan