Rapid7 Vulnerability & Exploit Database

pgAdmin Session Deserialization RCE

Back to Search

pgAdmin Session Deserialization RCE

Disclosed
03/04/2024
Created
04/17/2024

Description

pgAdmin versions <= 8.3 have a path traversal vulnerability within their session management logic that can allow a pickled file to be loaded from an arbitrary location. This can be used to load a malicious, serialized Python object to execute code within the context of the target application. This exploit supports two techniques by which the payload can be loaded, depending on whether or not credentials are specified. If valid credentials are provided, Metasploit will login to pgAdmin and upload a payload object using pgAdmin's file management plugin. Once uploaded, this payload is executed via the path traversal before being deleted using the file management plugin. This technique works for both Linux and Windows targets. If no credentials are provided, Metasploit will start an SMB server and attempt to trigger loading the payload via a UNC path. This technique only works for Windows targets. For Windows 10 v1709 (Redstone 3) and later, it also requires that insecure outbound guest access be enabled. Tested on pgAdmin 8.3 on Linux, 7.7 on Linux, 7.0 on Linux, and 8.3 on Windows. The file management plugin underwent changes in the 6.x versions and therefor, pgAdmin versions < 7.0 can not utilize the authenticated technique whereby a payload is uploaded.

Author(s)

  • Spencer McIntyre
  • Davide Silvetti
  • Abdel Adim Oisfi

Platform

Python

Architectures

python

Development

Module Options

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_session_deserialization
msf exploit(pgadmin_session_deserialization) > show targets
    ...targets...
msf exploit(pgadmin_session_deserialization) > set TARGET < target-id >
msf exploit(pgadmin_session_deserialization) > show options
    ...show and set options...
msf exploit(pgadmin_session_deserialization) > 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

;