Mikhail Flionov - Linux through the eyes of a hacker. Mikhail Flionov: Linux through the eyes of a hacker Open source is safe

Mikhail Flenov

Linux through the eyes of a hacker

Foreword

This book is devoted to the consideration of one of the most popular operating systems (OS) installed on servers - Linux OS. For home use, this system is not yet as popular as among professional administrators, but recently there have been prerequisites for capturing this market.

Installing the OS is getting easier, and the graphical interface and usability are in some cases on par with the most famous Windows OS in the small business environment.

This book will be useful for Linux administrators and those users who want to get to know this system better. The configuration and security issues discussed will be useful for specialists using various operating systems, because most of the information is not tied to a specific system.

You will be able to find out how hackers infiltrate the servers and defend against intrusion. Since some of the examples in this book can be used not only for defense, but also for attack, I would like to warn young crackers. Healthy curiosity is good, but remember that law enforcement does not sleep and always gets its way. If once you were lucky with a break-in and no one paid attention to it, then next time you may find yourself in the hands of justice.

Part of the book is written from a hacker's point of view and demonstrates how they infiltrate the system. In the hope that this information will not be used to hack servers, I tried to focus specifically on protection and left some things outside of the presentation or simply did not finish, so that there would be no temptation to use the methods of hackers and break the law. Of course, to implement my ideas (to bring them to their logical conclusion), you need to spend a few minutes programming or searching the Internet. But while the book can serve as a starting point for a hacker, I hope it doesn't. Remember the legality of your actions.

Any object can be viewed from different points of view. A simple example from life is a knife, being a table object, under certain circumstances becomes a weapon of murder or a means of self-defense. Likewise, the hacker techniques that will be discussed in this book can be perceived as tips for day-to-day care of the OS, methods of protection against intrusion, and a means of hacking the system. I hope that you will not use the acquired knowledge for destructive purposes, it does not decorate a person. Why do you need a cracker's black popularity? Wouldn't it be better to devote yourself to more useful things.

Despite Linux's clear desire to settle in home computers, configuration is still too complex and contains many parameters that most users do not need. If you just close your eyes and leave all the defaults, then true Linux security is out of the question. No OS will work reliably and with maximum protection with these settings. The manufacturer cannot know in advance what we need, and does everything possible to make the program work on any system, and for this it is necessary to include many additional functions, which makes the system redundant.

It just so happened that Linux administrators should have more experience and knowledge than Windows specialists, and this is due precisely to the complexities of configuration. In this book, I tried to tell you as much as possible about the Linux OS, and at the same time I tried to do it from the perspective of a hacker.

Why is the book called "Linux through the eyes of a hacker", and what are those eyes? This question interests many of my readers. When we pick up a book, we hope that it appearance corresponds to the internal. In this case, we are talking about what content will correspond to this name? To answer this question, you need to clearly understand who a hacker is and what he sees in the OS.

When I am asked what I mean by the word "hacker", I give the simplest example: as an administrator, you installed and made the OS work, but if you managed to tune it for maximum performance and security, then you are a hacker.

The hacker's skills should be aimed at creating something better than others (faster, more convenient and safer). This is exactly what the Linux OS itself is, created by hackers for the whole world.

This book looks at the OS from the very basics to complex system manipulation. All the material presented is presented in a simple and accessible language. Thanks to this, you do not need additional literature to learn about Linux. All information can be obtained from one source. For a deeper study of the issue, you may only need good knowledge in English and reading the documentation or HOWTO files that come with the Linux system.

The main difference of the book is that we will not talk about security and performance in separate concluding chapters, which is a big mistake, but as needed. When a person has already acquired the skills of ineffective work with the system, it will be difficult to retrain. That is why we will analyze sequentially (from the basics to difficult questions) all aspects of each topic under consideration, carefully laying out the knowledge gained "on the shelves."

A description of the application and simple administration of Linux can always be found on the Internet or in the documentation on the OS, but information on effective use is more difficult to find, and all the available information is fragmentary and difficult to combine into one whole. But security doesn't like scrappy data. If you miss one small detail, your computer is vulnerable to hacking.

