Java RMI Exploit

10 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€48.10
List Price:  €67.35
You save:  €19.24
£39.88
List Price:  £55.83
You save:  £15.95
CA$71.97
List Price:  CA$100.76
You save:  CA$28.79
A$80.16
List Price:  A$112.23
You save:  A$32.07
S$67.96
List Price:  S$95.14
You save:  S$27.18
HK$388.27
List Price:  HK$543.62
You save:  HK$155.34
CHF 45.02
List Price:  CHF 63.04
You save:  CHF 18.01
NOK kr569.59
List Price:  NOK kr797.48
You save:  NOK kr227.88
DKK kr358.90
List Price:  DKK kr502.49
You save:  DKK kr143.58
NZ$88.63
List Price:  NZ$124.10
You save:  NZ$35.46
د.إ183.61
List Price:  د.إ257.07
You save:  د.إ73.45
৳5,972.19
List Price:  ৳8,361.55
You save:  ৳2,389.35
₹4,258.89
List Price:  ₹5,962.79
You save:  ₹1,703.89
RM224.30
List Price:  RM314.04
You save:  RM89.74
₦77,378.02
List Price:  ₦108,335.42
You save:  ₦30,957.40
₨13,924.71
List Price:  ₨19,495.71
You save:  ₨5,570.99
฿1,707.62
List Price:  ฿2,390.81
You save:  ฿683.18
₺1,762.36
List Price:  ₺2,467.44
You save:  ₺705.08
B$310.08
List Price:  B$434.14
You save:  B$124.06
R926.14
List Price:  R1,296.68
You save:  R370.53
Лв94.05
List Price:  Лв131.68
You save:  Лв37.62
₩72,995.06
List Price:  ₩102,198.93
You save:  ₩29,203.86
₪183.24
List Price:  ₪256.56
You save:  ₪73.31
₱2,921.84
List Price:  ₱4,090.81
You save:  ₱1,168.96
¥7,853.11
List Price:  ¥10,994.99
You save:  ¥3,141.87
MX$1,006.35
List Price:  MX$1,408.98
You save:  MX$402.62
QR182.19
List Price:  QR255.09
You save:  QR72.89
P691.26
List Price:  P967.82
You save:  P276.56
KSh6,461.20
List Price:  KSh9,046.20
You save:  KSh2,585
E£2,544.49
List Price:  E£3,562.49
You save:  E£1,018
ብር6,361.91
List Price:  ብር8,907.19
You save:  ብር2,545.27
Kz45,590.88
List Price:  Kz63,830.88
You save:  Kz18,240
CLP$49,514.09
List Price:  CLP$69,323.69
You save:  CLP$19,809.60
CN¥364.84
List Price:  CN¥510.80
You save:  CN¥145.96
RD$3,032.23
List Price:  RD$4,245.36
You save:  RD$1,213.13
DA6,760.37
List Price:  DA9,465.07
You save:  DA2,704.69
FJ$115.98
List Price:  FJ$162.39
You save:  FJ$46.40
Q385.05
List Price:  Q539.11
You save:  Q154.05
GY$10,455.66
List Price:  GY$14,638.77
You save:  GY$4,183.10
ISK kr6,980.10
List Price:  ISK kr9,772.70
You save:  ISK kr2,792.60
DH502.81
List Price:  DH703.98
You save:  DH201.16
L922.32
List Price:  L1,291.33
You save:  L369
ден2,959.81
List Price:  ден4,143.97
You save:  ден1,184.16
MOP$399.96
List Price:  MOP$559.97
You save:  MOP$160.01
N$920.98
List Price:  N$1,289.45
You save:  N$368.46
C$1,839.04
List Price:  C$2,574.80
You save:  C$735.76
रु6,810.12
List Price:  रु9,534.71
You save:  रु2,724.59
S/186.41
List Price:  S/260.99
You save:  S/74.57
K202.74
List Price:  K283.85
You save:  K81.11
SAR187.78
List Price:  SAR262.91
You save:  SAR75.12
ZK1,383.10
List Price:  ZK1,936.45
You save:  ZK553.35
L239.36
List Price:  L335.12
You save:  L95.76
Kč1,209.95
List Price:  Kč1,694.03
You save:  Kč484.08
Ft19,835.61
List Price:  Ft27,771.44
You save:  Ft7,935.83
SEK kr553.09
List Price:  SEK kr774.38
You save:  SEK kr221.28
ARS$51,277.48
List Price:  ARS$71,792.58
You save:  ARS$20,515.09
Bs346.08
List Price:  Bs484.55
You save:  Bs138.46
COP$219,391.32
List Price:  COP$307,165.41
You save:  COP$87,774.08
₡25,377.51
List Price:  ₡35,530.54
You save:  ₡10,153.03
L1,269.45
List Price:  L1,777.33
You save:  L507.88
₲390,156.27
List Price:  ₲546,250
You save:  ₲156,093.73
$U2,225.52
List Price:  $U3,115.91
You save:  $U890.38
zł205.57
List Price:  zł287.82
You save:  zł82.24
Already have an account? Log In

Transcript

Hey guys. So in this video, I want to show you guys how you can exploit Java RMI surveys with Metasploit Framework. Java RMI stands for remote method invocation or just Java on my plane. It's a mechanism that allows an object that exists in one Java Virtual Machine to access and call methods that are contained in another Java Virtual Machine. So basically, it's the same thing as an RPC, but in an injected object oriented paradigm, and sort of a procedural one. So this allows for communication between Java programs that are not in the same address space.

