0xMikiko
    • 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
    • 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
    • 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
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
  • 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
    <h1>Hack The Box - Reversing (Easy Part 1)</h1> ![image](https://hackmd.io/_uploads/Bk1qS5WgR.png) Ghi chú: <ul> <li>Easy: 1-7 challenge </li> <ul> <li><a href="#The Art of Reversing">1. The Art of Reversing</a></li> <li><a href="#Tear Or Dear">2. Tear Or Dear</a></li> <li><a href="#Find The Easy Pass">3. Find The Easy Pass</a></li> <li><a href="#Eat the Cake!">4. Eat the Cake!</a></li> <li><a href="#Impossible Password ">5. Impossible Password </a></li> <li><a href="#Baby RE ">6. Baby RE </a></li> <li><a href="#Ransom ">7. Ransom </a></li> </ul> </li> </ul> <h2>Difficulty: Easy </h2> <div id="The Art of Reversing"></div> <h3>Challenge 1: The Art of Reversing</h3> This is a program that generates Product Keys for a specific Software Brand. The input is the client UserName and the Number of Days that the sofware will remain active on the client. The output is the product key that client will use to activate the software package. We just have the following product key 'cathhtkeepaln-wymddd' Could you find the corresponding Username say A and the number of activation days say B given as input? The flag you need to enter must follow this format: HTB{AB} <a href="https://drive.google.com/file/d/1qwRHfw8dpMzJ9jrvCNcyDuxZDjQS2H3k/view?usp=sharing">Download Challenge Here</a> <h3>Solution</h3> Chúng ta có thể sử dụng lệnh 'file' để cung cấp cái nhìn tổng quan về loại tệp. ![upload_3f82d8bfa99604468d9bde2b360fd706](https://hackmd.io/_uploads/r1DKoMxtT.png) Mở chương trình trong dnSpy ![upload_d22beb19f67f1fb032375621e14d0f58](https://hackmd.io/_uploads/HykcsMgYT.png) Phần này chứa hàm `main()`, thiết lập các ứng dụng mà chúng ta quan tâm. Trong đó, ta chú ý `Run(Form1) - InitializeComponent()`. Chương trình sẽ cho ta nhập vào `Username` và `Activate Day`. Thực hiện mã hóa để tạo ra `Key`. ![image](https://hackmd.io/_uploads/Hk0V3EW5p.png) Ta quan sát hàm `buttonCreateProductKey_Click()` để biết nội dung mã hóa. ![upload_0a6d358d7bcaf89ceaf7da9834c7ae4d](https://hackmd.io/_uploads/HJS5jzxtT.png) Đầu tiên chúng ta thấy hàm này kiểm tra xem hộp văn bản Tên người dùng hoặc Số ngày có trống hay không. Nếu một trong hai trống, nó sẽ ném, báo lỗi và trả về. * `nPr():` tạo `key` bằng `username`. Tên người dùng đã bị đảo thứ tự, không phải bị mã hóa. * `ToR()` là thuật toán đệ quy chuyển đổi số đầu vào thành chữ số La Mã.. * `DoR()` thực hiện đảo ngược mảng, đẩy tất cả các ký tự sang bên phải một lần. Điều này có nghĩa là C biến thành D, V thành W, v.v. :::info ```python givenUser = "cathhtkeepaln" Input = "0123456789abc" Output = "21450c3b6798a" dictionary = {} for i in range(13): dictionary[Output[i]] = givenUser[i] print("".join(dictionary[key] for key in sorted(dictionary.keys()))) #hacktheplanet ``` ::: :::info ```python givenDay = "dddmyw" originalGivenDay = "".join([chr(ord(givenDay[i])-1) for i in range(len(givenDay))]) #ccclxv C = 100, L = 50, X = 10, V = 5. So we have 100 + 100 + 100 + 50 + 10 + 5 = 365 ``` ::: :::success ``` Flag: HTB{hacktheplanet365} ``` ::: <div id="Tear Or Dear"></div> <h3>Challenge 2: Tear Or Dear</h3> Find the username and password and put them in the flag in the format: HTB{username:password}. Warning: It can produce false positives. <a href="https://drive.google.com/file/d/1O1yVUOng5ITQZ7jUdRjfAMFTlnl78Jwo/view?usp=sharing">Download Challenge Here</a> <h3>Solution</h3> Mở chương trình trong dnSpy ![upload_a271a2694def5bdfdeec989788f9b962](https://hackmd.io/_uploads/r125jflF6.png) Phần này chứa hàm chính và hàm thích hợp khác mà chúng ta quan tâm. Nếu mở rộng nó, chúng ta sẽ thấy hai thành phần: LogonForm. Hàm này chỉ gọi hàm, chỉ gọi hàm `InitializeComponent()`. Chương trình tìm kiếm thông tin về Tên người dùng và Mật khẩu. Nếu chúng ta nhấp vào nút Đăng nhập, nó sẽ kiểm tra thông tin đầu vào của chúng ta. Nó hiển thị cho chúng ta 2 điều kiện để nhận được thông báo “Chính xác”. ![upload_5f0bf8cc36c705ea848bc36c6e7453a4](https://hackmd.io/_uploads/S1Ooizltp.png) Nó hiển thị cho chúng ta 2 điều kiện để nhận được thông báo “Chính xác”. * `this.username == this.o` * `this.check1(s) == True` Nếu đi sâu xuống, chúng ta có thể nhận ra điều gì đó: * `this.o = encrypted10("1hpip"+ 9 times password)` nhưng bất kể mật khẩu là gì, 100% nó sẽ trả về "roiw!@#". Vậy `this.o = "roiw!@#"` * `UserName = this.aa` in order to `check1(string s) = True` * Chương trình tạo ra các chuỗi như: `"1hpip"+ 9 lần mật khẩu`. Sau đó lấy 5 ký tự đầu tiên của chuỗi. Đảo ngược và xóa ký tự cuối cùng. Vậy `this.aa = "piph"` :::success ``` Flag: HTB{piph:roiw!@#} ``` ::: <div id="Find The Easy Pass"></div> <h3>Challenge 3: Find The Easy Pass</h3> Find the password (say PASS) and enter the flag in the form HTB{PASS} <a href="https://drive.google.com/file/d/1yFJxk6Z3K_hUBRYNZrBKxC24u4eX_KuV/view?usp=sharing">Download Challenge Here</a> <h3>Solution</h3> Chúng ta có thể sử dụng lệnh 'file' để cung cấp cái nhìn tổng quan về loại tệp. ![upload_e92af2cc60d75ffcf3375b6a4d2ffe50](https://hackmd.io/_uploads/H1y2iMgt6.png) Chương trình này được biên dịch với Borland Delphi. Mở chương trình trong IDA. ![upload_d780ff4b739e2bb6096cd1e0f6a84479](https://hackmd.io/_uploads/ByE2jzeFp.png) Hàm `LStrLAsg` trong Delphi được sử dụng trong lập trình Delphi để gán các giá trị chuỗi. Nó là viết tắt của `"Long String Assign"` (Chỉ định Chuỗi Dài). Thủ tục này thường liên quan đến việc xử lý các hoạt động gán chuỗi, bao gồm cả việc quản lý bộ nhớ. Hàm `LStrCatN` trong Delphi được sử dụng để nối một số ký tự được chỉ định từ chuỗi này sang chuỗi khác. Nó là viết tắt của `"Long String Concatenate N"` (Nối Chuỗi Dài N). Hàm này thường được sử dụng khi bạn muốn nối một số ký tự cụ thể từ chuỗi này đến cuối chuỗi khác. Chương trình thực hiện kiểm tra dữ liệu ta nhập vào và chuỗi đã được nối bởi hàm `LStrCatN` - chuỗi đó là <b>fortran!</b>. :::success ``` Flag: HTB{fortran!} ``` ::: <div id="Eat the Cake!"></div> <h3>Challenge 4: Eat the Cake!</h3> Find the Password and enter it in the form HTB{password} <a href="https://drive.google.com/file/d/1I64pazDmuVHHVYrZG4YlkCDzBD6vAzGs/view?usp=sharing">Download Challenge Here</a> <h3>Solution</h3> Chúng ta có thể sử dụng lệnh 'file' để cung cấp cái nhìn tổng quan về loại tệp. ![upload_dcef98c8f65242c55fab801ae6b447cd](https://hackmd.io/_uploads/BJsnoflY6.png) Chúng tôi có trình đóng gói/giải nén UPX. ![upload_d159bed0949c6d6a7f0530fba24ffc44](https://hackmd.io/_uploads/B1y6ozlFa.png) Mở chương trình trong IDA ![upload_0702c998a295d60c8036e8c9c6e0cdaf](https://hackmd.io/_uploads/BJmpjMeY6.png) Thật dễ dàng để nhận ra chương trình này kiểm tra từng kí tự của `input` với từng ký tự của `Destination`. Chúng ta có thể nhận được `input = “h@ckth3parad1$E”` . :::success ``` Flag: HTB{h@ckth3parad1$E} ``` ::: <div id="Impossible Password"></div> <h3>Challenge 5: Impossible Password</h3> Are you able to cheat me and get the flag? <a href="https://drive.google.com/file/d/1OuWkKf3fVTCVm_uHnwimnrxYXJPSPfO9/view?usp=sharing">Download Challenge Here</a> <h3>Solution</h3> Chúng ta có thể sử dụng lệnh 'file' để cung cấp cái nhìn tổng quan về loại tệp. ![upload_f92e75543c259bb34adce4ffa4917005](https://hackmd.io/_uploads/r1KasMxtp.png) Mở chương trình trong IDA. ![upload_d6b8fc18e68def668d4a2cbb27f6bcd6](https://hackmd.io/_uploads/BJC6jfeta.png) Thử thách này có 2 giai đoạn. Nếu chúng ta vượt qua cả hai giai đoạn, nó sẽ in cờ. * Stage 1: `input = SuperSeKretKey` * Stage 2: `strcmp(input_value,random_value)`. * Tôi đã vá bằng một đoạn code IDApython để sửa lệnh nhảy :::info ```python import ida_bytes ida_bytes.patch_byte(0x400968,0x74) ``` ::: Nếu bạn không muốn làm như trên, bạn có thể sử dụng `SuperSeKretKey ^ 0x09` ![upload_2b595f23af5397d1bd974672b03eac69](https://hackmd.io/_uploads/rkGAoGeF6.png) :::success ``` Flag: HTB{40b949f92b86b18} ``` ::: <div id="Baby RE"></div> <h3>Challenge 6: Baby RE</h3> Chúng ta có thể sử dụng lệnh 'file' để cung cấp cái nhìn tổng quan về loại tệp. <a href="https://drive.google.com/file/d/14DV_qifT1L4Dd15wzj4awDKalZQ8dZk7/view?usp=sharing ">Download Challenge Here</a> <h3>Solution</h3> Chúng ta có thể sử dụng lệnh 'file' để cung cấp cái nhìn tổng quan về loại tệp. ![upload_612453a0ac1e70ec9e521452c5f8a6b9](https://hackmd.io/_uploads/ByYRjfgYa.png) Mở chương trình trong IDA. ![upload_118f4513a6c14737550a7ac5725e68a6](https://hackmd.io/_uploads/H1UG2zlFa.png) :::success ``` Flag: HTB{B4BY_R3V_TH4TS_EZ} ``` ::: <div id="Ransom"></div> <h3>Challenge 7: Ransom</h3> We received an email from Microsoft Support recommending that we apply a critical patch to our Windows servers. A system administrator downloaded the attachment from the email and ran it, and now all our company data is encrypted. Can you help us decrypt our files? <a href="https://drive.google.com/file/d/1258ZNJqn4ooFswnh4OrtaJc3K7cHx7Sf/view?usp=sharing ">Download Challenge Here</a> <h3>Solution</h3> Chúng ta có thể sử dụng lệnh 'file' để cung cấp cái nhìn tổng quan về loại tệp. ![upload_f2d36ea595a89312678dc505b3d3fb0f](https://hackmd.io/_uploads/SJEXhGgYp.png) Mở chương trình trong IDA. ![upload_2386d61898b53aa644b4e905f3c45835](https://hackmd.io/_uploads/ByKXnMltT.png) Hàm này thực hiện `mã hóa tệp được đưa làm tham số` và `ghi tệp đã được mã hóa` ![upload_c0b9bd0dbd39718a4e78edc640514e61](https://hackmd.io/_uploads/r1hm2Ggt6.png) Bây giờ là lúc để khai thác nó. :::info ```python from Crypto.Util.number import long_to_bytes key = list(b"SUPERSECURE") encrypted_bytes = open("login.xlsx.enc", "rb").read() count = 0 decrypted_bytes = b"" for byte in encrypted_bytes: decrypted_bytes += long_to_bytes(((byte - key[count % len(key)]) % 256)) count += 1 with open('login.xlsx', 'wb') as file: file.write(decrypted_bytes) ``` ::: ![upload_9efdef7d743db0ef4bc61068ace21b08](https://hackmd.io/_uploads/B14E3GxYp.png) :::success ``` Flag: HTB{M4lW4R3_4n4LY5I5_IN73r357iN9_57uFF} ``` :::

    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