For additional information on the security of your computer and networks, I advise you to read my book "Computer Through the Eyes of a Hacker", which contains a lot general information on these issues.

Despite the fact that this book is aimed more at describing the security of the Linux operating system, many of the problems discussed in it can be useful to you when building a secure Linux server. Likewise, the book "Linux through the eyes of a hacker" will be useful for Windows security specialists.

This book does not cover issues related to viruses, because currently viral activity in Linux is minimal, but this does not mean that the danger does not exist. There is always a threat, and protection against viruses is similar to protection against Trojans, of which there are many for Linux. You can also read about virus attacks and the possibility of repelling them in the book "Computer through the eyes of a hacker".

So, let's get acquainted with Linux from the point of view of a hacker, and I am sure that you will look at it with completely different eyes and will find a lot of new and interesting things for yourself.

Acknowledgments

In each of my books, I try to thank everyone who participated in its creation and helped to come into being. Without these people, nothing would have happened.

First of all, I would like to mention the publishing house "BHV-Petersburg", with which I have been working for several years. Thanks to the management, editors and proofreaders who work with me to help make the book the way I intended it. After all, you have to write in difficult conditions, but it cannot be otherwise, because information is out of date before the book hits the counter.

I will never tire of thanking parents, wife and children for their patience. After the main work, I come home and work on the next book. Thus, the family can see me only at the computer, and it is very difficult to communicate with me, because all thoughts rush far into virtual reality.

Many thanks to my friends and acquaintances who suggested something, helped with ideas and programs.

Special thanks to the administrators of my ISP who made it possible to test some of the methods described in this book on their hardware and servers. I tried to work carefully and not destroy anything. It seems to be so ☺.

It just so happens, but animals also participate in the writing of each book. This work was no exception. My new cat Chikist walks around the apartment from 11:00 pm to 1:00 am and screams, I can't sleep, which means I devote more time to work.

I would like to thank another cat who is an assistant in the MS Office software package. I wrote the book in MS Word, and the Linux OS worked in virtual machineso you can take screenshots. If a child was thrown at me, the cat-assistant helped to occupy my one-year-old son, acting as a nanny. I put my son Kirill next to me, and he calmly played with the cat on the monitor screen, and I could continue to work on the book. True, sometimes it was necessary to save the cat and the monitor, when the son began clumsily stroking his beloved animal with a small hand.

And the biggest thanks go to you for buying the book, and to my regular readers, with whom I regularly communicate on the site's forum www.vr-online.ru. Last works based on their questions and suggestions. If you have any problems, then you are welcome to this forum. I will try to help as much as possible and look forward to any comments regarding this book. Your comments will help me make my job better.

Foreword

This book is devoted to the consideration of one of the most popular operating systems (OS) installed on servers - Linux OS. For home use, this system is not yet as popular as among professional administrators, but recently there have been prerequisites for capturing this market.

Installing the OS is getting easier, and the graphical interface and usability are in some cases on par with the most famous Windows OS in the small business environment.

This book will be useful for Linux administrators and those users who want to get to know this system better. The configuration and security issues discussed will be useful for specialists using various operating systems, because most of the information is not tied to a specific system.

You will be able to find out how hackers infiltrate the servers and defend against intrusion. Since some of the examples in this book can be used not only for defense, but also for attack, I would like to warn young crackers. Healthy curiosity is good, but remember that law enforcement does not sleep and always gets its way. If once you were lucky with a break-in and no one paid attention to it, then next time you may find yourself in the hands of justice.

Part of the book is written from a hacker's point of view and demonstrates how they infiltrate the system. In the hope that this information will not be used to hack servers, I tried to focus specifically on protection and left some things outside of the presentation or simply did not finish, so that there would be no temptation to use the methods of hackers and break the law. Of course, to implement my ideas (to bring them to their logical conclusion), you need to spend a few minutes programming or searching the Internet. But while the book can serve as a starting point for a hacker, I hope it doesn't. Remember the legality of your actions.

