This module exploits a vulnerability in pgAdmin where an authenticated user can establish a connection to the query tool and send a specific payload in the query_commited POST parameter. This payload is directly executed via a Python eval() statement, resulting in remote code execution in versions prior to 9.2. To exploit this vulnerability, pgAdmin credentials are required. Additionally, in order to interact with the vulnerable SQL editor component, valid database credentials are necessary to initialize a session and obtain a transaction ID, which is required for the exploit.
Python
python
To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':
msf > use exploit/multi/http/pgadmin_query_tool_authenticated
msf exploit(pgadmin_query_tool_authenticated) > show targets
...targets...
msf exploit(pgadmin_query_tool_authenticated) > set TARGET < target-id >
msf exploit(pgadmin_query_tool_authenticated) > show options
...show and set options...
msf exploit(pgadmin_query_tool_authenticated) > exploit
Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.
– Jim O’Gorman | President, Offensive Security