Skip to content

Backport: Properly NULL-terminate GSS receive buffer on error packet reception#1498

Merged
reshke merged 4 commits intoapache:mainfrom
reshke:bp_CVE_2022_41862
Dec 23, 2025
Merged

Backport: Properly NULL-terminate GSS receive buffer on error packet reception#1498
reshke merged 4 commits intoapache:mainfrom
reshke:bp_CVE_2022_41862

Conversation

@reshke
Copy link
Copy Markdown
Contributor

@reshke reshke commented Dec 22, 2025

This pr fixes https://www.postgresql.org/support/security/CVE-2022-41862/ in cloudberry

https://git.postgresql.org/cgit/postgresql.git/commit/?id=71c37797d7bd78266146a5829ab62b3687c47295

Original commit message:

===

pqsecure_open_gss() includes a code path handling error messages with v2-style protocol messages coming from the server. The client-side buffer holding the error message does not force a NULL-termination, with the data of the server getting copied to the errorMessage of the connection. Hence, it would be possible for a server to send an unterminated string and copy arbitrary bytes in the buffer receiving the error message in the client, opening the door to a crash or even data exposure.

As at this stage of the authentication process the exchange has not been completed yet, this could be abused by an attacker without Kerberos credentials. Clients that have a valid kerberos cache are vulnerable as libpq opportunistically requests for it except if gssencmode is disabled.

Author: Jacob Champion
Backpatch-through: 12
Security: CVE-2022-41862

pqsecure_open_gss() includes a code path handling error messages with
v2-style protocol messages coming from the server.  The client-side
buffer holding the error message does not force a NULL-termination, with
the data of the server getting copied to the errorMessage of the
connection.  Hence, it would be possible for a server to send an
unterminated string and copy arbitrary bytes in the buffer receiving the
error message in the client, opening the door to a crash or even data
exposure.

As at this stage of the authentication process the exchange has not been
completed yet, this could be abused by an attacker without Kerberos
credentials.  Clients that have a valid kerberos cache are vulnerable as
libpq opportunistically requests for it except if gssencmode is
disabled.