Any object can be viewed from different points of view. A simple example from life is a knife, being a table object, under certain circumstances becomes a weapon of murder or a means of self-defense. Likewise, the hacker techniques that will be discussed in this book can be perceived as tips for day-to-day care of the OS, methods of protection against intrusion, and a means of hacking the system. I hope that you will not use the acquired knowledge for destructive purposes, it does not decorate a person. Why do you need a cracker's black popularity? Wouldn't it be better to devote yourself to more useful things.

Despite Linux's clear desire to settle in home computers, configuration is still too complex and contains many parameters that most users do not need. If you just close your eyes and leave all the defaults, then true Linux security is out of the question. No OS will work reliably and with maximum protection with these settings. The manufacturer cannot know in advance what we need, and does everything possible to make the program work on any system, and for this it is necessary to include many additional functions, which makes the system redundant.

It just so happened that Linux administrators should have more experience and knowledge than Windows specialists, and this is due precisely to the complexities of configuration. In this book, I tried to tell you as much as possible about the Linux OS, and at the same time I tried to do it from the perspective of a hacker.

Why is the book called "Linux through the eyes of a hacker", and what are those eyes? This question interests many of my readers. When we pick up a book, we hope that its appearance matches the inner one. In this case, we are talking about what content will correspond to this name? To answer this question, you need to clearly understand who a hacker is and what he sees in the OS.

When I am asked what I mean by the word "hacker", I give the simplest example: as an administrator, you installed and made the OS work, but if you managed to tune it for maximum performance and security, then you are a hacker.

The hacker's skills should be aimed at creating something better than others (faster, more convenient and safer). This is exactly what the Linux OS itself is, created by hackers for the whole world.

This book looks at the OS from the very basics to complex system manipulation. All the material presented is presented in a simple and accessible language for each. Thanks to this, you do not need additional literature to learn about Linux. All information can be obtained from one source. For a deeper study of the issue, you may only need to have a good knowledge of English and read the documentation or HOWTO files that come with the Linux system.

The main difference of the book is that we will not talk about security and performance in separate concluding chapters, which is a big mistake, but as needed. When a person has already acquired the skills of ineffective work with the system, it will be difficult to retrain. That is why we will analyze sequentially (from the basics to difficult questions) all aspects of each topic under consideration, carefully laying out the knowledge gained "on the shelves."

A description of the application and simple administration of Linux can always be found on the Internet or in the documentation on the OS, but information on effective use is more difficult to find, and all the available information is fragmentary and difficult to combine into one whole. But security doesn't like scrappy data. If you miss one small detail, your computer is vulnerable to hacking.

For additional information on computer and network security, I advise you to read my book "Computer Through the Eyes of a Hacker", which provides a lot of general information on these issues.

Despite the fact that this book is aimed more at describing the security of the Linux operating system, many of the problems discussed in it can be useful to you when building a secure Linux server. Likewise, the book "Linux through the eyes of a hacker" will be useful for Windows security specialists.

This book does not cover issues related to viruses, because currently viral activity in Linux is minimal, but this does not mean that the danger does not exist. There is always a threat, and protection against viruses is similar to protection against Trojans, of which there are many for Linux. You can also read about virus attacks and the possibility of repelling them in the book "Computer through the eyes of a hacker".

So, let's get acquainted with Linux from the point of view of a hacker, and I am sure that you will look at it with completely different eyes and will find a lot of new and interesting things for yourself.

Acknowledgments

In each of my books, I try to thank everyone who participated in its creation and helped to come into being. Without these people, nothing would have happened.

First of all, I would like to mention the publishing house "BHV-Petersburg", with which I have been working for several years. Thanks to the management, editors and proofreaders who work with me to help make the book the way I intended it. After all, you have to write in difficult conditions, but it cannot be otherwise, because information is out of date before the book hits the counter.

I will never tire of thanking parents, wife and children for their patience. After the main work, I come home and work on the next book. Thus, the family can see me only at the computer, and it is very difficult to communicate with me, because all thoughts rush far into virtual reality.

Many thanks to my friends and acquaintances who suggested something, helped with ideas and programs.

