Black book of hacking free download


















It will guide you on how to address network sniffers, manipulating packets, infecting virtual machines, creating private trojans, and many more. Moreover, this book tells the readers that how they can create a trojan command-and-control utilizing GitHub, how to recognize sandboxing, and automate simple malware tasks, like keylogging and screenshotting and also to increase Windows opportunities with creative process control. It has a fantastic feature that guides you on how to continue the successful Burp Suite web-hacking tool, so, that you can build and design your plugins, and not only that even you can also distance to assist you in finding possibly productive and significant vulnerabilities much quicker.

This book generally tells you about the password breaking manual; this is an ideal requirement for those who want to know how to break or crack passwords. It comprises a collection of primary and high-level techniques that penetration testers and network security experts can use to assess the security of an association from a password position.

Moreover, The manual holds the most popular password cracking and investigation tools and central password cracking techniques. This book includes different techniques that have been implicated in human hacking as obtaining someone to disclose their password. This book generally contains several ways that will teach you to identity theft, fraud, and processes in which a person is deceived.

Moreover, it also developed into an industrial-grade, and high-class running system administration seasoned, reliable, and enterprise-attentive. With the help of this book, you can easily decade-long construction process, simultaneously with innumerable volunteers from the different hacker community.

Thus it has taken on the responsibility of streamlining and making our work conditions attack free, therefore saving us from much of the hard work. It also granted a secure and stable foundation, enabling us to focus on defending our digital world. Thus Web Hacking illustrates simple web vulnerabilities, and it shows you how to begin finding vulnerabilities and assembling gratuities.

After web hacking , we have gray hat hacking. This book has two parts, the gray hat hacking is the first part of the book and it begins by introducing essential laws so that as a pentester, you can understand everything without getting any problem. With the law, as we know, there is a thin line when we talk about hacking websites.

Whereas the second part is exceptionally technical, comprises of topics varying from network scanning, fingerprinting into shellcode writing, and vulnerability exploitation. Moreover, this book includes a copy of ventures, addressing different fundamentals such as buffer overflows, heap overflows, and format string overflows. Now we have the blue team handbook, this book is another reference model like the Red Team manual that we have discussed above and is printed for cybersecurity event responders, security engineers, and InfoSec pros alike.

This book has covered the main topic, which includes the incident acknowledgment process, how attackers operate, standard tools for conflict response, a proper method for network analysis, common indicators of understanding, Windows and Linux analysis processes, and many more other sharp reference topics. At last, we have Mastering Metasploit, this book comprises a complete and comprehensive, step by step tutorial example that will take you through the essential features of the Metasploit framework.

These skills are scarce and can help you earn a lot, not just money but also fame. That is possible only if you put your efforts on the right track; otherwise, you may end up in jail. Search for:. Java 2 Network Security Pages A Bug Hunter's Diary Pages Metasploit Penetration Testing Cookbook Pages Releases No releases published. Packages 0 No packages published. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window.

Advanced Penetration Testing. The Basics of Web Hacking. The Basics of Hacking and Penetration Testing.

The Art of Deception by Kevin Mitnick. Metasploit - The Penetration Tester's Guide. Ethical Hacking and Penetration Testing Guide. Network Attacks and Exploitation - A Framework. Python Web Penetration Testing Cookbook. Wireshark for Security Professionals.

Mastering Modern Web Penetration Testing. The Shellcoder's Handbook. The Web Application Hacker's Handbook. Ethical Hacking and Countermeasures. Reversing - Secrets of Reverse Engineering. Network Security Bible. Hacking Web Applications - Hacking Exposed. Hacking for Dummies. Hacking Wireless Network for Dummies. Professional Penetration Testing. Hack Attacks Testing. Basic Security Testing with Kali Linux. Kali Linux Cookbook. Information Security Management Handbook.

Computer and Information Security Handbook. Once it has attached itself to a new program, though, all the memory addresses will have changed, and the virus will be in big trouble. It will either bomb out itself, or cause its host program to bomb. There are two ways to avoid catastrophe here. Firstly, one could put all of the data together in one place, and write the program to dynamically determine where the data is and store that value in a register e.

The only safe place to do this is at the very end of the segment, where the stack resides. Thus we can determine exactly what the stack is doing, and stay out of its way. This is the method we choose. When the CPU executes the return instruc- tion in the subroutine, it uses the two bytes stored by the call to determine where to return to, and increments the stack pointer by two.

