Exploiting a Target

CompTIA Security+ Certification (SY0-501) Chapter 9 - Testing Your Infrastructure
11 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€91.73
List Price:  €128.43
You save:  €36.69
£78.50
List Price:  £109.90
You save:  £31.40
CA$135.42
List Price:  CA$189.60
You save:  CA$54.17
A$152.22
List Price:  A$213.12
You save:  A$60.89
S$133.77
List Price:  S$187.28
You save:  S$53.51
HK$781.89
List Price:  HK$1,094.68
You save:  HK$312.79
CHF 88.30
List Price:  CHF 123.63
You save:  CHF 35.32
NOK kr1,058
List Price:  NOK kr1,481.24
You save:  NOK kr423.24
DKK kr684.10
List Price:  DKK kr957.77
You save:  DKK kr273.66
NZ$164.15
List Price:  NZ$229.81
You save:  NZ$65.66
د.إ367.20
List Price:  د.إ514.09
You save:  د.إ146.89
৳10,978.23
List Price:  ৳15,369.96
You save:  ৳4,391.73
₹8,290.53
List Price:  ₹11,607.08
You save:  ₹3,316.54
RM471.80
List Price:  RM660.54
You save:  RM188.74
₦156,534.34
List Price:  ₦219,154.34
You save:  ₦62,620
₨27,950.66
List Price:  ₨39,132.05
You save:  ₨11,181.38
฿3,595.26
List Price:  ฿5,033.51
You save:  ฿1,438.25
₺3,229.78
List Price:  ₺4,521.83
You save:  ₺1,292.04
B$499.40
List Price:  B$699.18
You save:  B$199.78
R1,883.20
List Price:  R2,636.56
You save:  R753.35
Лв179.42
List Price:  Лв251.19
You save:  Лв71.77
₩133,286.20
List Price:  ₩186,606.01
You save:  ₩53,319.81
₪365.03
List Price:  ₪511.06
You save:  ₪146.02
₱5,561.09
List Price:  ₱7,785.75
You save:  ₱2,224.66
¥14,911.76
List Price:  ¥20,877.07
You save:  ¥5,965.30
MX$1,670.32
List Price:  MX$2,338.52
You save:  MX$668.19
QR364.82
List Price:  QR510.77
You save:  QR145.94
P1,359.04
List Price:  P1,902.71
You save:  P543.67
KSh13,398.66
List Price:  KSh18,758.66
You save:  KSh5,360
E£4,718.65
List Price:  E£6,606.31
You save:  E£1,887.65
ብር5,656.15
List Price:  ብር7,918.84
You save:  ብር2,262.68
Kz83,512.74
List Price:  Kz116,921.18
You save:  Kz33,408.44
CLP$93,810.03
List Price:  CLP$131,337.80
You save:  CLP$37,527.76
CN¥710.61
List Price:  CN¥994.89
You save:  CN¥284.27
RD$5,917.87
List Price:  RD$8,285.25
You save:  RD$2,367.38
DA13,435.55
List Price:  DA18,810.31
You save:  DA5,374.76
FJ$226.69
List Price:  FJ$317.37
You save:  FJ$90.68
Q780.94
List Price:  Q1,093.35
You save:  Q312.40
GY$20,949.18
List Price:  GY$29,329.69
You save:  GY$8,380.51
ISK kr13,659.63
List Price:  ISK kr19,124.03
You save:  ISK kr5,464.40
DH1,002.67
List Price:  DH1,403.78
You save:  DH401.11
L1,768.33
List Price:  L2,475.73
You save:  L707.40
ден5,652.42
List Price:  ден7,913.61
You save:  ден2,261.19
MOP$805.88
List Price:  MOP$1,128.27
You save:  MOP$322.38
N$1,866.55
List Price:  N$2,613.25
You save:  N$746.69
C$3,681.10
List Price:  C$5,153.70
You save:  C$1,472.59
रु13,266.49
List Price:  रु18,573.62
You save:  रु5,307.13
S/368.83
List Price:  S/516.39
You save:  S/147.55
K382.06
List Price:  K534.91
You save:  K152.84
SAR375
List Price:  SAR525.02
You save:  SAR150.01
ZK2,508.19
List Price:  ZK3,511.57
You save:  ZK1,003.37
L456.04
List Price:  L638.48
You save:  L182.43
Kč2,310.02
List Price:  Kč3,234.13
You save:  Kč924.10
Ft36,211.46
List Price:  Ft50,697.50
You save:  Ft14,486.03
SEK kr1,038.11
List Price:  SEK kr1,453.39
You save:  SEK kr415.28
ARS$85,066.49
List Price:  ARS$119,096.49
You save:  ARS$34,030
Bs691.23
List Price:  Bs967.75
You save:  Bs276.52
COP$389,029.38
List Price:  COP$544,656.70
You save:  COP$155,627.31
₡50,979.09
List Price:  ₡71,372.77
You save:  ₡20,393.67
L2,470.17
List Price:  L3,458.33
You save:  L988.16
₲730,160.41
List Price:  ₲1,022,253.79
You save:  ₲292,093.37
$U3,841.23
List Price:  $U5,377.88
You save:  $U1,536.64
zł395.31
List Price:  zł553.46
You save:  zł158.14
Already have an account? Log In

