The Hands-On, Practical Guide to Preventing Ajax-Related Security Vulnerabilities
More and more Web sites are being rewritten as Ajax applications; even traditional desktop software is rapidly moving to the Web via Ajax. But, all too often, this transition is being made with reckless disregard for security. If Ajax applications aren't designed and coded properly, they can be susceptible to far more dangerous security vulnerabilities than conventional Web or desktop software. Ajax developers desperately need guidance on securing their applications: knowledge that's been virtually impossible to find, until now.
Ajax Security systematically debunks today's most dangerous myths about Ajax security, illustrating key points with detailed case studies of actual exploited Ajax vulnerabilities, ranging from MySpace's Samy worm to MacWorld's conference code validator. Even more important, it delivers specific, up-to-the-minute recommendations for securing Ajax applications in each major Web programming language and environment, including .NET, Java, PHP, and even Ruby on Rails. You'll learn how to:
· Mitigate unique risks associated with Ajax, including overly granular Web services, application control flow tampering, and manipulation of program logic
· Write new Ajax code more safely-and identify and fix flaws in existing code
· Prevent emerging Ajax-specific attacks, including JavaScript hijacking and persistent storage theft
· Avoid attacks based on XSS and SQL Injection-including a dangerous SQL Injection variant that can extract an entire backend database with just two requests
· Leverage security built into Ajax frameworks like Prototype, Dojo, and ASP.NET AJAX Extensions-and recognize what you still must implement on your own
· Create more secure "mashup" applications
Ajax Security will be an indispensable resource for developers coding or maintaining Ajax applications; architects and development managers planning or designing new Ajax software, and all software security professionals, from QA specialists to penetration testers.
Autorentext
Billy Hoffman is the lead researcher for HP Security Labs of HP Software. At HP, Billy focuses on JavaScript source code analysis, automated discovery of Web application vulnerabilities, and Web crawling technologies. He has worked in the security space since 2001 after he wrote an article on cracking software for 2600, "The Hacker Quarterly," and learned that people would pay him to be curious. Over the years Billy has worked a variety of projects including reverse engineering file formats, micro-controllers, JavaScript malware, and magstripes. He is the creator of Stripe Snoop, a suite of research tools that captures, modifies, validates, generates, analyzes, and shares data from magstripes. Billy's work has been featured in Wired, Make magazine, Slashdot, G4TechTV, and in various other journals and Web sites. Billy is a regular presenter at hacker conferences including Toorcon, Shmoocon, Phreaknic, Summercon, and Outerz0ne and is active in the South East hacking scene. Occasionally the suits make him take off the black t-shirt and he speaks at more mainstream security events including RSA, Infosec, AJAXWorld, and Black Hat. Billy graduated from the Georgia Institute of Technology in 2005 with a BS in Computer Science with specializations in networking and embedded systems. He lives in Atlanta with his wife and two tubby and very spoiled cats.
Bryan Sullivan is a software development manager for the Application Security Center division of HP Software. He has been a professional software developer and development manager for over 12 years, with the last five years focused on the Internet security software industry. Prior to HP, Bryan was a security researcher for SPI Dynamics, a leading Web application security company acquired by HP in August 2007.While at SPI, he created the DevInspect product, which analyzes Web applications for security vulnerabilities during development. Bryan is a frequent speaker at industry events, most recently AjaxWorld, Black Hat, and RSA. He was involved in the creation of the Application Vulnerability Description Language (AVDL) and has three patents on security assessment and remediation methodologies pending review. He is a graduate of the Georgia Institute of Technology
with a BS in Applied Mathematics. When he's not trying to break the Internet, Bryan spends as much time as he can on the golf links. If any Augusta National members are reading this, Bryan would be exceedingly happy to tell you everything he knows about Ajax security over a round or two.
Inhalt
Preface xvii
Preface (The Real One) xvix
Chapter 1 Introduction to Ajax Security 1
An Ajax Primer 2
What Is Ajax? 2
Asynchronous 3
JavaScript 6
XML 11
Dynamic HTML (DHTML) 11
The Ajax Architecture Shift 11
Thick-Client Architecture 12
Thin-Client Architecture 13
Ajax: The Goldilocks of Architecture 15
A Security Perspective: Thick-Client Applications 16
A Security Perspective: Thin-Client Applications 17
A Security Perspective: Ajax Applications 18
A Perfect Storm of Vulnerabilities 19
Increased Complexity, Transparency, and Size 19
Sociological Issues 22
Ajax Applications: Attractive and Strategic Targets 23
Conclusions 24
Chapter 2 The Heist 25
Eve 25
Hacking HighTechVacations.net 26
Hacking the Coupon System 26
Attacking Client-Side Data Binding 32
Attacking the Ajax API 36
A Theft in the Night 42
Chapter 3 Web Attacks 45
The Basic Attack Categories 45
Resource Enumeration 46
Parameter Manipulation 50
Other Attacks 75
Cross-Site Request Forgery (CSRF) 75
Phishing 76
Denial-of-Service (DoS) 77
Protecting Web Applications from Resource Enumeration and Parameter
Manipulation 77
Secure Sockets Layer 78
Conclusions 78
Chapter 4 Ajax Attack Surface 81
Understanding the Attack Surface 81
Traditional Web Application Attack Surface 83
Form Inputs 83
Cookies 84
Headers 85
Hidden Form Inputs 86
Query Parameters 86
Uploaded Files 89
Traditional Web Application Attacks: A Report Card 90
Web Service Attack Surface 92
Web Service Methods 92
Web Service Definitions 94
Ajax Application Attack Surface 94
The Origin of the Ajax Application Attack Surface 96
Best of Both Worlds-for the Hacker 98
Proper Input Validation 98
The Problem with Blacklisting and Other Specific Fixes 99
Treating the Symptoms Instead of the Disease 102
Whitelist Input Validation 105
Regular Expressions 109
Additional Thoughts on Input Validation 109
Validating Rich User Input 111
Validating Markup Languages 111
Validating Binary Files 113
Validating JavaScript Source Code 114
Validating Serialized Data 120
The Myth of User-Supplied Content 122
Conclusion 123
Chapter 5 Ajax Code Complexity 125
Multiple Languages and Architectures 125
Array Indexing 126
String Operations 128
Code Comments 129
Someone Else's Problem 130
JavaScript Quirks 132
Interpreted, Not Compiled 132
Weakly Typed 133
Asynchronicity 135
Race Conditions 135
Deadlocks and the Dining Phil…