Book Image

Mastering Metasploit - Fourth Edition

By : Nipun Jaswal
Book Image

Mastering Metasploit - Fourth Edition

By: Nipun Jaswal

Overview of this book

Updated for the latest version of Metasploit, this book will prepare you to face everyday cyberattacks by simulating real-world scenarios. Complete with step-by-step explanations of essential concepts and practical examples, Mastering Metasploit will help you gain insights into programming Metasploit modules and carrying out exploitation, as well as building and porting various kinds of exploits in Metasploit. Giving you the ability to perform tests on different services, including databases, IoT, and mobile, this Metasploit book will help you get to grips with real-world, sophisticated scenarios where performing penetration tests is a challenge. You'll then learn a variety of methods and techniques to evade security controls deployed at a target's endpoint. As you advance, you’ll script automated attacks using CORTANA and Armitage to aid penetration testing by developing virtual bots and discover how you can add custom functionalities in Armitage. Following real-world case studies, this book will take you on a journey through client-side attacks using Metasploit and various scripts built on the Metasploit 5.0 framework. By the end of the book, you’ll have developed the skills you need to work confidently with efficient exploitation techniques
Table of Contents (17 chapters)
1
Section 1 – Preparation and Development
6
Section 2 – The Attack Phase
10
Section 3 – Post-Exploitation and Evasion

What this book covers

Chapter 1, Approaching a Penetration Test Using Metasploit, takes us through the absolute basics of conducting a penetration test with Metasploit. It helps in establishing an approach and setting up the environment for testing. Moreover, it takes us through the various stages of a penetration test systematically. It further discusses the advantages of using Metasploit over traditional and manual testing.

Chapter 2, Reinventing Metasploit, covers the absolute basics of Ruby programming essentials that are required for module building in Metasploit. This chapter further covers how to dig into existing Metasploit modules and write our custom scanner, authentication tester, post-exploitation, and credential harvester modules; finally, it builds on our progress by throwing light on developing custom modules in Railgun.

Chapter 3, The Exploit Formulation Process, discusses how to build exploits by covering the essentials of exploit writing. This chapter also introduces fuzzing and throws light on debuggers too. It then focuses on gathering essentials for exploitation by analyzing the application's behavior under a debugger. It finally shows the exploit-writing process in Metasploit based on the information collected and discusses bypasses for protection mechanisms such as SEH and DEP.

Chapter 4, Porting Exploits, helps to convert publicly available exploits into the Metasploit framework. This chapter focuses on gathering essentials from the available exploits written in Perl/Python and PHP, along with server-based exploits, by interpreting the essential information with a Metasploit-compatible module using Metasploit libraries and functions.

Chapter 5, Testing Services with Metasploit, carries our discussion on performing a penetration test over various services. This chapter covers some crucial modules in Metasploit that help in testing SCADA, database, and VOIP services.

Chapter 6, Virtual Test Grounds and Staging, is a brief discussion on carrying out a complete penetration test using Metasploit. This chapter focuses on additional tools that can work along with Metasploit to conduct a comprehensive penetration test. The chapter advances by discussing popular tools including Nmap and OpenVAS while explaining the use of these tools within Metasploit itself. It discusses Active Directory testing and generating manual and automated reports.

Chapter 7, Client-Side Exploitation, shifts our focus to client-side exploits. This chapter focuses on modifying the traditional client-side exploits into a much more sophisticated and precise approach. The chapter starts with browser-based and file-format-based exploits and discusses compromising the users of a web server. It also explains the modification of browser exploits into a lethal weapon using Metasploit. Along with this, it discusses Arduino devices and their combined usage with Metasploit. Toward the end, the chapter focuses on developing strategies to exploit Android and using Kali NetHunter.

Chapter 8, Metasploit Extended, talks about basic and advanced post-exploitation features of Metasploit, escalating privileges, using transports, and much more. The chapter advances by discussing the necessary post-exploitation features available on the Meterpreter payload and moves to examining the advanced and hardcore post-exploitation modules. Not only does this chapter help provide quick know-how about speeding up the penetration testing process, but it also uncovers many features of Metasploit that save a healthy amount of time while scripting exploits. By the end, the chapter also discusses automating the post-exploitation process.

Chapter 9, Evasion with Metasploit, discusses how Metasploit can evade advanced protection mechanisms, such as antivirus solutions, by using custom codes with Metasploit payloads. It also outlines how signatures of IDPS solutions such as Snort can be bypassed and how we can circumvent blocked ports on a Windows-based target.

Chapter 10, Metasploit for Secret Agents, talks about how law enforcement agencies can make use of Metasploit for their operations. The chapter discusses proxying sessions, unique APT methods for persistence, sweeping files from the target systems, code-caving techniques for evasion, using venom framework to generate undetectable payloads, and how not to leave traces on the target systems using anti-forensic modules.

Chapter 11, Visualizing Metasploit, is dedicated to the GUI tools associated with Metasploit. This chapter builds upon controlling Meterpreter sessions with Kage and performing tasks such as scanning and exploiting a target with Armitage. The chapter also teaches fundamentals for red-teaming with the Armitage's Teamserver. In the end, it discusses Cortana, which is used for scripting attacks in Armitage by developing virtual bots.

Chapter 12, Tips and Tricks, teaches you various skills to speed up your testing and use Metasploit more efficiently.