Special thanks to the administrators of my ISP who made it possible to test some of the methods described in this book on their hardware and servers. I tried to work carefully and not destroy anything. It seems to be so?

It just so happens, but animals also participate in the writing of each book. This work was no exception. My new cat Chikist walks around the apartment from 11:00 pm to 1:00 am and screams, I can't sleep, which means I devote more time to work.

I would like to thank another cat who is an assistant in the MS Office software package. I wrote the book in MS Word, and the Linux OS was running in a virtual machine so that you could take screenshots. If a child was thrown at me, the cat-assistant helped to occupy my one-year-old son, acting as a nanny. I put my son Kirill next to me, and he calmly played with the cat on the monitor screen, and I could continue to work on the book. True, sometimes it was necessary to save the cat and the monitor, when the son began clumsily stroking his beloved animal with a small hand.

And the biggest thanks go to you for buying the book, and to my regular readers, with whom I regularly communicate on the site's forum www.vr-online.ru... Recent works are based on their questions and suggestions. If you have any problems, then you are welcome to this forum. I will try to help as much as possible and look forward to any comments regarding this book. Your comments will help me make my job better.

This text is an introductory fragment. From the C ++ book by Hill Murray

Foreword Language shapes our way of thinking and defines what we can think about. B.L. Worf C ++ is a versatile programming language designed to make programming more enjoyable for the serious programmer. Except for minor

From the book Music Center on the computer author Leontyev Vitaly Petrovich

Foreword A modern computer without sound, hardly anyone now can imagine. But at first it was so. Computers were created for serious computing in special organizations, the only sounds of which were the noise of fans and the chirping of printers. FROM

From book Microsoft Office author Leontyev Vitaly Petrovich

Foreword There is no doubt that the so-called office programs are the Most Popular and Most Useful programs of all that can live in the iron belly of your computer. And if you already know how to start a computer, install programs, work with

From the book Life Cycle Processes software tools author author unknown

From the book INFORMATION TECHNOLOGY. SOFTWARE DOCUMENTATION MANAGEMENT GUIDE author author unknown

Foreword 1. DEVELOPED AND INTRODUCED by the Technical Committee for Standardization TC 22 "Information Technology" 2. APPROVED AND PUT INTO EFFECT by Resolution of the State Standard of Russia No. 260 dated 20.12.93 The standard was prepared on the basis of the use of the authentic text of technical

From book Human factor in programming author Constantine Larry L

Foreword The Other Side softwareThis book is about the other side of software - the one that looks into external world... This side of computers is about people - techies like you and me, and ordinary people like you and me. The notes collected here explore

From book 300 best programs for all occasions author Leontyev Vitaly Petrovich

Foreword All the Most Necessary Things in this world have one disagreeable quality: at the right moment they are never at hand. Whether this is a consequence of the notorious "sandwich law" or of elementary human absent-mindedness - science does not know. Total all

From the BPwin book and Erwin. CASE development tools information systems author

Foreword The creation of modern information systems is a very difficult task, the solution of which requires the use of special techniques and tools. Not surprisingly, the number of system analysts and developers has grown significantly lately.

From the book Modeling Business Processes with BPwin 4.0 author Maklakov Sergey Vladimirovich

Preface In 1998, the author's book was published, dedicated to the tools for system analysis and design of information systems - BPwin and ERwin. (Maklakov S. BPwin and ERwin. CASE-tools for developing information systems. M: Dialogue-MEPhI). The book went through two editions and

From the book XSLT Technology author Valikov Alexey Nikolaevich

Foreword What is this book about? It is difficult to overestimate the impact that the emergence and spread of the extensible markup language XML (from the English extensible Markup Language) had on information technology over the past couple of years. XML technologies have found applications in many areas and

From the book Techniques for creating interiors of various styles the author Timofeev S.M.

Foreword 3ds Max is very popular program to create interior projects. The program provides a lot of opportunities for creating a photorealistic picture of the future interior, allows you to convey several design concepts for the same room,

From the book of 19 deadly sins that threaten software security author Howard Michael

Foreword The theory of computers is based on the assumption of deterministic behavior of machines. We usually expect the computer to behave as we programmed it to behave. In fact, this is only a rough assumption. Modern computers general

