CVE-2020-18438

7.5 HIGH

📋 TL;DR

This directory traversal vulnerability in phpok 5.1 allows attackers to access sensitive files outside the intended directory via the title parameter in admin.php. It affects all installations of phpok 5.1, potentially exposing configuration files, credentials, and other sensitive data.

💻 Affected Systems

Products:
  • qinggan phpok
Versions: 5.1
Operating Systems: All operating systems running phpok
Default Config Vulnerable: ⚠️ Yes
Notes: All installations of phpok 5.1 are vulnerable by default. The vulnerability is in the admin.php file which is typically accessible.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise through disclosure of database credentials, configuration files, and sensitive application data leading to further attacks.

🟠

Likely Case

Disclosure of sensitive configuration files containing database credentials, API keys, and application secrets.

🟢

If Mitigated

Limited impact with proper file permissions and web server configurations preventing access to critical system files.

🌐 Internet-Facing: HIGH - Admin.php is typically accessible from the internet, allowing remote exploitation.
🏢 Internal Only: MEDIUM - Internal attackers could still exploit this to gain sensitive information about the application.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires access to admin.php, which typically requires authentication. However, if authentication is bypassed or weak credentials exist, exploitation becomes easier.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Versions after 5.1

Vendor Advisory: https://github.com/qinggan/phpok/issues/4

Restart Required: No

Instructions:

1. Upgrade phpok to version 5.2 or later. 2. Download the latest version from the official repository. 3. Replace the vulnerable files with patched versions. 4. Verify the fix by testing the title parameter.

🔧 Temporary Workarounds

Input Validation Filter

all

Add input validation to filter directory traversal sequences in the title parameter

Modify admin.php to include: if (strpos($_GET['title'], '..') !== false) { die('Invalid input'); }

Access Restriction

linux

Restrict access to admin.php to trusted IP addresses only

Add to .htaccess: Order Deny,Allow
Deny from all
Allow from 192.168.1.0/24

🧯 If You Can't Patch

  • Implement strict input validation to block directory traversal sequences in all user inputs
  • Restrict file permissions on sensitive configuration files and move them outside web root

🔍 How to Verify

Check if Vulnerable:

Test by accessing admin.php with a title parameter containing directory traversal sequences like '../../etc/passwd'

Check Version:

Check phpok version in configuration files or via phpinfo() if enabled

Verify Fix Applied:

Attempt the same directory traversal attack after patching - it should return an error or filtered response

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests to admin.php with '..' or '../' in parameters
  • Unusual file access patterns in web server logs

Network Indicators:

  • Multiple requests to admin.php with varying file paths in parameters
  • Requests attempting to access known sensitive files

SIEM Query:

source="web_logs" AND uri="*admin.php*" AND (param="*..*" OR param="*../*")

🔗 References

📤 Share & Export