Home
Github
  • 👋Welcome !
  • 🚩CTF Writeups
    • SKR CTF
      • Binary
        • Auth Me 2.0
      • Misc
        • Schrodinger's Cat 2
      • Reverse Engineering
        • Nogard 3
    • osu!gaming CTF 2024
      • pwn
        • betterthanu
    • Crackmes
      • PieIsMyFav
      • Plain Sight
    • WolvCTF 2024
      • pwn
        • babypwn
    • TexSAW CTF 2024
      • rev
        • Catch The White Rabbit
      • Forensics
        • Malicious Threat
        • MalWhere?
    • SwampCTF 2024
      • Misc
        • Lost Some Magic
        • The Time Equations
    • pwnable.kr
      • Toddler's Bottle
        • fd
    • Codegate CTF 2024
      • ai
        • ai_warmup
    • Junior Crypt CTF 2024
      • Misc
        • Terms of Use
      • Forensics
        • Admin Rights
        • Confusion
      • PPC
        • l33t
    • IHack 2024 Qualification
      • DFIR
        • Happy SPLUNKing
      • Malware
        • Confusing Javascript
    • Malcore Challenge
    • Intern Task
      • SQLI
  • 📮Room/Machine
    • HTB - Sherlock
      • DFIR
        • Brutus
        • Unit42
        • Jingle Bell
  • 📚Notes
    • CTF Related
      • pwn
        • pwntools
        • Format String Vulnerability
        • Integer Overflow
        • Executable Properties
        • gdb-gef
        • Template Script
      • b2r/koth
    • Assembly Language
    • x86 Architecture
  • 🛠️Tools
    • DFIR
    • Malware Analysis
    • Essentials
  • 👽Threat Hunting
    • Intro
    • Common Tactics
    • Methodologies
    • Types of threat hunting
  • 😸whoami
    • About Me
    • Other
      • FYP
  • Archives
    • 3108 CTF
      • Kategori
        • Tugasan Utama : Warkah Untuk Perwira
          • Tugasan I : Seruan Perwira
          • Tugasan II : Tali Barut
          • Warkah Akhir
        • Web
          • Lemah
          • Pantun Pantul
          • Wantujus
          • Wantusom
        • Reverse Engineering
          • Pa+rio+ik
          • Sarawak
        • Network
          • Johan
          • Lagi-lagi Johan
        • Misc
          • 3108 CTF Town
          • Mencari Rahsia Si Dia
        • Cryptography
          • 1957bit
          • Nasihat
          • Selamat Malam
        • OSINT
          • Pertemuan Kapisata : Babak I
          • Pertemuan Kapista : Babak II
          • Pertemuan Kapista : Finale
    • Curtin CTF 2023
      • Pwn n Rev
        • Classic Bufferoverflow
        • Intro to Buffer Overflow
        • Don't Go Overboard
        • Don't Go Overboard 2
        • Let The Random Games Begin1
        • Let The Random Games Begin 2
        • Let The Random Games Begin 3
    • 1337UP LIVE CTF
      • Pwn
        • Floor Mat Store
    • HTB University CTF 2023
      • Reverse Engineering
        • Windows Of Opportunity
Powered by GitBook
On this page
  • Solution
  • Flag
  1. Archives
  2. HTB University CTF 2023
  3. Reverse Engineering

Windows Of Opportunity

HTB 2023

Last updated 1 year ago



Solution

Given a file named windows.

windows: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=121c16ba1218dc3686b3cdac4705bc7496fb0fe7, for GNU/Linux 3.2.0, not stripped
    Arch:     amd64-64-little
    RELRO:    Partial RELRO
    Stack:    No canary found
    NX:       NX enabled
    PIE:      PIE enabled

The program wants the user to input a password (flag). If the password incorrect, it will show this.

Checking the code using Ghidra, i can see that line 18 compares variable local_d with array arr.

local_d is the sum of the value at current index and the index after from user input.

local_d = local_38[i+1] + local_38[i];

Double click the arr[] to see the array.

                             arr                                             XREF[3]:     Entry Point(*), main:0010119b(*), 
                                                                                          main:001011a2(*)  
        00104060 9c 96 bd        undefine
                 af 93 c3 
                 94 60 a2 
           00104060 9c              undefined19Ch                     [0]                               XREF[3]:     Entry Point(*), main:0010119b(*), 
                                                                                                                     main:001011a2(*)  
           00104061 96              undefined196h                     [1]
           00104062 bd              undefined1BDh                     [2]
           00104063 af              undefined1AFh                     [3]
           00104064 93              undefined193h                     [4]
           00104065 c3              undefined1C3h                     [5]
           00104066 94              undefined194h                     [6]
           00104067 60              undefined160h                     [7]
           00104068 a2              undefined1A2h                     [8]
           00104069 d1              undefined1D1h                     [9]
           0010406a c2              undefined1C2h                     [10]
           0010406b cf              undefined1CFh                     [11]
           0010406c 9c              undefined19Ch                     [12]
           0010406d a3              undefined1A3h                     [13]
           0010406e a6              undefined1A6h                     [14]
           0010406f 68              undefined168h                     [15]
           00104070 94              undefined194h                     [16]
           00104071 c1              undefined1C1h                     [17]
           00104072 d7              undefined1D7h                     [18]
           00104073 ac              undefined1ACh                     [19]
           00104074 96              undefined196h                     [20]
           00104075 93              undefined193h                     [21]
           00104076 93              undefined193h                     [22]
           00104077 d6              undefined1D6h                     [23]
           00104078 a8              undefined1A8h                     [24]
           00104079 9f              undefined19Fh                     [25]
           0010407a d2              undefined1D2h                     [26]
           0010407b 94              undefined194h                     [27]
           0010407c a7              undefined1A7h                     [28]
           0010407d d6              undefined1D6h                     [29]
           0010407e 8f              undefined18Fh                     [30]
           0010407f a0              undefined1A0h                     [31]
           00104080 a3              undefined1A3h                     [32]
           00104081 a1              undefined1A1h                     [33]
           00104082 a3              undefined1A3h                     [34]
           00104083 56              undefined156h                     [35]
           00104084 9e              undefined19Eh                     [36]

The value in each of the array is the value of local_d, which i explained earlier. So, we need to calculate the value (in ascii) for the user input.

9C = H (48) + T (54)
96 = T (54) + B (42)
BD = B (42) + { (7B)
AF = { (7B) + 4 (34)
...
the rest of the calculations
...
9E = ! (21) + } (7D)

We get a flag from it, check it just to make sure it is legit.


Flag

HTB{4_d00r_cl0s35_bu7_4_w1nd0w_0p3n5!}

The flag format starts with HTB{. It should be easy for us to start calculate the rest of the value. You can use as guidance and some simple math skills.

ASCII Table