| From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
| Subject: | Adding a range check on the sequence index from the publisher. |
| Date: | 2026-09-21 19:51:26 |
| Message-ID: | CAD21AoBWDMuMmnevZaZ1xSOi75eUx8X7LbVQzmUZudk6F8Bdgg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi all,
(CCing Amit as the committer of this feature)
This was originally reported to pgsql-security by Anthropic OSS
program but the security team considered it as a non-vuln bug since
it's a v19-beta code, and I'm reporting here on behalf of them as it's
permitted now.
The reported problem is in sequencesync.c; the sequence
synchronization worker uses an integer that came back from the
publisher as a list subscript without checking it, and then writes
through the resulting pointer.
While it's not a problem in normal cases where the publisher is a
normal PostgreSQL, it could lead to out-of-bounds writes when the
publisher is a malicious server looking like a publisher.
Other fields that we get through get_and_validate_seq_info() could
also get the wrong value but they just show the wrong values rather
than OOB writes. So I think we need a safeguard only for seqidx.
I've attached the patch to fix it. Feedback is very welcome.
Regards,
--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Add-a-range-check-on-the-sequence-index-from-the-.patch | text/x-patch | 2.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Hannu Krosing | 2026-09-21 20:01:18 | Re: Direct TOAST v2, faster, smaller and no migration needed |
| Previous Message | Nathan Bossart | 2026-09-21 19:01:09 | Re: Teach pg_upgrade to deal with invalid databases |