Description
Deserialization of untrusted data (CWE-502) in pgAdmin 4 FileBackedSessionManager. The session manager performed unsafe deserialization of session-file contents (using Python's standard object-serialization module) before performing any HMAC integrity check. Any file dropped into the sessions directory was deserialized unconditionally. An authenticated user with write access to the sessions directory (whether by misconfiguration or in combination with another path-traversal flaw) could plant a crafted serialized payload to achieve operating-system level remote code execution under the pgAdmin process identity. Fix prepends a 64-byte hex SHA-256 HMAC over the session body, computed with SECRET_KEY, and verifies it via hmac.compare_digest before any deserialization. The check is raised (rather than asserted) on empty SECRET_KEY so it is not stripped under -O. This issue affects pgAdmin 4: before 9.15.
Authenticated pgAdmin user with prior write access to the sessions directory. Standalone exploitation requires this unusual prerequisite (sessions directory is normally writable only by the pgAdmin process). AV:L and AC:H reflect the chain dependency for non-local exploitation. S:U reflects that RCE in the pgAdmin process is the same security authority as the application itself.
Authenticated pgAdmin user with prior write access to the sessions directory. Standalone exploitation requires this unusual prerequisite (sessions directory is normally writable only by the pgAdmin process). AV:L and AC:H reflect the chain dependency for non-local exploitation. S:U reflects that RCE in the pgAdmin process is the same security authority as the application itself.
Product status
Any version before 9.15
Credits
Fernando Bortotti
References
github.com/pgadmin-org/pgadmin4/issues/9901