MOPCON
      • 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
    # Bug Bounty 打雜經驗談 - Bug Hunter 如何協助軟體安全性 - 陳仲寬 {%hackmd rG6pzIawQKe5cHU4rycgYg %} :::success :::spoiler click to open Table of Content [TOC] ::: 主持人:這位是「資安抓漏專家」陳仲寬(奧義智慧) 講者曾帶過學生參加駭客比賽,還「測試」過校內主機取過個資 公司服務:除了資安,還有遊戲 ~~除了冰淇淋(主業?)還有資安歐~~ ### Today's Goal + 了解 Bug Bounty 及其他服務的差異 + 我們如何了解做 Bug Bounty + 分享我們找到的問題以及學到的事,希望能幫助開發者了解一些攻擊技巧。 ### 你的程式有弱點嗎? + 檢視自身安全 + Testing + Source Code Review + SAST, DAST(靜態/動態掃描) + CI/CDhttps://hackmd.io/@mopcon/2020/%2F%40mopcon%2FHyWYqFHDv + **引進外部測試**,加入駭客的角度 - 引進外部測試 - 利用駭客能量加強自身安全性。 - 通靈想方法 - 有許多不同的方式 ### 以下名詞你聽過幾個 - Vulnerbility Assessment VA - Penetration Testing PT - Breach and Attack Simulation BAS - Red Team - Bug Bounty ## VA V.s PT ### Vulnerbility Assessment + 利用自動化工具針對已知的漏洞進行掃描。 + 通常不會實際法甕攻擊,只是透過版本之類的資料進行分析 + E.g. 利用Nmap掃port、 service version,並看是否有對應的CVE ### Penetration Testing + 針對單一或有限服務,人工進行測試 + 測試技術為程式/系統層面的行為 + 發動實際攻擊,但不破壞系統的點到為止 + `'OR'1'='1'--` + SQL注入起手式,可能讓外部程式碼刪掉整個資料庫! + 例如:台大成績事件 + 如何確保不破壞系統?沒辦法,所以通常是有經驗的人來進行。 ### Breach and attack simulation(BAS) + 近年來興起的服務模式 + PT 卡住了怎麼辦? + 僅針對小部分的服務做測試,攻擊面太小,找不到能進入主機的路 + PT 測不到的地方 + 不針對系統外的因素測試,如:釣魚郵件(社交工程) -> 很蠢,但總是會有人中標 + Wndows 內網設定相當相當複雜,很難不犯錯。 + 我們的經驗:攻擊者拿下一台機器後,幾乎 100% 拿得下 DC。 + **假設攻擊者已經成功落地,拿下一台低權限內網主機,攻擊者是否可以進行橫向移動或提權等行為** ### Red Team + 更全面性的檢測,更靈活的打法 + 各介紹網站幾乎都會提到「不限任何手段」 + 洩漏於外部網站的帳號密碼 + 有些攻擊公司以外的供應商 + 運用上游供應商可能的漏洞 + 公司所使用的設備、軟體 + 全面性的協助企業檢視其資安風險、資安策略 ### Bug Bounty - 設定好可測試範圍,提供外部駭客和研究員的資格,用任何方式找出系統的漏洞,經過審核後,每筆漏洞提供一筆**高額獎金** + 真實性的加強 + 雖然PT, Red Team都強調有駭客的思維進入, + 一來仍然不是野生的駭客打的,並且思路同公司可能會被限制 + 擁有一些內部資訊,並不是真實擬真的環境 + 持續性的檢測 + 通常紅隊服務成本較高,無法一直進行,僅能進行一次性/或週期性。 + Bug Bounty: Bug Hunters 可以花數個月甚至更久的時間測試你的系統。 + 有規範的全民(駭客)監督,但總比被打爆好 + Google search: HITCON zero day - ### 常見的誤解 + 每個人定義不一致,名字並不重要,實際做了什麼才是重點 + E.g. 有些只使用工具做自動測試,卻宣稱為 PT/Red Team。 + 誤將 Bug Bounty 當作PT來用 + Bug Bounty 最為靈活/彈性,但通常單一漏洞獎金較高 + 全面性不足 + 跟研究者的能力成高度正比。 + 通靈想辦法。 + 建議引入順序 1. VA 2. PT 3. BAS 4. Red Team, Bug Bounty ### Bug Bounty經驗談 - 組織 BambookFox 團隊打 CTF,希望除了CTF外有梗食物的經驗 - 交大校園網路滲透測試 - 組織三年參與Bug Bounty - 2016,2017 -> Synology - 2018 -> QNAP - Synology, QNAP 都有取得最嚴重的 Pre-auth Rott RCE(不用經過任何的驗證) - 兩邊都快速驗證問題並修復,顯示他們對資安的重視並持續改進系統資安 hacker 最想要的東西就是你的 RCE ### Bug Bounty 經驗 ### 1. 邏輯性漏洞/權限性漏洞 - 容易出現,因為沒有Guilfline可以檢查 對於其他固定套路的漏洞... 原碼掃描、框架就可以做 #### Case1: NAS Device Read-Write Arbitary Files via Unnecessary Feature 情境:我們已經能找到一個漏洞取得低權限帳戶。 If you can write arbitrary files, you will have very high possibilities to root + Shadow password + Crontab + ... + Photo_user + SETUID + With the --copy root parameter, it will do the cp command and copy a file with the root permission. #### Bell-LaPadula Model - Bell-LaPadula Model addresses confidential problem - 高權限不該複寫低權限檔案,低權限檔案不該查看高權限檔案。 ![](https://www.cs.rutgers.edu/~pxk/416/notes/images/19-MAC.png) - Security level - Top Secret - Secret - Confidential - Unclassified #### Case2: Arbitray JS Execution via Unrestricted Notify + 設備提供管理者通知使用者的功能 + 內部實作為,送出 JS 給其他使用者,而這個 API 沒作保護。 + 任何人都可以推送JS 給其他 user。 bamboofox says: HIHO XDD + 取得 User cookie ### 有洞的地方就會一直有洞 - 對於單一軟體,漏洞常常一直集中在同一個地方 #### Case3: NAS Photo System Login without password + The special charactrers | and > aren't filtered out correctly, which is #### Case4: Photo System Remote Code Execution + As previous mentioned, >, <, L and & are not filtered correctly。 ### 串連小漏洞以達成更嚴重的威脅 + 許多漏洞需要串鏈更多個小漏洞才能達成,分開來看這些漏洞的風險都不高,但能串成嚴重攻擊。 - Vulnerability跟Bug一樣,通常都多到修不完。要如何prioritize是一項重要問題。在prioritize過程中容易把小漏洞(CVSS分數低)忽略。 - 連續技的風險很難評估,因此團隊需要有經驗的人 - 這也凸顯了 Bug Bounty 的重要性,Bug Hunter 可能會幫你找出真兇。 #### Case 5: Privilege Escalation - case 3 + case 4 #### Case 6: Network Device Pre-Auth Root RCE + File Export Functionality with controllable file path + 起手式: ../../..../passwd + 執行 ExportFunctionality 需要有當個圖片的權限。 + 系統提供 Guest User Demo 的功能,因此利用此功能繞過權限控制 + 取得 ID, access code + Pre-Auth Location 這不是 feature 這是 bug #### Case 7: Jeffxx's Samsung Exploit #### Case 8: Orange's Hack Facebook Again ## 對資料的解讀不一致,往往會造成資安的問題 + 對資料的解讀不一致,往往會造成安全性問題 + 傳統各種 injection 也是資料解讀不一致造成 + Web Server 認為是資料 + SQL 認為是操作運算元 #### Case 9: From SQL Injection to Command Injection #### Orange's SSRF @ HITCON CMT 2017 + Orange, "A New Era of SSRF - Exploiting URL Parser in Treding Programming" [ How I Chained 4 vulnerabilities on GitHub Enterprise, From SSRF Execution Chain to RCE! ](https://blog.orange.tw/2017/07/how-i-chained-4-vulnerabilities-on.html) [A New Era of SSRF -Exploiting URL Parser in Trending Programming Languages!](https://www.blackhat.com/docs/us-17/thursday/us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-Languages.pdf) #### Case 10: XML Injection - 把資料中插入 `]]><` + XML Injection + /etc/passwd Injection + /etc/passwd Injection to RCE ### 5.Deserialization 漏洞比例增加 ## 其他 - Command Injection - 測試的設備中,幾乎都有 Command inecton - e.g. IP欄位, FileName - File Operation bypass Permission - E.g. 解壓縮檔案,可以解到高權限目錄 - 可以透過創建 link 看到別的檔案。 - SSRF - 檔案預覽 - 讀取本機高權限檔案 - E.g. 檔案下載功能,可讀取local檔案,透過SSRF讀取高權限檔案 ## Code QL ## 流程面 + 不論是駭客還是 Bounty 主辦方,都需要互相尊重 + Reporting + Poc + 揭露報告 + 許多研究員在參與 Bug Bounty 後,會希望能揭露問題讓更多人知道。 + 駭客 / 研究員需盡告知的義務,並確認漏洞修正完畢後才能揭露 ## Accounting + 做 Red TEam 或 Bug Bounty 時,你怎麼知道駭客進來做了什麼? + 企業在進行 Bug Bounty 前,需先建置好監控機制(Detection),e.g. SIEM, SOC, EDR...。監控/ 事後驗證攻擊者行為。 - 服務性質、企業網路性質 - 同時測試藍隊的防禦監控有沒有效 - 如果你沒有監控機制或是你家藍隊監控不到,那你可以呼叫**奧義** ###### tags: `MOPCON 2020`

    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