Skip to content

資訊安全

弱點掃描

XSS

https://stackoverflow.com/questions/64152836/checkmarx-how-to-validate-and-sanitize-httpservletrequest-getinputstream-to-p https://stackoverflow.com/questions/1265282/what-is-the-recommended-way-to-escape-html-symbols-in-plain-java https://stackoverflow.com/questions/11478813/request-getparameter-protect-against-xss-what-is-the-best-practice

Code injection

https://stackoverflow.com/questions/15197673/using-pythons-eval-vs-ast-literal-eval

Insecure Randomness

如果這組偽隨機值被用做任何安全性使用,如密碼、金鑰、Session或是隱密辨識值,攻擊者就可以 預測下一個或已經產生的數值

Uncontrolled Format String

https://www.netsparker.com/blog/web-security/format-string-vulnerabilities/ Format strings are used in many programming languages to insert values into a text string. In some cases, this mechanism can be abused to perform - buffer overflow attacks - extract information - execute arbitrary code.

Command_Injection

python

https://docs.python.org/3.6/library/subprocess.html#subprocess.Popen

args is required for all calls and should be a string, or a sequence of program arguments.

Providing a sequence of arguments is generally preferred, as it allows the module to take care of any required escaping and quoting of arguments (e.g. to permit spaces in file names).

If passing a single string, either shell must be True (see below) or else the string must simply name the program to be executed without specifying any arguments.

``` python=

subprocess.call(["ping -c 1 8.8.8.8; rm test_file"], shell=True)

the test_file will be removed

subprocess.call(["ping", "-c", "1", "8.8.8.8", "rm", "test_file"], shell=True)

ping: usage error: Destination address required

subprocess.call(["ping", "-c", "1", "8.8.8.8", "rm", "test_file"])

ping: test_file: Temporary failure in name resolution

```

Popen Constructor , the default shell=False

If env is not None, it must be a mapping that defines the environment variables for the new process; these are used instead of the default behavior of inheriting the current process’ environment. Python - subprocess and the env argument

java

On Command Injection over Java’s ProcessBuilder

事件

log4j vulnerability

Certificate

Authorization & Authentication

Keycloak

Oso

Malware analysis

工具

Fail2ban

Infisical

防毒技術

【科普】2017各款防毒軟體技術原理剖析 2017 預防尚未進入防毒資料庫的未知威脅 - 啟發法: 通過一系列的規則試圖推理出可能的目標,實際上,通過一系列手段還原出可執行檔案的實際行為,並將其與記錄病毒行為的啟發特徵庫相比對 - 靜態啟發: 在可疑文件讀入到記憶體執行前,先行一步反編譯,根據得到的代碼分析出程式可執行的命令種類和順序,再與啟發特徵庫中的行為比較,近似者報毒 - 動態啟發: 建立一個隔離的虛擬環境預先執行要掃描的程式幾十毫秒。通過監控程式最初的幾條或幾十條指令來判斷程式是否可疑(正常程式一般會先調用圖形 API 繪製界面等,但病毒通常直接開始讀寫硬碟,注入其他程序) - 行為攔截(Behavior Blocker) - HIPS: 主機入侵防禦的英文縮寫,分為 AD 應用程式防護、RD 註冊表防護、FD 文件防護三塊。在程式執行時攔截所有行為並詢問用戶是否放行 - 主動防禦: 有啟發能力的 HIPS,與啟發式的不同在於,擁有主動防禦的防毒可以在程式正常執行(不隔離)的情況下不間斷地監視程式的行為,發現與啟發特徵庫匹配的動作便終止該程序 - 雲分析 - 人工智慧(AI): 分析雲端的大量資料,機器學習後再下放到本地 - 廣譜/基因: 通過衡量某個未知的文件和已知惡意文件的相似度來進行判別。如果一個未知文件在關鍵的地方和已知惡意威脅高度相似則判為有害 - 沙盒(SandBox)

主防和 HIPS 都屬於執行後保護,在其運作時,可疑程式已經在記憶體中執行,可以說是防毒軟體的最後一道關卡

  • Comodo
    • 以防護為重,查殺為輔
    • 防護思路
      • 第一步一樣由 AntiVirus 做判斷,並連接到雲信譽庫,白名單文件放行,沒檢測到病毒又不在白名單裡的文件自動入沙;Viruscope 再對沙盒裡的檔案進行行為分析,判斷為有害立即清除
  • Bitdefender
    • 對於病毒的檢測率相當精準,很少有誤判的情況發生
    • 防護流程包含四個步驟
      • 入口防護,使用流量掃描(含 Web、Email、IM)
      • 到達本地的文件將 hash 核對簽名數據庫
      • 如果沒有簽名匹配,會使用 B-HAVE 引擎進行啟發檢測
      • 主防監控程式的行為,當分數達到閾值立刻阻止執行
    • ATC 主防
  • Kaspersky
    • 所有的雲都會靠 MD5、Hash 來判斷檔案的安全性,這就是所謂的雲拉黑,MD5 是一個快速判斷檔案的好方法,但對於卡巴來說不是唯一方法。首次執行程式會先進入 KSN 進行雲數據庫匹配,白 Hash 直接放入信任組,黑名單報 DangerousObject;而未知應用自動分析安全的話放入限制組(需搭配 HIPS 模塊),符合雲危險模型報 DangerousPattern
    • 卡巴斯基有多個防護層。第一層是 Web 防護,網頁的木馬在第一層就被擋下;若病毒不幸被下載到本地,會被特徵碼和啟發檢測到;如果檔案資料沒有被收入在本地病毒庫,還會連上 KSN 查詢;再下一層是主動防禦模塊,分析程式的行為,若有可疑活動立刻阻止
  • F-Secure