M3t30r
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • 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 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
      • Engagement control
      • Make a copy
      • 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 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
    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 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
    # 2021 MyFirstCTF Write Up 這次也參加了AIS3的MyFirstCTF競賽,裡面是一些AIS3的題目跟額外的baby友善題(結果賽中都解baby題QAQ),好像蠻少人在打MyFirstCTF的Write Up的,就來整理一下吧~不過好像比較多梗題的部分(O P.S. 但是因為大部分的東西都被我刪了所以可能有點簡略敬請見諒QAQ 這次的成績17名+兩題首殺~好像很普通w ![](https://i.imgur.com/NtHPsgc.png) # MISC ## Cat Slayer ᶠᵃᵏᵉ | Nekogoroshi 這題跟AIS3 Pre-exam是一樣的題目,直接複製XD 題目給了一行command ```bash TERM=xterm-256color ssh -p 5566 h173@quiz.ais3.org ``` 把它拿到Terminal執行後可以發現他跳出了一個Python的執行畫面,用鍵盤可以輸入數字,輸入錯誤會鎖起來,因此可以用手動的輸入猜密碼,得到正確的密碼就可以解鎖flag。 ``` Password: 202583045529 ``` FLAG: ``` AIS3{H1n4m1z4w4_Sh0k0gun} ``` ## [祝賀] 新垣結衣新婚快樂 發錢囉 [baby] > Bonus : First Blood 這題給了一張圖片,看起來像是forensics,所以先用一些例如zsteg或online tool之類的工具試了一下,後來用binwalk試了一下發現裡面包了一個zip檔。 ![](https://i.imgur.com/g264BDQ.jpg) P.S. 是新垣結衣欸~ ``` $ binwalk baby.png DECIMAL HEXADECIMAL DESCRIPTION -------------------------------------------------------------------------------- 0 0x0 PNG image, 1200 x 675, 8-bit/color RGB, non-interlaced 179 0xB3 Zlib compressed data, best compression 1511327 0x170F9F End of Zip archive ``` 所以用foremost把裡面的東西拉出來。 ``` $ foremost baby.png -o baby Processing: baby.png |foundat=awertyjas‮qrmnk‮.pngt�w4����?�ik� m��T�ԦZ{�ڵ�J���F�U�k�=�P����&VlAD��z�>�?��|Ϲ�x:�p?������}ߏ�k�+RS0S *| ``` 接下來到```/baby```可以發現一個```00001726.zip```,裡面有一張圖片,推測應該是flag,但是local需要密碼解鎖,猜了幾個常用密碼跟照片名還是錯誤,所以開始找online tool。 ![](https://i.imgur.com/IJQc2PA.png) 非常幸運的是我[第一個使用的網站](https://www.ezyzip.com/unzip-files-online.html)就讓我解開了,而且不需要密碼~ P.S. 這題應該是偽加密,但是我其實到現在還是沒搞懂它的原理是什麼XXD ![](https://i.imgur.com/fIGvBh8.png) P.S. 是星野源欸~ FLAG: ``` AIS3{看好了世界,我只示範一次如何一天搶走幾億人的老婆} ``` > 結果新垣結衣跟星野源還是結婚了~ # Web ## Copy & Paste [baby] 這題給了一個奇怪的黑色網站,有一個flag按鈕,按下去之後會顯示個幾秒flag之後消失。但是,他的flag大到我只看到中間部分,沒辦法送啊? 按了F12之後看一下發現他好像用算的把螢幕高度anchor住了,所以我的螢幕不夠長就看不到完整的flag。那有什麼方法可以讓完整的flag顯示出來? 後來腦洞大開把瀏覽器壓扁之後,他的height變小,我就可以看到完整的flag了! P.S. 通靈用在這裡是正確的(O ![](https://i.imgur.com/CrzUGc1.png) FLAG: ``` AIS3{Re33Ee3E33e3eEEe3eE3El11I1l1i11y_lo0O0oo00o00oOC0OOoo00o0Oo0O0o0Ooo0Oo0oo0Oo0OOOO000OO0ng_f1aG} ``` P.S. 所以我還是不知道怎麼複製貼上w而且這個flag我打好久QQ 不過還好手打,賽後用OCR跑出來的是錯的啦= = # Crypto ## Judgement [baby] 這題的題目很簡潔,只有一個```Judgement.py```跟一個```output.txt```。 ```python from hashlib import sha256 import string flag = 'AIS3{THIS_IS_A_FAKE_FLAG}' cand = string.ascii_letters + string.digits + '_{}' charset = string.printable[:93] enc = '' for c in flag: assert(c in cand) enc += charset[int(sha256(c.encode()).hexdigest(), 16) % len(charset)] print(enc) ``` ``` )g;Fk@>2g;2V2J?d5G3_8V2<dR2i5GZ@<?2)g\j_2V&?2;@[F@ek2_3"=k&;2)\F2J9LL4g[W2"[2<)RZ23@<?2elFZ?2=@jZ23@=F2Yi52;lL5Vj2J?2J8\e@eW23e2lF330 ``` 第一個想法是逆推,但是它裡面用了sha256加密後的某個位置的字元,所以也沒辦法直接逆推,只好用順向搜尋的方式解題。 但因為他取sha256的字元,逆推後並不只一種可能性,所以我們用不同的ascii碼範圍搜尋可能字元後,因為題目提及flag符合文法與leet語法,再用手動來把flag拼出來。 先把爆搜的程式寫出來。 ```python from hashlib import sha256 import string g=")g;Fk@>2g;2V2J?d5G3_8V2<dR2i5GZ@<?2)g\j_2V&?2;@[F@ek2_3\"=k&;2)\F2J9LL4g[W2\"[2<)RZ23@<?2elFZ?2=@jZ23@=F2Yi52;lL5Vj2J?2J8\e@eW23e2lF330" s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}" for i in range(133): for j in range(127,64,-1): # range(65,128), range(48,128) if s[int(sha256(chr(j).encode()).hexdigest(),16)%93]==g[i]: print(chr(j),end='') break ``` 跑出了三種結果: ``` AISv{iX_IS_M_BeautqM_day_~utside_AIr|q_MRe_SiNvin{_qow{RS_Arv_BlOOmIN_oN_dAys_ide_nhvse_wi|s_iwv_Y~u_ShOuM|_Be_Brnin_n_hv} AISGEiT_IS_L_BeaZtFUL_Kay_~ZtsiKe_AIrDF_LRe_SiNGinE_FoQERS_ArG_BlOOmIN_oN_KAys_iKe_nhGse_QiDs_iQG_Y~Z_ShOZLD_Be_BUrnin_n_hG} 8IS39iT_IS_4_BeaZ215=4_Kay_0Z2siKe_8IrD5_4Re_SiN3i79_51oQ9RS_8r3_BlOO@IN6_oN_K8ys_1iKe_7h3se_QiDs_1iQ3_Y0Z_ShOZ4D_Be_B=r7i76_17_h311} ``` 剩下就是手動拼組了,不過可以確定range(48,128)的字串長度必定為flag長度,因其包含了所有flag可能字元。 FLAG: ``` AIS3{iT_IS_4_Beaut1FUL_day_0utside_8IrD5_4Re_SiNGin9_F1owERS_Ar3_BlOOmIN6_oN_dAys_1iKe_7h3se_kiDs_1ik3_Y0u_ShOuLD_Be_BUrnin6_1n_h311} ``` P.S.我拼了1.5hr錯了10次才對,1t's 4 re41 h31l... # Reverse ## ⒸⓄⓋⒾⒹ-①⑨ [baby] > Bonus : First Blood 這題直接給了一個x64的task.elf檔,既然是reverse就直接用IDA Pro打開吧~ Decompile之後先看看main,沒有找到什麼可以用的東西,function多到暈頭轉向,看到的東西只有```YOU WIN!```... ![](https://i.imgur.com/uIRgngL.png) 不過在裡面發現了一個可疑的function```check_flag_is_correct(char *)```,進去看看decompile的內容。 ![](https://i.imgur.com/yQDTxXZ.png) 看起來是個判斷傳入字串是否符合條件的函數,點進target發現有一串數字。 ![](https://i.imgur.com/XICIwSx.png) 看來是把這些數字拿來比對運算結果,所以我們就把條件判斷爆搜字串之後就可以拿到flag了。 寫個程式來把flag爆搜出來。 ```cpp #include<bits/stdc++.h> using namespace std; int p[32]={65, 72, 81, 48, 127, 48, 49, 51, 113, 86, 98, 59, 97, 62, 114, 120, 35, 37, 96, 76, 121, 33, 35, 124, 101}; int main(){ for(int i=0;i<32;i++){ for(int j=0;;j++){ if(char(char(j)^i)==char(p[i])){ cout<<char(j); break; } } } return 0; } ``` FLAG: ``` AIS3{574y_h0m3|w34r_m45k} ``` P.S. 賽後發現xor算法可以直接算出flag,不需要爆搜,比賽的時候沒想好繞了一圈... ```cpp #include<bits/stdc++.h> using namespace std; int p[32]={65, 72, 81, 48, 127, 48, 49, 51, 113, 86, 98, 59, 97, 62, 114, 120, 35, 37, 96, 76, 121, 33, 35, 124, 101}; int main(){ for(int i=0;i<32;i++){ cout<<char(i^p[i]); } cout<<endl; return 0; } ``` ###### tags: `hexo`

    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