The vulnerability exists because the AWS Advanced Go Wrapper for Amazon Aurora PostgreSQL constructs SQL queries without using fully qualified names for various PostgreSQL functions and operators. This allows a low-privilege authenticated user to create crafted functions with the same names in a different schema. If this schema is in the PostgreSQL search_path before the pg_catalog schema, the database will execute the user's malicious function instead of the intended system function. This can lead to privilege escalation, as the function may be executed with the permissions of a higher-privileged user, such as rds_superuser.
The patch addresses this by explicitly specifying the pg_catalog schema for all built-in PostgreSQL functions and operators used in the queries. This ensures that the correct, trusted functions are always executed, regardless of the search_path configuration.