--- title: SCIST 資訊安全試辦 - 08/21 課程共筆 tags : Security, 試辦 date : 2021/08/21 --- :::info - **Location:** On Webex - **Date:** August 15, 2021 - **Agenda:** Web Security - **Host:** SCIST - **Feel free to write.** ::: :::spoiler Table of Content [TOC] ::: --- # 2021/08/21 Web Security ## 滲透測試的流程 - 開發能力 - 基礎知識 - 接洽流程 - 蒐集階段 - port 版本 - 弱點利用 - WEB 漏洞 - XSS (Cross-Site Scripting) - SQL Injection - 提權階段 - tool:metasploit - 整裡階段 - POC - 告知如何複現 - 報告階段 - word ppt ## 網站三技術 * WWW(World Wide Web),由 HTML、HTTP、URL 組成! 網站的**前端**是由 HTML 、 CSS 、 Javascript 所組成。 * Language: HTML * 如同網站的骨架,由標籤跟內文組成 ```htmlmixed <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <h1>This is heading</h1> <p>This is paragraph</p> </body> </html> ``` > 學習資源:https://www.w3schools.com/html/default.asp 如果要查看某個網頁的 HTML,可以按下 `F12` 查看 * CSS * 如同網站的衣服。負責美化網頁,如字型、顏色、背景,甚至還可以透過 CSS 製作動畫。 * JavaScript * 如同網頁的關節。讓網頁有更多互動的行為。如點擊按鈕後,顯示一個視窗。 * 包含了 BOM 以及 DOM 網站的後端則常使用 ***PHP*** 來撰寫 * Protocol: HTTP * Location: URL ## 資料庫 (MySQL) 資料庫的架構由上至下依序為 **資料庫(Database)** => **資料表(Table)** => **資料欄位(Column)** => **資料(Data)** https://sqlbolt.com/ ## LAB1 - nslookup [LAB](http://35.234.24.11:8080/account/login.php) 下載 dnsuntils ```bash= sudo apt install dnsutils ``` 透過 nslookup 查看 ip ```bash= nslookup feifei.tw ``` 下載 iputils-ping ```bash= sudo apt install iputils-ping ``` 透過 ping 查看 ip ```bash= ping feifei.tw ``` ## HTTP ### URL 統一資料定位符 URL(Uniform Resource Locator),俗稱網址,如同網頁的門牌,透過網址就可以到達指定的網頁。 URL 規定的格式如下: ``` [協定類型]://[伺服器位址]:[埠號]/[檔案路徑][檔名]?[查詢]#[片段ID] ``` 舉例來說 ``` https://example.com:443/index.php?q=100#1 ``` | 協定類型 | 伺服器位置 | 埠號 | 檔案路徑 | 檔名 | 查詢 | 片段 ID | | -------- | ----------- | ---- | -------- | --------- | ----- | ------- | | https | example.com | 443 | / | index.php | q=100 | 1 | https://www.urldecoder.org/ 在 RFC 7231 定義 HTTP/1.1 請求的方法(Method)如下: | 方法 (Methods) | 說明 | | ----------- | ---------------------------------------------- | | ***GET*** | 取得資料 | | ***POST*** | 提交指定資源的實體 | | ***HEAD*** | 取得標頭 | | ***OPTIONS*** | 取得資源的溝通方式 | | ***PUT*** | 取代指定資源 | | ***DELETE*** | 刪除指定資源 | | ***CONNECT*** | 和指定資源標明的伺服器之間,建立隧道(tunnel) | 傳送過後會有相對應的回應 在 RFC 7231 定義狀態碼(Response Status Codes)如下: | 類別 | 常見範例 | | ----------------| -------------------------| | 1xx - 資訊回應 | 100 Continue | | 2xx - 成功回應 | 200 OK | | 3xx - 重新定向 | 302 Found | | 4xx - 使用者端錯誤 | 404 Not Found | | 5xx - 伺服器端錯誤 | 500 Internal Server Error | ### GET 方法 GET 可以想成是要向網頁查詢資料,而查詢的方式是透過告知伺服器這筆資料的一些相關資訊 查詢的內容會顯示在 URL 上,其格式如下 ``` 網址?資訊1=資料1&資訊2=資料2 ``` 可以注意到 GET 使用的幾個特點 1. GET 是在網址後加上一個 `?` 再接上資訊 2. 每個資訊會用 `資訊=資料` 的格式表示 3. 當我們有多筆資訊要提供時,中間要用一個 `&` 串接 舉例來說,當我們透過 Google 搜尋 Linux 時,會有一個參數 `q` 用來接收我們查詢的內容 `Linux`,這時候網址列就會顯示: ``` https://www.google.com/search?q=Linux ``` https://http.cat/ ## LAB2 - curl 下載 curl ```bash= sudo apt install curl ``` ### GET 這裡要練習使用 curl 來對網站送出 GET 請求。 ```bash= curl http://35.234.24.11:8080/practice/basic/curl/get.php ``` ### POST 這裡要練習使用 curl 來對網站送出 POST 請求。傳送的檔案內容: - 參數名稱 : data - 參數值 : good curl 可以透過加上參數 `--data` 來傳送 POST。 ```bash= curl http://35.234.24.11:8080/practice/basic/curl/post.php --data "data=good" ``` :::info 補充一下,這裡使用的 `--data` 預設會使用 POST 來傳送,你也可以透過 `-X` 參數指定傳送的協定: ```bash= curl http://35.234.24.11:8080/practice/basic/curl/post.php -X POST --data "data=good" ``` ::: ### Header 這裡要練習在使用 curl 的時候查看 Response Header。 curl 可以透過加上參數 `-i` 來查看 ```bash= curl http://35.234.24.11:8080/practice/basic/curl/getcookie.php -i ``` 在 `Set-Cookie` 的部分就可以看到答案囉 ### Send-Cookie 這裡要練習透過 curl 夾帶 cookie 去向網站請求。 curl 可以透過加上參數 `--cookie` 來夾帶 cookie 傳送的 cookie: - 參數名稱 : flag - 內容 : givemeflag ```bash= curl http://35.234.24.11:8080/practice/basic/curl/sendcookie.php --cookie "flag=givemeflag" ``` https://lidemy-http-challenge.herokuapp.com/start
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up