Information disclosure: PDO exception messages expose database connection details to users #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Multiple files catch
PDOExceptionand immediately print the full exception message to the HTTP response:PDO exception messages include the DSN string used to establish the connection, which contains the database hostname, port, and database name.
Location
index.php, line 17message.php, line 49setup.php, line 16Risk
On any database connectivity error (wrong credentials, DB unreachable, misconfiguration), the server leaks the full connection string to whoever triggered the request. An attacker can use this to learn internal hostnames, network topology, and database names to plan further attacks.
Suggested fix direction
Log the full exception server-side (
error_log($e->getMessage())), and return only a generic user-facing message such as "A database error occurred. Please try again later."Severity
moderate
Found by
Automated audit by Claude Code