29,99 €
This book provides a comprehensive guide to cybersecurity, covering hacking techniques, tools, and defenses. It begins by introducing key concepts, distinguishing penetration testing from hacking, and explaining hacking tools and procedures. Early chapters focus on security fundamentals, such as attack vectors, intrusion detection, and forensic methods to secure IT systems.
As the book progresses, readers explore topics like exploits, authentication, and the challenges of IPv6 security. It also examines the legal aspects of hacking, detailing laws on unauthorized access and negligent IT security. Readers are guided through installing and using Kali Linux for penetration testing, with practical examples of network scanning and exploiting vulnerabilities.
Later sections cover a range of essential hacking tools, including Metasploit, OpenVAS, and Wireshark, with step-by-step instructions. The book also explores offline hacking methods, such as bypassing protections and resetting passwords, along with IT forensics techniques for analyzing digital traces and live data. Practical application is emphasized throughout, equipping readers with the skills needed to address real-world cybersecurity threats.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 1593
Veröffentlichungsjahr: 2024
Michael Kofler, Klaus Gebeshuber, Peter Kloep, Frank Neugebauer, André Zingsheim, Thomas Hackner, Markus Widl, Roland Aigner, Stefan Kania, Tobias Scheible, Dr. Matthias Wübbeling
The Comprehensive Guide to Penetration Testing and Cybersecurity
This e-book is a publication many contributed to, specifically:
Editor Kyrsten ColemanAcquisitions Editor Hareem ShafiGerman Edition Editor Christoph Meister, Anne ScheibeCopyeditor Melinda RankinTranslation Winema Language Services, Inc.Cover Design Graham Geary Shutterstock.com: 186627704/© Nneirda, 1472495273/© Alexander SupertrampProduction E-Book Hannah LaneTypesetting E-Book Satz-Pro, Germany
We hope that you liked this e-book. Please share your feedback with us and read the Service Pages to find out how to contact us.
The Library of Congress Cataloging-in-Publication Control Number for the printed edition is as follows: 2023019445
ISBN 978-1-4932-2425-8 (print)ISBN 978-1-4932-2426-5 (e-book)ISBN 978-1-4932-2427-2 (print and e-book)
© 2023 by Rheinwerk Publishing Inc., Boston (MA)1st edition 2023 3rd German edition published 2023 by Rheinwerk Verlag, Bonn, Germany
These days most websites require you to have a profile to use them fully, and the guidelines for creating a usable password have become more and more complex. It’s a joke within internet spheres that soon you’ll need a DNA sample just to be able to access your social media account successfully. Although comments like these are obviously a joke, the real fear of getting sensitive information stolen is evident in the rise of websites or browser add-ons with the main purpose of either saving or creating unique passwords.
As the age of technology moves forward at breakneck pace and storing sensitive information online becomes even more normalized, it’s more important than ever to stay informed if you’re a cybersecurity professional. Enter Hacking and Security: The Comprehensive Guide to Penetration Testing and Cybersecurity, a guide to help beginners and seasoned professionals alike navigate the cyber landscape with confidence. Our expert author team will teach you to use ethical hacking and other cybersecurity techniques to uncover security vulnerabilities and harden your sensitive systems against attacks.
What did you think about our book? Your comments and suggestions are the most useful tools to help us make our books the best they can be. Please feel free to contact me and share any praise or criticism you may have.
Thank you for purchasing a book from SAP PRESS!
Kyrsten ColemanEditor, SAP PRESS
[email protected] Publishing • Boston, MA
This e-book is protected by copyright. By purchasing this e-book, you have agreed to accept and adhere to the copyrights. You are entitled to use this e-book for personal purposes. You may print and copy it, too, but also only for personal use. Sharing an electronic or printed copy with others, however, is not permitted, neither as a whole nor in parts. Of course, making them available on the internet or in a company network is illegal as well.
For detailed and legally binding usage conditions, please refer to the section Legal Notes.
This e-book copy contains a digital watermark, a signature that indicates which person may use this copy:
You are reading this e-book in a file format (EPUB or Mobi) that makes the book content adaptable to the display options of your reading device and to your personal needs. That’s a great thing; but unfortunately not every device displays the content in the same way and the rendering of features such as pictures and tables or hyphenation can lead to difficulties. This e-book was optimized for the presentation on as many common reading devices as possible.
If you want to zoom in on a figure (especially in iBooks on the iPad), tap the respective figure once. By tapping once again, you return to the previous screen. You can find more recommendations on the customization of the screen layout on the Service Pages.
News coverage of hacking attacks and security breaches affecting millions, sometimes billions, of devices is ubiquitous. It has brought the topics of hacking and IT security increasingly to the fore in recent years and has also created an awareness among “normal users” that the security of IT infrastructure affects everyone.
Many computer, smartphone, or, more generally, internet users are in danger of resigning themselves to the many risks. It’s clear to most that “proper” passwords should be used and that updates should be applied regularly—but beyond that, users feel largely unprotected against the dangers of increasing digitization.
In fact, it’s primarily the task of administrators, IT managers, and software developers to ensure greater security. Increasingly stringent legal requirements and the loss of image associated with security breaches are forcing companies to take a more intensive look at security. It’s no longer enough for a device to simply work, for software to look “fancy,” or for smartphones to be packaged in stylish, ever-thinner cases. The hardware and software, along with the associated server and cloud infrastructure, must also be secure—at least as secure as is currently technically possible.
Hacking is the colloquial term for finding ways to bypass the security measures of a program or system or to exploit known security gaps. The goal is usually to read or manipulate private or secret data.
Hacking often has a negative context, but it’s not always a bad thing: when a company commissions a so-called penetration test to verify the security of its own IT infrastructure by external persons, the penetration testers use the same tools as criminal hackers. The same is true for security researchers trying to find new vulnerabilities. This is often done on behalf of or in collaboration with large IT companies, universities, or government security agencies. Whether a hacker is “good” or “bad” depends on how he or she behaves once a vulnerability has been discovered.
If you’re an administrator or IT manager responsible for the security of a system, you need to know the tools that hackers use. To defend yourself or your company, you need to know how attackers operate. In that respect, this book is very concerned with giving you an overview of the most important hacking tools and techniques. However, we don’t stop at that point. Rather, we’ll focus on how you can defend yourself against attackers, what defensive actions you can take, and where you can improve the configuration of your systems. To put it another way:for this book, hacking is the means, rather than the end. The goal is to achieve a higher level of safety.
In this work, we want to provide a broad introduction to the topics of hacking and IT security. With almost 1,200 pages on offer, it may sound like an understatement to speak of an “introduction.” But the reality is that both hacking and security are immeasurably large areas of knowledge.
One could write a separate book on almost every topic we address in this book. In addition, there are all the special topics that we don’t even touch upon in our book. In a nutshell: don’t expect this book to be all-encompassing or that by reading it you will already be a hacking and security expert.
That being said, there has to be a starting point if you want to get into hacking and security. We tried our best to give you a good starting point with this book. Specifically, after an introduction to our range of topics, we’ll address the following subjects:
Kali Linux (distribution with a huge collection of hacking tools)
Metasploitable and Juice Shop (virtual test systems for trying out hacking)
Hacking tools (nmap, hydra, Metasploit, Empire, OpenVAS, SET, Burp, Wireshark, and so on)
Offline hacking; access to other people’s notebooks/hard drives
IT forensics
Password hacking; secure handling of passwords
Wi-Fi, Bluetooth, and radio communication
USB hacking and security
Implementation of external security checks
Penetration testing
Basic coverage of Windows and Linux, Active Directory, and Samba
Intrusion detection systems and Snort
Exploit basics of buffer overflows, fuzzing, heap spraying, microarchitecture vulnerabilities (Meltdown and Spectre).
Cloud security, focusing on Amazon S3, Nextcloud/ownCloud, Microsoft 365
Hacking and security of smartphones and other mobile devices
Attacking and securing web applications
Securing and secure development of IoT devices
Bug bounty programs
The wide range of topics explains why this book has not one author, but 11. A brief introduction to our team can be found at the end of the book.
For this edition, we’ve comprehensively updated the book and added much new content. This includes, in particular, the following:
IT forensics
Intrusion detection systems and Snort
Bug bounty programs
Sliver, Starkiller, and MalDuino
Purple teaming
Linux kernel hardening
This book is intended for system administrators, security managers, developers, and IT professionals in general who already have some basic knowledge. To put it bluntly: you should at least know what PowerShell or a terminal is. And you must be willing to think across operating systems: neither hacking nor IT security is limited to Windows or Linux computers today.
Pure IT users, on the other hand, are not in the focus. Of course, training computer users is an indispensable aspect of improving IT security both at home and in businesses. However, a compilation of more or less trivial rules and tips on how to use computers, smartphones, and the internet in general safely and responsibly does not seem to us to serve a purpose in this technically oriented book.
Don’t be put off by the size of the subject area! We’ve tried to divide our book into manageable chapters. You can read most of them largely independently to learn the ropes step by step, gain hacking expertise, and develop a better understanding of how to better secure your own systems. You’ll quickly discover that a more in-depth look at hacking and security techniques is incredibly fascinating.
With our book, we hope to contribute to better management of IT security in the future than has been the case so far!
—Michael Kofler, on behalf of the entire team of authors
Experience from numerous penetration tests shows that many administrators of computer systems and networks hardly know about the capabilities and audacity of hackers. An attacker needs exactly one vulnerability to penetrate a system; a defender needs to prevent many of the possible attacks. There are no rules; no path is off-limits to a hacker.
I’ve always been fascinated by the extreme creativity of and technical capabilities and variants that have been implemented by hackers. I’ve always wanted to know what the bad guys can do so I can use the knowledge to strengthen the good side. The book The Art of Intrusion by Kevin Mitnick (Wiley 2005) sparked my curiosity about the subject even more.
It is also a great concern of mine to show young people the fascinating technical possibilities on the one hand while also motivating their future work on the good side. The European Cyber Security Challenge, with local qualifications for pupils and students in 24 European countries and a European final, provides a great opportunity to discover and promote young security talents.
I have often noticed that some aspects of security are ignored when it comes to Samba servers. Frequently, Samba shares are given permissions to prevent unauthorized access, but the security of the operating system is then sometimes neglected. A Linux host with Samba as a file server must always be viewed from two angles. I always address this in my seminars as well. For a long time, I wanted to describe this view of Samba systems in more detail.
That’s when I got the request from Rheinwerk Publishing for this book, which was exactly what I had imagined. It’s not just about configuring a Samba server, but about setting up a Samba server as securely as possible. The framework of the book covering various tools, services, and devices is also just right for the topic. So here’s a book that I myself have always wanted. I’m very pleased that I can now contribute to it with my chapter. I hope you, reader, will enjoy this book as much as I did.
IT security is a topic that no one can ignore. The German public is regularly startled by hacking incidents: In 2020, a cyberattack on Duesseldorf University Hospital led to the hospital having to sign off on emergency care and cancel surgeries. In 2021, Bitkom reported that annual damages from hacker attacks had exceeded 220 billion euros. At the same time, the highest number of new malware variants ever measured was recorded. And recently, since the start of the war against Ukraine in February 2022, the full implications of cyberwar are also being felt.
Thus the motto is: IT security must be at the top of the priority list—for companies, organizations, and the public sector. But IT security should also play a more prominent role for private users.
Attacks on IT systems are very attractive for perpetrators. From online payments and business processes to cloud-based services and the Internet of Things (IoT), digital infrastructures offer a large field of attack. The anonymity of the web lowers the inhibition threshold for attempting such attacks.
Anyone who cuts corners when it comes to IT and data security is ill-advised. If, on the other hand, you succeed in teaching your own employees how hackers think and act, you’re already a big step closer to a robustly secured IT infrastructure. Those who understand their attackers are better defenders.
This compendium therefore goes in exactly the right direction with its concern: “For this book, hacking is the means, rather than the end. The goal is to achieve a higher level of safety,” the preface states. I can only support this: as managing director of SySS GmbH, I am responsible for 90 IT security consultants who do nothing else every day but “hack” our customers’ systems on demand.
Such penetration tests quickly and efficiently detect security gaps. IT managers can then fix them—before illegal hackers exploit them. At the same time, such a test and the associated final report also show our customers in detail how we act to detect and exploit weaknesses.
It is precisely such knowledge that is of inestimable importance when it comes to making one’s own systems ever more secure. The book Hacking and Security provides this know-how for practical use. I can only warmly recommend to anyone who is professionally involved in IT security to read it. Stay one step ahead of the “bad” hackers.
—Sebastian Schreiber, Managing Director SySS GmbH
This chapter provides a first introduction to the huge topic of hacking and security and answers the following basic questions:
What is hacking? Are there good and bad hackers?
What is security?
Why is software so insecure?
What are attack vectors? Which attack vectors exist?
What are (zero-day) exploits?
What is the purpose of penetration testing?
What laws and standards apply to hacking and security?
Because you bought this book, you’re obviously interested in these topics and probably have prior knowledge. Nevertheless, we advise you to take a closer look at this relatively nontechnical chapter. It introduces terms and concepts used throughout the book. Even IT professionals, mostly specialists in a rather narrow field, are rarely familiar with the diverse terminology of the security world. Thus, not only is this chapter an introduction, but it also aims to provide a linguistic basis for a better understanding of all subsequent chapters.
Wikipedia defines a hack as an action to break or bypass the security mechanisms of a system. A hack in this context is therefore an unintended way of breaking into a system, changing, manipulating, or destroying data. (A hack can also be a messy, quickly created solution to a problem or the misuse of a device to perform other tasks. But that’s not the subject of this book).
Accordingly, hacking is the search for hacks and a hacker is the person who deals with them. In the media, the term hacking is usually used in a negative or criminal context, but that’s not correct. Hacking in itself is value-neutral. Just as a knife can be used equally to cut vegetables or kill someone, finding a hack can be used to improve the security of a system or to attack the system and cause damage.
Rules also apply to hackers. On the one hand, laws prohibit any unauthorized data manipulation, sometimes including even the attempt to penetrate a computer system. On the other hand, the hacking community has repeatedly defined its own ethical rules. Admittedly, there’s no international standard for this. Rather, what a hacker may or should do depends heavily on cultural and political contexts. From this point of view, hackers are sometimes divided into three groups, although the boundaries cannot always be drawn exactly:
Responsible hackers abide by both laws and hacker ethics. They use their knowledge to improve the security of computer systems, share discovered security vulnerabilities with affected manufacturers, and so on. The term ethical hacking is used for this type of hacking.
Criminal or malicious hackers use their knowledge for criminal activities and accept that their activities cause damage.
In between there are hackers who don’t play by the rules but pursue higher goals, such as improving society or using technology more responsibly. There’s a large gray area here that makes a clear distinction between good and evil difficult or dependent on one’s social or political position.
The hacker types just outlined are often referred to as white hats, black hats, and grey hats. In 2020, security expert David Kleidermacher initiated a discussion about these terms because they could be interpreted in a racist way. Many members of the community, on the other hand, argue that white and black in this context have nothing to do with skin color, but with the dualism between day and night, or with the colors of hats in old Westerns. (In some such films, the villains wear black hats.) For more, see http://s-prs.co/v569600.
The derogatory term script kiddies refers to people who, without in-depth knowledge, carry out hacking attacks with programs or scripts that are easy to find on the internet and sometimes cause great damage. But it’s debatable whether script kiddies also count as hackers. In any case, the term cracker, which was suggested for better differentiation, has not caught on.
Hacking needs to be learned. Of course, you can read books like this one and try the techniques presented here yourself. Much more entertaining, and especially popular in IT student circles, are hacking competitions. In these competitions, participants are given access to specially prepared computer systems, usually in the form of virtual machines. The objective is often to penetrate the system and find hidden “treasures” (“flags”) in it as quickly as possible. The collective name for such competitions is capture the flag (CTF). Frequently, participants are not only individuals, but entire teams.
There are also variants of the classic CTF competitions in which, for example, each team receives a server. The goal then is to protect your own server against the attacks of the other teams and at the same time to attack and “conquer” the servers of the other teams. Individual subtasks are rewarded with points. The team that scores the most points is the winner.
There are various sites on the internet where virtual machines from former hacking competitions are available for download (search for “hacking ctf images”, for example). With these downloads, you can try the former competition content for yourself and see how far you would get. Often, there are also more or less concrete solution instructions (search for “hacking ctf writeups”).
Beginners often are overwhelmed by the mostly very specific tasks in hacking contests. A better place to start is with purpose-built virtual machines or Docker images that use outdated versions of popular software. Moreover, these machines are prepared with various security vulnerabilities, which almost guarantees a certain sense of achievement.
We’ll introduce the most popular of these test systems in Chapter 3.
A penetration test (pen test for short) is a comprehensive security test for a computer system (see also Chapter 10 and Chapter 11). Often a person or organization from outside the company is commissioned to do this. The pen testers try to act like hackers—that is, attack the system and find security gaps. This means that the same working techniques are applied. The main difference between hackers and pen testers is therefore not so much in the way they work as in the fact that pen testers have an explicit mandate for their work, and they do not manipulate or destroy data as part of their tests but report the defects they find so that they can then be fixed.
But pen testers have a big advantage over hackers: they don’t need to operate in secret. A hacker usually won’t start his attack with a large scan because its intensive tests will set all alarm bells ringing on a well-secured server. A pen tester acting in agreement with the company, on the other hand, can use such tools without any problem.
When it comes to accessing foreign data, manipulating it, or otherwise causing damage to IT systems, there are many paths that lead to the goal:
Network hackingIn a sense, this is the “classic” type of hacking; it’s done via network connections. For example, it exploits insecure passwords, sloppy configuration, or known bugs to perform the attack. The goal is mostly to gain unrestricted access to the computer either directly or by guessing/listening to a password or password hash (root access).Variants of this are fictitious websites for password entry (phishing) or the exploitation of programming errors in order to execute one’s own code or SQL statements on websites (HTML injections, SQL injections, and so on; see Chapter 17).
Password hackingKnowing the correct password provides the easiest way into the attacked computer. Accordingly, many techniques are aimed at finding a password. These include systematic cracking, logging of all keystrokes by software or hardware (key logging), reading and reusing password hashes, and so on. However, most of these methods already require access to the computer, either via the network or physically (e.g., to apply a USB key logger or to tap the wireless keyboard).
BackdoorsAn attacker can save himself all hacking effort if he knows about a so-called backdoor into a program or even installs it himself. In the simplest case, this is a combination of a login name and password known only to the manufacturer, as is common for many routers, mainboards, and the like. It’s rarely possible to prevent these passwords from being discovered and published on the internet sooner or later. However, the backdoor also can use a much more sophisticated mechanism.
With open-source software, permanent backdoors can almost be ruled out; they would be conspicuous in the publicly accessible code. However, there have been cases in which a hacker has offered a modified version of an open-source program for download. Such manipulations are easy to accomplish and are often noticed only after some time has passed. That’s why it’s recommended to download software only from official websites in general and take the trouble to check the checksums. (In real life, of course, one must assume that at best only a few enthusiasts with an affinity for security will make this effort.)
The situation is quite different for commercial software for which source code isn’t available. There are countless conspiracy theories floating around the web that manufacturers or intelligence agencies routinely build backdoors into operating systems and communications software. After the Snowden revelations, this can’t be ruled out entirely. And as neither the existence nor the nonexistence of a backdoor can be proven due to the lack of source code, this uncertainty will prevail
BugdoorsIt’s even more difficult to prove the existence of so-called bugdoors. These are errors—bugs—that pose a security problem and make it appear as if they were intentionally built in.Software contains errors; that’s incontrovertible wisdom. It’s impossible to say whether bugs were inserted on purpose without knowing the developers’ intentions. For this reason, it’s very difficult to work with this category. However, a bad taste remains when you look at the quality of the code that led to security vulnerabilities
Viruses, worms, and other malicious softwareA piece of malicious software (malware) is a program that performs unwanted functions on a computer or device. Depending on how such software spreads or is disguised, it can take the form of viruses, worms, Trojan horses, or backdoors.
The technical design adapts over time to the IT infrastructure currently in use. Whereas the first viruses were spread via floppy disks, email has become the most popular means of transfer in the last decade.
Malware is also extremely commonly encountered on smartphones (see Chapter 22). A classic example is a flashlight app in which, behind its intrinsically useful function, other functions for spying on the user are hidden. Today, the disguise is mostly better, but the idea has remained the same.
The objectives of malware also change and are subject to fashion trends. Encryption programs (ransomware) that first encrypt as many files on the hard drive as possible have been particularly popular recently. This has been driven to perfection by the Emotet malware, which has caused hundreds of millions of dollars in damage worldwide in recent years.
The key required to restore one’s own data after a ransomware attack can be purchased (ransomed) from the blackmailers. This business model works so well that criminals can combine predefined components and buy their own encryption Trojan on corresponding websites with just a few clicks (cybercrime as a service).
Denial of Service (DoS): Denial-of-serviceattacks have a completely different approach. Their sole purpose is to disrupt the operation of a company or access to a disliked website by sending so many requests that regular operation is no longer possible. DoS attacks work particularly well if a software bug can be exploited at the same time to specifically crash the server’s software.
Botnets are often used for DoS attacks. A botnet is a network of computers or devices that have been previously brought under the hacker’s control using other methods. A botnet can be used to coordinate and send hundreds of thousands of requests per second to a particular server until it becomes overwhelmed by the onslaught and stops responding properly. This type of attack is referred to as a distributed denial of service (DDoS).
Individual companies are usually not in a position to defend themselves against a targeted DDoS attack. This requires the help of the companies responsible for the internet infrastructure. These companies can, for example, intervene in large network nodes with filters or firewalls.
In practice, many attacks utilize multiple exploits and apply different methods simultaneously. Sophisticated hackers always manage to carry out a successful attack by combining vulnerabilities that are relatively harmless in themselves.
The number of hacking targets has increased dramatically in recent years. While “classic” hacking was directed against computers or servers, it’s now also necessary to keep an eye on smartphones and all networked devices. These include network routers, switches, firewalls, printers, TVs, Wi-Fi- or Bluetooth-enabled loudspeakers, automatic vacuum cleaners, web cameras, other electronic devices and gadgets (Internet of Things [IoT] devices), heating, ventilation, and shading systems (home automation), electronic doors and locks, cars, airplanes, medical equipment, industrial facilities, and much more.
The cloud is a topic in itself. By its very nature, the cloud consists of computers or virtual machines that can be attacked as such. At the same time, however, the cloud system as a whole is also a target for attack: countless secret documents have already been downloaded from the Amazon cloud because an administrator overlooked the fact that the directories in question were publicly accessible without any protection. (However, it’s debatable whether taking advantage of such negligence has anything to do with hacking).
Attacks on subcomponents of a device, such as a Wi-Fi chip or a CPU, go in a completely different direction. For example, in the fall of 2017, it emerged that many Intel CPUs produced over a two-year period have a mini operating system with management functions at the lowest level—the management engine. (Strictly speaking, this is an adapted Minix—that is, a tiny Unix variant developed for training purposes).
One might argue about who needs such functions at all, but the matter becomes disastrous when it turns out that the CPU and any software running on it can be attacked via these management functions due to basic and partly trivial errors. It’s no wonder that some critics even suspect a backdoor here.
In early 2018, the next CPU-level security disaster was revealed: A flaw in several CPU architectures, which is particularly severe in Intel models, allows processes to access isolated memory areas of other processes. The error is so elementary that there is a whole range of attack variants. The two most important ones were given the names Meltdown and Spectre (see Chapter 18, Section 18.10).
These bugs affect billions of devices. Updates on the CPU level (via microcode updates) are only partially possible. For this reason, all operating systems (Windows, macOS, Linux, iOS, Android) and web browsers have to be adapted so that their code virtually bypasses the CPU bug—at the price of reduced system performance. Because many devices will never receive the required updates, this bug will probably have an impact for years to come.
Meltdown and Spectre were unfortunately just the beginning. Once on the right track, security researchers found a whole series of related vulnerabilities. Although there are bug fixes for these as well, they are associated with further speed losses.
Similarly problematic to CPU errors are errors in GPUs or in network chips. For example, the Kr00k security gap, which affects Wi-Fi chips made by Broadcom and Cypress, was discovered at the beginning of 2020. These chips are estimated to be installed in more than 1 billion devices (mainly smartphones)! While software updates are available, it’s unclear how many devices will ever receive these updates.
You can see that errors at the hardware or firmware level are becoming more and more frequent, and their scope is enormous—on the one hand, such errors can be exploited regardless of the operating system, and on the other hand, they are particularly difficult to fix through updates. Although firmware updates are possible for most chips, their implementation is complicated in many operating systems, and not provided for at all with others. For employees responsible for the security of a company or organization, this is a nightmare: Do all PCs, smartphones, routers, and so on that do not have a firmware update available now have to be taken out of service? Who will pay or justify the associated costs?
Instead of attacking hardware components, hackers can also exploit flaws in software components, such as programming errors in libraries or design flaws in application programming interfaces (APIs). In this context, the best known example from the recent past is named Log4Shell. The hack is based on the very popular open-source library Log4j, which is used in many Java programs to log messages. Unfortunately, in 2021 it was found that many programs that use Log4j use it to provide an almost trivially easy way to execute foreign code—a paradise for any hacker.
In this case, it’s even debatable whether the library is or was defective at all: in fact, using a particularly elegant logging syntax, the library has worked exactly as described since 2013. The fact that the mechanism can also be misused did not become known until eight years later.
The error behavior (or the too universal application possibility) of the library was quickly fixed after it became known. Nevertheless, countless vulnerable programs are still in use today. Every program that uses Log4j must be recompiled and then updated on the customer’s side or on each respective computer or device. And this is precisely where the problem lies: there is a lot of software that is no longer maintained or for which the distribution of updates (e.g., in IoT devices) is very costly.
To facilitate hacking, countless programs have been developed. The range extends from simple scripts for a network scan to comprehensive analysis tools that systematically scan a server or device for all known security gaps and problems.
In addition, there are programs that were originally designed to analyze network, Wi-Fi, or Bluetooth issues or for similar tasks, but which can of course be perfectly misused for other purposes. Much of this software is available free of charge on the internet, often even in source code (open-source concept).
In addition, there are companies that focus on this segment and sell software for very specific hacking tasks, sometimes in an upscale price segment for elite target groups (police, intelligence agencies, military, international security companies).
In this book, we’ll focus on common tools that are available for free and are correspondingly common in practice (see Chapter 4). Instead of searching for and downloading each hacking tool separately, many hackers and pen testers turn to complete toolboxes that provide a huge collection of tools in the form of a toolkit. The best known toolkit in this context is Kali Linux (see Chapter 2), a Linux distribution that bundles several thousand hacking programs that run on Linux.
Hacking tools are by no means limited to software. An entire market has now established itself for hacking hardware. The offer starts with simple “gadgets” that look like a USB stick but behave like a keyboard and quickly open PowerShell on Windows, download malware with a command, and execute it. If the target doesn’t manage to stop this process within two or three seconds, then it’s already too late.
However, there are also much more intelligent devices, which in fact are inconspicuously packaged mini computers. If the hacker manages to place these devices correctly (this usually requires physical access to the target’s computer), he can use them to hack into network, USB, or Bluetooth communications or perform other tasks.
In Chapter 9, we’ll introduce some such hacking gadgets and show you how you can protect yourself against them. A whole range of other hacking devices has been developed over the last few years.
Finally, the Raspberry Pi is recommended as a quasi entry into the world of hacking hardware: This minicomputer is not designed for hacking tasks, but it can be configured as a Wi-Fi access point in no time. Hackers can use it, for example, to try to lure their targets into a free, but unfortunately unencrypted, Wi-Fi connection. Subsequently, all sorts of nastiness can be realized, such as manipulating DNS records to redirect the target to phishing websites.