CONTENTS IN DETAIL

ACKNOWLEDGMENTS

INTRODUCTION

About This Book

Who Should Read This Book

A Brief History of the Internet

Scripting in the Browser

A New Challenger Enters the Arena

Machines for Writing HTML

A Series of Tubes

What to Worry About First

What’s in This Book

1
LET’S HACK A WEBSITE

Software Exploits and the Dark Web

How to Hack a Website

PART I: THE BASICS

2
HOW THE INTERNET WORKS

The Internet Protocol Suite

Internet Protocol Addresses

The Domain Name System

Application Layer Protocols

HyperText Transfer Protocol

Stateful Connections

Encryption

Summary

3
HOW BROWSERS WORK

Web Page Rendering

The Rendering Pipeline: An Overview

The Document Object Model

Styling Information

JavaScript

Before and After Rendering: Everything Else the Browser Does

Summary

4
HOW WEB SERVERS WORK

Static and Dynamic Resources

Static Resources

URL Resolution

Content Delivery Networks

Content Management Systems

Dynamic Resources

Templates

Databases

Distributed Caches

Web Programming Languages

Summary

5
HOW PROGRAMMERS WORK

Phase 1: Design and Analysis

Phase 2: Writing Code

Distributed vs. Centralized Version Control

Branching and Merging Code

Phase 3: Pre-Release Testing

Coverage and Continuous Integration

Test Environments

Phase 4: The Release Process

Options for Standardized Deployment During Releases

The Build Process

Database Migration Scripts

Phase 5: Post-Release Testing and Observation

Penetration Testing

Monitoring, Logging, and Error Reporting

Dependency Management

Summary

PART II: THE THREATS

6
INJECTION ATTACKS

SQL Injection

What Is SQL?

Anatomy of a SQL Injection Attack

Mitigation 1: Use Parameterized Statements

Mitigation 2: Use Object-Relational Mapping

Bonus Mitigation: Use Defense in Depth

Command Injection

Anatomy of a Command Injection Attack

Mitigation: Escape Control Characters

Remote Code Execution

Anatomy of a Remote Code Execution Attack

Mitigation: Disable Code Execution During Deserialization

File Upload Vulnerabilities

Anatomy of a File Upload Attack

Mitigations

Summary

7
CROSS-SITE SCRIPTING ATTACKS

Stored Cross-Site Scripting Attacks

Mitigation 1: Escape HTML Characters

Mitigation 2: Implement a Content Security Policy

Reflected Cross-Site Scripting Attacks

Mitigation: Escape Dynamic Content from HTTP Requests

DOM-Based Cross-Site Scripting Attacks

Mitigation: Escaping Dynamic Content from URI Fragments

Summary

8
CROSS-SITE REQUEST FORGERY ATTACKS

Anatomy of a CSRF Attack

Mitigation 1: Follow REST Principles

Mitigation 2: Implement Anti-CSRF Cookies

Mitigation 3: Use the SameSite Cookie Attribute

Bonus Mitigation: Require Reauthentication for Sensitive Actions

Summary

9
COMPROMISING AUTHENTICATION

Implementing Authentication

HTTP-Native Authentication

Non-Native Authentication

Brute-Force Attacks

Mitigation 1: Use Third-Party Authentication

Mitigation 2: Integrate with Single Sign-On

Mitigation 3: Secure Your Own Authentication System

Requiring Usernames, Email Address, or Both

Requiring Complex Passwords

Securely Storing Passwords

Requiring Multifactor Authentication

Implementing and Securing the Logout Function

Preventing User Enumeration

Summary

10
SESSION HIJACKING

How Sessions Work

Server-Side Sessions

Client-Side Sessions

How Attackers Hijack Sessions

Cookie Theft

Session Fixation

Taking Advantage of Weak Session IDs

Summary

11
PERMISSIONS

Privilege Escalation

Access Control

Designing an Authorization Model

Implementing Access Control

Testing Access Control

Adding Audit Trails

Avoiding Common Oversights

Directory Traversal

Filepaths and Relative Filepaths

Anatomy of a Directory Traversal Attack

Mitigation 1: Trust Your Web Server

Mitigation 2: Use a Hosting Service

Mitigation 3: Use Indirect File References

Mitigation 4: Sanitize File References

Summary

12
INFORMATION LEAKS

Mitigation 1: Disable Telltale Server Headers

Mitigation 2: Use Clean URLs

Mitigation 3: Use Generic Cookie Parameters

Mitigation 4: Disable Client-Side Error Reporting

Mitigation 5: Minify or Obfuscate Your JavaScript Files

Mitigation 6: Sanitize Your Client-Side Files

Stay on Top of Security Advisories

Summary

13
ENCRYPTION

Encryption in the Internet Protocol

Encryption Algorithms, Hashing, and Message Authentication Codes

The TLS Handshake

Enabling HTTPS

Digital Certificates

Obtaining a Digital Certificate

Installing a Digital Certificate

Attacking HTTP (and HTTPS)

Wireless Routers

Wi-Fi Hotspots

Internet Service Providers

Government Agencies

Summary

14
THIRD-PARTY CODE

Securing Dependencies

Know What Code You Are Running

Be Able to Deploy New Versions Quickly

Stay Alert to Security Issues

Know When to Upgrade

Securing Configuration

Disable Default Credentials

Disable Open Directory Listings

Protect Your Configuration Information

Harden Test Environments

Secure Administrative Frontends

Securing the Services That You Use

Protect Your API Keys

Secure Your Webhooks

Secure Content Served by Third Parties

Services as an Attack Vector

Be Wary of Malvertising

Avoid Malware Delivery

Use a Reputable Ad Platform

Use SafeFrame

Tailor Your Ad Preferences

Review and Report Suspicious Ads

Summary

15
XML ATTACKS

The Uses of XML

Validating XML

Document Type Definitions

XML Bombs

XML External Entity Attacks

How Hackers Exploit External Entities

Securing Your XML Parser

Python

Ruby

Node.js

Java

.NET

Other Considerations

Summary

16
DON’T BE AN ACCESSORY

Email Fraud

Implement a Sender Policy Framework

Implement DomainKeys Identified Mail

Securing Your Email: Practical Steps

Disguising Malicious Links in Email

Open Redirects

Preventing Open Redirects

Other Considerations

Clickjacking

Preventing Clickjacking

Server-Side Request Forgery

Protecting Against Server-Side Forgery

Botnets

Protecting Against Malware Infection

Summary

17
DENIAL-OF-SERVICE ATTACKS

Denial-of-Service Attack Types

Internet Control Message Protocol Attacks

Transmission Control Protocol Attacks

Application Layer Attacks

Reflected and Amplified Attacks

Distributed Denial-of-Service Attacks

Unintentional Denial-of-Service Attacks

Denial-of-Service Attack Mitigation

Firewalls and Intrusion Prevention Systems

Distributed Denial-of-Service Protection Services

Building for Scale

Summary

18
SUMMING UP

INDEX

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.229.113