From How to Feed an Elephant, or First Steps to Organize Yourself with Evernote author Sultanov Gani

Foreword The book is dedicated to the case management and information collection system using the Evernote service. Here is what is written about this mini-book in the official blog of Evernote: “The book will be especially interesting for those who have been eyeing the methods of increasing personal effectiveness of GTD

From the book Introduction to Cryptography author Zimmermann Philip

Foreword Cryptography is a frequent topic in children's comics and spy stories. Children once collected Ovaltine® labels to obtain Captain Midnight's Secret Decoder Ring. Almost everyone has watched a television film about an inconspicuous dressed gentleman with

From the iOS book. Programming techniques author Nahavandipur Vandad

Foreword This edition of the book is not just a supplement, but a completely revised version of the previous one. Everything has changed in iOS 7: the look and feel of the operating system, the way we use our iOS devices and, most importantly, the principles

From the book The Fanatic Programmer by Fowler Chad

Foreword I'm sure that there is something extraordinary in each of us, but it takes a lot of time to understand what is really important, to pull it out of ourselves. You cannot become outstanding if you don’t love your environment, your tools, your area.



Considered the issues of tuning Linux OS for maximum performance and security. Basic administration and access control, Firewall configuration, file sharing server, WEB-, FTP- and Proxy-servers, delivery programs are described. email, dNS servicesas well as system monitoring policy and data archiving. Potential vulnerabilities are presented, recommendations are given to prevent possible attacks and it is shown how to act in case of an attack or hacking of the system in order to restore its operability as quickly as possible and prevent data loss. In the third edition, the material has been revised and supplemented with new information in accordance with modern realities. The CD contains additional documentation and source programs.

What is Linux?

Linux OS is free operating system, the source codes of which are open for public viewing and even for making changes. Most do not look at the source code, but perceive their presence as an additional pleasant freebie. But even a freebie should be useful, and if it is useless, then only litter.

No, having the source code is good, and I'm not arguing here. This is an advantage for such a product as an OS, because you can recompile the kernel and optimize its operation as much as possible for your hardware. If for custom utilities recompilation is not needed and, say, a text editor can be optimized only slightly, then for the OS the ability to compile source codes is a big and bold plus, which

allows you to squeeze the maximum out of your computer. But Linux has many other benefits, far more important.

Why am I saying this? Besides, I love Linux OS not for freebies and not for the availability of source codes, but for the quality. I will love it even if the source codes are closed or charged.

Is open source safe?


In addition, no matter how many people look at the source code, the security will not increase if the viewers do not have the necessary qualifications. Let's say that a billion people who don't understand programming look at codes, will security change? No. The number of real security specialists who have looked at the code is not so high, and they are able to quickly and efficiently find errors. This is a separate skill that requires special training.


Costly support can end up costing more Linux ownership than Windows. In North America, where IT pay is high, Linux often outperforms Windows in terms of cost of ownership.

Distributions

For a long time I could not decide which distribution to use, but then I decided to choose Ubuntu. I took a look at a couple of Linux sites and looked at the statistics of the operating systems from which users entered the site. Ubuntu turned out to be the most popular. In principle, knowing one distribution, it is very easy to switch to another, because each of them is still Linux.

But in reality, in 99% of cases in distributions everything is identical, so the problem is more exaggerated than it has real grounds.

I hope this book helps you learn more about security in general and Linux security in particular. We've talked a lot about both security and various attack methods, and it might seem that every administrator is fighting attackers. Personally, I believe that there are no hackers and crackers. This is a myth that administrators are trying to scare with.

There are strong and weak people in any world. Hackers, for the most part, are young guys who just know more than others and know how to apply their knowledge in practice.

For some reason the sphere information technologies many see it as something supernatural. But this is no longer the case. Computers have become part of our lives and have become the same household items as radio or television. So let's treat them as well.

It is normal for an automotive technician to interfere with the engine, bore it, or simply decorate the car. The manufacturer does not prohibit doing this, but does not guarantee stable operation after such actions. However, only the guarantee is lost, and it never occurs to anyone to pursue the auto repairman as an “auto hacker”.

All this suggests that hackers need to be dealt with intelligently. If your server has been hacked, this does not mean that a hacker should be jailed. No, you just need to pay much more attention to safety. If we can improve the overall level of knowledge and the quality of the services provided on the network, then there will be much less hacks and hackers.

Learn, develop and improve your own, rather than relying on ready-made solutions that should protect you. If you leave all the doors open, then no one will protect you, including law enforcement agencies.

Download from free file storage

Resolve the captcha to access the links!

The issues of tuning Linux OS for maximum performance and security are considered. Potential vulnerabilities and recommendations for preventing possible attacks are described. Given detailed description setting up access rights and configuring the firewall. It is shown how to act in case of an attack or breach of the system in order to restore its operability as quickly as possible and prevent data loss.

For users, administrators and security professionals

Foreword

This book is devoted to the consideration of one of the most popular operating systems (OS) installed on servers - Linux OS. For home use, this system is not yet as popular as among professional administrators, but recently there have been prerequisites for capturing this market.

Installing the OS is getting easier, and the graphical interface and usability are in some cases on par with the most famous Windows OS in the small business environment.

This book will be useful for Linux administrators and those users who want to get to know this system better. The configuration and security issues discussed will be useful for specialists using various operating systems, because most of the information is not tied to a specific system.

You will be able to find out how hackers infiltrate the servers and defend against intrusion. Since some of the examples in this book can be used not only for defense, but also for attack, I would like to warn young crackers. Healthy curiosity is good, but remember that law enforcement does not sleep and always gets its way. If once you were lucky with a break-in and no one paid attention to it, then next time you may find yourself in the hands of justice.

Part of the book is written from a hacker's point of view and demonstrates how they infiltrate the system. In the hope that this information will not be used to hack servers, I tried to focus specifically on protection and left some things outside of the presentation or simply did not finish, so that there would be no temptation to use the methods of hackers and break the law. Of course, to implement my ideas (to bring them to their logical conclusion), you need to spend a few minutes programming or searching the Internet. But while the book can serve as a starting point for a hacker, I hope it doesn't. Remember the legality of your actions.

Chapter 1

Introduction

I once showed a Windows administrator how to install and use Linux. He liked the installation process itself, because in the latest versions it is quite simple. But when we installed and decided to configure the Samba server, a bunch of questions followed: "Why configure Samba?", "Why can't you get access automatically?" Windows administrators are lazy and used to the OS doing everything for them. what is needed, but when their system is hacked, they start asking questions: "Why didn't Microsoft give us the right toolsto prohibit certain actions? ".

If you look at Linux from the user's point of view, then after installing the system, nothing needs to be configured. You can immediately start working with any office applications and user utilities. But if we are talking about network and server programs, then more complex settings are already required here, and nothing will automatically work. By default, almost all actions on the system that could lead to an unwanted result or network intrusion are prohibited. To change restrictions, you need to set up configuration files, which are extremely inconvenient to edit, or use specialized utilities, most of which have a command line interface.

Because of these inconveniences, my friend Windows administrator said: "Linux was invented by administrators who have nothing to do at work in order to play with configuration files." A week later, the same person was setting up the IIS (Internet Information Services) service on a new server running Windows 2003. He swore the same words, because this service is not installed by default from the OS, and you need it before you start working connect and clearly state what should be used and what should not.

Microsoft began to make the OS on the "if only it was convenient" principle, so it was enough to connect the required components. But now Windows is getting more complex every year, most of the convenient security features are simply disabled and you have to open them when necessary. In Linux, everything was the other way around, this OS was created from the point of view "if only it was safer", and now they are moving towards increasing services.

Convenience and safety are two sides of the same coin, so the manufacturer has to sacrifice something.

1.1. Hacker attacks

Before we get acquainted with Linux and its security principles, we need to know how hackers can get into the system. In order to protect the system, you need to be aware of the possible actions of an attacker. Let's take a look at the process of hacking a computer. We need to know what hackers think about, what they breathe and what they eat ☺. This is the only way we can build an impenetrable information wall for a server or network.

