金大資安研究社
      • 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
    • 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 No publishing access yet

      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.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      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
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Make a copy 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
  • 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: 資安演講,資安基礎架構,google hacking --- :::info ❤歡迎各位參與共筆的製作❤ [Discord討論區](https://discord.com/invite/QcHWtZ3z) [回饋問卷](https://forms.gle/cZBrJ4givtAZprtU9) ::: # 4/22 資安基礎架構+google hacking [TOC] ---- ## 資安基礎架構 - 靜態分析實務&自動化動態分析(逆向分析) 請不要以身試法!!! ### Linux Base https://ais3-club.kiwissec.com/ step 選擇 系統安全 ![](https://i.imgur.com/81ZPqeP.png) ![](https://i.imgur.com/4nDgy0J.png) 點擊兌換(老師有發兌換碼)(輸入驚嘆號後的兌換碼) ![](https://i.imgur.com/HpZ8uak.png) 啟動AttackBox ![](https://i.imgur.com/fLzm8dl.png) 打開Activites 點擊左下角的Files ![](https://i.imgur.com/wb3FbHI.png) 開啟Desktop ![](https://i.imgur.com/YY2CoQ9.png) 解壓縮LinuxLab ![](https://i.imgur.com/U53ckYG.png) 點擊Extract(此為解壓縮的部分) ![](https://i.imgur.com/ymf5yez.png) 點擊Extract(此為解壓縮的部分) ![](https://i.imgur.com/W6mSSTS.png) ![](https://i.imgur.com/FxLggt9.png) 右鍵打開Terminal ![](https://i.imgur.com/LRlYBT7.png) - pwd 查看當前所在的工作目錄 - cd LinuxLab 切換當前所在工作目錄至LinuxLab檔案 - cat readme 閱讀readme檔案 ``` pwd cd LinuxLab cat readme ``` #### 簡介 * 以linux kernal來開發的作業系統 * 通常是開源的 * Kali Linux、Ubuntu是基於 Debian 的一套 Linux 作業系統 * Kali Linux 專門用於滲透測試(內建很多 滲透工具) ## 指令介面 CLI(shell、console) e.g. sh,bash,zsh --- ### Linux 指令 #### **man** Linux 的文件管理指令,即操作手冊 - 舉例:(查看ls這項指令的功能) ``` man ls ``` #### pwd 輸出當前所在的工作目錄 #### cd 切換當前所在的工作目錄 #### 絕對路徑與相對路徑 絕對路徑通常以`/`開頭 * /etc/passwd 相對路徑表示當前目錄相對於根資料夾檔案或目錄的位置 * ./test.txt ![](https://i.imgur.com/Hb1fmkt.png) #### ls (參數可合併使用) -a (all) :列出所有檔案及目錄,含被隱藏的目錄及檔案,隱藏的檔案其檔名前面會有`.` -l (list):輸出目錄及檔案的詳細資訊 -h (human): 檔案大小顯示較人性化 -la -al #### mkdir 建立新的資料夾 `mkdir -p`建立多層目錄,例如`mkdir -p 資料夾/子資料夾` #### mv - move 移動或重新命名檔案和目錄 #### rm - remove 刪除檔案(幾乎無法還原) -r:連同子目錄一起刪除 #### cat 輸出檔案內容 #### cp - copy 將檔案或目錄複製到另一個位置 #### touch 1. 更改檔案或目錄的時間戳記 2. 建立檔案(較常使用這個功能) #### echo 搭配運算子使用 ">"代表重定向 - 將前一個指令的輸出重定向到其他地方 #### file 確定大部分情況的檔案格式(有些檔案不會有副檔名) 以資安領域來說,有些檔案會偽造檔案格式(更改名牌) #### grep Regular expression 匹配字符 來找file 特定的string ``` file.txt | grep "string" ``` #### find 可尋找檔案 -name : 尋找檔案及資料夾 -size : 搜尋檔案大小 -user : 搜尋屬於某位用戶的檔案 -type : 搜尋檔案類型 -mtime : 設定搜尋的時間長度 -iname : 忽略檔案名稱的大小寫 ``` find ./ -name "filename" ``` #### clear 清除終端機上顯示出的所有文字 ### Linux lab 先用ls查看這個資料夾裡有甚麼,會發現這裡有個readme,我們先用cat讀取一下他,會發現這裡說明了lab的提示和規則,那麼我們接著就來開始解lab吧( ノ ゚ヮ゚)ノ ![](https://i.imgur.com/kHLYsGo.png) #### f1 >:::spoiler f1解答 >``` >ls #先看看LinuxLab這資料夾裡有甚麼,會發現有個f1.txt >cat f1.txt #用cat讀取他,然後就能取得第一個flag >``` >::: #### f2 >:::spoiler f2解答 >``` >ls -al #查看是否有隱藏起來的檔案(這裡會發現有個.f2.txt的隱藏檔案) >cat .f2.txt #讀取內容獲得f2的flag >``` >::: #### f3 >:::spoiler f3解答 >``` >ls -al >cd f3 >ls >cat readme >ls -lt #以更改時間進行排序 >cat flag? #查看哪個是最新的並cat他 >``` >::: #### f4 >:::spoiler f4解答 >``` >cd ../f4 >ls >./f4.sh >#(隨便輸入一個試試) >pwd #(複製他) >./f4.sh >貼上 >``` >::: #### f5 >:::spoiler f5解答 >``` >cd ../f5 >ls >cat readme1 >cd ./dir6/sub3/sub6 >ls >cat readme2 >cd ../../ >ls >cat readme3 >cd ../dir2/sub4/sub9/ >ls >cat readme4 >cd ../../../dir8/sub10/sub7 >ls >cat readme5 >cd .. >ls -al >cat f5 >``` >::: #### f6 >:::spoiler f6解答 >``` >cd ../f6 >./f6.sh >mkdir -p ./Kiwis/Dir >ls >cd Kiwis >ls >./f6.sh >``` >::: #### f7 >:::spoiler f7解答 >``` >cd ../f7 >ls >./f7.sh >mv Kiwis/SmallKiwis ./SmallKiwis >./f7.sh >``` >::: #### f8 >:::spoiler f8解答 >``` >cd ../f8 >ls >./f8.sh >mv SmallKiwis/ BigKiwis/ #另一種寫法 mv SmallKiwis BigKiwis >#此處將SmallKiwis 更名為BigKiwis >./f8.sh >``` >::: #### f9 > rm -f 強制刪掉 >:::spoiler f9解答 >``` >cd ../f9 >ls >./f9.sh >ls -al >rm -r Kiwis/ >ls -al >./f9.sh >``` >::: #### f10 >:::spoiler f10解答 >``` >cd ../f10 >./f10.sh >ls -al >touch -t 202304040000 PastKiwis >./f10.sh >``` >::: #### f11 > ">"強制蓋過去 > ">>"不會蓋過裡面原本內容 >:::spoiler f11解答 >``` >cd ../f11 >ls >./f11.sh >cat kiwis #會發現裡面是空的 >echo 'I love Kiwis' > kiwis >./f11.sh >``` >::: #### f12 >:::spoiler f12解答 >``` >cd ../f12 >ls >./f12.sh >cp kiwis KiwisDad/ >cp kiwis KiwisMom/ >ls KiwisDad #會看到裡面有kiwis(KiwisMom同理) >./f12.sh >``` >::: #### f13 >:::spoiler f13解答 >``` >cd ../f13 >ls >./f13.sh >file kiwis #這裡會顯示為空的 >echo 'hello' > kiwis >file kiwis #查看一下,會發現顯示kiwis:ASCII text 表hello為ASCII >text >echo "#include <stdio.h>" > kiwis #如果再次用file kiwis查看會發現顯示kiwis:C source,ASCII text >cat kiwis #顯示'#include <stdio.h>' >./f13.sh >``` >::: #### f14 >:::spoiler f14解答 >``` >cd ../f14 >ls -al >ls -al ./dir1 >grep -r "kiwis" >``` >::: #### f15 >:::spoiler f15解答 >``` >cd ../f15 >ls >cat $(find ./ -name "*.txt") >cd ./dir5/sub3/sub7/ >cat f15.txt >``` >::: ### 靜態分析 :::info 前置:c語言 ::: 不執行程式的條件進行分析 通過代碼結構、語義、邏輯分析或利用工具進行分析 看別人的code也是一種靜態分析 工具:IDA(有免費版,一般來說要付費)、gihidra(免費) 今日教學:IDA ![](https://i.imgur.com/V5JmDhE.png) IDA是二進制反編譯軟體(這就是逆向工程及漏洞分析) 今日4動作: 1. 空白 2. f5 3. 滑鼠點2下 4. tab 解壓縮DynamicAnalyzeLab ![](https://i.imgur.com/uPqqWgd.png) 打開ida ![](https://i.imgur.com/hjUNfgR.png) ![](https://i.imgur.com/aQmqyhm.png) - lab1 (tip:查看字串可發現flag) >:::spoiler lab1參考解答 > >方法1: >``` >chmod +x ./lab1 >./lab1 #發現要輸入密碼,那我們從IDE去查看 >``` >發現他把flag直接寫在輸出ww,成功取得flag >![](https://i.imgur.com/SlA65Ho.png) > >方法2: >``` >chmod +x ./lab1 >strings lab1 #可以顯示lab1裡面的所有使用到的function,透過funuction可以找到flag的蹤跡 >``` >![](https://i.imgur.com/kLsYqIJ.png) >::: - lab2 (走迷宮 tip:找出移動方向的鍵,走出迷宮可得flag) >:::spoiler lab2參考解答 >``` >chmod +x ./lab2 >./lab2 >``` >::: ### 自動化動態分析 程式被混淆就需要他 今天...不教動態分析 今天教**全自動**動態分析 #### 符號執行 採用抽象符號代替精確值 Angr Ref: https://angr.io/ binary file 轉 object code 會配合 IDA 去使用 使用方法 載入 binary file ## Dynamic link include library 不會編進 binary file ## Static link include library 會編進 binary file - LAB3 >lab3 放入ida f5 main >:::spoiler lab3 參考解答(使用angr) >``` >import angr >proj = angr.Project("./lab3", load_options={'auto_load_libs': False}) >state = proj.factory.entry_state() >simgr = proj.factory.simgr(state) >print(simgr.active) ># [<SimState @ 0x401160>] >print(simgr.explore(find=0x4000000+0x1566, avoid=0x4000000+0x1583)) >print(simgr.found[0].posix.dumps(0)) >``` >![](https://i.imgur.com/1DQjpZP.png) > >``` >chmod +x ./lab3 >python3 angr_example.py # 執行剛剛所寫的程式碼 >./lab3 # 執行lab3並輸入剛剛所找到的密碼 >``` >![](https://i.imgur.com/R6yMUq0.png) > >![](https://i.imgur.com/ifZNlKa.png) >::: - lab3 方法2 >:::spoiler lab3參考解答(直接看IDA) >``` >chmod +x ./lab3 >./lab3 > >#會出現What's my favorite number?然後輸入正確密碼取得flag >``` >按f5 觀察程式碼 會發現他判斷數值為549255,反之會出現Sorry, that's not it! 所以可推斷出549255可能為favorite number >![](https://i.imgur.com/OseWtLo.png) > >輸入看看,成功取得flag >![](https://i.imgur.com/lEwNL6q.png) >:::

    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
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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