CVE-2023-53922

9.8 CRITICAL

📋 TL;DR

CVE-2023-53922 is a critical remote code execution vulnerability in TinyWebGallery v2.5 that allows unauthenticated attackers to upload malicious PHP files via the admin upload functionality. By uploading .phar files containing system commands and accessing their URLs, attackers can execute arbitrary code on the server. All users running TinyWebGallery v2.5 are affected.

💻 Affected Systems

Products:
  • TinyWebGallery
Versions: v2.5
Operating Systems: All operating systems running PHP
Default Config Vulnerable: ⚠️ Yes
Notes: The vulnerability exists in the default installation and requires no special configuration to be exploitable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete server compromise allowing attackers to execute arbitrary commands, steal data, install malware, pivot to other systems, or use the server for further attacks.

🟠

Likely Case

Attackers upload web shells to gain persistent access, deface websites, steal sensitive data, or use the server for cryptocurrency mining or DDoS attacks.

🟢

If Mitigated

With proper file upload restrictions and web application firewalls, exploitation attempts would be blocked, limiting impact to failed attack attempts.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: CONFIRMED
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploit code is publicly available and requires minimal technical skill to execute. The attack can be automated.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Not available

Vendor Advisory: http://www.tinywebgallery.com/

Restart Required: No

Instructions:

1. Check the TinyWebGallery website for security updates. 2. If no patch is available, consider migrating to alternative gallery software. 3. Apply all workarounds listed below immediately.

🔧 Temporary Workarounds

Restrict file upload extensions

all

Configure web server to block .phar and .php file uploads

# For Apache: Add to .htaccess
<FilesMatch "\.(phar|php)$">
    Order Allow,Deny
    Deny from all
</FilesMatch>
# For Nginx: Add to server block
location ~ \.(phar|php)$ {
    deny all;
}

Disable admin upload functionality

linux

Remove or disable the vulnerable upload feature

# Remove or rename the upload script
mv /path/to/tinywebgallery/admin/upload.php /path/to/tinywebgallery/admin/upload.php.disabled

🧯 If You Can't Patch

  • Implement strict file upload validation that only allows image file extensions (jpg, png, gif)
  • Place the application behind a web application firewall (WAF) with file upload protection rules

🔍 How to Verify

Check if Vulnerable:

Check if running TinyWebGallery v2.5 by examining version files or configuration. Test if unauthenticated file upload of .phar files is possible.

Check Version:

grep -r 'version\|Version' /path/to/tinywebgallery/ | grep -i '2\.5'

Verify Fix Applied:

Attempt to upload a .phar file to the admin upload endpoint. If the upload is blocked or the file cannot be executed, the workaround is effective.

📡 Detection & Monitoring

Log Indicators:

  • Unusual file uploads to admin endpoints
  • .phar or .php files being uploaded from unexpected IPs
  • POST requests to upload.php with suspicious filenames

Network Indicators:

  • HTTP POST requests to /admin/upload.php with .phar files
  • Subsequent requests to uploaded .phar files

SIEM Query:

source="web_logs" AND (uri_path="/admin/upload.php" AND file_extension IN ("phar", "php"))

🔗 References

📤 Share & Export