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

本文介绍了Synacktiv公司发布的2025冬季挑战赛——Quinindrome。参与者需要创建一个同时满足字节级回文和“自打印”属性的ELF可执行文件,并优化其体积以争夺排行榜名次。挑战涉及ELF文件头操作和x86指令的精巧布局。

2025冬季挑战赛:Quinindrome

距离Synacktiv夏季挑战赛结束已过去数月,初雪已然落下。该活动广受欢迎,甚至有一位参与者在解题过程中发现了一个0day漏洞!该漏洞尚未公开,但将在Synacktiv网站上另文发布。随着冬季来临,现在是时候向您介绍Synacktiv冬季挑战赛了!在这个代码高尔夫挑战中尝试与其他参与者一较高下,并在1月1日前提交您的解决方案🏌️。

目录

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

🎁 奖项

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

  • 第一名:这套出色的IFixIt工具包以及一个焊接工具,用于修复您的所有电子设备。
  • 第二名:这款Netgear 8端口PoE+可管理交换机,是家庭网络的理想选择。
  • 第三名:一个Yubikey 5C NFC密钥,确保您的身份验证安全无虞!

🏆 挑战内容

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

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

当然,进程必须正常结束而不出现段错误,且返回码必须定义为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月进行,解题报告将于2026年初发布。

您可以在进展过程中随时提交您的解决方案。 您可以向我们发送任意数量的解决方案,但每天限提交一次。这意味着如果您在12月31日上午发送了一个二进制文件,那么当天将没有额外的提交机会。

一旦您的提交被接收并通过验证,总排名将会更新。然而,为了保持悬念,具体分数将不会公布。

如果您对规则有任何疑问,请随时通过邮件联系我们。

🖥️ 测试虚拟机

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

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

🥷🏼 额外挑战

我们内部已经开发了一个相当高效的解决方案。您能够超越Synacktiv吗?

这是我们二进制文件的sha256sum:8af9fdd50a4b5df623d59b4fde2d8c01d88c27a9badb09e2fdb1b24ca475e111

该解决方案将在挑战赛的解题报告中公布并加以解释。

祝您好运,并祝新年快乐!

🏅 实时排名

  1. ioonag - 2025年12月8日 下午10:21
  2. XeR - 2025年12月17日 下午1:58
  3. Leon Noel - 2025年12月27日 上午12:30
  4. toby - 2025年12月27日 下午3:28
  5. 00BL1X - 2025年12月29日 上午3:15
  6. doegox - 2025年12月7日 上午2:37
  7. Lion - 2025年12月12日 下午6:41
  8. Swissky - 2025年12月8日 下午6:13
  9. alph4kam - 2025年12月11日 下午7:47
  10. 3akev - 2025年12月19日 上午8:43
  11. Nicolas - 2025年12月23日 上午10:16
  12. itszn - 2025年12月3日 下午1:28
  13. matt - 2025年12月28日 下午11:45
  14. Sk4r - 2025年12月12日 上午12:26
  15. mirisme - 2025年12月12日 下午7:46
  16. rick - 2025年12月29日 下午6:02
  17. rl0x01 - 2025年12月16日 下午4:58
  18. Gerfaut - 2025年12月27日 上午10:58
  19. Cortex - 2025年12月2日 下午8:45
  20. Aker - 2025年12月22日 上午7:33
  21. hendo - 2025年12月9日 下午5:49
  22. n0x - 2025年12月14日 下午2:46
  23. Youssef - 2025年12月28日 下午3:16
  24. CupOfCoffee - 2025年12月5日 上午8:01
  25. Noé - 2025年12月13日 下午5:11
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计