Book Image

Mastering Modern Web Penetration Testing

By : Prakhar Prasad, Rafay Baloch
Book Image

Mastering Modern Web Penetration Testing

By: Prakhar Prasad, Rafay Baloch

Overview of this book

Web penetration testing is a growing, fast-moving, and absolutely critical field in information security. This book executes modern web application attacks and utilises cutting-edge hacking techniques with an enhanced knowledge of web application security. We will cover web hacking techniques so you can explore the attack vectors during penetration tests. The book encompasses the latest technologies such as OAuth 2.0, Web API testing methodologies and XML vectors used by hackers. Some lesser discussed attack vectors such as RPO (relative path overwrite), DOM clobbering, PHP Object Injection and etc. has been covered in this book. We'll explain various old school techniques in depth such as XSS, CSRF, SQL Injection through the ever-dependable SQLMap and reconnaissance. Websites nowadays provide APIs to allow integration with third party applications, thereby exposing a lot of attack surface, we cover testing of these APIs using real-life examples. This pragmatic guide will be a great benefit and will help you prepare fully secure applications.
Table of Contents (18 chapters)
Mastering Modern Web Penetration Testing
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

The return of XSS


We've already covered XSS in Chapter 3, Cross-Site Scripting (XSS), but here, we'll have a few more techniques related to XSS in the form of malicious file uploads. There are different file formats, which when allowed, can execute arbitrary JavaScript. Let's go through some of them.

SWF – the flash

There are certain cases when .swf files are allowed to upload. In this case, we can craft an ActionScript code to execute JS, compile it, and then upload it on the vulnerable website to achieve XSS capability.

The following is an ActionScript2 (AS2) code which uses the getURL() function to execute JS when run in a browser with Adobe Flash Player:

class XSS {
    static var app: XSS;
    function XSS() {
      var xss = "javascript:alert(\"SWF-based XSS: \"+document.domain)";
      getURL(xss, "_self");
    }
    static function main(mc) {
      app = new XSS();
    }}

To compile this code into a .swf file, we'll use a cross-platform ActionScript2 compiler known as mtasc. It is...