forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5a9167c
committed
Run REFRESH MATERIALIZED VIEW CONCURRENTLY in right security context
The internal commands in REFRESH MATERIALIZED VIEW CONCURRENTLY arecorrectly executed in SECURITY_RESTRICTED_OPERATION mode, except forcreating the temporary "diff" table, because you cannot createtemporary tables in SRO mode. But creating the temporary "diff" tableis a pretty complex CTAS command that selects from another temporarytable created earlier in the command. If you can cajole that CTAScommand to execute code defined by the table owner, the table ownercan run code with the privileges of the user running the REFRESHcommand.The proof-of-concept reported to the security team relied on CREATERULE to convert the internally-built temp table to a view. That's notpossible since commitb23cd18, and I was not able to find adifferent way to turn the SELECT on the temp table into codeexecution, so as far as I know this is only exploitable in v15 andbelow. That's a fiddly assumption though, so apply this patch tomaster and all stable versions.Thanks to Pedro Gallegos for the report.Security:CVE-2023-5869Reviewed-by: Noah Misch1 parentdafbfed commit5a9167c
1 file changed
+26
-7
lines changedLines changed: 26 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
656 | 656 |
| |
657 | 657 |
| |
658 | 658 |
| |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
659 | 667 |
| |
660 | 668 |
| |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
661 | 683 |
| |
662 |
| - | |
| 684 | + | |
663 | 685 |
| |
664 | 686 |
| |
665 |
| - | |
| 687 | + | |
666 | 688 |
| |
667 | 689 |
| |
668 | 690 |
| |
| |||
788 | 810 |
| |
789 | 811 |
| |
790 | 812 |
| |
791 |
| - | |
792 |
| - | |
| 813 | + | |
| 814 | + | |
793 | 815 |
| |
794 | 816 |
| |
795 |
| - | |
796 |
| - | |
797 |
| - | |
798 | 817 |
| |
799 | 818 |
| |
800 | 819 |
| |
|
0 commit comments
Comments
(0)