Details

The Web Application Hacker's Handbook


The Web Application Hacker's Handbook

Finding and Exploiting Security Flaws
2. Aufl.

von: Dafydd Stuttard, Marcus Pinto

38,99 €

Verlag: Wiley
Format: EPUB
Veröffentl.: 31.08.2011
ISBN/EAN: 9781118175248
Sprache: englisch
Anzahl Seiten: 912

DRM-geschütztes eBook, Sie benötigen z.B. Adobe Digital Editions und eine Adobe ID zum Lesen.

Beschreibungen

<b>The highly successful security book returns with a new edition, completely updated</b> <p>Web applications are the front door to most organizations, exposing them to attacks that may disclose personal information, execute fraudulent transactions, or compromise ordinary users. This practical book has been completely updated and revised to discuss the latest step-by-step techniques for attacking and defending the range of ever-evolving web applications. You'll explore the various new technologies employed in web applications that have appeared since the first edition and review the new attack techniques that have been developed, particularly in relation to the client side.</p> <ul> <li>Reveals how to overcome the new technologies and techniques aimed at defending web applications against attacks that have appeared since the previous edition</li> <li>Discusses new remoting frameworks, HTML5, cross-domain integration techniques, UI redress, framebusting, HTTP parameter pollution, hybrid file attacks, and more</li> <li>Features a companion web site hosted by the authors that allows readers to try out the attacks described, gives answers to the questions that are posed at the end of each chapter, and provides a summarized methodology and checklist of tasks</li> </ul> <p>Focusing on the areas of web application security where things have changed in recent years, this book is the most current resource on the critical topic of discovering, exploiting, and preventing web application security flaws.<br /><br /><br /></p>
<p>Introduction xxiii</p> <p><b>Chapter 1 Web Application (In)security 1</b></p> <p>The Evolution of Web Applications 2</p> <p>Common Web Application Functions 4</p> <p>Benefits of Web Applications 5</p> <p>Web Application Security 6</p> <p>“This Site Is Secure” 7</p> <p>The Core Security Problem: Users Can Submit Arbitrary Input 9</p> <p>Key Problem Factors 10</p> <p>The New Security Perimeter 12</p> <p>The Future of Web Application Security 14</p> <p>Summary 15</p> <p><b>Chapter 2 Core Defense Mechanisms 17</b></p> <p>Handling User Access 18</p> <p>Authentication 18</p> <p>Session Management 19</p> <p>Access Control 20</p> <p>Handling User Input 21</p> <p>Varieties of Input 21</p> <p>Approaches to Input Handling 23</p> <p>Boundary Validation 25</p> <p>Multistep Validation and Canonicalization 28</p> <p>Handling Attackers 30</p> <p>Handling Errors 30</p> <p>Maintaining Audit Logs 31</p> <p>Alerting Administrators 33</p> <p>Reacting to Attacks 34</p> <p>Managing the Application 35</p> <p>Summary 36</p> <p>Questions 36</p> <p><b>Chapter 3 Web Application Technologies 39</b></p> <p>The HTTP Protocol 39</p> <p>HTTP Requests 40</p> <p>HTTP Responses 41</p> <p>HTTP Methods 42</p> <p>URLs 44</p> <p>Rest 44</p> <p>HTTP Headers 45</p> <p>Cookies 47</p> <p>Status Codes 48</p> <p>Https 49</p> <p>HTTP Proxies 49</p> <p>HTTP Authentication 50</p> <p>Web Functionality 51</p> <p>Server-Side Functionality 51</p> <p>Client-Side Functionality 57</p> <p>State and Sessions 66</p> <p>Encoding Schemes 66</p> <p>URL Encoding 67</p> <p>Unicode Encoding 67</p> <p>HTML Encoding 68</p> <p>Base64 Encoding 69</p> <p>Hex Encoding 69</p> <p>Remoting and Serialization Frameworks 70</p> <p>Next Steps 70</p> <p>Questions 71</p> <p><b>Chapter 4 Mapping the Application 73</b></p> <p>Enumerating Content and Functionality 74</p> <p>Web Spidering 74</p> <p>User-Directed Spidering 77</p> <p>Discovering Hidden Content 80</p> <p>Application Pages Versus Functional Paths 93</p> <p>Discovering Hidden Parameters 96</p> <p>Analyzing the Application 97</p> <p>Identifying Entry Points for User Input 98</p> <p>Identifying Server-Side Technologies 101</p> <p>Identifying Server-Side Functionality 107</p> <p>Mapping the Attack Surface 111</p> <p>Summary 114</p> <p>Questions 114</p> <p><b>Chapter 5 Bypassing Client-Side Controls 117</b></p> <p>Transmitting Data Via the Client 118</p> <p>Hidden Form Fields 118</p> <p>HTTP Cookies 121</p> <p>URL Parameters 121</p> <p>The Referer Header 122</p> <p>Opaque Data 123</p> <p>The ASP.NET ViewState 124</p> <p>Capturing User Data: HTML Forms 127</p> <p>Length Limits 128</p> <p>Script-Based Validation 129</p> <p>Disabled Elements 131</p> <p>Capturing User Data: Browser Extensions 133</p> <p>Common Browser Extension Technologies 134</p> <p>Approaches to Browser Extensions 135</p> <p>Intercepting Traffic from Browser Extensions 135</p> <p>Decompiling Browser Extensions 139</p> <p>Attaching a Debugger 151</p> <p>Native Client Components 153</p> <p>Handling Client-Side Data Securely 154</p> <p>Transmitting Data Via the Client 154</p> <p>Validating Client-Generated Data 155</p> <p>Logging and Alerting 156</p> <p>Summary 156</p> <p>Questions 157</p> <p><b>Chapter 6 Attacking Authentication 159</b></p> <p>Authentication Technologies 160</p> <p>Design Flaws in Authentication Mechanisms 161</p> <p>Bad Passwords 161</p> <p>Brute-Forcible Login 162</p> <p>Verbose Failure Messages 166</p> <p>Vulnerable Transmission of Credentials 169</p> <p>Password Change Functionality 171</p> <p>Forgotten Password Functionality 173</p> <p>“Remember Me” Functionality 176</p> <p>User Impersonation Functionality 178</p> <p>Incomplete Validation of Credentials 180</p> <p>Nonunique Usernames 181</p> <p>Predictable Usernames 182</p> <p>Predictable Initial Passwords 183</p> <p>Insecure Distribution of Credentials 184</p> <p>Implementation Flaws in Authentication 185</p> <p>Fail-Open Login Mechanisms 185</p> <p>Defects in Multistage Login Mechanisms 186</p> <p>Insecure Storage of Credentials 190</p> <p>Securing Authentication 191</p> <p>Use Strong Credentials 192</p> <p>Handle Credentials Secretively 192</p> <p>Validate Credentials Properly 193</p> <p>Prevent Information Leakage 195</p> <p>Prevent Brute-Force Attacks 196</p> <p>Prevent Misuse of the Password Change Function 199</p> <p>Prevent Misuse of the Account Recovery Function 199</p> <p>Log, Monitor, and Notify 201</p> <p>Summary 201</p> <p>Questions 202</p> <p><b>Chapter 7 Attacking Session Management 205</b></p> <p>The Need for State 206</p> <p>Alternatives to Sessions 208</p> <p>Weaknesses in Token Generation 210</p> <p>Meaningful Tokens 210</p> <p>Predictable Tokens 213</p> <p>Encrypted Tokens 223</p> <p>Weaknesses in Session Token Handling 233</p> <p>Disclosure of Tokens on the Network 234</p> <p>Disclosure of Tokens in Logs 237</p> <p>Vulnerable Mapping of Tokens to Sessions 240</p> <p>Vulnerable Session Termination 241</p> <p>Client Exposure to Token Hijacking 243</p> <p>Liberal Cookie Scope 244</p> <p>Securing Session Management 248</p> <p>Generate Strong Tokens 248</p> <p>Protect Tokens Throughout Their Life Cycle 250</p> <p>Log, Monitor, and Alert 253</p> <p>Summary 254</p> <p>Questions 255</p> <p><b>Chapter 8 Attacking Access Controls 257</b></p> <p>Common Vulnerabilities 258</p> <p>Completely Unprotected Functionality 259</p> <p>Identifier-Based Functions 261</p> <p>Multistage Functions 262</p> <p>Static Files 263</p> <p>Platform Misconfiguration 264</p> <p>Insecure Access Control Methods 265</p> <p>Attacking Access Controls 266</p> <p>Testing with Different User Accounts 267</p> <p>Testing Multistage Processes 271</p> <p>Testing with Limited Access 273</p> <p>Testing Direct Access to Methods 276</p> <p>Testing Controls Over Static Resources 277</p> <p>Testing Restrictions on HTTP Methods 278</p> <p>Securing Access Controls 278</p> <p>A Multilayered Privilege Model 280</p> <p>Summary 284</p> <p>Questions 284</p> <p><b>Chapter 9 Attacking Data Stores 287</b></p> <p>Injecting into Interpreted Contexts 288</p> <p>Bypassing a Login 288</p> <p>Injecting into SQL 291</p> <p>Exploiting a Basic Vulnerability 292</p> <p>Injecting into Different Statement Types 294</p> <p>Finding SQL Injection Bugs 298</p> <p>Fingerprinting the Database 303</p> <p>The UNION Operator 304</p> <p>Extracting Useful Data 308</p> <p>Extracting Data with UNION 308</p> <p>Bypassing Filters 311</p> <p>Second-Order SQL Injection 313</p> <p>Advanced Exploitation 314</p> <p>Beyond SQL Injection: Escalating the Database Attack 325</p> <p>Using SQL Exploitation Tools 328</p> <p>SQL Syntax and Error Reference 332</p> <p>Preventing SQL Injection 338</p> <p>Injecting into NoSQL 342</p> <p>Injecting into MongoDB 343</p> <p>Injecting into XPath 344</p> <p>Subverting Application Logic 345</p> <p>Informed XPath Injection 346</p> <p>Blind XPath Injection 347</p> <p>Finding XPath Injection Flaws 348</p> <p>Preventing XPath Injection 349</p> <p>Injecting into LDAP 349</p> <p>Exploiting LDAP Injection 351</p> <p>Finding LDAP Injection Flaws 353</p> <p>Preventing LDAP Injection 354</p> <p>Summary 354</p> <p>Questions 354</p> <p><b>Chapter 10 Attacking Back-End Components 357</b></p> <p>Injecting OS Commands 358</p> <p>Example 1: Injecting Via Perl 358</p> <p>Example 2: Injecting Via ASP 360</p> <p>Injecting Through Dynamic Execution 362</p> <p>Finding OS Command Injection Flaws 363</p> <p>Finding Dynamic Execution Vulnerabilities 366</p> <p>Preventing OS Command Injection 367</p> <p>Preventing Script Injection Vulnerabilities 368</p> <p>Manipulating File Paths 368</p> <p>Path Traversal Vulnerabilities 368</p> <p>File Inclusion Vulnerabilities 381</p> <p>Injecting into XML Interpreters 383</p> <p>Injecting XML External Entities 384</p> <p>Injecting into SOAP Services 386</p> <p>Finding and Exploiting SOAP Injection 389</p> <p>Preventing SOAP Injection 390</p> <p>Injecting into Back-end HTTP Requests 390</p> <p>Server-side HTTP Redirection 390</p> <p>HTTP Parameter Injection 393</p> <p>Injecting into Mail Services 397</p> <p>E-mail Header Manipulation 398</p> <p>SMTP Command Injection 399</p> <p>Finding SMTP Injection Flaws 400</p> <p>Preventing SMTP Injection 402</p> <p>Summary 402</p> <p>Questions 403</p> <p><b>Chapter 11 Attacking Application Logic 405</b></p> <p>The Nature of Logic Flaws 406</p> <p>Real-World Logic Flaws 406</p> <p>Example 1: Asking the Oracle 407</p> <p>Example 2: Fooling a Password Change Function 409</p> <p>Example 3: Proceeding to Checkout 410</p> <p>Example 4: Rolling Your Own Insurance 412</p> <p>Example 5: Breaking the Bank 414</p> <p>Example 6: Beating a Business Limit 416</p> <p>Example 7: Cheating on Bulk Discounts 418</p> <p>Example 8: Escaping from Escaping 419</p> <p>Example 9: Invalidating Input Validation 420</p> <p>Example 10: Abusing a Search Function 422</p> <p>Example 11: Snarfing Debug Messages 424</p> <p>Example 12: Racing Against the Login 426</p> <p>Avoiding Logic Flaws 428</p> <p>Summary 429</p> <p>Questions 430</p> <p><b>Chapter 12 Attacking Users: Cross-Site Scripting 431</b></p> <p>Varieties of XSS 433</p> <p>Reflected XSS Vulnerabilities 434</p> <p>Stored XSS Vulnerabilities 438</p> <p>DOM-Based XSS Vulnerabilities 440</p> <p>XSS Attacks in Action 442</p> <p>Real-World XSS Attacks 442</p> <p>Payloads for XSS Attacks 443</p> <p>Delivery Mechanisms for XSS Attacks 447</p> <p>Finding and Exploiting XSS Vulnerabilities 451</p> <p>Finding and Exploiting Reflected XSS Vulnerabilities 452</p> <p>Finding and Exploiting Stored XSS Vulnerabilities 481</p> <p>Finding and Exploiting DOM-Based XSS Vulnerabilities 487</p> <p>Preventing XSS Attacks 492</p> <p>Preventing Reflected and Stored XSS 492</p> <p>Preventing DOM-Based XSS 496</p> <p>Summary 498</p> <p>Questions 498</p> <p><b>Chapter 13 Attacking Users: Other Techniques 501</b></p> <p>Inducing User Actions 501</p> <p>Request Forgery 502</p> <p>UI Redress 511</p> <p>Capturing Data Cross-Domain 515</p> <p>Capturing Data by Injecting HTML 516</p> <p>Capturing Data by Injecting CSS 517</p> <p>JavaScript Hijacking 519</p> <p>The Same-Origin Policy Revisited 524</p> <p>The Same-Origin Policy and Browser Extensions 525</p> <p>The Same-Origin Policy and HTML 5 528</p> <p>Crossing Domains with Proxy Service Applications 529</p> <p>Other Client-Side Injection Attacks 531</p> <p>HTTP Header Injection 531</p> <p>Cookie Injection 536</p> <p>Open Redirection Vulnerabilities 540</p> <p>Client-Side SQL Injection 547</p> <p>Client-Side HTTP Parameter Pollution 548</p> <p>Local Privacy Attacks 550</p> <p>Persistent Cookies 550</p> <p>Cached Web Content 551</p> <p>Browsing History 552</p> <p>Autocomplete 552</p> <p>Flash Local Shared Objects 553</p> <p>Silverlight Isolated Storage 553</p> <p>Internet Explorer userData 554</p> <p>HTML5 Local Storage Mechanisms 554</p> <p>Preventing Local Privacy Attacks 554</p> <p>Attacking ActiveX Controls 555</p> <p>Finding ActiveX Vulnerabilities 556</p> <p>Preventing ActiveX Vulnerabilities 558</p> <p>Attacking the Browser 559</p> <p>Logging Keystrokes 560</p> <p>Stealing Browser History and Search Queries 560</p> <p>Enumerating Currently Used Applications 560</p> <p>Port Scanning 561</p> <p>Attacking Other Network Hosts 561</p> <p>Exploiting Non-HTTP Services 562</p> <p>Exploiting Browser Bugs 563</p> <p>DNS Rebinding 563</p> <p>Browser Exploitation Frameworks 564</p> <p>Man-in-the-Middle Attacks 566</p> <p>Summary 568</p> <p>Questions 568</p> <p><b>Chapter 14 Automating Customized Attacks 571</b></p> <p>Uses for Customized Automation 572</p> <p>Enumerating Valid Identifiers 573</p> <p>The Basic Approach 574</p> <p>Detecting Hits 574</p> <p>Scripting the Attack 576</p> <p>JAttack 577</p> <p>Harvesting Useful Data 583</p> <p>Fuzzing for Common Vulnerabilities 586</p> <p>Putting It All Together: Burp Intruder 590</p> <p>Barriers to Automation 602</p> <p>Session-Handling Mechanisms 602</p> <p>CAPTCHA Controls 610</p> <p>Summary 613</p> <p>Questions 613</p> <p><b>Chapter 15 Exploiting Information Disclosure 615</b></p> <p>Exploiting Error Messages 615</p> <p>Script Error Messages 616</p> <p>Stack Traces 617</p> <p>Informative Debug Messages 618</p> <p>Server and Database Messages 619</p> <p>Using Public Information 623</p> <p>Engineering Informative Error Messages 624</p> <p>Gathering Published Information 625</p> <p>Using Inference 626</p> <p>Preventing Information Leakage 627</p> <p>Use Generic Error Messages 628</p> <p>Protect Sensitive Information 628</p> <p>Minimize Client-Side Information Leakage 629</p> <p>Summary 629</p> <p>Questions 630</p> <p><b>Chapter 16 Attacking Native Compiled Applications 633</b></p> <p>Buffer Overflow Vulnerabilities 634</p> <p>Stack Overflows 634</p> <p>Heap Overflows 635</p> <p> “Off-by-One” Vulnerabilities 636</p> <p>Detecting Buffer Overflow Vulnerabilities 639</p> <p>Integer Vulnerabilities 640</p> <p>Integer Overflows 640</p> <p>Signedness Errors 641</p> <p>Detecting Integer Vulnerabilities 642</p> <p>Format String Vulnerabilities 643</p> <p>Detecting Format String Vulnerabilities 644</p> <p>Summary 645</p> <p>Questions 645</p> <p><b>Chapter 17 Attacking Application Architecture 647</b></p> <p>Tiered Architectures 647</p> <p>Attacking Tiered Architectures 648</p> <p>Securing Tiered Architectures 654</p> <p>Shared Hosting and Application Service Providers 656</p> <p>Virtual Hosting 657</p> <p>Shared Application Services 657</p> <p>Attacking Shared Environments 658</p> <p>Securing Shared Environments 665</p> <p>Summary 667</p> <p>Questions 667</p> <p><b>Chapter 18 Attacking the Application Server 669</b></p> <p>Vulnerable Server Configuration 670</p> <p>Default Credentials 670</p> <p>Default Content 671</p> <p>Directory Listings 677</p> <p>WebDAV Methods 679</p> <p>The Application Server as a Proxy 682</p> <p>Misconfigured Virtual Hosting 683</p> <p>Securing Web Server Configuration 684</p> <p>Vulnerable Server Software 684</p> <p>Application Framework Flaws 685</p> <p>Memory Management Vulnerabilities 687</p> <p>Encoding and Canonicalization 689</p> <p>Finding Web Server Flaws 694</p> <p>Securing Web Server Software 695</p> <p>Web Application Firewalls 697</p> <p>Summary 699</p> <p>Questions 699</p> <p><b>Chapter 19 Finding Vulnerabilities in Source Code 701</b></p> <p>Approaches to Code Review 702</p> <p>Black-Box Versus White-Box Testing 702</p> <p>Code Review Methodology 703</p> <p>Signatures of Common Vulnerabilities 704</p> <p>Cross-Site Scripting 704</p> <p>SQL Injection 705</p> <p>Path Traversal 706</p> <p>Arbitrary Redirection 707</p> <p>OS Command Injection 708</p> <p>Backdoor Passwords 708</p> <p>Native Software Bugs 709</p> <p>Source Code Comments 710</p> <p>The Java Platform 711</p> <p>Identifying User-Supplied Data 711</p> <p>Session Interaction 712</p> <p>Potentially Dangerous APIs 713</p> <p>Configuring the Java Environment 716</p> <p>ASP.NET 718</p> <p>Identifying User-Supplied Data 718</p> <p>Session Interaction 719</p> <p>Potentially Dangerous APIs 720</p> <p>Configuring the ASP.NET Environment 723</p> <p>PHP 724</p> <p>Identifying User-Supplied Data 724</p> <p>Session Interaction 727</p> <p>Potentially Dangerous APIs 727</p> <p>Configuring the PHP Environment 732</p> <p>Perl 735</p> <p>Identifying User-Supplied Data 735</p> <p>Session Interaction 736</p> <p>Potentially Dangerous APIs 736</p> <p>Configuring the Perl Environment 739</p> <p>JavaScript 740</p> <p>Database Code Components 741</p> <p>SQL Injection 741</p> <p>Calls to Dangerous Functions 742</p> <p>Tools for Code Browsing 743</p> <p>Summary 744</p> <p>Questions 744</p> <p><b>Chapter 20 A Web Application Hacker’s Toolkit 747</b></p> <p>Web Browsers 748</p> <p>Internet Explorer 748</p> <p>Firefox 749</p> <p>Chrome 750</p> <p>Integrated Testing Suites 751</p> <p>How the Tools Work 751</p> <p>Testing Work Flow 769</p> <p>Alternatives to the Intercepting Proxy 771</p> <p>Standalone Vulnerability Scanners 773</p> <p>Vulnerabilities Detected by Scanners 774</p> <p>Inherent Limitations of Scanners 776</p> <p>Technical Challenges Faced by Scanners 778</p> <p>Current Products 781</p> <p>Using a Vulnerability Scanner 783</p> <p>Other Tools 785</p> <p>Wikto/Nikto 785</p> <p>Firebug 785</p> <p>Hydra 785</p> <p>Custom Scripts 786</p> <p>Summary 789</p> <p><b>Chapter 21 A Web Application Hacker’s Methodology 791</b></p> <p>General Guidelines 793</p> <p>1 Map the Application’s Content 795</p> <p>2 Analyze the Application 798</p> <p>3 Test Client-Side Controls 800</p> <p>4 Test the Authentication Mechanism 805</p> <p>5 Test the Session Management Mechanism 814</p> <p>6 Test Access Controls 821</p> <p>7 Test for Input-Based Vulnerabilities 824</p> <p>8 Test for Function-Specific Input Vulnerabilities 836</p> <p>9 Test for Logic Flaws 842</p> <p>10 Test for Shared Hosting Vulnerabilities 845</p> <p>11 Test for Application Server Vulnerabilities 846</p> <p>12 Miscellaneous Checks 849</p> <p>13 Follow Up Any Information Leakage 852</p> <p>Index 853</p>
<b>DAFYDD STUTTARD</b> is an independent security consultant, author, and software developer specializing in penetration testing of web applications and compiled software. Under the alias PortSwigger, Dafydd created the popular Burp Suite of hacking tools. <p><b>MARCUS PINTO</b> delivers security consultancy and training on web application attack and defense to leading global organizations in the financial, government, telecom, gaming, and retail sectors.<br /> The authors cofounded MDSec, a consulting company that provides training in attack and defense-based security.</p>
<b>New technologies. New attack techniques. Start hacking.</b> <p>Web applications are everywhere, and they're insecure. Banks, retailers, and others have deployed millions of applications that are full of holes, allowing attackers to steal personal data, carry out fraud, and compromise other systems. This book shows you how they do it.</p> <p>This fully updated edition contains the very latest attack techniques and countermeasures, showing you how to break into today's complex and highly functional applications. Roll up your sleeves and dig in.</p> <ul> <li> <p>Discover how cloud architectures and social networking have added exploitable attack surfaces to applications</p> </li> <li> <p>Leverage the latest HTML features to deliver powerful cross-site scripting attacks</p> </li> <li> <p>Deliver new injection exploits, including XML external entity and HTTP parameter pollution attacks</p> </li> <li> <p>Learn how to break encrypted session tokens and other sensitive data found in cloud services</p> </li> <li> <p>Discover how technologies like HTML5, REST, CSS and JSON can be exploited to attack applications and compromise users</p> </li> <li> <p>Learn new techniques for automating attacksand dealing with CAPTCHAs and cross-site request forgery tokens</p> </li> <li> <p>Steal sensitive data across domains using seemingly harmless application functions and new browser features</p> </li> </ul> <p>Find help and resources at http://mdsec.net/wahh</p> <ul> <li> <p>Source code for some of the scripts in the book</p> </li> <li> <p>Links to tools and other resources</p> </li> <li> <p>A checklist of tasks involved in most attacks</p> </li> <li> <p>Answers to the questions posed in each chapter</p> </li> <li> <p>Hundreds of interactive vulnerability labs</p> </li> </ul>

Diese Produkte könnten Sie auch interessieren:

Symbian OS Explained
Symbian OS Explained
von: Jo Stichbury
PDF ebook
32,99 €
Symbian OS Internals
Symbian OS Internals
von: Jane Sales
PDF ebook
56,99 €
Parallel Combinatorial Optimization
Parallel Combinatorial Optimization
von: El-Ghazali Talbi
PDF ebook
120,99 €