It is impossible to give specific recipes for hacking. In each case, this is a process that depends on the system itself and its security settings. Most often, hacking occurs through errors in some programs, and each administrator can use different software.

Why is the number of attacks only increasing every year? Previously, all information about vulnerabilities was stored on closed BBS (Bulletin Board System, electronic bulletin board) and was available only to a select few. Hackers also belonged to this category. It was they who carried out attacks with impunity, because the level of enlightenment and experience of such people was quite high.

On the other hand, the elite of the hacker world consisted mainly of respectable people for whom security research was not the goal of destruction.

Currently, information about vulnerabilities lies on every corner and is in the public domain. Hacking can now be done by anyone. I would immediately like to ask the fighters for freedom of information: "How did it happen?" It's just that excessive freedom will ultimately lead to destruction. There is a certain category of people who do not feed with bread, let me spoil it somewhere. If a person, using publicly available information, succumbs to this weakness, then he will turn into a burglar.

1.1.1. Research

Let's say you have a server that needs to be hacked or tested for intrusion resistance. Where do you start? What to do first? Many questions immediately arise and not a single answer.

There is no clear sequence of actions. Hacking is a creative process, which means that it must be approached from this point of view. There are no definite rules and you can't fit everything under one template. But I can give several recommendations that it is advisable to adhere to.

The very first thing to start hacking or testing a system for vulnerability is port scanning. For what? And in order to find out what services (in Linux these are daemons) are installed on the system. Each open port is a service program installed on a server to which you can connect and perform certain actions. For example, an FTP service is hanging on port 21. If you can connect to it, you will be able to download and upload files to the server. But this is only if you have the appropriate rights.

First, you need to scan the first 1024 ports. Among them there are a lot of standard services such as FTP, HTTP, Telnet, etc. Each open port is a door with a lock to enter the server. The more such doors there are, the more likely it is that some kind of bolt will not withstand the onslaught and will open.

1.1.2. Hacking a WWW server

Hacking a WWW server has its own peculiarities. If CGI / PHP or other scripts are executed on it, the hacking is carried out in a completely different way. First, you need to scan the server for vulnerable CGI scripts. Believe it or not, again, according to the research of various companies, a large number of "leaky" scripts are working on the Internet. This is due to the fact that when developing sites, errors are initially introduced. Novice programmers very rarely check the input parameters in the hope that the user will not change the code of the page or the URL, where the server receives the necessary data to perform any action.

One of the famous content management systems, PHP-nuke, had an error with parameters. This is a set of scripts that allow you to create a forum, chat, news feed and manage the content of the site. All parameters in scripts are passed through the browser URL string, and the rendering was contained in the ID parameter. The developers assumed that a number would be transmitted in it, but did not check it. A hacker who knows the structure of the database (which is not difficult, because the PHP-nuke source codes are available) could easily put an SQL query to the server's database in the ID parameter and get the passwords of all users registered on the site. Of course, the clients will be encrypted, but it doesn't take much effort to decrypt, and we'll look at this a little later (

see sect. 14.10

The problem is compounded by the fact that some languages \u200b\u200b(for example, Perl) were not originally designed for use on the Internet. Because of this, they have dangerous functions for manipulating the system, and if a programmer inadvertently used them in his modules, then an attacker can take advantage of such imprudence.

Potentially dangerous functions are found almost everywhere, only in different proportions. The only more or less protected language is Java, but it slows down the system very much and requires a lot of resources, which is why Webmasters are not willing to use it. But even this language in clumsy hands can turn into a big gate for hackers with the words: "Welcome!"

But the biggest vulnerability is an illiterate programmer. Due to the lack of specialists in this area, programming began to be done by all and sundry. Many self-taught people do not even try to think about security, and hackers only benefit from it.

1.1.3. Hammer and sickle

Where it was not possible to hack the server with the help of skill and knowledge, you can always use the purely Russian method of "Hammer and Sickle". This does not mean that the sickle should be put to the administrator's throat and knock on his head with a hammer. It's just that dumb password guessing is always left in stock.

