👨‍💻
CTFs
HomePlaygroundOSCPBuy Me a Flag 🚩
  • 🚩Zeyu's CTF Writeups
  • Home
  • Playground
  • OSCP
  • My Challenges
    • SEETF 2023
    • The InfoSecurity Challenge 2022
    • SEETF 2022
    • Cyber League Major 1
    • STANDCON CTF 2021
      • Space Station
      • Star Cereal
      • Star Cereal 2
      • Mission Control
      • Rocket Science
      • Space University of Interior Design
      • Rocket Ship Academy
      • Space Noise
  • 2023
    • DEF CON CTF 2023 Qualifiers
    • hxp CTF
      • true_web_assembly
    • HackTM CTF Qualifiers
      • Crocodilu
      • secrets
      • Hades
  • 2022
    • niteCTF 2022
      • Undocumented js-api
      • js-api
    • STACK the Flags 2022
      • Secret of Meow Olympurr
      • The Blacksmith
      • GutHib Actions
      • Electrogrid
      • BeautyCare
    • LakeCTF Qualifiers
      • People
      • Clob-Mate
      • So What? Revenge
    • The InfoSecurity Challenge 2022
      • Level 1 - Slay The Dragon
      • Level 2 - Leaky Matrices
      • Level 3 - PATIENT0
      • Level 4B - CloudyNekos
      • Level 5B - PALINDROME's Secret (Author Writeup)
    • BalsnCTF 2022
      • 2linenodejs
      • Health Check
    • BSidesTLV 2022 CTF
      • Smuggler
      • Wild DevTools
      • Tropical API
    • Grey Cat The Flag 2022
    • DEF CON CTF 2022 Qualifiers
    • Securinets CTF Finals 2022
      • StrUggLe
      • XwaSS ftw?
      • Strong
      • Artist
    • NahamCon CTF 2022
      • Flaskmetal Alchemist
      • Hacker TS
      • Two For One
      • Deafcon
      • OTP Vault
      • Click Me
      • Geezip
      • Ostrich
      • No Space Between Us
    • Securinets CTF Quals 2022
      • Document-Converter
      • PlanetSheet
      • NarutoKeeper
    • CTF.SG CTF
      • Asuna Waffles
      • Senpai
      • We know this all too well
      • Don't Touch My Flag
      • Wildest Dreams Part 2
      • Chopsticks
    • YaCTF 2022
      • Shiba
      • Flag Market
      • Pasteless
      • Secretive
      • MetaPDF
      • Crackme
    • DiceCTF 2022
      • knock-knock
      • blazingfast
    • TetCTF 2022
      • 2X-Service
      • Animals
      • Ezflag Level 1
  • 2021
    • hxp CTF 2021
    • HTX Investigator's Challenge 2021
    • Metasploit Community CTF
    • MetaCTF CyberGames
      • Look, if you had one shot
      • Custom Blog
      • Yummy Vegetables
      • Ransomware Patch
      • I Hate Python
      • Interception
    • CyberSecurityRumble CTF
      • Lukas App
      • Finance Calculat0r 2021
      • Personal Encryptor with Nonbreakable Inforation-theoretic Security
      • Enterprice File Sharing
      • Payback
      • Stonks Street Journal
    • The InfoSecurity Challenge (TISC) 2021
      • Level 4 - The Magician's Den
      • Level 3 - Needle in a Greystack
      • Level 2 - Dee Na Saw as a need
      • Level 1 - Scratching the Surface
    • SPbCTF's Student CTF Quals
      • 31 Line PHP
      • BLT
      • CatStep
    • Asian Cyber Security Challenge (ACSC) 2021
      • Cowsay As A Service
      • Favorite Emojis
      • Baby Developer
      • API
      • RSA Stream
      • Filtered
      • NYONG Coin
    • CSAW CTF Qualification Round 2021
      • Save the Tristate
      • securinotes
      • no pass needed
      • Gatekeeping
      • Ninja
    • YauzaCTF 2021
      • Yauzacraft Pt. 2
      • Yauzabomber
      • RISC 8bit CPU
      • ARC6969 Pt. 1
      • ARC6969 Pt. 2
      • Back in 1986 - User
      • Lorem-Ipsum
    • InCTF 2021
      • Notepad 1 - Snakehole's Secret
      • RaaS
      • MD Notes
      • Shell Boi
      • Listen
      • Ermittlung
      • Alpha Pie
    • UIUCTF 2021
      • pwnies_please
      • yana
      • ponydb
      • SUPER
      • Q-Rious Transmissions
      • capture the :flag:
      • back_to_basics
      • buy_buy_buy
    • Google CTF 2021
      • CPP
      • Filestore
    • TyphoonCon CTF 2021
      • Clubmouse
      • Impasse
    • DSTA BrainHack CDDC21
      • File It Away (Pwn)
      • Linux Rules the World! (Linux)
      • Going Active (Reconnaissance)
      • Behind the Mask (Windows)
      • Web Takedown Episode 2 (Web)
      • Break it Down (Crypto)
    • BCACTF 2.0
      • L10N Poll
      • Challenge Checker
      • Discrete Mathematics
      • Advanced Math Analysis
      • Math Analysis
      • American Literature
      • More Than Meets the Eye
      • 􃗁􌲔􇺟􊸉􁫞􄺷􄧻􃄏􊸉
    • Zh3ro CTF V2
      • Chaos
      • Twist and Shout
      • 1n_jection
      • alice_bob_dave
      • Baby SSRF
      • bxxs
      • Sparta
    • Pwn2Win CTF 2021
      • C'mon See My Vulns
      • Illusion
    • NorzhCTF 2021
      • Leet Computer
      • Secure Auth v0
      • Triskel 3: Dead End
      • Triskel 2: Going In
      • Triskel 1: First Contact
      • Discovery
    • DawgCTF 2021
      • Bofit
      • Jellyspotters
      • No Step On Snek
      • Back to the Lab 2
      • MDL Considered Harmful
      • Really Secure Algorithm
      • The Obligatory RSA Challenge
      • Trash Chain
      • What the Flip?!
      • Back to the Lab 1
      • Back to the Lab 3
      • Dr. Hrabowski's Great Adventure
      • Just a Comment
      • Baby's First Modulation
      • Two Truths and a Fib
    • UMDCTF 2021
      • Advantageous Adventures
      • Roy's Randomness
      • Whose Base Is It Anyway
      • Cards Galore
      • Pretty Dumb File
      • Minetest
      • Donnie Docker
      • Subway
      • Jump Not Easy
      • To Be XOR Not To Be
      • Office Secrets
      • L33t M4th
      • Bomb 2 - Mix Up
      • Jay
    • Midnight Sun CTF 2021
      • Corporate MFA
      • Gurkburk
      • Backups
    • picoCTF 2021
      • It Is My Birthday (100)
      • Super Serial (130)
      • Most Cookies (150)
      • Startup Company (180)
      • X marks the spot (250)
      • Web Gauntlet (170 + 300)
      • Easy Peasy (40)
      • Mini RSA (70)
      • Dachshund Attacks (80)
      • No Padding, No Problem (90)
      • Trivial Flag Transfer Protocol (90)
      • Wireshark twoo twooo two twoo... (100)
      • Disk, Disk, Sleuth! (110 + 130)
      • Stonks (20)
    • DSO-NUS CTF 2021
      • Insecure (100)
      • Easy SQL (200)
Powered by GitBook
On this page
  • Problem
  • Solution
  • First 14 Chars
  • Second 14 Chars
  • Third 14 Chars
  • Fourth 14 Chars
  • Fifth 14 Chars
  • Final Script

Was this helpful?

  1. 2021
  2. DawgCTF 2021

Back to the Lab 3

LabVIEW

PreviousBack to the Lab 1NextDr. Hrabowski's Great Adventure

Last updated 3 years ago

Was this helpful?

Problem

I think you just have to unzip it and open up _main.vi. ... Oh god, what... what is this?

back_to_the_lab_3.7z:

Author: nb

Solution

First things first, it's pretty annoying that you only get one try, and we need to debug this multiple times later on. We can patch the program and make sure that the checker always allows the rest of the program to run by replacing it with 1.

First 14 Chars

The bytearray with each number rotated left by 3 bits and 4 bits respectively is compared with two constant bytearrays. But note that the bytes are treated as 8-bit unsigned integers, so our implementation needs to consider that.

Second 14 Chars

The bytearray is represented as RGB values.

  • R = byte value

  • G = 5 (constant)

  • B = array index

We can inspect the RGB values:

Third 14 Chars

The input is split into the first 7 and last 7 bytes, then interleaved.

Fourth 14 Chars

Every 2 characters in the array are concatenated and used as the "group name" to read the TDMS file. The Y-value is compared to the array index. Use the probe watch window to debug the program.

Y-value for "ru" is 0

Y-value for "ct" is 1

"3_" is 3

"ur" is 2

"th" is 4

"r1" is 6

"e_" is 5

Then, rearrange so that we go from 0 to 6.

Fifth 14 Chars

There are multiple parts to this.

First, we know it starts with 'd', since other options give us False immediately.

One of the parts is password protected. If we drag the comment out we can see the hidden password.

This unlocks the block diagram.

The input is first converted to their ASCII values, then multiplied with 7927.

Then, 0x49 is subtracted.

Then it goes through some redundant enqueuing, and is compared to some constants.

But we get some weird results. 990802 = 1187410?

Then I realised that the last 16 bits are equal. We are probably comparing 16 bit numbers!

Final Script

Finally!

import string

INT_BITS = 8

def leftRotate(n, d):
    result = bin(n << d)
    if len(result) - 2 > 8:
        result = result[-8:-1 * (len(result) - 2 - 8)] + result[2:-8]

    return int(result, 2)

rotated_left_3 = [34, 11, 187, 59, 26, 162, 0, 0, 0, 0, 147, 153, 250, 179]
rotated_left_4 = [68, 22, 119, 118, 52, 69, 100, 183, 119, 19, 0, 0, 0, 0]

flag = ''

for i in range(14):
    for char in string.ascii_letters + string.digits + '-_{}':
        if leftRotate(ord(char), 3) == rotated_left_3[i] or leftRotate(ord(char), 4) == rotated_left_4[i]:
            flag += char

    i += 1

print(flag)
assert len(flag) == 14

r_values = [49, 95, 99, 108, 117, 53, 116, 51, 114, 95, 52, 114, 114, 97]
flag += ''.join([chr(x) for x in r_values])

print(flag)
assert len(flag) == 28

flag += 'y_l00p_ca53_5t'
print(flag)
assert len(flag) == 42

flag += 'ructur3_the_r1'
print(flag)
assert len(flag) == 56

fragment = ''
results = [1187410, 616666, 989235, 1068505, 600812, 949600, 1100213, 600812, 1131921, 600812, 1068505, 949600, 997162]
for result in results:
    for char in string.ascii_letters + string.digits + '-_{}':
        output = ord(char) * 7927 - 0x49
        if int(bin(output)[-16:], 2) == int(bin(result)[-16:], 2):
            fragment += char
            break

flag += 'd'
flag += fragment[::-1]
print(flag)
https://drive.google.com/file/d/184nf-brey1pmk7uvW0VaZ234hrpB3Mgi/view?usp=sharing