So this vulnerability is due to the default configuration of the Rmi registry and RM activation services allowing the loading of classes from a remote URL so that that's what it does, it allows TAs are getting loaded from a remote URL. And this we can take advantage of this and exploit it So this protocol Rmi protocol uses makes use of two other protocols. For its on the wire format is Java object serialization and HTTP. The object serialization protocol is used to marshal call and return data. But the other one they should be protocol is used to only post a remote method invocation and often return data when circumstances weren't. So first, we need to see if it exists if the target is vulnerable to this particular exploit because we want to check for that port.

So let's do an Nmap scan on over target machine. And even for this video, I'm going to be using now splittable to which I actually have it open from my VirtualBox right here. I just opened it up and just look for the IP here, just type ipconfig and you've seen the IP so let's go So let's go back. Let's go back to our Kali machine. And now type that 921600 which is our meta splittable to IP address answer. And now let's see if our registry Rmi registry port is open and not.

So as you can see, these are like all the ones that are open right now. And it's right here our Rmi registry is open which is 1099. For our next step is you we got up we got to figure out what you can do you can use and map spread and verify if this if this particular machine is vulnerable or not, this particular IP address is vulnerable to Rmi registry or not. So all you got to do is you can use an end map script engine so Zoho it goes you can just type in map and then Script dash desperate. And then Rmi on my wall, because that's what we're looking for in class loader. Dash V, we're going to be talking the port which is 1099.

That's where Rmi registry is. And then our IP address, which is our meta splittable to IP address is 01 95. And enter. Looks like it's down. I think the IPS change. Let's try it again.

Yes, this one I do it. So let's go back to a virtual machine and type that in 190. Awesome. So our target is vulnerable Rmi registry default combination makes remote code execution possible. So now, our next step. is to see as you open up MSF console, because we're gonna be using the Ross Boyd framework for this.

So open that up and look for this particular exploit which is Java RMI exploit. I'm just going to type search Java RMI awesome. So yeah, we got a lot of exploitable we got three four exploits. And I'm going to be picking this one right here. So just copy that and type use paste. Now let's look for the options we need to set.

And that's it. So we need to set our remote hosts which is our meta splittable to machine so our hosts 1921680 198. Now we already have our new check in show options to see so our party said or Center. They need anything all right now. Okay, awesome. Our next step is to just see if it runs.

Let's run and see if it's working. Great. So, as you can see the loader is interval enabled in the execution was completed. Our next step is exploitation phase. For this, we can see that the scanner detected a Java Java RMI port in point on port 1099 right here, right, would suggest that the target may be vulnerable. Now it's time to explore the same set service with the poet with this particular module.

Multi or was it right here, multi copy that and now choose it over here and paste because the first one was an officer right level now we're trying to actually act Point, answer. Great. Now, let's look at the options. So we have our arm also is not set. So let's set that up, set our hose 1921680 190, enter. Great.

So now we have Okay, we also have our for this module, Java RMI server, it takes advantage of the default configuration of the army registry and the activation services. So this allows us like I was mentioning earlier, this allows us to load classes from any remote URL, an HTTP URL, because it invokes a method in the Rmi registry, just some from the garbage collector, which is available via like any Rmi endpoint. And this can be used against both Rmi registry and RM IR an ID also against most other custom made Rmi endpoints as well. One thing though, it doesn't work against Java management extension course, since those do not support remote cause loading, unless another Rmi endpoint is active in the same Java process as the only time that it is possible. And our method calls do not support or require any sort of authentication either.

Alright, so let's now let's go back and see so we have our our host set our port set to add, our next step is to set a payload so that we can have a connection back and I want to go for something a reverse TCP shell connection, you can just type show payload. And like I said, I'm looking for something like a reverse TCP shell connection. So I want to go for and that can give me a metaphor to show them So I'm going to go over some TCP connection back for that can give me that upper shell. So this looks good. Let's copy that. And set the payload, set payload and paste it.

Answer. Awesome. Now let's again look for the options and see what options we need to set. So we see our Aravosis set perfect. There to set up our localhost though, let's go to let's open up another tab and type ipconfig again to see what has ever called Linux IP, which is 197. So set L ellos.

1921680197. Enter. Well, let's look at the options again, show options. Awesome. Our l host is set. So our host is set on the poor out pour, pour, pour, pour, pour.

And now we gotta run this exclusive So just type run and see if it works if America shows awesome so we got our meterpreter shell open all you got to do to set the session as you get to like we can see that the exploit started a handler on our system and you can see a hammer has been started and then it sends the Rmi method call to the target right here. And that emitters pretty shell down and open. Now if you type sessions, gosh, I got your shows all the sessions that are open. So we got two sessions open. That's awesome. You can use either one to access a meterpreter shell because both are Metacritic shells.

So I'm going to go type sessions and dash I which has got which will tell me what I need and then I'm going to type two because matter for Shell two is open, right? So I'm just going to go for two and enter. Great. There you go. There's our meta version. And as I mentioned before, meta operator is a very powerful shell.

It'll give you scope to a lot of exploits and a lot of vulnerability tools. You can check by typing sis info to see what the information is about your system. There you go. It is metals portable. That's our training machine. That's it guys.

I hope you enjoyed this video. We'll see in the next one.

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.