Likewise, executing a push instruction decrements the stack by two bytes and stores the desired register at the location of the stack pointer. The pop instruction reverses this process. The int instruction requires five bytes of stack space, and this includes calls to hardware interrupt handlers, which may be accessed at any time in the program without warning, one on top of the other. The data area for the virus can be located just below the memory required for the stack. The exact amount of stack space required is rather difficult to determine, but 80 bytes will be more than sufficient.

The data will go right below these 80 bytes, and in this manner its location may be fixed. Of course, one cannot put initialized variables on the stack. They must be stored with the program on disk. To store them near the end of the program segment would require the virus to expand the file size of every file to near the 64K limit. Such a drastic change in file sizes would quickly tip the user off that his system has been infected! Instead, initialized variables should be stored with the executable virus code.

This strategy will keep the number of bytes which must be added to the host to a minimum. Thus it is a worthwhile anti-detection measure. The drawback is that such variables must then be located dynamically by the virus at run time. All that is necessary is a master control routine to pull everything together. This master routine must: 1 Dynamically determine the location offset of the virus in memory. To determine the location of the virus in memory, we use a simple trick.

The problem is that if the host program requires command line parameters, they are stored for the program at this same location. If the DTA were not changed temporarily while the virus was executing, the search routine would overwrite any command line parameters before the host program had a chance to access them. That would cause any infected COM program which required a command line parameter to bomb.

The virus would execute just fine, and host programs that required no parameters would run fine, but the user could spot trouble with some programs. Temporarily moving the DTA elimi- nates this problem. One instruction which does transfer control to an absolute offset is the return from a call.

Of course, the return address must be set to H to transfer control to the host, and not somewhere else. As written, this master control routine is a little dangerous, because it will make the virus completely invisible to the user when he runs a program It seems wise to tame the beast a bit when we are just starting. The First Host To compile and run the virus, it must be attached to a host program. It cannot exist by itself. All that is needed is a simple program that does nothing but exit to DOS.

That just stops the program from running, and DOS takes over. These take up five bytes which do nothing. We code it to look just like it would if the virus had infected it. Study it carefully. Go back over the text and piece together the various functional elements, one by one. And if you feel confident, you might try putting it in a subdirectory of its own on your machine and giving it a whirl.

If you do though, be careful! Proceed at your own risk! Case Number Two: A Sophisticated Executable Virus The simple COM file infector which we just developed might be good instruction on the basics of how to write a virus, but it is severely limited.

Since it only attacks COM files in the current directory, it will have a hard time proliferating. In this chapter, we will develop a more sophisticated virus that will overcome these limitations. Such improvements make the virus much more complex, and also much more dangerous. We started with something simple and relatively innocuous in the last chapter. It is very capable of finding its way into computers all around the world, and deceiving a very capable computer whiz.

The EXE file is designed to allow DOS to execute programs that require more than 64 kilobytes of code, data and stack. Figure 10 is a graphical representation of an EXE file. The meaning of each byte in the header is explained in Table 1. After that, the segment references in the image of the program loaded into memory point to the correct memory location. The segment at the start of the load module contains a far call to the second segment.

The last page may only be partially filled, with the number of valid bytes specified in Last Page Size. The header is always a multiple of 16 bytes in length. This is in addition to the image of the program stored in the file. If enough memory is not available, DOS will return an error when it tries to load the program. This is modified dynamically by DOS when the file is loaded, to reflect the proper value to store in the ss register.

This is modified by DOS at load time. Overlays will have dif- ferent values stored here. Relocation Pointer Table would contain a vector to point to the segment reference 20 06 of this far call. When DOS loads the program, it might load it starting at segment H, because DOS and some memory resident programs occupy locations below this.

Then it would take the relocation pointer and transform it into a pointer, which points to the segment in the far call in memory.

Note that a COM program requires none of these calisthen- ics since it contains no segment references. Thus, DOS just has to set the segment registers all to one value before passing control to the program. This can be done in a whole variety of ways, some of which require more work than others. A universal EXE virus cannot make any assumptions about how those segments are set up by the host program. It would crash as soon as it finds a program where those assumptions are violated.

For example, if one were to use whatever stack the host program was initialized with, the stack could end up right in the middle of the virus code with the right host.

