forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit17fe279
committed
Fix insecure parsing of server command-line switches.
An oversight in commite710b65 alloweddatabase names beginning with "-" to be treated as though they were securecommand-line switches; and this switch processing occurs before clientauthentication, so that even an unprivileged remote attacker could exploitthe bug, needing only connectivity to the postmaster's port. Assortedexploits for this are possible, some requiring a valid database login,some not. The worst known problem is that the "-r" switch can be invokedto redirect the process's stderr output, so that subsequent error messageswill be appended to any file the server can write. This can for example beused to corrupt the server's configuration files, so that it will fail whennext restarted. Complete destruction of database tables is also possible.Fix by keeping the database name extracted from a startup packet fullyseparate from command-line switches, as had already been done with theuser name field.The Postgres project thanks Mitsumasa Kondo for discovering this bug,Kyotaro Horiguchi for drafting the fix, and Noah Misch for recognizingthe full extent of the danger.Security:CVE-2013-18991 parentce9ab88 commit17fe279
File tree
5 files changed
+32
-32
lines changed- src
- backend
- main
- postmaster
- tcop
- utils/init
- include/tcop
5 files changed
+32
-32
lines changedLines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
189 | 189 |
| |
190 | 190 |
| |
191 | 191 |
| |
192 |
| - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
193 | 195 |
| |
194 | 196 |
| |
195 | 197 |
| |
|
Lines changed: 2 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3943 | 3943 |
| |
3944 | 3944 |
| |
3945 | 3945 |
| |
3946 |
| - | |
| 3946 | + | |
3947 | 3947 |
| |
3948 | 3948 |
| |
3949 | 3949 |
| |
| |||
3959 | 3959 |
| |
3960 | 3960 |
| |
3961 | 3961 |
| |
3962 |
| - | |
3963 |
| - | |
3964 |
| - | |
3965 |
| - | |
3966 |
| - | |
3967 | 3962 |
| |
3968 | 3963 |
| |
3969 | 3964 |
| |
| |||
3986 | 3981 |
| |
3987 | 3982 |
| |
3988 | 3983 |
| |
3989 |
| - | |
| 3984 | + | |
3990 | 3985 |
| |
3991 | 3986 |
| |
3992 | 3987 |
| |
|
Lines changed: 21 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3247 | 3247 |
| |
3248 | 3248 |
| |
3249 | 3249 |
| |
3250 |
| - | |
| 3250 | + | |
| 3251 | + | |
3251 | 3252 |
| |
3252 | 3253 |
| |
3253 |
| - | |
3254 |
| - | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
3255 | 3257 |
| |
3256 |
| - | |
3257 | 3258 |
| |
3258 | 3259 |
| |
3259 | 3260 |
| |
| |||
3304 | 3305 |
| |
3305 | 3306 |
| |
3306 | 3307 |
| |
3307 |
| - | |
| 3308 | + | |
| 3309 | + | |
3308 | 3310 |
| |
3309 | 3311 |
| |
3310 | 3312 |
| |
| |||
3321 | 3323 |
| |
3322 | 3324 |
| |
3323 | 3325 |
| |
3324 |
| - | |
| 3326 | + | |
| 3327 | + | |
3325 | 3328 |
| |
3326 | 3329 |
| |
3327 | 3330 |
| |
| |||
3346 | 3349 |
| |
3347 | 3350 |
| |
3348 | 3351 |
| |
3349 |
| - | |
| 3352 | + | |
| 3353 | + | |
3350 | 3354 |
| |
3351 | 3355 |
| |
3352 | 3356 |
| |
| |||
3464 | 3468 |
| |
3465 | 3469 |
| |
3466 | 3470 |
| |
3467 |
| - | |
3468 |
| - | |
| 3471 | + | |
3469 | 3472 |
| |
3470 |
| - | |
3471 |
| - | |
3472 |
| - | |
3473 |
| - | |
| 3473 | + | |
| 3474 | + | |
3474 | 3475 |
| |
3475 | 3476 |
| |
3476 | 3477 |
| |
| |||
3499 | 3500 |
| |
3500 | 3501 |
| |
3501 | 3502 |
| |
3502 |
| - | |
3503 |
| - | |
3504 | 3503 |
| |
3505 | 3504 |
| |
3506 | 3505 |
| |
| |||
3510 | 3509 |
| |
3511 | 3510 |
| |
3512 | 3511 |
| |
3513 |
| - | |
3514 |
| - | |
| 3512 | + | |
| 3513 | + | |
| 3514 | + | |
3515 | 3515 |
| |
3516 | 3516 |
| |
3517 | 3517 |
| |
3518 |
| - | |
| 3518 | + | |
| 3519 | + | |
| 3520 | + | |
3519 | 3521 |
| |
3520 |
| - | |
3521 | 3522 |
| |
3522 | 3523 |
| |
3523 | 3524 |
| |
| |||
3564 | 3565 |
| |
3565 | 3566 |
| |
3566 | 3567 |
| |
3567 |
| - | |
| 3568 | + | |
3568 | 3569 |
| |
3569 | 3570 |
| |
3570 | 3571 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
969 | 969 |
| |
970 | 970 |
| |
971 | 971 |
| |
972 |
| - | |
| 972 | + | |
973 | 973 |
| |
974 | 974 |
| |
975 | 975 |
| |
|
Lines changed: 5 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
72 |
| - | |
73 |
| - | |
74 |
| - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
75 | 77 |
| |
76 | 78 |
| |
77 | 79 |
| |
|
0 commit comments
Comments
(0)