NCtfU
      • 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
    • 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
    • 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 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
  • 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
    # NCtfU Official Writeup | HITCON-2020 ###### tags: `HITCON` `nctfu` [TOC] ## 0x0: 故事背景 ![攤位精美白板](https://i.imgur.com/7uwtdda.jpg) <img src="https://i.imgur.com/FqtCyro.jpg" width=49%> <img src="https://i.imgur.com/IAfZUH9.jpg" width=49%> ## 0x1: Crypto - 筆記本最後一頁,會找到一推看不懂的密文,以及一張 6 x 6 的 table。 ![](https://i.imgur.com/o2VuX6O.jpg) - 稍微觀察一下,會發現這些數字都是介於 0 ~ 5 之間,因此推測應該是跟 row 和 column 的 index 有關。 - `"hao.kang."` 似乎是一部分解開的明文,或許可以從這邊推敲看看加密的邏輯。 - 假設每組數字代表的是 `(row)(col)`,那麼 `05 10 32` 就會得到 `x e 8`。 - 假設每組數字代表的是 `(col)(row)`,那麼對應下來則是 `s l z`。 - 全部轉成 ascii code,會得到: ``` "hao" -> 104, 97, 111 "xe8" -> 120, 101, 56 (X) "slz" -> 115, 108, 122 (O) ``` - 觀察字母之間的間距,會發現 `"hao"` 平移 `+11` 後會變成 `"slz"`。 - 用 `"kang"` 驗證一下,會發現這個推論是對的: ``` "kang" -> 107, 97, 110, 103 "vlyr" -> 118, 108, 121, 114 ``` - 打星星的部分似乎是重點,直接對應下來,會得到: ``` 140.115.59.92.azce.8000 => IP = 140.115.59.92 PORT = 8000 ``` - 好像滿多人卡在這邊,因為中間夾了一串 `"azce"`,直接連會連不上。 > 這部分我們可能設計得不太好,因為凱撒加密預設是只處理英文的部分,不處理數字。因此,最後就變成了英文做 rotation 但數字不做,確實滿令人困惑的 :sweat_smile: > 然後還有一個雷點,就是某人一開始寫明文訊息寫得很開心,一不小心就生出長度為 93 的密文了XDD 還好有學長們幫忙 debug :pray: ## 0x2: Web - 發現了一個登入頁,但沒有帳密。 ![](https://i.imgur.com/M2soscU.png) - 跑一下 dirsearch,就發現有 `robots.txt`。 ![](https://i.imgur.com/Lo2yL6u.png) - 訪問 `robots.txt` 後,就得到一行字: ``` Disallow: /53cR37 ``` - 把 `53cR37` 載下來後,得到一組帳密 `artis / cut3`。 ![](https://i.imgur.com/0h3OfeG.png) - 登入了以後,就可以看到聊天紀錄了。不過最後兩則訊息卻 `[已被刪除]`。 ![](https://i.imgur.com/qHO1Sbx.png) - 如果按右上角的藍色 Profile,會進到 "artis" 的個人頁面。 - 如果是點聊天室中 "小辣椒" 的名字,則會進到 "小辣椒" 的個人頁。 ![](https://i.imgur.com/EejPpmb.png) ![](https://i.imgur.com/GnwYLxE.png) - 從上面可以發現,只有 `小辣椒` 是 Admin 帳戶類型。 - 如果用 `小辣椒` 的身份登入的話,好像就有機會看到被刪除的訊息了(? - 看一下 HTML,會發現 LOG IN 按鈕是連到 `login.php`。 ![](https://i.imgur.com/5xAw30O.png) - 直接連 `login.php`,就得到 source code 了!:open_mouth: ![](https://i.imgur.com/PB1rLaq.png) - 稍微研究一下,會發現 `$sql` 那行有 injection 漏洞。 - 前提是不能撈太多,只能撈出一行來。 - 如果用 `小辣椒' -- `,那麼整句就會變成: ```sql SELECT ... WHERE username='小辣椒' -- ' and password='' ``` - 這樣一來,就只會撈出一行來了。 > 這邊還有一個小雷點,就是 token 在還沒解開前好像就會跳出來XD 看來是測的不夠周全~ ![](https://i.imgur.com/TNyFtsi.png) <br> > 進階挑戰:使用 UNION 在網址列撈資料 > - 因為個人頁面的網址列是 `?name=artis`,因此或許會有 SQLI 漏洞 :thinking_face: > > - 使用 `artis' UNION SELECT 1,2,3,4,5,6 -- '` 可以得知 query 結果的寬度 = 6。 > ![](https://i.imgur.com/RYNBfse.png) > > - 透過 INFORMATION_SCHEMA,可以得知訊息是 message 表當中的 msg 欄位。 > - 使用 `artis' UNION SELECT 1,2,3,4,5,msg FROM message -- '` 即可撈到資料。 > ![](https://i.imgur.com/izbNntG.png) ## 0x3: Pwn (Misc ?) > [name=Yen] * 接續上一關拿到的網址,進來會看到只有一個input ![](https://i.imgur.com/Olbkwrm.jpg) * 隨便輸入一點東西,會看到BOW的字樣,其實就是要玩家輸入BufferOverflow的垃圾padding ![](https://i.imgur.com/ojZFXbW.jpg) * 例如說,輸入60字會拿到**N** ![](https://i.imgur.com/bfd3lXF.jpg) * 最後全拿完會拿到**NCtfU** ![](https://i.imgur.com/WYGY9YL.jpg) * 輸入進去就可以到下一關了XD ![](https://i.imgur.com/mCxspOa.jpg) ## 0x4: Stego > [name=Artis24106] - 由上一關最後的網址 `https://drive.google.com/file/d/1OC5I9xM1KojHpYTuJKw-icUcFHL1p6UY/view` 可以得到圖片 `qrcode.png` ![](https://i.imgur.com/AGXT7XT.png) - 用手機掃描或是使用線上工具(如 `https://zxing.org/w/decode`)可以得到 qrcode 訊息 `There is something 'in' the picture. Hint1: strings` ![](https://i.imgur.com/6eK8FKO.png) - 提示1為 `strings`。它是一個指令,會把檔案中的 printable characters 印出來。 - 於是使用 `strings qrcode.png` 可以在最下面看到 `Hint2: zsteg` ``` ... go{^ VY-Z @HXi i+1U bzEO y`be 7``O IEND Hint2: zsteg ``` - 提示2為 `zsteg`。它是一個圖片隱寫檢測工具([連結](https://ctf-wiki.github.io/ctf-wiki/misc/picture/png-zh/)),可以找出由[LSB](https://ctf-wiki.github.io/ctf-wiki/misc/picture/png-zh/)隱寫在圖片內的資訊。 - 使用 `zsteg qrcode.png` 得到最終的網址 ![](https://i.imgur.com/irNjADb.png) - 原來是一場生日派對啊!! ![](https://i.imgur.com/Xgwqs9f.png) ## 0xA: Scoreboard ![](https://i.imgur.com/XEf5Dxx.png) ![](https://i.imgur.com/Ao4LCXP.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

    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