2025冬季挑战赛:构建可自输出的回文ELF二进制文件

本文详细介绍了Synacktiv举办的2025冬季挑战赛,要求参赛者创建一个同时满足字节级回文和自输出(Quine)属性的ELF可执行文件。文章包含了挑战规则、测试脚本、参与方式、测试环境配置以及当前的实时排名。

2025冬季挑战赛: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月进行,题解文章将于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. ioonag - 2025年12月8日 下午10:21
  2. XeR - 2025年12月17日 下午1:58
  3. toby - 2025年12月29日 下午11:41
  4. 00BL1X - 2025年12月30日 上午1:02
  5. Leon Noel - 2025年12月27日 上午12:30
  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 设计