Skip to main content
Menu
Advisories

pgjdbc does not enforce TLS for some ssl, service and DataSource settings

GHSA-3MRW-838H-X9J9Published Updated GitHub

Description

Some pgjdbc settings that ask for TLS with certificate checks connected with sslmode=prefer instead. An attacker on the network could then intercept the connection.

Details

When sslmode is not set, only ssl=true or an empty ssl gave verify-full. Values such as 1, on, yes or verify-full gave prefer from 42.2.5. From 9.4.1208 to 42.2.4 they gave no TLS at all.

A service given in the Properties of getConnection() was ignored without a warning. The sslmode of that pg_service.conf entry was lost.

BaseDataSource.setUrl() did not replace a property that was already set. A second setUrl(), or a setter followed by setUrl(), kept the earlier sslmode, channelBinding or gssEncMode.

Proof of concept

jdbc:postgresql://db.example.com/app?ssl=on
// The driver uses sslmode=prefer. A network attacker can refuse TLS or present any certificate.

Impact

An attacker on the network path can read and change the traffic of an affected connection. For some authentication methods this includes the password. The application must use one of the configurations above.

Affected versions

References

GitHub · pgjdbc/pgjdbc