Preface |
|
xvii | |
Acknowledgments |
|
xix | |
|
1 Security In The World Of Web Applications |
|
|
1 | (20) |
|
Information Security in a Nutshell |
|
|
1 | (7) |
|
Flirting with Formal Solutions |
|
|
2 | (2) |
|
|
4 | (2) |
|
Enlightenment Through Taxonomy |
|
|
6 | (1) |
|
Toward Practical Approaches |
|
|
7 | (1) |
|
A Brief History of the Web |
|
|
8 | (6) |
|
Tales of the Stone Age: 1945 to 1994 |
|
|
8 | (2) |
|
The First Browser Wars: 1995 to 1999 |
|
|
10 | (1) |
|
The Boring Period: 2000 to 2003 |
|
|
11 | (1) |
|
Web 2.0 and the Second Browser Wars: 2004 and Beyond |
|
|
12 | (2) |
|
The Evolution of a Threat |
|
|
14 | (7) |
|
The User as a Security Flaw |
|
|
14 | (1) |
|
The Cloud, or the Joys of Communal Living |
|
|
15 | (1) |
|
Nonconvergence of Visions |
|
|
15 | (1) |
|
Cross-Browser Interactions: Synergy in Failure |
|
|
16 | (1) |
|
The Breakdown of the Client-Server Divide |
|
|
17 | (4) |
|
PART I ANATOMY OF THE WEB |
|
|
21 | (118) |
|
|
23 | (18) |
|
Uniform Resource Locator Structure |
|
|
24 | (7) |
|
|
24 | (1) |
|
Indicator of a Hierarchical URL |
|
|
25 | (1) |
|
Credentials to Access the Resource |
|
|
26 | (1) |
|
|
26 | (1) |
|
|
27 | (1) |
|
|
27 | (1) |
|
|
28 | (1) |
|
|
28 | (1) |
|
Putting It All Together Again |
|
|
29 | (2) |
|
Reserved Characters and Percent Encoding |
|
|
31 | (5) |
|
Handling of Non-US-ASCII Text |
|
|
32 | (4) |
|
Common URL Schemes and Their Function |
|
|
36 | (2) |
|
Browser-Supported, Document-Fetching Protocols |
|
|
36 | (1) |
|
Protocols Claimed by Third-Party Applications and Plug-ins |
|
|
36 | (1) |
|
Nonencapsulating Pseudo-Protocols |
|
|
37 | (1) |
|
Encapsulating Pseudo-Protocols |
|
|
37 | (1) |
|
Closing Note on Scheme Detection |
|
|
38 | (1) |
|
Resolution of Relative URLs |
|
|
38 | (2) |
|
Security Engineering Cheat Sheet |
|
|
40 | (1) |
|
When Constructing Brand-New URLs Based on User Input |
|
|
40 | (1) |
|
When Designing URL Input Filters |
|
|
40 | (1) |
|
When Decoding Parameters Received Through URLs |
|
|
40 | (1) |
|
3 Hypertext Transfer Protocol |
|
|
41 | (28) |
|
Basic Syntax of HTTP Traffic |
|
|
42 | (10) |
|
The Consequences of Supporting HTTP/0.9 |
|
|
44 | (1) |
|
|
45 | (1) |
|
|
46 | (1) |
|
Resolution of Duplicate or Conflicting Headers |
|
|
47 | (1) |
|
Semicolon-Delimited Header Values |
|
|
48 | (1) |
|
Header Character Set and Encoding Schemes |
|
|
49 | (2) |
|
|
51 | (1) |
|
|
52 | (2) |
|
|
52 | (1) |
|
|
52 | (1) |
|
|
53 | (1) |
|
|
53 | (1) |
|
|
53 | (1) |
|
|
53 | (1) |
|
|
53 | (1) |
|
|
54 | (1) |
|
|
54 | (1) |
|
|
54 | (2) |
|
|
54 | (1) |
|
300-399: Redirection and Other Status Messages |
|
|
55 | (1) |
|
400-499: Client-Side Error |
|
|
55 | (1) |
|
500-599: Server-Side Error |
|
|
56 | (1) |
|
Consistency of HTTP Code Signaling |
|
|
56 | (1) |
|
|
56 | (1) |
|
|
57 | (1) |
|
|
58 | (2) |
|
|
60 | (2) |
|
|
62 | (2) |
|
Protocol-Level Encryption and Client Certificates |
|
|
64 | (3) |
|
Extended Validation Certificates |
|
|
65 | (1) |
|
|
65 | (2) |
|
Security Engineering Cheat Sheet |
|
|
67 | (2) |
|
When Handling User-Controlled Filenames in Content-Disposition Headers |
|
|
67 | (1) |
|
When Putting User Data in HTTP Cookies |
|
|
67 | (1) |
|
When Sending User-Controlled Location Headers |
|
|
67 | (1) |
|
When Sending User-Controlled Redirect Headers |
|
|
67 | (1) |
|
When Constructing Other Types of User-Controlled Requests or Responses |
|
|
67 | (2) |
|
4 Hypertext Markup Language |
|
|
69 | (18) |
|
Basic Concepts Behind HTML Documents |
|
|
70 | (3) |
|
|
71 | (1) |
|
The Battle over Semantics |
|
|
72 | (1) |
|
Understanding HTML Parser Behavior |
|
|
73 | (3) |
|
Interactions Between Multiple Tags |
|
|
74 | (1) |
|
Explicit and Implicit Conditionals |
|
|
75 | (1) |
|
HTML Parsing Survival Tips |
|
|
76 | (1) |
|
|
76 | (2) |
|
HTTP/HTML Integration Semantics |
|
|
78 | (1) |
|
Hyperlinking and Content Inclusion |
|
|
79 | (6) |
|
|
79 | (1) |
|
Forms and Form-Triggered Requests |
|
|
80 | (2) |
|
|
82 | (1) |
|
Type-Specific Content Inclusion |
|
|
82 | (2) |
|
A Note on Cross-Site Request Forgery |
|
|
84 | (1) |
|
Security Engineering Cheat Sheet |
|
|
85 | (2) |
|
Good Engineering Hygiene for All HTML Documents |
|
|
85 | (1) |
|
When Generating HTML Documents with Attacker-Controlled Bits |
|
|
85 | (1) |
|
When Converting HTML to Plaintext |
|
|
85 | (1) |
|
When Writing a Markup Filter for User Content |
|
|
86 | (1) |
|
|
87 | (8) |
|
|
88 | (2) |
|
|
89 | (1) |
|
@ Directives and XBL Bindings |
|
|
89 | (1) |
|
|
90 | (1) |
|
Parser Resynchronization Risks |
|
|
90 | (1) |
|
|
91 | (2) |
|
Security Engineering Cheat Sheet |
|
|
93 | (2) |
|
When Loading Remote Stylesheets |
|
|
93 | (1) |
|
When Putting Attacker-Controlled Values into CSS |
|
|
93 | (1) |
|
When Filtering User-Supplied CSS |
|
|
93 | (1) |
|
When Allowing User-Specified Class Values on HTML Markup |
|
|
93 | (2) |
|
|
95 | (22) |
|
Basic Characteristics of JavaScript |
|
|
96 | (11) |
|
|
97 | (3) |
|
Execution Ordering Control |
|
|
100 | (1) |
|
Code and Object Inspection Capabilities |
|
|
101 | (1) |
|
Modifying the Runtime Environment |
|
|
102 | (2) |
|
JavaScript Object Notation and Other Data Serializations |
|
|
104 | (2) |
|
E4X and Other Syntax Extensions |
|
|
106 | (1) |
|
Standard Object Hierarchy |
|
|
107 | (5) |
|
The Document Object Model |
|
|
109 | (2) |
|
Access to Other Documents |
|
|
111 | (1) |
|
Script Character Encoding |
|
|
112 | (1) |
|
Code Inclusion Modes and Nesting Risks |
|
|
113 | (1) |
|
The Living Dead: Visual Basic |
|
|
114 | (1) |
|
Security Engineering Cheat Sheet |
|
|
115 | (2) |
|
When Loading Remote Scripts |
|
|
115 | (1) |
|
When Parsing JSON Received from the Server |
|
|
115 | (1) |
|
When Putting User-Supplied Data Inside JavaScript Blocks |
|
|
115 | (1) |
|
When Interacting with Browser Objects on the Client Side |
|
|
115 | (1) |
|
If You Want to Allow User-Controlled Scripts on Your Page |
|
|
116 | (1) |
|
7 Non-Html Document Types |
|
|
117 | (10) |
|
|
117 | (1) |
|
|
118 | (1) |
|
|
119 | (1) |
|
|
119 | (5) |
|
|
120 | (1) |
|
|
121 | (1) |
|
Mathematical Markup Language |
|
|
122 | (1) |
|
XML User Interface Language |
|
|
122 | (1) |
|
|
123 | (1) |
|
|
123 | (1) |
|
A Note on Nonrenderable File Types |
|
|
124 | (1) |
|
Security Engineering Cheat Sheet |
|
|
125 | (2) |
|
When Hosting XML-Based Document Formats |
|
|
125 | (1) |
|
On All Non-HTML Document Types |
|
|
125 | (2) |
|
8 Content Rendering With Browser Plug-Ins |
|
|
127 | (12) |
|
|
128 | (2) |
|
The Perils of Plug-in Content-Type Handling |
|
|
129 | (1) |
|
Document Rendering Helpers |
|
|
130 | (1) |
|
Plug-in-Based Application Frameworks |
|
|
131 | (5) |
|
|
132 | (2) |
|
|
134 | (1) |
|
|
134 | (1) |
|
XML Browser Applications (XBAP) |
|
|
135 | (1) |
|
|
136 | (1) |
|
Living with Other Plug-ins |
|
|
137 | (1) |
|
Security Engineering Cheat Sheet |
|
|
138 | (1) |
|
When Serving Plug-in-Handled Files |
|
|
138 | (1) |
|
When Embedding Plug-in-Handled Files |
|
|
138 | (1) |
|
If You Want to Write a New Browser Plug-in or ActiveX Component |
|
|
138 | (1) |
|
PART II BROWSER SECURITY FEATURES |
|
|
139 | (94) |
|
9 Content Isolation Logic |
|
|
141 | (24) |
|
Same-Origin Policy for the Document Object Model |
|
|
142 | (4) |
|
|
143 | (1) |
|
|
144 | (1) |
|
Interactions with Browser Credentials |
|
|
145 | (1) |
|
Same-Origin Policy for XMLHttpRequest |
|
|
146 | (2) |
|
Same-Origin Policy for Web Storage |
|
|
148 | (1) |
|
Security Policy for Cookies |
|
|
149 | (4) |
|
Impact of Cookies on the Same-Origin Policy |
|
|
150 | (1) |
|
Problems with Domain Restrictions |
|
|
151 | (1) |
|
The Unusual Danger of "localhost" |
|
|
152 | (1) |
|
Cookies and "Legitimate" DNS Hijacking |
|
|
153 | (1) |
|
|
153 | (5) |
|
|
154 | (3) |
|
|
157 | (1) |
|
|
157 | (1) |
|
Coping with Ambiguous or Unexpected Origins |
|
|
158 | (3) |
|
|
158 | (1) |
|
Hostnames with Extra Periods |
|
|
159 | (1) |
|
Non-Fully Qualified Hostnames |
|
|
159 | (1) |
|
|
159 | (2) |
|
|
161 | (1) |
|
Browser Extensions and UI |
|
|
161 | (1) |
|
|
161 | (1) |
|
Security Engineering Cheat Sheet |
|
|
162 | (3) |
|
Good Security Policy Hygiene for All Websites |
|
|
162 | (1) |
|
When Relying on HTTP Cookies for Authentication |
|
|
162 | (1) |
|
When Arranging Cross-Domain Communications in JavaScript |
|
|
162 | (1) |
|
When Embedding Plug-in-Handled Active Content from Third Parties |
|
|
162 | (1) |
|
When Hosting Your Own Plug-in-Executed Content |
|
|
163 | (1) |
|
When Writing Browser Extensions |
|
|
163 | (2) |
|
|
165 | (8) |
|
Origin Inheritance for about: blank |
|
|
166 | (1) |
|
Inheritance for data: URLs |
|
|
167 | (2) |
|
Inheritance for javascript: and vbscript: URLs |
|
|
169 | (1) |
|
A Note on Restricted Pseudo-URLs |
|
|
170 | (2) |
|
Security Engineering Cheat Sheet |
|
|
172 | (1) |
|
11 Life Outside Same-Origin Rules |
|
|
173 | (14) |
|
Window and Frame Interactions |
|
|
174 | (7) |
|
Changing the Location of Existing Documents |
|
|
174 | (4) |
|
|
178 | (3) |
|
Cross-Domain Content Inclusion |
|
|
181 | (3) |
|
A Note on Cross-Origin Subresources |
|
|
183 | (1) |
|
Privacy-Related Side Channels |
|
|
184 | (1) |
|
Other SOP Loopholes and Their Uses |
|
|
185 | (1) |
|
Security Engineering Cheat Sheet |
|
|
186 | (1) |
|
Good Security Hygiene for All Websites |
|
|
186 | (1) |
|
When Including Cross-Domain Resources |
|
|
186 | (1) |
|
When Arranging Cross-Domain Communications in JavaScript |
|
|
186 | (1) |
|
12 Other Security Boundaries |
|
|
187 | (10) |
|
Navigation to Sensitive Schemes |
|
|
188 | (1) |
|
Access to Internal Networks |
|
|
189 | (1) |
|
|
190 | (2) |
|
Limitations on Third-Party Cookies |
|
|
192 | (3) |
|
Security Engineering Cheat Sheet |
|
|
195 | (2) |
|
When Building Web Applications on Internal Networks |
|
|
195 | (1) |
|
When Launching Non-HTTP Services, Particularly on Nonstandard Ports |
|
|
195 | (1) |
|
When Using Third-Party Cookies for Gadgets or Sandboxed Content |
|
|
195 | (2) |
|
13 Content Recognition Mechanisms |
|
|
197 | (16) |
|
Document Type Detection Logic |
|
|
198 | (8) |
|
|
199 | (1) |
|
Special Content-Type Values |
|
|
200 | (2) |
|
Unrecognized Content Type |
|
|
202 | (1) |
|
Defensive Uses of Content-Disposition |
|
|
203 | (1) |
|
Content Directives on Subresources |
|
|
204 | (1) |
|
Downloaded Files and Other Non-HTTP Content |
|
|
205 | (1) |
|
|
206 | (6) |
|
|
208 | (1) |
|
Character Set Inheritance and Override |
|
|
209 | (1) |
|
Markup-Controlled Charset on Subresources |
|
|
209 | (1) |
|
Detection for Non-HTTP Files |
|
|
210 | (2) |
|
Security Engineering Cheat Sheet |
|
|
212 | (1) |
|
Good Security Practices for All Websites |
|
|
212 | (1) |
|
When Generating Documents with Partly Attacker-Controlled Contents |
|
|
212 | (1) |
|
When Hosting User-Generated Files |
|
|
212 | (1) |
|
14 Dealing With Rogue Scripts |
|
|
213 | (12) |
|
Denial-of-Service Attacks |
|
|
214 | (5) |
|
Execution Time and Memory Use Restrictions |
|
|
215 | (1) |
|
|
216 | (1) |
|
|
217 | (1) |
|
|
218 | (1) |
|
Window-Positioning and Appearance Problems |
|
|
219 | (3) |
|
Timing Attacks on User Interfaces |
|
|
222 | (2) |
|
Security Engineering Cheat Sheet |
|
|
224 | (1) |
|
When Permitting User-Created <iframe>Gadgets on Your Site |
|
|
224 | (1) |
|
When Building Security-Sensitive Uls |
|
|
224 | (1) |
|
15 Extrinsic Site Privileges |
|
|
225 | (8) |
|
Browser- and Plug-in-Managed Site Permissions |
|
|
226 | (1) |
|
|
227 | (1) |
|
Form-Based Password Managers |
|
|
227 | (2) |
|
Internet Explorer's Zone Model |
|
|
229 | (3) |
|
Mark of the Web and Zone.Identifier |
|
|
231 | (1) |
|
Security Engineering Cheat Sheet |
|
|
232 | (1) |
|
When Requesting Elevated Permissions from Within a Web Application |
|
|
232 | (1) |
|
When Writing Plug-ins or Extensions That Recognize Privileged Origins |
|
|
232 | (1) |
|
PART III A GLIMPSE OF THINGS TO COME |
|
|
233 | (34) |
|
16 New And Upcoming Security Features |
|
|
235 | (20) |
|
Security Model Extension Frameworks |
|
|
236 | (5) |
|
|
236 | (3) |
|
|
239 | (1) |
|
Other Uses of the Origin Header |
|
|
240 | (1) |
|
Security Model Restriction Frameworks |
|
|
241 | (9) |
|
|
242 | (3) |
|
|
245 | (3) |
|
Strict Transport Security |
|
|
248 | (1) |
|
|
249 | (1) |
|
|
250 | (3) |
|
In-Browser HTML Sanitizers |
|
|
250 | (1) |
|
|
251 | (2) |
|
Security Engineering Cheat Sheet |
|
|
253 | (2) |
|
17 Other Browser Mechanisms Of Note |
|
|
255 | (6) |
|
URL- and Protocol-Level Proposals |
|
|
256 | (2) |
|
|
258 | (1) |
|
|
259 | (2) |
|
18 Common Web Vulnerabilities |
|
|
261 | (6) |
|
Vulnerabilities Specific to Web Applications |
|
|
262 | (1) |
|
Problems to Keep in Mind in Web Application Design |
|
|
263 | (2) |
|
Common Problems Unique to Server-Side Code |
|
|
265 | (2) |
Epilogue |
|
267 | (2) |
Notes |
|
269 | (4) |
Index |
|
273 | |