That memory would have been free space before the virus had infected the program. As soon as the virus started making calls or pushing data onto the stack, it would corrupt its own code and self-destruct. To set up segments for the virus, new initial segment values for cs and ss must be placed in the EXE file header. Also, the old initial segments must be stored somewhere in the virus, so it can pass control back to the host program when it is finished executing.

We will have to put two pointers to these segment references in the relocation pointer table, since they are relocatable references inside the virus code segment. Adding pointers to the relocation pointer table brings up an important question. Since the EXE Header must be a multiple of 16 bytes in size, relocation pointers are allocated in blocks of four four byte pointers.

Thus, if we can keep the number of segment references down to two, it will be necessary to expand the header only every other time. On the other hand, the virus may choose not to infect the file, rather than expanding the header. There are pros and cons for both possibilities. On the other hand, if the virus chooses not to move the load module, then roughly half of all EXE files will be naturally immune to infection. You might want to try the other approach as an exercise, and move the load module only when necessary, and only for relatively small files pick a maximum size.

Read the EXE Header in the host program. Extend the size of the load module until it is an even multiple of 16 bytes, so cs will be the first byte of the virus. Write the virus code currently executing to the end of the EXE file being attacked. Add two relocation pointers at the end of the Reloca- tion Pointer Table in the EXE file on disk the location of these pointers is calculated from the header.

Write the new EXE Header back out to disk. All the initial segment values must be calculated from the size of the load module which is being infected. It must open the file in question and determine whether it can be infected and make sure it has not already been infected. The only two criteria for determining whether an EXE file can be infected are whether the Overlay Number is zero, and whether it has enough room in its relocation pointer table for two more pointers.

The latter requirement is determined by a simple calculation from values stored in the EXE header. It uses that with the offset 0 to find the ID word in the load module provided the virus is there.

If the virus has not already infected the file, Initial cs will contain the initial code segment of the host program. That was fine for starters, but a good virus should be able to leap from directory to directory, and even from drive to drive. Only in this way does a virus stand a reasonable chance of infecting a significant portion of the files on a system, and jumping from system to system.

To search more than one directory, we need a tree search routine. That is a fairly common algorithm in programming. In this manner, all of the subdirectories of any given directory may be searched for a file to infect.

If one specifies the directory to search as the root directory, then all files on a disk will get searched. Making the search too long and involved can be a problem though. A large hard disk can easily contain a hundred subdirecto- ries and thousands of files. When the virus is new to the system it will quickly find an uninfected file that it can attack, so the search will be unnoticably fast.

That could be a rather obvious clue that something is wrong. Users often put frequently used programs in their path, and execute them from different directories. Thus, if our virus searches the current directory, and all of its subdirectories, up to two levels deep, it will stand a good chance of infecting a whole disk. As added insurance, it can also search the root directory and all of its subdirectories up to one level deep.

Obviously, the virus will be able to migrate to different drives and directories without searching them specifically, because it will attack files on the current drive when an infected program is executed, and the program to be executed need not be on the current drive.

The second level is a routine which will search a specified directory branch to Figure Logic of the file search routines. The logic of this searching sequence is illustrated in Figure The code for these routines is also listed in Appendix B.

If it is, execute the search and copy routines, otherwise just pass control to the host program. Since programs are not normally executed in sync with the clock timer, it will essentially return a z flag randomly. Every other time, the virus will just pass control to the host without doing anything. When it does that, it will be completely invisible even to the most suspicious eye.

You might have to sit there and run the infected program 50 or times to get the virus to move to one new file on that system. That is annoying, and prob- lematic if you want to get it into a system with minimal risk. Fortunately, a slight change can fix it. The result is that the first time the virus is executed, it definitely searches for a file and infects it.

After that it goes to the 1-out-of infection scheme. EXE, and run it and be guaranteed to infect something. After that, the virus will infect the system more slowly. Another useful tactic that we do not employ here is to make the first infection very rare, and then more frequent after that.

This might be useful in getting the virus through a BBS, where it is carefully checked for infectious behavior, and if none is seen, it is passed around. In such a situation, no one person would be likely to spot the virus by sitting down and playing with the program for a day or two, even with a sophisticated virus checker handy. However, if a lot of people were to pick up a popular and useful infected program that they used daily, they could all end up infected and spreading the virus eventually.

The tradeoff in restraining the virus to infect only every one in N times is that it slows the infection rate down. What might take a day with no restraints may take a week, a month, or even a year, depending on how often the virus is allowed to reproduce.

