# 物聯網資安檢測實務 Final Project
組別:4
Proposal 簡報連結:https://docs.google.com/presentation/d/1BB4ffZhkQW1H5wctyOrYMfioGBTRo9NAuSrWICC9Hy4/edit?usp=sharing
## 排程
4/12(二) 進行Midterm - Proposal
6/07(二) 進行Final - Project demo
## 建議主題:
- Hands-on IoT security testing to COTS product
- IoT system attack and defense mechanism demonstration on an IoT lab platform
## 題目
**行走的熱點安全嗎?Security of a Walking Hotspot**
The suggested proposal for final project should include as follows but not limit :
- Topic (should addresses the problem)
- https://www.dlink.com/en/products/dwm-321-4g-lte-in-vehicle-hotspot
- https://www.ithome.com.tw/news/147955
- https://upstream.auto/news/press-release-global-automotive-cybersecurity-report-2020/
- https://ieeexplore.ieee.org/document/6720160
- 智慧巴士資通訊系統系列資安標準&測試規範: https://www.taics.org.tw/LatestAssForm.aspx?Type=1&Ass_id=1055
- The Target IoT device / software components / datasets (should be representative)
- Related works (should concludes the insufficiencies)
- 老師:你想做的這個題目有沒有存在了相關的releated work了,他們的不足處在什麼地方,希望有個論述。Related works以及Pre-Threat是為了回推今天你想要解決的這個問題的嚴重程度,佐證你題目的真實性,為什麼你要做這件事做一個完整的說明。
- Pre-Threat / Risk Analysis (should demonstrate the serious threat vectors)
- The Proposed/Planning testing methods according to the analysis result (need to be reasonable)
## Final 簡報
https://docs.google.com/presentation/d/1AcopknNqzE8p07oI2T4EbfU_PIUTZPVSXH147X3vcc0/edit?usp=sharing
### 內容應包含、但不限於以下部分:
* Test Target
* System model / Threat model
* Test Plan
* Demo
* Test coverage / Result analysis
* Related comparison
* Conclusion
## 設備
- 廠商:D-Link
- 產品:DWM-321 4G LTE In-Vehicle Hotspot
- 韌體名稱/版本/SHA-1:**待確認**
- Manual: https://www.dlink.com.vn/wp-content/uploads/2021/02/DWM-321D_A1_Manual_v1.00WW.pdf
- 鋼鐵人提供連結(注意不要外流):https://docs.google.com/spreadsheets/d/1nQZuFa95DwoLxGJhOXQXrO-DDJ0kuddXPJUBHEqnRo8/edit?usp=sharing
- Ignition sense

## 工作分配
| Column 1 | Column 2 | Column 3 |
| -------- | -------- | -------- |
| Text | Text | Text |
## 檢測流程
1. Reconnaissance
- 說明:查詢相關系列產品是否存在可被利用的已知弱點
2. Port Scan & Service Scan (晉志,狀態:完成)
- 說明:列舉產品上開啟的連結埠與服務
- 工具:Nmap
- 檢測結果:https://drive.google.com/drive/folders/1x-5R8Jq1x_nEPrl6ZcDkrFpZqm-f0QSa?usp=sharing
- TCP Ports (全掃)
- 指令:
```sh
sudo nmap -sS -A -p- 192.168.99.2 -oN DWM-321_all_TCP.nmap
```
- UDP Ports (Top 1000 Common Ports)
- 指令:
```sh
sudo nmap -sU -sV -sC 192.168.99.2 -oN DWM-321_top1000_TCP.nmap
```
3. Known Vulnerabilities Scanning (晉志,狀態:完成)
- 說明:掃描產品上的常見服務是否存在已知弱點
- 工具:Nessus Scanner
4. Exploitation
- 說明:嘗試實際攻擊、利用上述方式取得的漏洞
- 工具:Metasploit Framework、Burp Suite、Wireshark
5. Other Common Security Testings
- Operating System
- Local Vulnerability Testing
- Password File Permission Test
- System Process Permission Test
- Web Interface (工具:Burp Suite、EditThisCookie)
- Configuration and Deployment Management Testing
- Directory Listing
- Identity Management Testing
- Account Enumeration and Guessable User Account
- Authentication Testing
- Bypass Authentication Schema
- Authoriazation Testing
- Directory Traversal/File inclusion
- Privilege Escalation
- Bypass Authorization Schema
- Session Management Testing
- Cookies Attribute
- Input Validation
- Reflected Cross Site Scripting
- Stored Cross Site Scripting
- Command Injection
- URL Redirect
- XXE Injection
- Network Service (工具:arpspoof、DHCPig)
- DHCP Starvation
- ARP Spoofing
- Telnet Service Enabled by Default
- SSL/TLS Service (維哲,狀態:算完成吧)
- 說明:進行TLS/SSL安全性檢測
- 工具:testssl
- 檢測結果:
- 
- 
LOW - "low" encryption cipher suites currently those using 64 or 56 bit encryption algorithms but excluding export cipher suites.

