Security Measures for Your Single Page Application
Building a secured application is always a puzzle for many of us. This is so true when you need to secure a Single Page Java Web application where many things are happening on the browser which is not in your control. This post discusses this problem along with some of the popular preventive measures available today to secure your single page web application.
What is Single Page Application?
In earlier days web browsers were not really powerful as we see them today. We used to build web applications by moving most of the processing logic to the server, leaving browser as a simple mean to render the DOM returned by server. Simple user action like clicking a button, scrolling page were all handled on server. Over a period browsers became more rich in terms of functionalities and we have witnessed JavaScript emerging as powerful scripting language.
A single-page application (SPA) is a web application that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server. In other words, a single page application makes use of modern browser capabilities and responds to user actions such as clicking a button, navigating to new page etc according to the logic defined in the JavaScript running on the browser. Let us go ahead and take a look at some of the common security attacks and some preventive measures for them.
Common Security Attacks
The security attacks discussed in this section are not really unique to SPA, rather they are applicable for any web application per se. However SPAs are more vulnerable to attack as major portion of the UI code is running on browser leaving all traces of user actions and server interactions on the browser running on end-user's machine.
Cross site scripting (XSS)
Cross site scripting (XSS) is a very common attack that injects malicious code into a vulnerable web application. There are two categories of XSS attacks:
Stored or Persistent XSS
Stored or Persistent XSS attacks happen when an application takes user input without validating the contents and save it on server database. Later when user navigates to a page which displays the user input from previous page, server retrieves this data from database and embeds the content in HTML DOM without proper HTML escaping.
For example, consider a page with a field that allows user to add comments. If there is no proper validation for this field, a hacker may try adding HTML script tags as value for this field. This can be link to malicious JavaScript file from a server owned by hacker as shown here: <script src=”http://some-server.com/malicious-script.js”> </script> Web app fails to prevent such input, and stores it as value for comment field. When the application displays this comment later, the browser parses the JavaScript tag that was added as value for comment and any regular HTML tag. This malicious script can harm the user in many ways. For instance, the script can contain code to POST customer data such as session cookie, unsecured access token etc to a REST API owned by hacker. A hacker can use this information later for hacking the user account.
Reflective XSS
In the case of reflective XSS, the malicious script is injected by appending to the URL. Let us take an example to get more clear picture. Suppose a hacker is visiting a site , for e.g: www.jobinesh.com. As next hacker may try appending some arbitrary parameter value to URL and if the site responds back with parameter typed as is without properly escaping it, then this site may be vulnerable for reflective XSS attack. Here is an example: https://www.owasp.org/index.php/Testing_for_Reflected_Cross_site_scripting_(OTG-INPVAL-001)
You can learn more about XSS here: https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
Here are some options to prevent XSS: https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet
Cross-Site Request Forgery (CSRF)
Cross site request forgery (CSRF), is an attack that steals the current user's logged-in session from browser(via Session Cookie) and uses that stolen session to execute unwanted action in an application to which a user is logged in.
You can learn more about CSRF here: https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)
To learn on preventive measures, visit the following link: https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet
What is Single Page Application?
In earlier days web browsers were not really powerful as we see them today. We used to build web applications by moving most of the processing logic to the server, leaving browser as a simple mean to render the DOM returned by server. Simple user action like clicking a button, scrolling page were all handled on server. Over a period browsers became more rich in terms of functionalities and we have witnessed JavaScript emerging as powerful scripting language.
A single-page application (SPA) is a web application that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server. In other words, a single page application makes use of modern browser capabilities and responds to user actions such as clicking a button, navigating to new page etc according to the logic defined in the JavaScript running on the browser. Let us go ahead and take a look at some of the common security attacks and some preventive measures for them.
Common Security Attacks
The security attacks discussed in this section are not really unique to SPA, rather they are applicable for any web application per se. However SPAs are more vulnerable to attack as major portion of the UI code is running on browser leaving all traces of user actions and server interactions on the browser running on end-user's machine.
Cross site scripting (XSS)
Cross site scripting (XSS) is a very common attack that injects malicious code into a vulnerable web application. There are two categories of XSS attacks:
Stored or Persistent XSS
Stored or Persistent XSS attacks happen when an application takes user input without validating the contents and save it on server database. Later when user navigates to a page which displays the user input from previous page, server retrieves this data from database and embeds the content in HTML DOM without proper HTML escaping.
For example, consider a page with a field that allows user to add comments. If there is no proper validation for this field, a hacker may try adding HTML script tags as value for this field. This can be link to malicious JavaScript file from a server owned by hacker as shown here: <script src=”http://some-server.com/malicious-script.js”> </script> Web app fails to prevent such input, and stores it as value for comment field. When the application displays this comment later, the browser parses the JavaScript tag that was added as value for comment and any regular HTML tag. This malicious script can harm the user in many ways. For instance, the script can contain code to POST customer data such as session cookie, unsecured access token etc to a REST API owned by hacker. A hacker can use this information later for hacking the user account.
Reflective XSS
In the case of reflective XSS, the malicious script is injected by appending to the URL. Let us take an example to get more clear picture. Suppose a hacker is visiting a site , for e.g: www.jobinesh.com. As next hacker may try appending some arbitrary parameter value to URL and if the site responds back with parameter typed as is without properly escaping it, then this site may be vulnerable for reflective XSS attack. Here is an example: https://www.owasp.org/index.php/Testing_for_Reflected_Cross_site_scripting_(OTG-INPVAL-001)
You can learn more about XSS here: https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)
Here are some options to prevent XSS: https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet
Cross-Site Request Forgery (CSRF)
Cross site request forgery (CSRF), is an attack that steals the current user's logged-in session from browser(via Session Cookie) and uses that stolen session to execute unwanted action in an application to which a user is logged in.
You can learn more about CSRF here: https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)
To learn on preventive measures, visit the following link: https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet
Nice journal terribly fascinating and helpful info on your website. Thanks for sharing the journal and this nice info that is certainly about to facilitate us. We will be updating this post with new information to our knowledge box.
ReplyDeleteCheapest dedicated
Such a wonderful article! I learned more info to your post and It's attractive to me. Surely I will share with my friends and Keep it up a great job!
ReplyDeleteTableau Training in Chennai
Tableau Course in Chennai
Tableau Training Institutes in Chennai
Pega Training in Chennai
Primavera Training in Chennai
Unix Training in Chennai
Tableau Training in Chennai
Tableau Course in Chennai
ReplyDeleteI would definitely thank the admin of this blog for sharing this information with us. Waiting for more updates from this blog admin.
web designing training in chennai
web designing course
ccna Training in Chennai
PHP Training in Chennai
ReactJS Training in Chennai
Web Designing Course in chennai
Web designing training in chennai
What a fabulous post. Would like to thank the admin for sharing this post in our vision.
ReplyDeleteSpoken English Classes in Chennai
Spoken English Class in Chennai
Spoken English in Chennai
Best Spoken English Classes in Chennai
Best Spoken English Institute in Chennai
IELTS Coaching in Chennai
English Speaking Classes in Mumbai
Spoken English Classes in Anna Nagar
Spoken English Classes in Chennai Anna Nagar
IELTS Classes in Mumbai
Wonderful blog I ever read. Thank you.
ReplyDeleteSEO Training in Coimbatore
SEO Course in Coimbatore
SEO Course
SEO Training in Bangalore
SEO Course in Bangalore
Best SEO Training in Bangalore
I read awesome post after a long time.I am very satisfied with your way of writing.Expect the next post in the upcoming days.
ReplyDeleteAngularJS Training in OMR
Web designing Training in Anna Nagar
AngularJS Training in Tambaram
Web Designing Training in OMR
AngularJS Training in Porur
Web Designing Training in Porur
AngularJS Training in Velachery
Web designing Training in T Nagar
Network Security is a considering fact in the world of information technology. Network Security Solution Providers played an important role in defending these kind of cyber attacks.
ReplyDeleteThe blog you have shared is supreme and more useful for... Thanks for sharing with us...
ReplyDeleteHacking Course in Coimbatore
ethical hacking training in coimbatore
ethical hacking course in bangalore
ethical hacking institute in bangalore
Tally course in Madurai
Software Testing Course in Coimbatore
Spoken English Class in Coimbatore
Web Designing Course in Coimbatore
Tally Course in Coimbatore
Tally Training Coimbatore
Nice Blog Post, it's very informative regarding IELTS courses. keep sharing.....thanks
ReplyDeleteIELTS Coaching Institute in Jaipur
This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points. To appreciate this I like to share some useful information regarding Microsoft Azure which is latest and newest,
ReplyDeleteRegards,
Ramya
Azure Training in Chennai
Azure Training Center in Chennai
Best Azure Training in Chennai
Azure Devops Training in Chenna
Azure Training Institute in Chennai
Azure Training in Chennai OMR
Azure Training in Chennai Velachery
Azure Online Training
Azure Training in Chennai Credo Systemz
DevOps Training in Chennai Credo Systemz
Best Cloud Computing Service Providers
hi
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThanks for sharing your valuable information to us and knowledgeable also, its very useful to me, Keep on doing it, waiting for next update form you!!!
ReplyDeleteBest Aviation Academy in Chennai
Best Air hostess Training in Chennai
Pilot Training in Chennai
Airport Ground handling Training in Chennai
Airport Flight Dispatcher Trainee in Chennai
RTR - Aero Training in Chennai
Cabin Crew Training in Chennai
Aviation Academy in Chennai
Aviation training institute in Chennai
I read your blog now share great information here. Web Designer
ReplyDelete
ReplyDeleteThanks for sharing. In this article you shared lots of interesting information. Thanks a lot.
Placement Training in Chennai
best training and placement institute in chennai
Placement Training in Porur
soft skills training in chennai
soft skills training institutes in chennai
clinical sas training in chennai
SAS Training in Chennai
Placement Training in Chennai
Informative blog! it was very useful for me.Thanks for sharing. Do share more ideas regularly.
ReplyDeleteSpoken English Classes in Adyar
Spoken English Classes in T-Nagar
Spoken English Classes in Porur
Spoken English Class in Anna Nagar
IELTS Chennai
IELTS Classes in Mumbai
One of the best blogs that I have read till now. Thanks for your contribution to sharing such useful information.
ReplyDeleteEnglish Speaking Classes in Mulund
English Speaking Classes in Mulund West
English Speaking Course in Mulund
Spoken English Classes in Chennai
IELTS Coaching in Chennai
IELTS Coaching in Mumbai
English Speaking Classes in Mumbai
The presentation of your blog is easily understandable... Thanks for it...
ReplyDeletejava course in coimbatore
Best Java Training Institutes in Bangalore
Spoken English Class in Madurai
Selenium Training in Coimbatore
SEO Training in Coimbatore
Tally Training Coimbatore
best hand blender in india
ReplyDeletesuch a nice blog....
ReplyDeleteWireless Access Points To gain business advantage
enhance efficiencies
organizations across the world
increasingly opting for mobility solutions
ReplyDeletevery helpful
Best Security Systems
Thanks for sharing this blog. i'm really impresses with this blog. it teaches me a lot.
ReplyDeleteweb design training programs
php institute in chennai
magento course in chennai
arts whatsapp groups
ReplyDeleteThe ethereumpro our website is one of the world's most prominent ethereum mining profitability calculator that is working for excavators wherever all through the world. It is an enrolled site having a brilliant working history in mining. Likewise, giving surprising associations to their customers. The decision highlight of this site is it enrolled. Additionally, check from a wide extent of accidents or fakes. Visit our site it is secure for this system.
ReplyDeleteIn present era where cyberattacks have become normal, this blog helped me in understanding Business Security Solutions Houstoncan avoid normal security flaws within a given network.
ReplyDeleteit was a great informative blog. thanks for it
ReplyDeleteselenium testing courses in Bellandur|selenium testing courses in Marathahalli
python Training in Bellandur|python Training in Marathahalli
ReplyDeleteI went through your blog its really interesting and holds an informative content. Thanks for uploading such a wonderful blog.
python classes near Bellandur|python classes in Marathahalli
selenium testing classes in Bangalore|selenium testing classes near Bellandur
Thank you much more for your valuable information, keep going touch with us!
ReplyDeletePower BI Training in Chennai
Power BI Training Fees in Chennai
Embedded System Course Chennai
Linux Training in Chennai
Advanced Excel Training in Chennai
Oracle DBA Training in Chennai
Spark Training in Chennai
JMeter Training in Chennai
Appium Training in Chennai
Unix Training in Chennai
Power BI Training in Velachery
Thank you for delivering the great blog and keep doing...
ReplyDeleteLinux Training in Chennai
Linux Course in Chennai
Advanced Excel Training in Chennai
Oracle Training in Chennai
Job Openings in Chennai
Unix Training in Chennai
Tableau Training in Chennai
Oracle DBA Training in Chennai
Power BI Training in Chennai
Pega Training in Chennai
Spark Training in Chennai
Thanks for this great content.
ReplyDeleteDevOps Online Training
Superb blog. Thanks for sharing such a wonderful content and guest post.
ReplyDeletesalesforce Training in Bangalore
uipath Training in Bangalore
blueprism Training in Bangalore
Nice article, its very informative content..thanks for sharing...Waiting for the next update...
ReplyDeleteManual Testing Training in Chennai
manual testing course fees in chennai
Manual Testing Training
Manual Testing Training in OMR
Manual Testing Training in Porur
Mobile Testing Training in Chennai
core java training in chennai
DOT NET Training in Chennai
Hibernate Training in Chennai
Html5 Training in Chennai
The registrations and auditions for the Bigg Boss 13 are going to start soon. The official list of contestants is not yet announced by the officials. That will be announced by the makers on the inaugural day which is 15 the of September. bigg boss 13 contestants name list with photo and details Though a few rumored names are coming up as the expected celebrity contestants of the year. They are Nia Sharma, Raghav Juyal, Punit Pathak, Divyanka Tripathi, Garima Chaurasia, Ridhima Pandit, Aditya Narayan, Jasmin Bhasin, Zain Imam, Bhuvan Bam, Chetna Pande, Krystle D’Souza, and Devoleena Bhattacharjee. This year too, the show will be back with a new theme and the star host, Salman Khan. Though the theme is not declared yet officially. Stay tuned with us to know more about the show Bigg Boss 13.
ReplyDeleteThe registrations and auditions for the Bigg Boss 13 are going to start soon. The official list of contestants is not yet announced by the officials. That will be announced by the makers on the inaugural day which is 15 the of September. bigg boss 13 contestants name list with photo Though a few rumored names are coming up as the expected celebrity contestants of the year. They are Nia Sharma, Raghav Juyal, Punit Pathak, Divyanka Tripathi, Garima Chaurasia, Ridhima Pandit, Aditya Narayan, Jasmin Bhasin, Zain Imam, Bhuvan Bam, Chetna Pande, Krystle D’Souza, and Devoleena Bhattacharjee. This year too, the show will be back with a new theme and the star host, Salman Khan. Though the theme is not declared yet officially. Stay tuned with us to know more about the show Bigg Boss 13.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThe great information that you shared. It will help all of them. Thanks for posting. Keep maintain the updates
ReplyDeletePHP Development Companies in Chennai
|
PHP Development Company
|
PHP web development services
|
I went through your blog its really interesting and holds an informative content. Thanks for uploading such a wonderful blog.
ReplyDeleteaws Training in Bangalore
python Training in Bangalore
hadoop Training in Bangalore
angular js Training in Bangalore
bigdata analytics Training in Bangalore
The article was up to the point and described the information very effectively. Thanks to blog author for wonderful and informative post.
ReplyDeletewebsite designing Pakistan
Nice blog, thanks for sharing with us this interesting blog. Visit OGEN Infosystem for Website Designing and PPC Services in Delhi, India.
ReplyDeleteWeb Development Company
Now you can download office offline and online both. Office facilitates to activate it online.For that you have need of activation key and go to official site, login your account and enter valid key and activate it.Other wise you can install and then put key and activate offline also on your computer system successfully. If you get any of problem on your computer so contact to the support team .
ReplyDeleteBullguard Login
Office Login
Office Login
Mcafee Login
AVG Login
Norton Login
webroot login
webroot.com/safe
Turbotax Login
TurboTax is the best Accounting Software to maintain your tax pay account. You use it growth your business for this reason, that its have a brilliant team who always available for customers support and satisfy with them their answer, so if you have any issue with Turbotax visit here TurboTax Support and get free.
ReplyDeleteDragon naturally speaking support
HP Printer Offline
Office.com/setup
TurboTax Support
Garmin Login
Avg login
Thanks for sharing this valuable information and we collected some information from this post.
ReplyDeleteaws Training in Bangalore
python Training in Bangalore
hadoop Training in Bangalore
angular js Training in Bangalore
bigdata analytics Training in Bangalore
Very interesting, good job and thanks for sharing such a good blog. your article is so convincing that I never stop myself to say something about it. You’re doing a great job. Keep it up
ReplyDeleteaws Training in Bangalore
python Training in Bangalore
hadoop Training in Bangalore
angular js Training in Bangalore
bigdata analytics Training in Bangalore
check out
ReplyDeleteBest Security Systems
Financial sector has undergone drastic technological shifts in a comparatively short span of time. The shifts have been incorporated because of Growing Technology, Customer Demands, etc. Take a glance over some of the legacy Cross-platform App Development Company. These are so dynamic and efficient that it will cost you less time, more functionality, good output returns.
ReplyDeletenice work
ReplyDeletephp course in chennai
php developer training institution in chennai
php training in chennai
Thanks for taking time to share this useful blog...
ReplyDeleteDOT NET Training in Chennai
DOT NET Training in Bangalore
.net coaching centre in chennai
dot net training institutes in bangalore
aws training in bangalore
Data Science Courses in Bangalore
DevOps Training in Bangalore
PHP Training in bangalore
spoken english classes in bangalore
dot net training institute in marathahalli