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

Introducing file upload vulnerability


The DVWA web application was installed in a Debian server and was configured with a low security level. Let's visit the file upload section and see if we can upload and run our own PHP script on the backend:

We're presented with an HTML form that is asking us to upload an image. Instead, let's create a simple PHP file containing the following code, which displays the version of PHP installed, through the test.php filename:

<?php
echo phpversion();
?>

The preceding code executes the phpversion(); function when executed by a PHP interpreter. We use this to check if the uploaded PHP file is successfully executed on the server side or not:

We get a successful upload message and path information for the file as well, let's try to access the file to see if PHP code execution is possible on the server:

Look at that! Our PHP code ran on the server successfully. This payload was benign, only intended for testing. Now let's try executing shell commands on the...