CVE-2024-42558

9.8 CRITICAL

📋 TL;DR

This SQL injection vulnerability in Hotel Management System allows attackers to execute arbitrary SQL commands through the book_id parameter in admin_modify_room.php. This can lead to data theft, modification, or deletion, affecting all systems running the vulnerable commit.

💻 Affected Systems

Products:
  • Hotel Management System
Versions: Commit 91caab8 and potentially earlier versions
Operating Systems: All platforms running PHP with database backend
Default Config Vulnerable: ⚠️ Yes
Notes: Specifically affects the admin_modify_room.php endpoint with book_id parameter.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise including credential theft, data destruction, and potential remote code execution via database functions.

🟠

Likely Case

Unauthorized data access, modification of booking records, and potential privilege escalation to administrative access.

🟢

If Mitigated

Limited impact with proper input validation and parameterized queries preventing SQL injection.

🌐 Internet-Facing: HIGH - The vulnerable endpoint is accessible via web interface and requires no authentication.
🏢 Internal Only: HIGH - Even internal systems are vulnerable to insider threats or compromised accounts.

🎯 Exploit Status

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

Proof of concept available in GitHub gist, simple SQL injection payloads work.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Unknown

Vendor Advisory: None available

Restart Required: No

Instructions:

1. Update to latest version if available. 2. Manually patch admin_modify_room.php to use parameterized queries. 3. Validate and sanitize book_id input.

🔧 Temporary Workarounds

Input Validation Filter

all

Add input validation to only accept numeric values for book_id parameter

Add: if(!is_numeric($_GET['book_id'])) { die('Invalid input'); }

Web Application Firewall Rule

all

Block SQL injection patterns at the WAF level

WAF rule: Block requests containing SQL keywords like UNION, SELECT, INSERT, DELETE in book_id parameter

🧯 If You Can't Patch

  • Restrict access to admin_modify_room.php using IP whitelisting or authentication
  • Implement database user with minimal privileges for the application

🔍 How to Verify

Check if Vulnerable:

Test with payload: admin_modify_room.php?book_id=1' OR '1'='1

Check Version:

Check git commit hash or version file if available

Verify Fix Applied:

Test with same payload - should return error or no data, not execute SQL

📡 Detection & Monitoring

Log Indicators:

  • SQL error messages in web logs
  • Unusual database queries from web application user
  • Multiple failed parameter validation attempts

Network Indicators:

  • HTTP requests with SQL keywords in book_id parameter
  • Unusual traffic patterns to admin_modify_room.php

SIEM Query:

source="web_logs" AND (uri="*admin_modify_room.php*" AND (param="*book_id=*'*" OR param="*book_id=*%27*" OR param="*book_id=*UNION*" OR param="*book_id=*SELECT*"))

🔗 References

📤 Share & Export