PHP PDOException and Full Path Disclosure
The application passes an array to PDO::quote() instead of a string, causing a PHP warning and a PDOException that reveals the full server path and SQL query structure. An attacker could use this error information to learn about the application's file system and database schema.
Originally disclosed on HackerOne
- Fixed in 26 days
- Disclosed after 27 days
hi
in phrases on phrasemove or phraseChange action
- parameter phrasekey set to array like phraseChange[phraseKey][11]:test
pdo quote show error :
Warning: PDO::quote() expects parameter 1 to be string, array given in /srv/data/web/vhosts/www.localize.im/htdocs/classes/Database.php on line 30
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1' in /srv/data/web/vhosts/www.localize.im/htdocs/classes/Database.php:53 Stack trace: #0 /srv/data/web/vhosts/www.localize.im/htdocs/classes/Database.php(53): PDO->exec('UPDATE phrases ...') #1 /srv/data/web/vhosts/www.localize.im/htdocs/classes/Database.php(351): Database::update('UPDATE phrases ...') #2 /srv/data/web/vhosts/www.localize.im/htdocs/index.php(789): Database::setPhraseGroup(339, Array, '326') #3 {main} thrown in /srv/data/web/vhosts/www.localize.im/htdocs/classes/Database.php on line 53
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application does not validate that the 'phraseKey' parameter is a string before passing it to PDO::quote(), and error reporting is enabled, exposing internal paths and SQL.
Impact
An attacker could gather sensitive information about the server's file system and database structure, which may aid in further attacks; however, the error only occurs when a specific parameter is malformed and may not be exploitable in all configurations.
What the attacker needed
Access to the phraseChange action; ability to send array parameters
How it was found
- Send a request to the phraseChange action with the phraseKey parameter set as an array (e.g., phraseChange[phraseKey][11]=test).
- Observe the PHP warning and PDOException in the response, which disclose the full path and SQL query.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a web application sends data to a database, it should check that the data is the right type. Here, the application expected a single piece of text but received a list (an array), which caused an error. The error message accidentally showed the full file path on the server and part of the database query, which could help an attacker learn how the site is built.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.