trungchubao

A place to write something

View on GitHub

As the captain of Team U-niverse, I participated to the Block Harbor x VicOne Automotive CTF Season 2 (2024). We couldn't make it to the final rounds. It was, however, a chance for us to learn new things. Personally, I was able to sharpen my reverse engineering skill a little bit. Here under I will place write-ups for the RE challenges that I solved: "Want a password", "Gameboy Game" and "Cargame". As for write-ups of other challenges, please refer to the bottom of this page.


1. “Want a password”

2. “Gameboy Game”

3. “Car game”

    # --------- crack.py ------------
    import gdb
    import pyautogui
    import time
    import threading

    global score

    TIMEOUT = 1000

    # connect to the local GDB process
    gdb.execute("file cargame")
    gdb.Breakpoint("*0x4030ae")

    def waitUntilDone():
        time.sleep(TIMEOUT)
        gdb.Breakpoint("*0x403e6d")
        gdb.Breakpoint("*0x403d63")

    def bp_handler(event):
        global score

        if event.breakpoint.number == 1:
            gdb.execute("set *(unsigned char*)0x403e6d = 0x90")
            gdb.execute("set *(unsigned char*)0x403e6e = 0x90")
            gdb.execute("set *(unsigned char*)0x403e6f = 0x90")

            gdb.execute("set *(unsigned char*)0x403d63 = 0x90")
            gdb.execute("set *(unsigned char*)0x403d64 = 0x90")
            gdb.execute("set *(unsigned char*)0x403d65 = 0x90")

            t1 = threading.Thread(target=waitUntilDone, args=())
            t1.start()

            gdb.execute("continue")
        if event.breakpoint.number in (2,3):
            gdb.execute("set *(unsigned char*)0x403e6d = 0x89")
            gdb.execute("set *(unsigned char*)0x403e6e = 0x50")
            gdb.execute("set *(unsigned char*)0x403e6f = 0x18")

            gdb.execute("set *(unsigned char*)0x403d63 = 0x89")
            gdb.execute("set *(unsigned char*)0x403d64 = 0x50")
            gdb.execute("set *(unsigned char*)0x403d65 = 0x18")
            gdb.execute("continue")

    gdb.events.stop.connect(bp_handler)
    gdb.execute("set logging on")
    gdb.execute("set confirm off")

    gdb.execute("run -u trung")

The script is run by gdb -x crack.py.

Write-ups for other challenges:

  1. Challenge “Power”: https://glatcher.ru/2024/09/09/BlockHarbor2024-Power
  2. Challenges “Scanning Plates”, “Stego 1”, “I know alot about cars”, “Web RCE Anomaly”, “What is the VIN?”: https://github.com/OxT7723/CTFs/blob/main/BlockHarbor_CTF_Season2_2024/README.md
  3. Challenges “Walk in the park”, “Can bus anomaly #1”, “1 or 2?”, “Lost in the echo”, “ivi”, “Siggy”, “Stego 1”: https://blog.hamayanhamayan.com/entry/2024/09/10/222143
  4. Challenges “VCAN”, “Can bus anomaly #2”, “DID Access”, “What is the VIN?”, “Steering Angle”, “When were we driving?”, “Radio”, “Street Names”, “Autosar E2E”: https://laysakura.github.io/2024/09/09/automotive-ctf-2024-qual/