Another important anti-detection mechanism incorporated into INTRUDER is that it saves the date and time of the file being infected, along with its attribute.

Thus, the infected EXE does not have the date and time of the infection, but its original date and time. The infection cannot be traced back to its source by studying the dates of the infected files on the system. As an added bonus, the virus can infect read-only and system files without a hitch. To do that, all the registers should be set up the same as they would be if the host program were being executed without the virus.

We already discussed setting up cs:ip and ss:sp. If an invalid identifier i. As such, ax can simply be saved when the virus starts and restored before it transfers control to the host.

The rest of the registers are not initialized by DOS, so we need not be concerned with them. Of course, the DTA must also be moved when the virus is first fired up, and then restored when control is passed to the host.

Since the host may need to access parameters which are stored there, moving the DTA temporarily is essential since it avoids overwriting those parameters during the search operation. It contains nothing but routines that will help it reproduce. Although it is not intentionally destructive, it is extremely infective and easy to overlook.

The listing in Appendix B contains the code for the virus. On the one hand, the boot sector is always located in a very specific place on disk. Therefore, both the search and copy mechanisms can be extremely quick and simple, if the virus can be contained wholly within the boot sector.

On the other hand, since the boot sector is the first code to gain control after the ROM startup code, it is very difficult to stop before it loads.

If one writes a boot sector virus with sufficiently sophisti- cated anti-detection routines, it can also be very difficult to detect after it loads, making the virus nearly invincible. In the next two chapters we will examine both extremes. This chapter will take a look at one of the simplest of all boot sector viruses to learn the basics of how they work. The following chapter will dig into the details of a fairly sophisticated one. Boot Sectors To understand the operation of a boot sector virus one must first understand how a normal, uninfected boot sector works.

Typically this code will perform several functions necessary to get the computer up and running properly. First, it will check the hardware to see what kinds of devices are a part of the computer e. The most familiar part of this startup code is the memory test, which cycles through all the memory in the machine twice, displaying the addresses on the screen.

The startup code will also set up an interrupt table in the lowest bytes of memory. This table provides essential entry points interrupt vectors so all programs loaded later can access the BIOS services. Once these various house- keeping chores are done, the BIOS is ready to transfer control to the operating system for the computer, which is stored on disk. But which disk? Where on that disk? What does it look like? How big is it? How should it be loaded and executed?

If the BIOS knew the answers to all of these questions, it would have to be configured for one and only one operating system. That would be a problem. A machine set up with CPM an old, obsolete operating system could run none of the above. The boot sector provides a valuable intermediate step in the process of loading the operating system. It works like this: the BIOS remains ignorant of the operating system you wish to use.

However, it knows to first go out to floppy disk drive A: and attempt to read the first sector on that disk at Track 0, Head 0, Sector 1 into memory at location C00H. In this way the BIOS and the computer manufacturer avoids having to know anything about what operating system will run on the computer. Each operating system will have a unique disk format and its own configuration, its own system files, etc.

As long as every operating system puts a boot sector in the first sector on the disk, it will be able to load and run. Since a sector is normally only bytes long, the boot sector must be a very small, rude program. Generally, it is designed to load another larger file or group of sectors from disk and then pass control to them. Where that larger file is depends on the operating system.

These hidden files must be the first two files on a disk in order for the boot sector to work properly. If they are anywhere else, DOS cannot be loaded from that disk. When a normal DOS boot sector executes, it first deter- mines the important disk parameters for the particular disk it is installed on.

Next it checks to see if the two hidden operating system files are on the disk. COM or IO. SYS file into memory at location H. A hard drive is a little more complex. It will contain two or more boot sectors instead of just one. Since a hard drive can be divided into more than one partition an area on the disk for the use of an operating system , it may contain several different oper- ating systems.

When the BIOS loads the boot sector in the first physical sector on the hard drive, it treats it just the same as a floppy drive. However, the sector that gets loaded performs a completely different function. No matter how many partitions a disk may have, one of them must be made active by setting a byte in the partition table to boot off the hard disk. The first boot sector determines which partition is active, moves itself to a different place in memory, and then loads the first sector in the active partition into memory at C00H , where the partition boot sector originally was.

It is virtually identical to the boot sector on floppy disk. Designing a boot sector virus can be fairly simple—at least in principle. All that such a virus must do is take over the first sector on disk or the first sector in the active partition of a hard disk, if it prefers to go after that. From there, it tries to find uninfected disks in the system.

