
Explore how SQL injection, cross-site scripting, session hijacking, and cross-site request forgery threaten web apps, walk through the anatomy of attacks, and learn secure coding practices.
Authentication, authorization, auditing, availability, confidentiality and integrity. If any of these principles are compromised on your site, your site is at risk
A few definitions - risk, threat, vulnerability and attack. Reasons why websites are at risk. Known and unknown risks.
Start off with a well known security attack - script injection can wreak havoc on your site.
A simple but realistic example of how XSS could affect your site
Persistent, reflected and DOM based XSS. The differences are subtle but important.
How can you protect yourself from script injection? What are the good practices to follow?
Validate and sanitize user input to prevent cross-site scripting, encoding dangerous characters and avoiding trusted-page script execution. Show how PHP form handling, input processing, and browser protections guard against XSS.
Some more techniques by which input can be cleaned up
Check for patterns in your input. Only allow those patterns which seem legit!
PHP offers a whole bunch of ways to validate input, some more here.
What else can you do to make sure user input is safe to use?
Learn how the content security policy header lets browsers enforce trusted script and resource sources, using directives like script-src, image-src, and form-action to mitigate cross-site scripting.
Specify default directives so things are less onerous and learn to use wildcards
Inline code and the eval() functions usually spell trouble for your site
If you must use inline code, the Content Security Policy header gives you a few outs.
Explore broken authentication and session management as a core web security risk, and learn credential management, password strength, how passwords are stored and recovered, and protection of session tokens.
What makes a good password? Set some constraints so your users are forced to choose strong passwords.
Do not store passwords in plain text. When it comes to security you cannot trust even those who work with you.
Explore hashing and encryption: fixed-length outputs, irreversible and collision-resistant, with algorithms like md5 and sha. Learn how dictionary, brute-force, and rainbow-table attacks occur and how salting defeats them.
Explore secure password recovery and reset workflows, including token-based validation, initialize and notify phases, protecting the current account, and auditing to prevent security breaches.
Explore broken authentication and session management, detailing how server-stored sessions and cookie-based IDs remember users across pages, and how cookies compare to sessions for sensitive data.
Protect your website by understanding session management, session IDs, authentication, and the risks of session hijacking and session fixation, including permissive and strict setups and their attack steps.
Explore how session ids travel to clients via hidden form fields and cookies, and how attackers set cookies through cross-site scripting and header or meta tag tricks.
Discover how session fixation exploits client-specified or stolen session IDs in URLs, cookies, and cross-subdomain cookies, and why improper login handling enables impersonation.
Prevent session fixation by never accepting user-provided IDs and generating a new server-side ID after login, enforce complete logout and absolute timeouts.
Examine session hijacking and sniffing that expose session cookies on unsecured wifi. Encrypt all data between server and client to protect session IDs from cross-site scripting and malware.
Protect databases by preventing sql injection, a code injection technique that injects malicious sql into user input for execution on the database behind data-driven applications, as illustrated by Bobby Tables.
Learn how sql injection exploits unsafe url parameters by concatenating inputs into dynamic sql, exposing account details and the role of get parameters, input validation, and comments.
Explore how unsanitized input enables a SQL injection on a hypothetical site with an email password feature, and how server errors expose exploitable details such as or 1=1 conditions.
Explore how an SQL injection attack reveals column and table names by probing the email field, testing valid columns, and using error conditions and comments to deduce structure.
Explore inbound, in-band (error-based and union-based), blind, and out-of-band SQL injection types, including boolean-based and time-based techniques, and how they reveal database structures.
Mitigate SQL injection by using parameterized queries and prepared statements, binding user input safely, and using stored procedures while sanitizing input, applying least privilege, and whitelisting inputs.
Understand cross-site request forgery (csrf): attackers exploit a trusted, authenticated user to perform actions on a server, while cross-site scripting aims to steal data.
Explore a cross-site request forgery example using get and post parameters to trigger a funds transfer. Learn how image tags, hidden form fields, and social engineering enable this attack.
Learn how to mitigate cross-site request forgery by using the referrer and origin headers, synchronizer tokens, and a robust challenge-response with captchas, re-authentication, or one-time passwords.
An example using a secure token to verify that the request comes from a trusted site.
Explore the Open Web Application Security Project resources, top ten vulnerabilities, and cheat sheets to learn attacks and practical defenses for web development.
Learn how two factor authentication strengthens web security by combining knowledge, possession, and biometrics, and how time-based mobile OTPs offer advantages and risks like SMS interception and malware.
Explore how social engineering exploits human trust to steal passwords and data, with phishing, spear phishing, clone phishing, veiling, baiting, and clickjacking as practical attack techniques.
Coat your website with armor, protect yourself against the most common threats and vulnerabilities. Understand, with examples, how common security attacks work and how to mitigate them. Learn secure practices to keep your website users safe.
Let's parse that.
What's included in this course: