2025冬季挑战赛:打造对称自打印的ELF二进制文件

本文详细介绍了Synacktiv举办的2025冬季挑战赛“Quinindrome”,要求参赛者构建一个既是字节级回文、又能精确打印自身内容的ELF可执行文件。文章包含完整的验证脚本、参赛规则、测试环境技术规格及当前排名。

2025 Winter Challenge: Quinindrome

几个月过去了,自Synacktiv夏季挑战赛结束以来,第一场雪已经落下。那次活动非常受欢迎,甚至有一位参与者在解决挑战时发现了一个0day漏洞!该漏洞尚未公开,但将在Synacktiv网站上的一篇文章中专门介绍。随着冬天的到来,现在正是向大家介绍Synacktiv冬季挑战赛的时候!尝试在这个代码高尔夫挑战中与其他参与者一较高下,并在1月1日之前向我们提交您的解决方案🏌️。

目录

  • 🎁 奖品
  • 🏆 挑战内容
  • 📩 参与方式
  • 🖥️ 测试虚拟机
  • 🥷🏼 额外挑战
  • 🏅 临时排名

🎁 奖品

以下是排名前三的参与者的奖品:

  • 第一名:优秀的iFixit工具套装以及一个焊接台,用于修理您的所有电子设备。
  • 第二名:这款Netgear 8端口PoE+可管理交换机,非常适合您的家庭网络。
  • 第三名:一个Yubikey 5C NFC密钥,确保您无风险的认证!

🏆 挑战内容

目标是设计一个“Quinindrome”,即一个满足以下两个属性的ELF二进制文件:

  1. 是一个回文,即完全对称。
  2. 是一个字节级的“自产生程序”(quine):执行时能在标准输出上打印其自身文件内容。

当然,进程必须正常结束,不能出现段错误,并且返回码必须定义为0。

参加过上次挑战的参与者会认出这个主题,但请不要误会:您需要构思非常不同的技术来最大程度地优化您的解决方案。这次,您将需要操作ELF文件的头部,并找到构成您程序的x86指令的最佳布局!

以下是测试脚本:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash

##### Setup #####
# Create the required tmp files
export TMPDIR=$(mktemp -dp .)
binary=$(mktemp)
reversed_file=$(mktemp)
containerfile=$(mktemp)
output_file=$(mktemp)

# Function to clean up tmp files and exit with given status
function clean_exit() {
    rm -r "$TMPDIR"
    exit "$1"
}


##### Argument checks #####
# Check if binary path is provided
if [ $# -ne 1 ]; then
    echo "[+] Usage: $0 <binary_path>"
    clean_exit 1
fi

# Check if file exists and is readable
if [ ! -f "$1" ] || [ ! -r "$1" ]; then
    echo "[!] Error: File '$1' does not exist or is not readable."
    clean_exit 1
fi

# Rename the input file to prevent command injections
if ! cp -- "$1" "$binary" 2> /dev/null; then
    echo "[!] Failed to copy input file."
    clean_exit 1
fi


##### First check: byte-wise palindrome #####
size=$(wc -c < "$binary")

# Read the file byte by byte in reverse order (in a very efficient way)
for ((i = size - 1; i >= 0; i--)); do
    dd if="$binary" bs=1 skip=$i count=1 2> /dev/null
done > "$reversed_file"

if cmp -s "$binary" "$reversed_file"; then
    echo "[+] First check passed: binary is a byte-wise palindrome."
else
    echo "[!] First check failed: binary is not a byte-wise palindrome."
    clean_exit 1
fi


##### Build a scratch Podman image with the binary to test #####
# Create the containerfile
image_name="quinindrome_test"

cat > "$containerfile" <<EOF
FROM scratch
COPY --chmod=700 $binary /binary
CMD ["/binary"]
EOF

# Build the image
if ! podman build . -t "$image_name" -f "$containerfile" > /dev/null; then
    echo "[!] Failed to build Podman test image."
    clean_exit 1
fi


##### Second check: quine property #####
max_run_time=120

# Run the binary in the scratch container and capture output & return code
timeout "$max_run_time" podman run --rm "$image_name" > "$output_file"
return_code=$?

if [ $return_code -ne 0 ]; then
    echo "[!] Second check failed: binary execution returned non-zero status: $return_code."
    clean_exit 1
fi

if cmp -s "$binary" "$output_file"; then
    echo "[+] Second check passed: binary is a true quine, its output matches itself."
else
    echo "[!] Second check failed: Is that a quine? Binary output does not match itself."
    clean_exit 1
fi

echo "[+] Both checks passed: your binary is a very nice quinindrome!"
echo "[+] Your score: $size"

clean_exit 0

📩 参与方式

解决方案接收截止日期为12月31日23:59 UTC+1。 要提交您的方案,请发送至邮箱 winter-challenge@synacktiv.com

您已经明白,获胜者将是能够通过上述测试脚本获得最小分数的人。 如果出现平局,将根据收到解决方案的日期来决定名次。 挑战赛将在12月进行,技术文章(write-up)将于2026年初发布。 您可以在取得进展的过程中随时提交您的解决方案。 您可以根据需要提交任意数量的解决方案,但每天限提交一次。这意味着如果您在12月31日上午提交了一个二进制文件,之后将不再有额外的提交机会。 一旦您的方案被接收并验证,总排名将会更新。但是,为了保持悬念,分数将不会公开。 如果您对规则有任何疑问,请随时通过邮件联系我们。

🖥️ 测试虚拟机

以下是用于验证您解决方案的测试脚本将运行的虚拟机描述:

  • 操作系统:Debian 13,Linux内核版本 6.12.57+deb13-amd64。
  • 架构:x86_64。因此您的二进制文件必须使用32位或64位的x86头部和指令集。
  • 已安装 Podman 版本 5.4.2。
  • 虚拟机无法访问互联网。
  • 虚拟机配置为4个vCPU和8GB RAM。

🥷🏼 额外挑战

在我们这边,我们已经开发出了一个相当有效的解决方案。您能击败Synacktiv吗? 以下是我们二进制文件的sha256sum:8af9fdd50a4b5df623d59b4fde2d8c01d88c27a9badb09e2fdb1b24ca475e111。 该解决方案将在挑战赛的技术文章中发布和解释。

祝你好运,并祝节日快乐!

🏅 临时排名

  1. doegox - 2025年12月7日 上午2:37
  2. ioonag - 2025年12月5日 上午12:52
  3. XeR - 2025年12月5日 下午11:57
  4. itszn - 2025年12月3日 下午1:28
  5. Leon - 2025年12月5日 下午4:47
  6. Swissky - 2025年12月6日 下午2:42
  7. Cortex - 2025年12月2日 下午8:45
  8. Nicolas - 2025年12月5日 下午7:58
  9. CupOfCoffee - 2025年12月5日 上午8:01
  10. Sk4r - 2025年12月7日 上午11:13
  11. Youssef - 2025年12月8日 上午12:41
  12. hendo - 2025年12月7日 上午9:00
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计