forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit62aba76
committed
Prevent indirect security attacks via changing session-local state within
an allegedly immutable index function. It was previously recognized thatwe had to prevent such a function from executing SET/RESET ROLE/SESSIONAUTHORIZATION, or it could trivially obtain the privileges of the sessionuser. However, since there is in general no privilege checking for changesof session-local state, it is also possible for such a function to changesettings in a way that might subvert later operations in the same session.Examples include changing search_path to cause an unexpected function tobe called, or replacing an existing prepared statement with another onethat will execute a function of the attacker's choosing.The present patch secures VACUUM, ANALYZE, and CREATE INDEX/REINDEX againstthese threats, which are the same places previously deemed to need protectionagainst the SET ROLE issue. GUC changes are still allowed, since there aremany useful cases for that, but we prevent security problems by forcing arollback of any GUC change after completing the operation. Other cases arehandled by throwing an error if any change is attempted; these include temptable creation, closing a cursor, and creating or deleting a preparedstatement. (In 7.4, the infrastructure to roll back GUC changes doesn'texist, so we settle for rejecting changes of "search_path" in these contexts.)Original report and patch by Gurjeet Singh, additional analysis byTom Lane.Security:CVE-2009-41361 parent7aeaa97 commit62aba76
File tree
14 files changed
+273
-104
lines changed- src
- backend
- access/transam
- catalog
- commands
- executor
- tcop
- utils
- adt
- fmgr
- init
- misc
- include
- utils
14 files changed
+273
-104
lines changedLines changed: 10 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
137 | 137 |
| |
138 | 138 |
| |
139 | 139 |
| |
140 |
| - | |
| 140 | + | |
141 | 141 |
| |
142 | 142 |
| |
143 | 143 |
| |
| |||
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
168 |
| - | |
| 168 | + | |
169 | 169 |
| |
170 | 170 |
| |
171 | 171 |
| |
| |||
1522 | 1522 |
| |
1523 | 1523 |
| |
1524 | 1524 |
| |
1525 |
| - | |
1526 |
| - | |
1527 |
| - | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
1528 | 1528 |
| |
1529 | 1529 |
| |
1530 | 1530 |
| |
| |||
2014 | 2014 |
| |
2015 | 2015 |
| |
2016 | 2016 |
| |
2017 |
| - | |
| 2017 | + | |
2018 | 2018 |
| |
2019 | 2019 |
| |
2020 | 2020 |
| |
2021 | 2021 |
| |
2022 | 2022 |
| |
2023 |
| - | |
| 2023 | + | |
2024 | 2024 |
| |
2025 | 2025 |
| |
2026 | 2026 |
| |
| |||
3860 | 3860 |
| |
3861 | 3861 |
| |
3862 | 3862 |
| |
3863 |
| - | |
| 3863 | + | |
3864 | 3864 |
| |
3865 | 3865 |
| |
3866 | 3866 |
| |
| |||
4000 | 4000 |
| |
4001 | 4001 |
| |
4002 | 4002 |
| |
4003 |
| - | |
| 4003 | + | |
4004 | 4004 |
| |
4005 | 4005 |
| |
4006 | 4006 |
| |
|
Lines changed: 28 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
| 61 | + | |
61 | 62 |
| |
62 | 63 |
| |
63 | 64 |
| |
| |||
1481 | 1482 |
| |
1482 | 1483 |
| |
1483 | 1484 |
| |
1484 |
| - | |
| 1485 | + | |
| 1486 | + | |
1485 | 1487 |
| |
1486 | 1488 |
| |
1487 | 1489 |
| |
| |||
1494 | 1496 |
| |
1495 | 1497 |
| |
1496 | 1498 |
| |
1497 |
| - | |
| 1499 | + | |
| 1500 | + | |
1498 | 1501 |
| |
1499 |
| - | |
1500 |
| - | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
1501 | 1506 |
| |
1502 | 1507 |
| |
1503 | 1508 |
| |
| |||
1516 | 1521 |
| |
1517 | 1522 |
| |
1518 | 1523 |
| |
1519 |
| - | |
1520 |
| - | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
1521 | 1529 |
| |
1522 | 1530 |
| |
1523 | 1531 |
| |
| |||
2126 | 2134 |
| |
2127 | 2135 |
| |
2128 | 2136 |
| |
2129 |
| - | |
| 2137 | + | |
| 2138 | + | |
2130 | 2139 |
| |
2131 | 2140 |
| |
2132 | 2141 |
| |
| |||
2145 | 2154 |
| |
2146 | 2155 |
| |
2147 | 2156 |
| |
2148 |
| - | |
| 2157 | + | |
| 2158 | + | |
2149 | 2159 |
| |
2150 |
| - | |
2151 |
| - | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
2152 | 2164 |
| |
2153 | 2165 |
| |
2154 | 2166 |
| |
| |||
2189 | 2201 |
| |
2190 | 2202 |
| |
2191 | 2203 |
| |
2192 |
| - | |
2193 |
| - | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
2194 | 2209 |
| |
2195 | 2210 |
| |
2196 | 2211 |
| |
|
Lines changed: 15 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
| 41 | + | |
41 | 42 |
| |
42 | 43 |
| |
43 | 44 |
| |
| |||
133 | 134 |
| |
134 | 135 |
| |
135 | 136 |
| |
136 |
| - | |
| 137 | + | |
| 138 | + | |
137 | 139 |
| |
138 | 140 |
| |
139 | 141 |
| |
| |||
235 | 237 |
| |
236 | 238 |
| |
237 | 239 |
| |
238 |
| - | |
| 240 | + | |
| 241 | + | |
239 | 242 |
| |
240 |
| - | |
241 |
| - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
242 | 247 |
| |
243 | 248 |
| |
244 | 249 |
| |
| |||
548 | 553 |
| |
549 | 554 |
| |
550 | 555 |
| |
551 |
| - | |
552 |
| - | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
553 | 561 |
| |
554 | 562 |
| |
555 | 563 |
| |
|
Lines changed: 7 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
51 |
| - | |
| 51 | + | |
52 | 52 |
| |
53 | 53 |
| |
54 |
| - | |
| 54 | + | |
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
| |||
91 | 91 |
| |
92 | 92 |
| |
93 | 93 |
| |
94 |
| - | |
| 94 | + | |
| 95 | + | |
95 | 96 |
| |
96 | 97 |
| |
97 | 98 |
| |
| |||
142 | 143 |
| |
143 | 144 |
| |
144 | 145 |
| |
145 |
| - | |
146 |
| - | |
| 146 | + | |
| 147 | + | |
147 | 148 |
| |
148 | 149 |
| |
149 | 150 |
| |
|
Lines changed: 11 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
378 | 378 |
| |
379 | 379 |
| |
380 | 380 |
| |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
381 | 391 |
| |
382 | 392 |
| |
383 | 393 |
| |
|
Lines changed: 16 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
16 |
| - | |
| 16 | + | |
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
| |||
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
| 50 | + | |
50 | 51 |
| |
51 | 52 |
| |
52 | 53 |
| |
| |||
1033 | 1034 |
| |
1034 | 1035 |
| |
1035 | 1036 |
| |
1036 |
| - | |
| 1037 | + | |
| 1038 | + | |
1037 | 1039 |
| |
1038 | 1040 |
| |
1039 | 1041 |
| |
| |||
1192 | 1194 |
| |
1193 | 1195 |
| |
1194 | 1196 |
| |
1195 |
| - | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
1196 | 1200 |
| |
1197 |
| - | |
1198 |
| - | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
1199 | 1205 |
| |
1200 | 1206 |
| |
1201 | 1207 |
| |
| |||
1205 | 1211 |
| |
1206 | 1212 |
| |
1207 | 1213 |
| |
1208 |
| - | |
1209 |
| - | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
1210 | 1219 |
| |
1211 | 1220 |
| |
1212 | 1221 |
| |
|
Lines changed: 16 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
| 29 | + | |
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
| |||
2067 | 2067 |
| |
2068 | 2068 |
| |
2069 | 2069 |
| |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
2070 | 2075 |
| |
2071 | 2076 |
| |
2072 | 2077 |
| |
| |||
2075 | 2080 |
| |
2076 | 2081 |
| |
2077 | 2082 |
| |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
2078 | 2093 |
| |
2079 | 2094 |
| |
2080 | 2095 |
| |
|
0 commit comments
Comments
(0)