mongo_fdw versions prior to 5.6.0 construct the mongodb:// connection URI by inserting option values without percent-encoding. This allows URI metacharacters in option values to be interpreted as part of the URI structure, enabling a non-superuser role with USAGE on a foreign server to manipulate connection parameters. Such manipulation can redirect connections to attacker-controlled hosts, potentially leading to credential capture and man-in-the-middle attacks. The vulnerability is fixed in mongo_fdw 5.6.0 by using the libmongoc URI API, which properly encodes credentials and rejects metacharacters in other options.