Kipper
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    2
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # OS筆記-Chapter 15: Security ###### tags: `OS` --- #### 目錄 * 總論 [Chapter 1: Introduction](https://hackmd.io/NoZq3J7IQvOQpcbo_tctjA) [Chapter 2: Operating-System Structures](https://hackmd.io/OKykRLBESI6v9a13HgS35A) * 行程管理 [Chapter 3: Processes](https://hackmd.io/HOqN-iQ3RIKIC-NB9QjBIQ) [Chapter 4: Threads](https://hackmd.io/qzAIHeSASmKuecdkqidmHw) [Chapter 5: CPU Scheduling](https://hackmd.io/IT5g2wHzTdOtMSDXPVEpOw) [Chapter 6: Process Synchronization](https://hackmd.io/rv-PNe3ESxi08PElyUTc4Q) [Chapter 7: Deadlocks](https://hackmd.io/Uu0jDK-rSyKNKq690y146g) * 記憶體管理 [Chapter 8: Main Memory](https://hackmd.io/4KS_yPkBQzGZfHDisPciog) [Chapter 9: Virtual Memory](https://hackmd.io/yirxZFn8Rz2wT56AAR7Sxw) * 儲存裝置 [Chapter 10: File-System Interface](https://hackmd.io/aNPWKsFhTlGc-WFgQ__KRg) [Chapter 11: File System Implementation](https://hackmd.io/bFcrlmefQsGp6hZdbI1MHQ) [Chapter 12: Mass-Storage Systems](https://hackmd.io/9Y7Qo0OERda6htK7OOI36Q) [Chapter 13: I/O Systems](https://hackmd.io/VNwXrhJPSo-l_t9tUBhYIg) * 保護和安全 [Chapter 14: Protection](https://hackmd.io/izkd4JwXRwub_ZmhSMTlNw) <font color="red">Chapter 15: Security</font> --- ### 安全性問題 * 入侵者(intruder)/破壞者(cracker):嘗試突破安全性的人 * 威脅(threat):違反安全的潛在 * 攻擊(attach)嘗試破壞安全性 * 攻擊藉由偽裝(masquerading)突破認證(authentication) * 重送攻擊(replay attack):有效資料重複的傳輸,例如:重複轉移錢 * 中間人攻擊(man-in-the-middle attack):藉由連線劫持(session hijacking)攔截通訊 ![](https://i.imgur.com/vlAiPQH.png) * 為了保護系統,我們在四個層次採取安全措施 * 硬體:保護能存取機器的機房 * 人:只有適當的使用者可以存取 * 人可能經由社交工程(social engineering)被欺騙 * 網路釣魚(phishing) * 垃圾箱潛水(dumpster diving) * 作業系統:系統必須自我保護 * 網路:大部分資料會經由網路傳輸 ### 程式威脅(Program Threats) * 後門(back-door):能提供訊息或讓攻擊者容易存取的一個缺口 * 木馬(Trojan horse):偽裝成無害程式,騙使用者開啟,例如:安裝無害軟體,利用隱密通道(covert channel)安裝間諜軟體 * 模擬登入頁面,竊取帳密 * 間諜軟體(spyware):監控系統、後門、廣告 * 陷阱之門(trap door):迴避正常的安全檢查程序,例如:銀行的程式中加入錯誤的四捨五入以偷取小數點後的金額,積少成多 * 邏輯炸彈(logic bomb):符合預先設定的參數,就會觸發的安全漏洞 * 堆疊和緩衝區的溢位(Stack and Buffer Overflow) * 執行結果將產生一個root的殼(shell),或是其它特權指令的執行 * 利用溢位置換堆疊中的返回位置,使程式返回攻擊者注入的程式碼區段 ![](https://i.imgur.com/mjYVEl2.png) * 因溢位而覆蓋掉原先的返回位置 ![](https://i.imgur.com/rYYzuW7.png) * 病毒(virus) * 自身複製,感染其它程式 * 不會自己散播至其它機器 * 病毒注射器(virus dropper):在系統中插入病毒 ![](https://i.imgur.com/U4GLqfv.png) * 按鍵側錄程式(keystroke logger) ### 系統和網路威脅(System and Network Threats) * 作業系統越開放就越有可能有錯誤讓人利用 * 預設是安全(secure by default):降低系統的攻擊表面(attack surface) * 蠕蟲(worm) * 自身複製(spawn),感染其它程式 * 會自己散播至其它機器 * 掛勾(grappling hook/bootstrap/vector):連接原先已感染的機器,並載入主程式到上鉤的系統 ![](https://i.imgur.com/eYiU1Ln.png) * 連接阜掃描(Port scanning):不算是攻擊,是用來偵測弱點 * 拒絕服務(DOS,denial of service) * 擾亂系統或設備的合法使用 * 兩種類型 * 使用許多設備的資源造成沒有工作可以執行 * 混亂設備的網路 * 分散式拒絕服務(DDOA,distributed denial-of-service):多個被操控的殭屍設備向同一個目標攻擊 ### 以密碼學為安全性工具 * 電腦送出位元到網路上,卻不知道誰可能接收這些位元 * 密碼學(cryptography)被用來限制訊息的潛在傳送者和接收者 * 加密(encryption) * 加密演算法由以下元件組成 * 鑰匙K * 訊息M * 祕文C * 加密函數E(k):M->C * 解密函數D(k):C->M ![](https://i.imgur.com/GSfXGZt.png) * 對稱加密(symmetric encryption) * 使用相同的鑰匙加密和解密 * 鑰匙的安全必須被保護 * DES(data-encryption standard):64-bit,區段加密,不夠安全 * AES(advanced encryption standard):128-bit * RC4:串流加密(stream cipher) * 非對稱加密(asymmetric encryption) * 加密與解密使用不同鑰匙 * RSA加密 1. N=pq 2. r=(p-1)(q-1) 3. e<q,gcd(e,q)=1 4. ed ≡ 1 (mod r) 5. (N,e)公鑰,加密:c ≡ mᵉ (mod N) 6. (N,d)私鑰,解密:m ≡ cᵈ (mod N) * 大家用公鑰加密,擁有私鑰者才能知道內容 ![](https://i.imgur.com/xRgxAcH.png) * 認證(authentication) * 限制訊息可能傳送者(知道是誰傳來的) * 認證演算法由以下元件組成 * 鑰匙K * 訊息M * 認證因子A * 產生認證函數S(k):M->A * 對訊息驗證函數V(k):M✖A->{True,False} * 雜湊函數(hash function) * H(M)產生固定大小的資料區塊,稱為訊息摘要(messege digest)或雜湊值(hash value) * H(M)=H(M'),只有當M=M' * H必須被保護,否則H(M)的內容可以被偽造 * 對稱加密法 * 訊息認證碼(MAC,messeage-authentication code) * 使用安全的鑰匙認證訊息 * 數位簽名演算法(digital-sifnature algorithm) * 認證因子在此稱為數位簽名 * 與RSA相似,只是鑰匙的使用是反過來的 * 使用私鑰加密,公鑰持有者能認證 * 不可否認性(nonrepudiation) * 鑰匙分配 * 公開鑰匙不需要保密,簡單的儲存可以用來儲存鑰匙環 * 但攻擊者也可能偽造公開鑰匙 ![](https://i.imgur.com/26SXVun.png) * 數位憑證(digital certificate):由信任的第三方數位簽署的公開鑰匙 * 密碼學的製作 * 通常網路協定以階層(layer)的方式組織 ![](https://i.imgur.com/I6WPwR9.png) * 密碼學幾乎能插入OSI中任何階層 ![](https://i.imgur.com/LsyI94E.png) * 範例:SSL * SSL 3.0是一種讓兩台電腦安全地通信的密碼協定 * 進化成TLS協定 * 客戶與伺服器可以建立一個安全的會議層鑰匙(session key),避免中間人攻擊及重送攻擊 * 步驟 1. 伺服器由憑證機構得到憑證,憑證內容 * 伺服器屬性 * 公鑰 * 憑證有效期間 * 非對稱加密演算法E()的識別 2. 客戶從憑證機構取得驗證演算法 3. 客戶連線至伺服器,傳送隨機值 4. 伺服器回應,並加上憑證 5. 客戶驗證(包含有效期間) ### 使用者認證(User Authentication) * 作業系統的主要安全問題 * 密碼 * 最普通的方法 * 但可能被猜出或意外的暴露 * 猜密碼可能從一般人常使用的資料(如:生日、電話等等)或是暴力破解 * 若密碼寫在能夠被讀出的地方,則可能暴露 * 一些系統使用老化,強迫使用者在固定期間內要去改變密碼 * 密碼安全 * 使用雜湊(hash) * 希望有一個不可逆轉的函數,這樣就算存起來的密碼被看到也無法去解碼而知道真正的密碼 * 但若是取得整份密碼檔,還是可能被解碼還原 * 單次密碼(One-time passwords) * 系統使用一個配對密碼(paired password)的集合,系統隨機選擇並顯示密碼對的一部分,使用者接受盤問(challenged)且須回應(respond)出正確答案 * 可以用不同的方式製作(如:USB裝置、信用卡) * 生物識別技術 * 指紋讀取 ### 安全性防禦的製作(Implementing Security Defenses) * 大多數專業安全性贊成縱深防禦(defense in depth),敘述多層的防禦比較少層為佳 * 安全性策略(security policy) * 包含要保密什麼的敘述 * 有了策略,才知道什麼是需要的,什麼是不被允許的 * 週期檢討和更新 * 弱點評估 * 涵蓋很廣,從社交工程到危險評估(risk assessment)到阜掃描 * 大部分弱點評估的核心動作是侵入測試(penetration) * 隱藏式保全(security through obscurity):主張工具餔應該寫來測試安全性,這樣安全性漏洞將會很難被發現 * 侵入偵測(intrusion detection) * 包括 * 即時/事實發生後 * 侵入的型態 * 反應 1. 簡單:停止侵入活動的行程 2. 複雜:虛擬攻防系統(honeypot),暴露給侵入者假資源 * 侵入偵測系統(IDS,intrusion-detection system):偵測侵入,發出警告 * 識別標誌的偵測(signature-based detection): 1. 檢查特定行為樣式 2. 非預期的新公及無法偵測 * 異常偵測(anomaly detection):檢查異常行為 1. 侵入活動可能被包含在正常的標準中 2. 避免假警報與遺漏的侵入數目過多 * 侵入預防系統(IDP,intrusion-prevention system):除非偵測到侵入,否則流量通過 * 病毒保護 * 當防毒軟體發現一個已知樣式,進行程式消毒(disinfection) * 有些病毒當感染時,自我修改以避免與防毒程式的樣式相符 * 行程於sandbox中執行,防毒軟體分析行程的表現 * 記錄及記帳 * 系統呼叫可以被記錄以作為對程式行為的分析 * 記帳用來發現程式效能改變 ### 保護系統和網路的防火牆(Firewalling to Protect Systems and Networks) * 防火牆(firewall)用來分隔信任或不可信任的系統 * 從網際網路到非軍事領域(DMZ,demilitarized zone)以及從公司到網際網路的連結式允許的,但網際網路或DMZ到公司則是不允許的 ![](https://i.imgur.com/rGBn235.png) * 防火牆不能防止穿透(tunnel)的攻擊 * 防火牆可能被欺騙(spoofing) ### 電腦安全等級(Computer Security Classifications) * 4個等級:A、B、C、D * D:最低標準 * C:透過審核,提供保護 * C1:識別具有相同保護級別的合作用戶 * C2:允許用戶級別的存取控制 * B:C的所有屬性,但是每個對象可能具有唯一的敏感度標籤 * B1、B2、B3 * A:使用正式的設計和驗證技術來確保安全性

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    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

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully