Intro to Security in Web Development

Projected Time

About 90-180 minutes

Prerequisites

A basic understanding of following is required:

Motivation

Apprentices will learn secure development basics, common pitfalls, and how to avoid them.

Website attacks and cyber attacks are growing in numbers every day and the importance of creating a secure website and website security, in general, is increasing rapidly. So, being secure in the online world becomes more and more important every day and it is more than important to protect your website and the data it holds now. So, therefore, we’ll give you five reasons why website security is important.(By Agnes Talalaev)

Which companies use web security? Some of the popular companies that use web security are mentioned below with the links that describe the role of web security in these companies:

Objectives

Participants will be able to:

Specific Things to Learn

Materials

Supplemental Resources - Web Security Libraries and Practices

Lesson

Common Mistakes / Misconceptions

Guided Practice

Independent Practice

  1. Spend 15 minutes on SQL Injection Practice
  2. Spend 15 minutes on XSS Practice
  3. Validate user input for a project with Parsley and validate fields with Validator. - Parsley, the ultimate JavaScript form validation library - Validator
  4. Build a form (or use an existing one) which allows users to submit a comment string and renders those comments into a doc on the page. Use DOMPurify to prevent XSS. For example an input comment like <script type='application/javascript'>alert('xss');</script> should not trigger an alert on the page. - DOMPurify
  5. Build a page template with all inputs escaped and validated and set up a PUT request instead of GET and POST to prevent CSRF. You can also look into implementing Token based CSRF prevention techniques if interested.
  6. The next step is to try XSS to do that make an HTML form with a text field and submit button(like search bar) now enter script based XSS attack through the text field <script>alert('You are under attack')</script> , you can also try various singleton tags like bold, italic, etc. on each other’s webpages.
  7. Now fix the vulnerabilities by HTML escaping all the dynamic input data.
  8. After that write some URL based XSS , assuming the input by users <?phpecho $_GET["message"];?> like this is serving as output somewhere on the site http://your-server/something.php?message=<script>alert('XSS attack');</script>. side note: There are many other ways of doing XSS/CSRF attacks so keep exploring.

Check For Understanding

Further Reading/Practice (for the super interested and more experienced!)

Extensions

If you are feeling inclined, or interested in red teaming, you can experiment with Insecure Labs or a Kali Linux VM and read about its rich FOSS tool suite.