The vulnerability exists in the PLAIN restore functionality of pgAdmin4. It was introduced as a part of a fix for a previous vulnerability (CVE-2025-12762). The fix implemented a function has_meta_commands to scan for potentially dangerous psql meta-commands (like \\!) in a SQL file before executing a restore. However, this function reads the file in binary mode and uses a regular expression that does not correctly handle files starting with a UTF-8 Byte Order Mark (BOM). An attacker can craft a malicious SQL file with a BOM at the beginning, which causes the has_meta_commands check to be bypassed. The use_sql_utility function, which calls has_meta_commands, then proceeds with the restore operation, passing the file to the psql utility. psql correctly handles the BOM, strips it, and then executes the embedded malicious meta-commands, leading to remote command execution on the server where pgAdmin is running. The vulnerability was later fixed by removing the flawed has_meta_commands check and instead using the \\restrict option when calling psql, which is a more robust way to prevent meta-command execution.