美國國安局(National Security Agency, NSA)發出安全指引,建議企業移除TLS1.0、1.1等舊版TLS設定,採用更強的加密及驗證標準。NSA建議僅能使用TLS 1.2 或TLS 1.3,不得使用SSL 2.0、SSL 3.0、TLS 1.0和TLS 1.1。即使是部署了TLS1.2及1.3,NSA也建議需避免較弱的加密參數及加密套件,特別像是TLS 1.2中的NULL、RC2、RC4、DES、IDEA與TDES/3DES等演算法,NSA建議不應再採用使用這些演算法的加密套件。TLS 1.3已經移除這些加密套件,但支援TLS1.2及1.3的實作,還是應檢查是否用了這些套件。
https://www.ithome.com.tw/news/142379
---
- 
Your server or application will be vulnerable if no order is set for the HTTPS cipher or if the cipher order includes an insecure cipher.
An insecure cipher allows an attacker to establish an insecure SSL/TLS connection and launch different attacks.
Therefore, in your SSL/TLS configuration, you should set the allowed ciphers and their order to match secure values.
Over time, vulnerabilities have been discovered in various common ciphers that have made them insecure due to the attacks they are open to. As a result, ciphers such as RC4, DSA, MD5, DH, ECDH, and others have been deprecated and considered unsafe (though many are still widely used).

https://crashtest-security.com/configure-ssl-cipher-order/
---
- 
CA issued=>MITM attacks get undetected.
Many browsers will work around such incomplete trust chain, i.e. fill in the missing intermediate certificate from other sources. This is typically done by using locally cached certificates or using the CA Issuers part of the Authority Information Access extension in the certificate to download the missing CA certificate.
But apart from the desktop browsers these workarounds are usually not done. This means that mobile applications, mobile browsers or standalone desktop applications or scripts will fail to validate the certificate which usually results in failing to access the site. In this case it would only be an availability issue. Some developers though then "fix" the problem by simply switching off certificate validation - in which case the availability problem turns into a security problem since now arbitrary certificates are accepted for the site and MITM attacks get undetected.
https://security.stackexchange.com/questions/187313/chain-of-trust-incomplete-and-server-cipher-order-not-set
- 
SSL/TLS client-initiated renegotiation is a feature that allows the client to renegotiate new encryption parameters for an SSL/TLS connection within a single TCP connection. During the SSL/TLS handshake the server incurs a higher computational cost. An attacker can exploit this asymmetry by opening an SSL/TLS connection to the server and repeatedly initiating renegotiation, causing the server to waste resources that would otherwise be used for the server's normal function.
**Can be attacked by using THC-SSL-DOS to impliment renegotiation attack**
- 指令:
- ```
thc-ssl-dos -l 15 192.168.87.1 443 --accept
```
https://www.twblogs.net/a/5caf77eabd9eee48d7883919




- 
CVE-2013-2566:The RC4 algorithm, as used in the TLS protocol and SSL protocol, has many single-byte biases, which makes it easier for remote attackers to conduct plaintext-recovery attacks via statistical analysis of ciphertext in a large number of sessions that use the same plaintext.
CVE-2015-2808:The RC4 algorithm, as used in the TLS protocol and SSL protocol, does not properly combine state data with key data during the initialization phase, which makes it easier for remote attackers to conduct plaintext-recovery attacks against the initial bytes of a stream by sniffing network traffic that occasionally relies on keys affected by the Invariance Weakness, and then using a brute-force approach involving LSB values, aka the "Bar Mitzvah" issue.
- 指令:
- ```sh
testssl 192.168.99.2
```
- Password Management (工具:hydra、john) (晉志,狀態:完成)
- Hardcoded Credentials
- Password Stored/Transmitted in Weak Encodings
- Default Credentials
- Hardware(工具:USB to UART/RS232)
- Interface Identification
## 漏洞利用參考
- Directory Traversal
- 對應項目:未授權記憶體讀取越界漏洞導致資訊洩漏
- CVE:CVE-2018-10822
- CVSS v3: 8.6 (AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N)
- 漏洞描述:Allows remote attackers to read arbitrary files via a `/..` or `//` after "GET /uir" in an HTTP request.
- POC
```bash
$ curl http://routerip/uir//etc/passwd
```
- 參考連結:https://sploit.tech/2018/10/12/D-Link.html
- 可能的弱點利用:Ignition Sense
- 此功能若沒有接上額外的電路,啟用後設備會完全無法運作 (Ping都ping不到)
- 若可以找到 bypass 相關弱點,會是很嚴重的問題
- 就算沒成功利用,可以在簡報上特別註明廠商應該加強保護此功能(介面加上顯眼的警語與提示、重複身分驗證等等)
## 實驗環境
### OpenVPN設定
1. Ubuntu OpenVPN Client設定
```
Gateway: mylink.ddns.net:1194
Username: ntu
Password: p10942a
```
2. Download CA Certificate
https://drive.google.com/file/d/1HzZa9mTjCmwGbOR9wMx9pqQijOfOv3__/view?usp=sharing
3. 參考設定



4. 代測物的IP為192.168.87.1,連線成功後瀏覽器開啟 http://192.168.87.1
5. 代測物的Web管理界面帳號為admin 密碼admin

### Fortinet VPN設定
1. 至 https://www.fortinet.com/support/product-downloads 下載並安裝 FortiClient VPN
2. 開啟FortiClient VPN新增連線,設定如下
```
Connection Name: 隨意填
Remote Gateway: dlink.fortiddns.com
Customize port: 4430
Username: 各位學號全小寫
Password(連線時輸入): ntu各位學號全小寫
```

3. 代測物的IP為192.168.99.2,連線成功後瀏覽器開啟 http://192.168.99.2
4. 代測物的Web管理界面帳號為admin 密碼admin