Author: Jacob Champion
Backpatch-through: 12
Security: CVE-2022-41862
@reshke reshke changed the title Properly NULL-terminate GSS receive buffer on error packet reception Backport: Properly NULL-terminate GSS receive buffer on error packet reception Dec 22, 2025
@reshke reshke added the type: Security Vulnerability disclosure or Fixing security issue label Dec 23, 2025
@reshke reshke merged commit 68e5248 into apache:main Dec 23, 2025
229 of 238 checks passed
reshke added a commit to open-gpdb/cloudberry that referenced this pull request Dec 24, 2025
…reception (apache#1498)

This pr fixes https://www.postgresql.org/support/security/CVE-2022-41862/ in cloudberry


https://git.postgresql.org/cgit/postgresql.git/commit/?id=71c37797d7bd78266146a5829ab62b3687c47295


Original commit message:

===

pqsecure_open_gss() includes a code path handling error messages with v2-style protocol messages coming from the server.  The client-side buffer holding the error message does not force a NULL-termination, with the data of the server getting copied to the errorMessage of the connection.  Hence, it would be possible for a server to send an unterminated string and copy arbitrary bytes in the buffer receiving the error message in the client, opening the door to a crash or even data exposure.

As at this stage of the authentication process the exchange has not been completed yet, this could be abused by an attacker without Kerberos credentials.  Clients that have a valid kerberos cache are vulnerable as libpq opportunistically requests for it except if gssencmode is disabled.

Author: Jacob Champion
Backpatch-through: 12
Security: CVE-2022-41862
hw118118 pushed a commit to hw118118/cloudberrydb that referenced this pull request Jan 27, 2026
…reception (apache#1498)

This pr fixes https://www.postgresql.org/support/security/CVE-2022-41862/ in cloudberry


https://git.postgresql.org/cgit/postgresql.git/commit/?id=71c37797d7bd78266146a5829ab62b3687c47295


Original commit message:

===

pqsecure_open_gss() includes a code path handling error messages with v2-style protocol messages coming from the server.  The client-side buffer holding the error message does not force a NULL-termination, with the data of the server getting copied to the errorMessage of the connection.  Hence, it would be possible for a server to send an unterminated string and copy arbitrary bytes in the buffer receiving the error message in the client, opening the door to a crash or even data exposure.

As at this stage of the authentication process the exchange has not been completed yet, this could be abused by an attacker without Kerberos credentials.  Clients that have a valid kerberos cache are vulnerable as libpq opportunistically requests for it except if gssencmode is disabled.

Author: Jacob Champion
Backpatch-through: 12
Security: CVE-2022-41862
hw118118 pushed a commit to hw118118/cloudberrydb that referenced this pull request Jan 27, 2026
…reception (apache#1498)

This pr fixes https://www.postgresql.org/support/security/CVE-2022-41862/ in cloudberry


https://git.postgresql.org/cgit/postgresql.git/commit/?id=71c37797d7bd78266146a5829ab62b3687c47295


Original commit message:

===

pqsecure_open_gss() includes a code path handling error messages with v2-style protocol messages coming from the server.  The client-side buffer holding the error message does not force a NULL-termination, with the data of the server getting copied to the errorMessage of the connection.  Hence, it would be possible for a server to send an unterminated string and copy arbitrary bytes in the buffer receiving the error message in the client, opening the door to a crash or even data exposure.

As at this stage of the authentication process the exchange has not been completed yet, this could be abused by an attacker without Kerberos credentials.  Clients that have a valid kerberos cache are vulnerable as libpq opportunistically requests for it except if gssencmode is disabled.

Author: Jacob Champion
Backpatch-through: 12
Security: CVE-2022-41862
hw118118 pushed a commit to hw118118/cloudberrydb that referenced this pull request Jan 28, 2026
…reception (apache#1498)

This pr fixes https://www.postgresql.org/support/security/CVE-2022-41862/ in cloudberry


https://git.postgresql.org/cgit/postgresql.git/commit/?id=71c37797d7bd78266146a5829ab62b3687c47295


Original commit message:

===

pqsecure_open_gss() includes a code path handling error messages with v2-style protocol messages coming from the server.  The client-side buffer holding the error message does not force a NULL-termination, with the data of the server getting copied to the errorMessage of the connection.  Hence, it would be possible for a server to send an unterminated string and copy arbitrary bytes in the buffer receiving the error message in the client, opening the door to a crash or even data exposure.

As at this stage of the authentication process the exchange has not been completed yet, this could be abused by an attacker without Kerberos credentials.  Clients that have a valid kerberos cache are vulnerable as libpq opportunistically requests for it except if gssencmode is disabled.

Author: Jacob Champion
Backpatch-through: 12
Security: CVE-2022-41862
oppenheimer01 pushed a commit to oppenheimer01/cloudberrydb that referenced this pull request Apr 12, 2026
…reception (apache#1498)

This pr fixes https://www.postgresql.org/support/security/CVE-2022-41862/ in cloudberry

https://git.postgresql.org/cgit/postgresql.git/commit/?id=71c37797d7bd78266146a5829ab62b3687c47295

Original commit message:

===

pqsecure_open_gss() includes a code path handling error messages with v2-style protocol messages coming from the server.  The client-side buffer holding the error message does not force a NULL-termination, with the data of the server getting copied to the errorMessage of the connection.  Hence, it would be possible for a server to send an unterminated string and copy arbitrary bytes in the buffer receiving the error message in the client, opening the door to a crash or even data exposure.

As at this stage of the authentication process the exchange has not been completed yet, this could be abused by an attacker without Kerberos credentials.  Clients that have a valid kerberos cache are vulnerable as libpq opportunistically requests for it except if gssencmode is disabled.

Author: Jacob Champion
Backpatch-through: 12
Security: CVE-2022-41862
oppenheimer01 pushed a commit to oppenheimer01/cloudberrydb that referenced this pull request Apr 21, 2026
…reception (apache#1498)

This pr fixes https://www.postgresql.org/support/security/CVE-2022-41862/ in cloudberry

https://git.postgresql.org/cgit/postgresql.git/commit/?id=71c37797d7bd78266146a5829ab62b3687c47295

Original commit message:

===

pqsecure_open_gss() includes a code path handling error messages with v2-style protocol messages coming from the server.  The client-side buffer holding the error message does not force a NULL-termination, with the data of the server getting copied to the errorMessage of the connection.  Hence, it would be possible for a server to send an unterminated string and copy arbitrary bytes in the buffer receiving the error message in the client, opening the door to a crash or even data exposure.

As at this stage of the authentication process the exchange has not been completed yet, this could be abused by an attacker without Kerberos credentials.  Clients that have a valid kerberos cache are vulnerable as libpq opportunistically requests for it except if gssencmode is disabled.

Author: Jacob Champion
Backpatch-through: 12
Security: CVE-2022-41862
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: Backport type: Security Vulnerability disclosure or Fixing security issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants