Quantum Scrambler — picoCTF 2025 Writeup
好的,我现在需要帮用户总结一篇文章的内容,控制在100个字以内。用户给的文章是关于picoCTF 2025中的一个挑战,叫做Quantum Scrambler。看起来这是一个逆向工程的挑战。 首先,我得通读整篇文章,抓住主要信息。文章提到连接到程序后会看到一串十六进制数的列表。然后给了Python源代码分析,代码中有两个函数:get_flag()和scramble()。get_flag()读取flag文件并去除末尾空格,然后将每个字符转为十六进制。scramble()函数则打乱这些十六进制数的顺序。 接下来,作者通过替换随机值来测试程序的行为,发现加密后的列表中首尾的值保持不变,中间的可能被忽略。于是他们推断出解密的方法是取每个子列表的第一个和最后一个元素,转换回字符,从而得到flag。 现在我要把这些信息浓缩到100字以内。需要包括挑战名称、涉及的函数、加密方式以及解密方法。同时要确保语言简洁明了。 可能的结构是:介绍挑战和基本操作(获取flag并转为十六进制),然后说明加密方式(打乱顺序),最后解密方法(提取首尾元素)。 检查字数是否在限制内,并确保没有使用“这篇文章”或“总结”这样的开头词。 </think> 文章描述了一个名为Quantum Scrambler的picoCTF 2025挑战。程序通过获取flag并将其转换为十六进制列表进行加密,随后打乱顺序输出。通过分析代码和测试发现,加密后的列表中首尾元素保持不变,中间元素被忽略。最终通过提取首尾元素并转换回字符成功解密flag。 2026-2-12 05:28:30 Author: infosecwriteups.com(查看原文) 阅读量:0 收藏

The Quantum Scrambler is a reverse engineering challenge from picoCTF 2025. It may seem challenging — but once broken down, it is much more simpler. Let’s begin the writeup!

Analyzing the Program:

After we connect to the program and run it, we are met with a bunch of hexadecimals in a list.

Press enter or click to view image in full size

We were also given the python source code, let’s analyze it to see what happened.

Get truffles’s stories in your inbox

Join Medium for free to get updates from this writer.

In this snippet of code, the program calls two functions which obtains the flag and scrambles it. Then, it outputs the scrambled flag which is the list full of hexadecimals we saw earlier.

Press enter or click to view image in full size

The get_flag() function opens a file with the flag and gets it. It then get rid of any trailing whitespace with flag.strip(). The for loop takes every character in the flag and turns it into a hexadecimal (ex: ‘0x70’).

Press enter or click to view image in full size

This function scrambles the list of hexadecimals around.

Press enter or click to view image in full size

It may seem intimating to understand what is going on, however, we can substitute random values for the flag to see what changes and what does not. For instance, let’s pretend the flag is: fakeflag

I printed out the normally encoded values and the scrambled values so we can see the pattern. The encoded flag can be seen having the original values at the start and end. The values in the middle could be ignored.

Press enter or click to view image in full size

Since we understand how the program functions, we know will explore how to decrypt it and find the flag.

Solving the Challenge:

This program gets the first and last value from each of the list because the values in the middle do not matter. Then it changes the hexadecimal to a normal string.

encryptedList = theEncryptedOutputHere!
flag = []
for x in encryptedList:
flag.append(str(x[0]))
flag.append(str(x[-1]))

for x in flag:
print(str(chr(eval(x))), end='')

The output for me was: picoCTF{python_is_weird6ed1aaf0}

(A parentheses may be missing, don’t forget to add it!)


文章来源: https://infosecwriteups.com/quantum-scrambler-picoctf-2025-writeup-c6d892805c6f?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh