CVE-2020-18662

9.8 CRITICAL

📋 TL;DR

This CVE describes a SQL injection vulnerability in gnuboard5's installation script that allows attackers to execute arbitrary SQL commands via the table_prefix parameter. It affects gnuboard5 installations up to version 5.3.2.8 during the installation process. Attackers can exploit this to compromise the database and potentially gain control of the application.

💻 Affected Systems

Products:
  • gnuboard5
Versions: All versions <= 5.3.2.8
Operating Systems: Any OS running PHP and MySQL/MariaDB
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable during installation process when install_db.php is accessible. Risk reduces after installation if script is properly removed.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise allowing data theft, data manipulation, and potential remote code execution through database functions.

🟠

Likely Case

Database information disclosure, privilege escalation, and installation of backdoors in the gnuboard5 system.

🟢

If Mitigated

No impact if installation is completed and vulnerable file removed, or if input validation prevents exploitation.

🌐 Internet-Facing: HIGH - The install_db.php script is typically accessible during installation and can be targeted remotely.
🏢 Internal Only: MEDIUM - Lower risk if installation is completed quickly and script removed, but still vulnerable during setup.

🎯 Exploit Status

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

Simple SQL injection via GET/POST parameter. Exploitation requires access to install_db.php during installation phase.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: v5.3.2.9 and later

Vendor Advisory: https://github.com/gnuboard/gnuboard5/issues/43

Restart Required: No

Instructions:

1. Upgrade gnuboard5 to version 5.3.2.9 or later. 2. Delete install_db.php after installation if still present. 3. Verify the fix by checking that table_prefix parameter is properly sanitized.

🔧 Temporary Workarounds

Remove installation script

linux

Delete or restrict access to install_db.php after installation completes

rm -f install_db.php
chmod 000 install_db.php

Input validation workaround

all

Add parameter validation to table_prefix input before database operations

Edit install_db.php to add: if(!preg_match('/^[a-zA-Z0-9_]+$/', $table_prefix)) { die('Invalid table prefix'); }

🧯 If You Can't Patch

  • Ensure install_db.php is deleted or inaccessible after installation completes
  • Implement web application firewall rules to block SQL injection patterns targeting the table_prefix parameter

🔍 How to Verify

Check if Vulnerable:

Check if install_db.php exists and is accessible, and gnuboard5 version is <= 5.3.2.8

Check Version:

Check config.php or common.php for version information, or use: grep -r 'G5_VERSION' .

Verify Fix Applied:

Verify gnuboard5 version is >= 5.3.2.9 and install_db.php is either patched or removed

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL queries during installation
  • Multiple requests to install_db.php with SQL-like parameters
  • Database errors containing SQL syntax

Network Indicators:

  • HTTP requests to install_db.php with SQL injection payloads in table_prefix parameter
  • Unusual database connections from web server

SIEM Query:

source="web_logs" AND uri="/install_db.php" AND (table_prefix CONTAINS "'" OR table_prefix CONTAINS "--" OR table_prefix CONTAINS ";")

🔗 References

📤 Share & Export