Hello everybody and welcome back to the system hacking section. Now
in the previous videos we saw how we can actually create some of the exploits for the OWASP virtual machine,
and we were able to hack a Linux server with PHP meterpreter shell.
Now as we are finished with those Tomcat and Apache 2 exploits, now we are going to continue to the Windows
exploits.
Now these are some of the more important parts since most people use Windows,
and since most most vulnerable software is actually run on Windows.
So out of all of the other operating systems, Windows is the most vulnerable one. In the past bunch
of these vulnerabilities such as the one I told you about before,
the Eternal Blue, which we will be doing.
It is a vulnerability for the Windows 7 all packs and Windows, I believe, Server 2008. And
they have some additional Metasploit modules for Windows 8 and Windows 10,
but I couldn't seem to get those to work. So we will be doing the regular eternal blue exploit.
But before we actually continue with exploiting Windows with Metasploit, let us just install a program
that we will need
now in this section, and we also need once we start actually coding our own programs in Python.
The program is called Wine. Now Wine is basically programmed for Linux that allows Linux users to
actually run Windows programs in Linux.
What I mean by that is basically, for example, the executable windows extension is .exe.
Every .exe file that you run is basically only executable on Windows.
You cannot run it on Linux.
So in order for us to run some of the programs that are .exe or .msi, basically, we will need
to install wine, in order to do that on Linux.
Now there are two reasons why we need it currently.
One of them is that wine is actually required as a program in order to be able to run the eternal blue
NSA exploit on Windows 7, which is one of the more important exploits that we will do.
And the other reason is that we will need wine in order to make our python programs in Linux .exe,
later on when we start coding our own programs.
So let us start off by actually downloading it.
So I already have it installed.
I will show you how to perform that, and we will also install our first Windows program and use it in our
wine program.
We will install Python for Windows and use it as a wine installer. So you will see what I mean soon
enough.
Let me just enlarge this so you can see a little bit better what I am doing.
So if you just type here wine in Kali Linux, wine --help, you should get prompted with this since
I believe wine is already pre-installed in Kali Linux. But if you run a 64 bit version of Kali Linux, I believe
that you will need to upgrade and add some architecture for the 32 bit.
So we also want to install wine 32 bit.
Now I already installed it and I will show you what the command is in order to perform the installation.
So just type in your terminal,
dpkg --add-architecture.
And basically what you want is i386 for the 32 bit version.
Now this is just one of the three commands that we want to run in order to install,
so let us actually run all three at the same time.
So let me add these && in order to continue with another command, and apt-get update &&.
And the third command which we want to do is apt-get install wine32.
So as we can see, first of all, we are adding the architecture for i386, and then we are updating our
repositories, and after that we are actually installing the wine 32 bit.
Now the apt-get install wine 32 bit won't really work without this command.
So we need to run this first.
Now since I already ran this before, I will not be running it at the moment since I already have wine
installed.
And what you want to do,
basically, this process I believe, especially if you didn't update your Kali Linux repositories for
long time, it will take around 20 to 30 minutes. If you did update your repositories,
however, it shouldn't take too long. So you will be good to go.
So after you run that what you want to do is, basically, let us go to the Python Web site and actually
download the MSI installer for Python 2.
So, I already did all of that but I will show you how you can do it, since it is important for
future videos. Now Python, we do not need it for the exploit module that we will use in the next
videos, but we will need it in our coding section.
So, start new session, we want to start a new one, and what we want to do is just go to your web page
and just type here,
https://www.python.org
And basically where you want to go is to this link right here,
so /downloads/release/python-2714, which is
Python 2.
Now the reason why we are not using Python 3 is because most all of the programs, and all of the modules
and libraries in Python, are still supported in Python 2.
And, fortunately, Python 2 is basically a little easier since it doesn't include some brackets
and all that which I always forget to include in Python 3. But, I will show you the syntax for both.
once we get to that. For now
I just want to show you how you can install this.
So once you're on this page you want to scroll down, and you will get a bunch of versions of python
right here, or basically the installer for python. What you want to do is basically go all the way down to
the Windows x86 MSI installer.
Once you do that, go click on it. It will ask you, do you want to install python-2.7.14.msi
python-2.7.14.msi. The size is 18 megabytes. You want to save that file, and it will save that file
right here in your downloads folder. As we can see if I open my downloads folder, it will show two copies of
python-2.7.14 because I already installed one yesterday. So we can just delete
one, or let me open in terminal and then I will delete it.
It doesn't matter, one of them has to go. Or, doesn't. I just want to delete it so I don't have
the duplicate. And what you want to do after that is basically you can just, let me just close this.
We do not need this browser open anymore.
What you want to do is change your directory to downloads. And if you click here ls, you will see your
python file right here. And the next thing you want to do wine msiexec
/i
and then python.
I believe the syntax looks something like this,
we will check it right now.
It should work.
And after that it should start loading your wine program.
Now since I already did install it, what you want to do is basically just click on Next everywhere, and
basically you want to install it in the C drive. It will create a virtual C drive for your Kali Linux machine.
And once you click finish the installation, just click on finish,
I will click on X right here since I already have it.
Do you want to cancel installation, yes. And then finish. So everything has finished now.
Once you finish the installation, what you want to do is basically navigate to your C drive.
Now the C Drive is something you find in Windows, not in Linux, but for Wine it created a virtual C drive with
basically Windows, modules, libraries, and all of that, that allow us to run Windows executables.
So, in order to go there you need to go to the root.
Then if you click on the root ls, you will notice that there is nothing named
as wine.
Now wine basically is a hidden file in this directory and you can find it in two ways.
One of them is, basically, you can just go through the directory, right click I believe, and you
can go properties.
Not really sure if...access files, access files, change permissions.
I thought it would be something like show hidden files, but it doesn't matter.
Another way that you can do this is just type ls -la, which is a command that we covered. So you will see
all of the files including hidden files as well.
So, if you look closely you will see that we have our .wine directory, which is a hidden directory.
So, basically, everything that starts with . will be a hidden file in your directory, and we want to
go to that directory. So just type cd .wine. And then if we clear the screen and type ls once
again, you will see that we actually have our drive_c directory. So we change our directory
to there,
we can ls, and right here you will see that we actually have basically all of the Windows files
installed. Program Files, Program Files (x86),
windows, users, Python 27 is the python that we installed previously.
So, this is not currently in need for us, but we will be using, as I said, it later on.
So, it is good to show you an example of making a windows file executable on Linux.
So now if you, for example, if I change my directory to Python, and I ls here, you will see Python.exe,
which is a Windows executable. In order for you to run it,
you would need to type wine python.exe. So you will not be able to run it with
./python.exe, you would need to specify wine before that.
So, I just wanted to show you that. This is just a basic wine installation.
What we will do in the next videos is we will start exploiting both Windows 7, Windows 10, and maybe Windows
XP. And I will show you how you can craft your own payloads with MSF Venom in more detail, and how you
can actually exploit Windows both with the payload being delivered by you, and without the payload
even being delivered, with zero day exploits such as Eternal Blue.
Well I mean they were zero day exploits, now they are mostly patched. But I'll show you how they work
since a lot of the devices are still vulnerable to that attack. Since it is an attack on Windows 7,
most people still do use Windows 7, and most people do not update their Windows. So you will be able
to find some of the devices that are still vulnerable to this attack. But more about that in the next
videos.
I just wanted to show you this wine installation, and we will continue hacking in the next lecture.
Hope I see you there and take care.
Bye!