Problems arise when that virus becomes so compli- cated that it takes up too much room. Then the virus must become two or more sectors long, and the author must find a place to hide multiple sectors, load them, and copy them.

This can be a messy and difficult job. If a single sector of code could be written that could both load the DOS operating system and copy itself to other disks, one would have a very simple virus which would be practi- cally impossible for the unsuspecting user to detect. Such is the virus we will discuss in this chapter. Rather than designing a virus that will infect a boot sector, it is much easier to design a virus that simply is a self-reproducing boot sector.

To deal with these variations in such a limited amount of space would take a miracle program. Instead, we will design a whole, functional boot sector. The Necessary Components of a Boot Sector To write a boot sector that can both boot up the DOS operating system and reproduce means we are going to have to trim down on some of what a normal boot sector does.

That will make room for the code necessary to carry out covert operations. The first bytes in the sector are always a jump instruc- tion to the real start of the program, followed by a bunch of data about the disk on which this boot sector resides.

In general, this data changes from disk type to disk type. All K disks will have the same data, but that will differ from 1. The standard data for the start of the boot sector is described in Table 2. It consists of a total of 43 bytes of information.

This is simply eight bytes to put a name in to identify the boot sector. Right after the jump instruction, the boot sector sets up the stack. This is just a table of parameters which the BIOS uses to control the disk drive Table 3 through the disk drive controller a chip on the controller card. When the boot sector is loaded, the BIOS has already set up a default table, and put a pointer to it at the address H interrupt 1E Hex.

This is standard practice, although in many cases the BIOS table is perfectly adequate to access the disk. Rather than simply changing the address of the interrupt 1EH vector, the boot sector goes through a more complex procedure that allows the table to be built both from the data in the boot sector and the data set up by the BIOS.

It does this by locating the BIOS default table and reading it byte by byte, along with a table stored in the boot sector. Once the new table is built inside the boot sector, the boot sector changes interrupt vector 1EH to point to it. The next step, locating the system files, is done by finding the start of the root directory on disk and looking at it. The disk data at the start of the boot sector has all the information we need to calculate where the root directory starts.

From there, the boot sector looks at the first two directory entries on disk. These are just 32 byte records, the first eleven bytes of which is the file name. One can easily compare these eleven bytes with file names stored in the boot record.

It assumes that the first file is located at the very start of the data area on disk, in one contiguous block. The file size in bytes is stored at the offset 1CH from the start of the directory entry at H.

The file is loaded at H. Gutting Out the Boot Sector The first step in creating a one sector virus is to write some code to perform all of the basic boot sector functions which is as code-efficient as possible.

So we will strip out all the fancy bells and whistles that are typically included in a boot sector. First, we want to do an absolute minimum of error handling. The usual boot sector displays several error messages to help the user to try to remedy a failure. Whoever is using the computer will get the idea that something is wrong and try a different disk anyhow. This rudeness eliminates the need for error message strings, and the code required to display them.

That can save up to a hundred bytes. The second point of rudeness we will incorporate into our boot sector virus is that it will only check the disk for the first system file and load it. If for some reason the second file does not exist, our boot sector will load and execute the first one, rather than displaying an error message. The result is practically the same. Trimming the boot sector in this fashion makes it necessary to search for only two files instead of four, and saves about 60 bytes.

Two files instead of four? True, most boot sectors do, but a viral boot sector must be different. The usual boot sector is really part of an operating system, but the viral boot sector is not. It will typically jump from disk to disk, and it will not know what operating system is on that disk. Limiting the search to the first system file means that we only have to find IO.

Anyhow, incorporating all of these shortcuts into a boot sector results in bytes of code, which leaves bytes for the search and copy routines. That is more than enough room. The listing for this basic non-viral boot sector, BOOT. ASM, is pre- sented in Appendix C.

Doing that is easy because the boot sector is such a simple animal. First, the copy mechanism must determine where it came from. The third to the last byte in the boot sector will be set up by the virus with that information. If the boot sector came from drive A, that byte will be zero; if it came from drive C, that byte will be 80H. It cannot come from any other drive since a PC boots only from drive A or C. Namely, if it is from drive A, it can look for drive C the hard disk and infect it.

If there is no drive C, it can look for a second floppy drive, B:, to infect. There is never any point in trying to infect A.



0コメント

  • 1000 / 1000