attacker.html
attacker.css
把長寬設成最大值,然後 position 是 absolute 就好了。
Question:
修改成 transparent 就看不到了,然後調整一下 margin 。
Questions:
2. How does the appearance of the attacker’s site compare to that of the defender’s site?
3. What happens when you click on the “Explore Menu” button on the attacker’s site?
It will trigger "You Have Been Hacked!!"
4. Describe an attack scenario in which the style of clickjacking implemented for this Task leads to undesirable consequences for a victim user.
可能有人只是想要點擊 Explore Menu ,結果卻觸發另一個按鈕,而造成連結到其他的 malicious website 。
如果 top 不是自己,就會把 top 設定成自己。
Questions:
5. What happens when you navigate to the attacker’s site now?
雖然進入 http://www.cjlab-attacker.com 但會自動導到 http://www.cjlab.com/
6. What happens when you click the button?
就跟原本沒有 clijacking 一樣,不會發生被攻擊。
allow-scripts:允許 defender 的 JS 執行(否則整個站會掛掉)
但是不包含 allow-top-navigation ,這樣就能阻止 defender 的 JS 嘗試跳出 iframe
7. What does the sandbox attribute do? Why does this prevent the frame buster from working?
它可以限制 iframe 裡面內容能做什麼(例如禁止彈出視窗、執行 JavaScript、改變父頁面等)。
8. What happens when you navigate to the attacker’s site after updating the iframe to use the sandbox attribute?
就變成原本的 attacker 的網站了,原本的 top 是否等於 self 的那個 script 就沒有用了
Questions:
10. What is the X-Frame-Options HTTP header attribute, and why is it set to “DENY” to prevent the
attack?
完全不允許這頁被嵌入 iframe ,即使 attacker 加了 sandbox,瀏覽器會直接不顯示內容
<iframe>
, <frame>
, <object>
來載入你的網頁。
這是我們這題用到的 container 。
1.
2.
我們可以直接送 ping 道 google.com
這是 drop 掉 ICMP
這是 drop 掉 Telnet
以下是 code
按照下面去輸入:
Outside hosts cannot ping internal hosts.
可以看到我們沒辦法從外面 ping 到 internal hosts 。
Outside hosts can ping the router.
可以 ping router ip 。
Internal hosts can ping outside hosts.
我們在 192.168.60.6 container 裡面是可以 ping 到外面的
All other packets between the internal and external networks should be blocked.
這張是外部沒辦法送進來
這張是內部沒辦法送出去
可以看到其他的封包都必須被 block 住。
可以看到只能 telnet 192.168.60.5 ,但不能 telnet 192.168.60.6 和 192.168.60.7
可以看到可以對自己內部的 machine telnet ,但不能對外部的 telnet 。
ICMP experiment:
ping 之前是沒有 connection tracking 的。
在 ping 的過程是有 connection tracking 的。
ping 結束的那個時刻也是有的。
但再過一陣子就沒有 connection tracking 了。
UDP experiment:
發送訊息前是沒有 connection tracking ,但發送之後就有了,但隔了大概 30 秒做左右又沒有 connection tracking 了。
TCP experiment:
TCP 比較有趣,還沒連線錢是沒有的,但是一旦建立連線就會有 connection tracking ,一直到結束過後一兩分鐘才會沒有 connection tracking ,如同老師上課說的,TCP 即使結束,它還要一點時間才能把狀態恢復,所以要等一段時間是正常的。
與 2.c 不同,現在我們是可以從裡面連出來的
在沒有第二行的情況下,我們傳送速率感覺上是沒有被限制的,還是很快
但加上第二行的時候,速度很明顯的被限制了,一開始還有點快,但後面就變緩慢了。
因為沒有第二條指令的時候不知道要怎麼處理超過限制的 packet ,就按照 default 的方式去傳。
有了第二條指令之後就將超過限制的 packet 丟掉了。
這裡是要做負載平衡
第一種是用均勻分配的機制
可以看到我們可以均勻的分配到 192.168.60.5, 192.168.60.6, 192.168.60.7 這幾個機器上面
我們只需要調整 --every <num>
以及最後的 destination 的 ip 就可以了。
第二種是機率分配的機制
可以看到就是靠機率去分配,我們要修改的就是 --probability P
後面的機率數值,以及 destination 要送到哪一個 ip 就可以了
我們就完成了
建立 gateway container(兩張網卡)
進入 gateway container 的 shell
建立 LAN container(要被轉發過來的目標機器)
在 LAN container 裡安裝並啟動 SSH server
在 gateway container 裡設定 nftables
從 host 連線
會連到 LAN container!
2. Allow TCP dst port 80 and 8080 from the WAN interface.
測試 port 80 和 8080 是否成功被允許,可以在 LAN container 裡跑一個 HTTP server:
並在 host 上測試
Network Address Translation
Default: Drop all coming packets from the WAN interface.
進到 filter container
Raw Socket 的 code 。
命名成 packet_filter.c
因為 Raw socket 所以要用 root 跑
最後去做測試
由於我家裡沒有乙太網路,我都是用電腦的無線網卡連接手機的個人熱點,所以我沒辦法使用 eth0 和 eth1 之類的乙太網路網卡界面。
因此若助教您要測試可能需要有無線網卡,我的無線網卡是
我會直接 assign 在我的程式裡面
上面是我的 output
要使用我的程式只需要
之後就可以成功攔截 DHCP 封包。
如果發現沒有攔截到任何封包,可以嘗試
這樣我們就完成這一題了