NCNU-OpenSource
      • 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
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners 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
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
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
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 系統安全強化、監控與攻擊防禦筆記 --- ## 目錄 1. [系統安全強化 (System Hardening)](#系統安全強化-system-hardening) 1. [SBOM 與漏洞掃描](#sbom-與漏洞掃描) 2. [權限控管](#權限控管) - [AppArmor](#apparmor) - [SELinux](#selinux) - [其他權限機制](#其他權限機制) 2. [系統效能監控與調校](#系統效能監控與調校) 1. [Observability 三本柱](#observability-三本柱) 2. [伺服器監控要點](#伺服器監控要點) 3. [監控架構 Push / Pull](#監控架構-push--pull) 4. [Linux Kernel 微調](#linux-kernel-微調) 5. [Prometheus 生態](#prometheus-生態) 3. [攻擊策略與弱點](#攻擊策略與弱點) 1. [MITRE ATT&CK 概覽](#mitre-attck-概覽) 2. [CVE 與漏洞資料庫](#cve-與漏洞資料庫) 3. [資安服務](#資安服務) - [弱點掃描](#弱點掃描) - [滲透測試](#滲透測試) - [紅隊/藍隊/紫隊](#紅隊藍隊紫隊) 4. [Web 應用安全:OWASP Top 10](#web-應用安全owasp-top-10) 5. [DDoS 與網路攻擊](#ddos-與網路攻擊) 6. [日誌管理與分析](#日誌管理與分析) --- ## 系統安全強化 (System Hardening) ### 檢視服務與系統 災難復原後不僅須還原資料,亦需確認 **服務執行程式** 或 **作業系統** 是否遭受污染。 ### SBOM 與漏洞掃描 - **SBOM (Software Bill of Materials)**:列出軟體所含函式庫、元件、版本號、來源…,便於風險評估與更新。 - **OSV**:開源漏洞資料庫,可據 SBOM 比對現有弱點。 - **Syft**:產生容器映像/檔案系統的 SBOM。 - **Grype**:掃描映像或檔案系統,找出已知漏洞(常與 Syft 搭配)。 ### 權限控管 Linux 角色:`root`、一般使用者、服務帳號。配置不當將導致水平/垂直提權。 | 控管模型 | 說明 | 典型場景 | |----------|------|----------| | **DAC** *(Discretionary)* | 預設權限模式;以檔案擁有者為核心,`chmod / chown` 控制。易因 root 過度特權而受攻擊。 | 多使用者系統 | | **MAC** *(Mandatory)* | 系統集中策略,依 *process* 與 *物件* 標籤決策。 | 高安全需求環境 | #### AppArmor - 路徑為核心的 MAC 模組,透過 **Profile** 約束程式。 - Modes:`enforce` / `complain` / `kill` / `unconfined` / `mixed`。 - 常用指令:`aa-status`、`aa-enforce <profile>`、`aa-complain <profile>`、`apparmor_parser -r <file>`。 - 限制:路徑變動即失效;無法限制 CPU/Memory 使用量。 #### SELinux - **Type Enforcement**;以「安全上下文 (user:role:type:level)」標籤檔案與 process。 - Modes:`Enforcing` / `Permissive` / `Disabled`。 - 與 AppArmor 差異:細節更豐富、學習曲線較陡;預設啟用於 RHEL/CentOS。 #### 其他權限機制 - `su` / `sudo`:限制使用者切換或執行高權指令 (配置 `/etc/sudoers`)。 - **ACL (Access Control List)**:較 `chmod` 細緻,可針對個別使用者/群組賦權。 - **setuid / setgid**:以檔案擁有者權限執行;對高風險目錄可加掛 `nosuid`、`noexec`。 --- ## 系統效能監控與調校 ### Observability 三本柱 1. **Log**:事件紀錄 (`/var/log/syslog`、`auth.log`…) ← `rsyslog` 產生。 2. **Metrics**:CPU、記憶體、磁碟、網路等關鍵指標。 3. **Trace**:鏈結多元件之請求流程,找瓶頸/錯誤。 ### 伺服器監控要點 | 資源 | 建議閾值 | 常用工具 | |------|----------|----------| | CPU | 75 % (通用) / 90 % (高效能) | `top` / `htop` | | Process | Zombie、優先權、CPU% | `ps` / `kill` | | Memory | < 80 % 使用率 | `top` (`MiB Swap`) | | Disk | queue < 0.5;監空間 | `df -h` / `iostat -xz 1` / `iotop` | | Network | 使用率 < 80 % | `iftop` / `ifconfig` | ### 監控架構 Push / Pull - **Push Model**:Agent 主動傳送 (e.g. StatsD → Graphite)。 - **Pull Model**:監控端定期抓取 (Prometheus、Scrape)。 ### Linux Kernel 微調 - `sysctl -w <key>=<val>` (暫時);持久寫入 `/etc/sysctl.conf` → `sysctl -p`。 - 常見參數: - **網路**:`net.ipv4.tcp_congestion_control`、`net.core.rmem_max`、`net.core.wmem_max`、`tcp_rmem`、`tcp_wmem`、`tcp_syncookies`。 - **檔案 I/O**:`fs.file-max`、`noatime` / `nodiratime` / `relatime`。 - **記憶體**:`vm.swappiness`(建議 10)。 ### Prometheus 生態 - **Server** ↔ **Exporter** ↔ **TSDB**;以 HTTP Pull 收集。 - **Pushgateway**:短命任務暫存 metrics。 - **Alertmanager**:條件告警、整合 Telegram/Slack… - **Grafana**:視覺化儀表板。 | Metric Type | 說明 | |-------------|------| | `Counter` | 累加次數 (`http_requests_total`) | | `Gauge` | 當前值 (`cpu_usage`) | | `Histogram` | 值分佈;bucket + `count` + `sum` | | `Summary` | 統計百分位 (avg / p99) | --- ## 攻擊策略與弱點 ### MITRE ATT&CK 概覽 14 個 **Tactics** 循環描述攻擊生命週期:`Recon → Resource Dev → Initial Access → Execution → Persistence → PrivEsc → Defense Evasion → Credential Access → Discovery → Lateral Movement → Collection → C2 → Exfiltration → Impact`。提供通用語言與藍紅隊演練基準。 ### CVE 與漏洞資料庫 - **CVE**:公共漏洞清單,僅含識別碼與簡述;風險評分、修補資訊由 NVD 等補充。 ### 資安服務 #### 弱點掃描 | 工具 | 適用範圍 | 功能亮點 | |------|----------|----------| | **Lynis** | Unix 系統 | 稽核 + 弱掃 | | **Nikto** | Web 伺服器 | 錯誤配置 / 過時軟體 / XSS… | | **sqlmap** | 資料庫 | SQL Injection 測試與利用 | #### 滲透測試 - **步驟**:Planning → Discovery → Attack → Reporting (NIST)。 - **方法**:黑箱、白箱、灰箱、雙黑箱、雙白箱。 - **Metasploit**:自動化匯入漏洞模組攻擊。 - **SAST / DAST**:靜態 vs. 動態程式碼安全測試。 #### 紅隊/藍隊/紫隊 - **紅隊**:模擬真實攻擊,評估組織防禦。 - **藍隊**:偵測、阻擋、回應紅隊行動。 - **紫隊**:橋接紅藍,協同精進。 --- ## Web 應用安全:OWASP Top 10 | # | Risk | 核心說明 / 防禦要點 | |--|------|----------------| | 1 | Injection | 使用 **參數化查詢**、白名單過濾、輸入轉碼 | | 2 | Broken Auth | 強密碼、Session 管理、Cookie Secure/HttpOnly | | 3 | Sensitive Data Exposure | 敏感資訊加密 / Hash(含 Salt) | | 4 | XML External Entities | 禁用 XXE、升級 SOAP 1.2 以上 | | 5 | Broken Access Control | 嚴格 RBAC、禁目錄列舉 | | 6 | Security Misconfiguration | 關閉不必要功能、預設密碼、錯誤訊息隱藏 | | 7 | Cross‑Site Scripting | 內容安全策略 (CSP)、自動輸入編碼 | | 8 | Insecure Deserialization | 驗證來源、完整性檢查 | | 9 | Components w/ Known Vuln | 及時升級套件、移除未用依賴 | | 10 | Insufficient Logging & Monitoring | 全面記錄 + 即時告警 | --- ## DDoS 與網路攻擊 ### Great Cannon - 中國網絡武器,可注入惡意 JS 進行大規模 DDoS(如 2015 GitHub 事件)。追蹤可用 TTL 偏差、Traceroute 比對。 ### DoS / DDoS 類型 & 應對 | 攻擊 | 層級 | 機制 | 典型防禦 | |------|------|------|-----------| | **HTTP Flood** | L7 | 大量 HTTP Req | Rate Limit、Captcha | | **DNS Flood / 放大 / 反射** | L7 | 濫用開放 Resolver | Anycast DNS、RRL | | **SYN Flood** | L4 | 半連線耗盡 | SYN Cookies、丟棄舊佇列 | | **其他** | - | Blackhole / Scrubbing Center | | --- ## 日誌管理與分析 ### Log 生命週期 - **logwatch**:摘要並定時電郵。 - **logrotate**:切割、壓縮、保留策略。 ### SIEM / SOAR | 類別 | 定義 | 常見工具 | |------|------|----------| | **SIEM** | 事件收集、正規化、關聯分析 | OSSIM、Datadog、ELK Stack、Graylog | | **SOAR** | 自動化協調、回應,降低 MTTR | Splunk Phantom、IBM Resilient | ---

    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