Transcript

Penetration testing, better known as a pen test is the process where somebody manifests themselves as an outsider, and actually tries to grab sensitive data sensitive information from within your infrastructure. Now, you've got to be careful here, you don't want to confuse a vulnerability assessment with a penetration test, a vulnerability assessment at no time will ever actually try to grab the data, a penetration test will actually try to grab the data itself. So when we're talking about a penetration test, there's a few steps that are always going to take place number one, you're going to be discovering vulnerabilities. In this case, you're going to be doing some form of reconnaissance, you're going to be trying to get information. And in many cases, you actually end up using vulnerability scanners to do that. Second, and this is what you would never do in a vulnerability assessment is you're actually going to exploit those vulnerabilities.

You're going to go in and you're going to grab usernames and passwords. Words, are you going to pull down the database, or you're going to corrupt a web page, you're going to actually do some form of exploit that does something very concrete to that target network. So those are your first two steps. Well, your third step, actually, you know what, let's make this the first step. Your first step before you do any of this stuff is authorization. Because of the implicit naughtiness of a penetration test, the buy in from management, the authorization is incredibly important.

At the very minimum, you're going to have to do two things. Number one, you're going to have to define the targets. Most the time when you're doing a pen test, you're trying to say, you know, can you do this? Can you crack our website or something like that? But the second thing you're going to have to define is something known as the attack model. An attack model defines what the attacker knows before they do a penetration test.

The first attack model is known as a white box. In this case, the attacker has extensive knowledge about the target. They know IP addresses, they know who's running, what they might even have usernames and passwords. In this case, attackers are more like trusted insiders. This is the cheapest and fastest type of attack model for a pen test. On the other side is a blackbox attack model.

In this case, the attackers know nothing about the target. This is more where the attackers are like strangers, and invariably This is going to be some form of external hacking. The downside to black boxes is that they are potentially expensive and slow. Due to the nature of the amount of time we need for reconnaissance. An alternative is what we call a gray box. The gray box is somewhere between the two extremes.

For example, we may know where a SQL Server is, but we may not have usernames, passwords or something like that. So you've got it worked out with upper management that you're going to do some form of pen test. So let's kind of march through the processes that are actually going to take place once you've been given the go ahead to get started. So the first thing we're going to be doing is we're going to be discovering vulnerabilities. To me, this is more what I call the reconnaissance mode. Now you've got three different ways to do an exploration to discover these vulnerabilities.

First of all, you can do what's known as a passive discovery with a passive, what you're talking about is you're not putting any of your packets onto the target. So you could be doing a who is lookup, for example, or you could be making some phone calls. With a passive, you're not doing anything from a computer that's sending packets over to your target. The second thing would be semi passive. Semi passive is you're actually putting packets onto the target, but you're not doing anything that would raise any alarms or set off a intrusion detection or anything like that. So for example, If you've got a target web server that you're looking for, you could just go to the website and check it out a little bit.

And you need to do whatever reconnaissance you need to do in that particular situation. The third one is an active discovery, an active reconnaissance in this situation, you are actually putting packets downrange on the target. You're running scanners, you're running an Nmap, you're running tools like that, that could possibly alert an intrusion detection system or block you by a intrusion prevention system, or by a firewall. The bottom line is, is that you're going to go through these processes. And in these cases, you're often just using standard vulnerability scanners to get this reconnaissance information. But you do reach a point where you suddenly go, Hmm, I have a target.

I wonder if it has a particular exploit. And that's where we need to talk about exploiting the target. No bye Way, the tools that I tend to use when I'm exploiting a target are probably the most single famous one is the infamous metta sploit. And in particular, I'm a big fan if you've been watching any of my other episodes, I love Kali Linux distro. It's a big popular one. It includes meta sploit, as long as a lot of other tools go along with it.

The thing to keep in mind about meta sploit is that meta sploit is not a program. All right, it's a it's a penetration testing what we call a framework, it really gives you a little more than a command line, and a number of tools that allow you to make an exploit. So for right now, let's go ahead and talk about what we have to do to exploit a target and then we'll take a look at meta sploit. When we're in a target, we're ready to exploit it. First, we're going to start off with some initial exploitation based on the idea of banner grabbing. Here's an example of me banner grabbing a website using telnet.

I have enough information that allows me to try to Do some form of initial exploitation. Now, this initial exploitation in and of itself may be sufficient. But what we can often do is do something what's known as a pivot. A pivot is nothing more than an initial exploitation, which allows us to act as a launching point to do even more exploitation. So for example, if I were to be able to get root access to a system that is in and of itself, an exploitation However, once I have root access, I can treat that as a pivot to do all kinds of interesting things. The other thing to keep in mind is that we do what's known as persistence.

Persistence simply means that we keep doing something for a while. Most good penetration testing doesn't happen over the course of a few hours or a few days. What will normally take place as it will go over weeks, looking for a particular issue. Last and this is what it's all about. escalation of privilege. As I just described, getting Root Access is the holy grail of penetration testing.

So what I've got here in front of me is good old meta sploit. Now, menace. sploit is a framework. It's not a single program, but as a framework, it allows me to run different programs that will work together and know what each other's doing. So meta sploit is absolutely amazing. Now, what I'm doing is I'm running something called Armitage on top of meta sploit.

Armitage just helps me run with the framework a little bit. So if we take a look here, this is our montage. But down here is just good ole meta sploit right here. And that's MSF means meta sploit framework. So for example, if I want to take a look at all the stuff that's going on for SMB clients on this network, you can see that I run this end map, but I run a Metasploit script right here. So this dot NSC file is basically it's a script, and it runs through.

And it does all kinds of stuff. So it's going through and it's looking for usernames for SMB. You can see a lot of these are disabled, unfortunately. Let's keep scrolling. Ah, it took me a minute, but there it is. This is not a disabled account.

So there is an account called MSF admin on a particular system. So the cool part about this is and I jumped ahead a little bit. Remember that with pen testing, we're going to first discover vulnerabilities. So I can run an Nmap and tools like that. And it does it's pretty little graphical representation of all the different systems that it found on this network. So the reconnaissance does a really really good job.

Now if I were to run meta sploit in it It's typical way, I would then start running these very esoteric commands of one type or another. And I would be injecting all of these different types of exploits. Meta sploit, literally uses vulnerability databases, and you can look for particular vulnerabilities. But what medicine does, it's particularly nice is that it does a banner grab on the system. So it'll sit there and go, Ah, this is a window system or whatever it might be, that's running this version of Apache web server, whatever it is, and then it makes a listing of the types of attacks you can do and this is where Armitage the graphical front end becomes kind of nice. If you take a look, take a look here.

You can see I can pick different attacks. And it's only showing me the ones that can do if you take a look over here at services. You can see here's this computer 192 160 859 and look at all the open services. This thing's running just about everything there is in fact, this is a very specific type of machine called meta splittable. And it's actually a virtual machine that's designed for people to attack. It's a fun thing to practice on.

And as you can see, by looking at this, you can see it's running just about everything you could possibly think of. And the fun part is, is we can just right click on this guy. Pick an attack. Lots and lots of HTTP attacks. Let's try it again. And it will go ahead and do that attack for me Let that guy launch.

And maybe it'll work and maybe it won't. It just depends on the patch level for that particular system. So make sure you're familiar with Metasploit. It's probably the first go to pen testing tool that's out there. And don't you ever call it a program it's a framework

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.