Let's go back to statistics. All research firms have come to the same conclusion that most beginners choose the names of their favorite dogs, cats, dates of birth or phone numbers as their password. A well-chosen dictionary can break almost any system. there are always inexperienced users with such passwords. The worst thing is if these "dummies" have big enough rights.

Don't you believe me yet? Let's remember the famous "Morris worm" that infiltrated the system by hacking it using a dictionary. The worm's own vocabulary was small enough, less than a hundred words. In addition, the search used terms from the dictionary installed in the system. There weren't that many of them either. And thanks to such a primitive algorithm, the worm was able to infect a huge number of computers and servers. It was one of the most massive hacks !!! Yes, the case is old, but the average professionalism of users is not growing, because many of them are experienced, but there are enough beginners.

1.1.4. The local network

Hack in local network may be easier for many reasons:

□ computers are connected via a high-speed connection of 10 Mbps and above;

□ it is possible to listen to the traffic of other computers on the network;

□ you can create dummy servers;

□ firewalls are used very rarely, because they are installed mainly in front of Internet access.

1.2. What is Linux?

Linux is a free operating system, the source code of which is open to public viewing and even modification.

The core OS was created in 1991 by a student at the University of Helsinki named Linus Torvalds. He wrote the backbone, functionally similar to Unix-systems, and posted it for public viewing, asking for help in improving and increasing the capabilities of the new OS. Quite a lot of people responded, and the work began to boil.

Hackers from various countries joined this project on a voluntary basis and began to create the most scandalous OS. And the booze around Linux appears almost every day, because the OS has become widespread and is absolutely free. Some software manufacturers consider this project promising, others (for example, Microsoft) - periodically turn it into an enemy.

Official version OS kernel 1.0 was released in 1994, i.e. three years after the first "rumors" about Linux. This speed of development was achieved thanks to a large number of professionals who agreed to develop Linus's interesting idea.

Linux OS is a multi-user and multitasking system that allows several users to work with a computer at once and perform different tasks at the same time.

1.3. Is open source safe?

There is an opinion that open source software is more reliable and safer than commercial software.

Proponents of this claim believe that such a system is being researched by many people. different ways and thus reveal all possible errors. The Windows XP operating system shows a fairly high reliability and security, although it is a commercial product. Most importantly, errors are fixed in a timely manner, are available for free download and are easy to install.

Yes, it is much easier and more effective to find errors at the code level together with testing the finished product, but the result is far from ideal. Despite mass testing, lapses are often found in Linux. And if you look at which army of users surveyed latest versions Windows, one would think that it would become flawless. Testing is one thing, and application in "combat conditions" shows completely unpredictable results.

Openness to Linux has one advantage - excellent value for money. The ability to install an OS for free saves you a lot of money. But the costs will come in terms of support, which is quite expensive for Linux, so there may be problems with timely updates. In addition, Linux administration requires more skills and abilities than Windows. There are no masters to make life easier. Need to know linux commands and be able to use them without prompting. That is why this OS has not yet settled in our homes.

Why is Linux so hard? The answer is simple. Performance and usability are incompatible things. In Windows everything is very clear, but it can take a lot of mouse clicks and several views to complete an operation. dialog boxeswhich takes up valuable time. On Linux, you need to start the console and execute the required directive. The only problem is that you have to remember a lot of commands.

1.4. Core

The kernel is the heart of the OS, which manages the physical and software resources of the computer. In addition, it allows you to access various hardware. For example, early versions the kernels only supported two USB devices: a keyboard and a mouse. Starting from version 2.4, built-in support for USB camcorders, printers and other devices.

The Linux kernel version number consists of three numbers:

□ first (major number) - indicates significant changes in the kernel;

□ the second (minor number) - characterizes the appearance of small changes. It can be used to determine whether the kernel is verified or intended for testing and is not sure that it does not contain errors. If the number is even, then the kernel has been rigorously tested. Otherwise, installing this version does not guarantee stable operation;

□ third - the number of the next working release (build). In some cases, this number is omitted. For example, we have already talked about the 2.4 branch in this chapter, and in this case, the assembly is not specified.