forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitbf6b9e9
committed
Don't allow logging in with empty password.
Some authentication methods allowed it, others did not. In the client-side,libpq does not even try to authenticate with an empty password, which makesusing empty passwords hazardous: an administrator might think that anaccount with an empty password cannot be used to log in, because psqldoesn't allow it, and not realize that a different client would in factallow it. To clear that confusion and to be be consistent, disallow emptypasswords in all authentication methods.All the authentication methods that used plaintext authentication over thewire, except for BSD authentication, already checked that the passwordreceived from the user was not empty. To avoid forgetting it in the futureagain, move the check to the recv_password_packet function. That onlyforbids using an empty password with plaintext authentication, however.MD5 and SCRAM need a different fix:* In stable branches, check that the MD5 hash stored for the user does notnot correspond to an empty string. This adds some overhead to MD5authentication, because the server needs to compute an extra MD5 hash, butit is not noticeable in practice.* In HEAD, modify CREATE and ALTER ROLE to clear the password if an emptystring, or a password hash that corresponds to an empty string, isspecified. The user-visible behavior is the same as in the stable branches,the user cannot log in, but it seems better to stop the empty password fromentering the system in the first place. Secondly, it is fairly expensive tocheck that a SCRAM hash doesn't correspond to an empty string, becausecomputing a SCRAM hash is much more expensive than an MD5 hash by design,so better avoid doing that on every authentication.We could clear the password on CREATE/ALTER ROLE also in stable branches,but we would still need to check at authentication time, because even if weprevent empty passwords from being stored in pg_authid, there might beexisting ones there already.Reported by Jeroen van der Ham, Ben de Graaff and Jelte Fennema.Security:CVE-2017-75461 parent86524f0 commitbf6b9e9
File tree
6 files changed
+117
-38
lines changed- doc/src/sgml/ref
- src
- backend
- commands
- libpq
- test/regress
- expected
- sql
6 files changed
+117
-38
lines changedLines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
219 | 219 |
| |
220 | 220 |
| |
221 | 221 |
| |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
222 | 233 |
| |
223 | 234 |
| |
224 | 235 |
| |
|
Lines changed: 45 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
384 | 384 |
| |
385 | 385 |
| |
386 | 386 |
| |
387 |
| - | |
388 | 387 |
| |
| 388 | + | |
389 | 389 |
| |
390 |
| - | |
391 |
| - | |
392 |
| - | |
393 |
| - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
394 | 417 |
| |
395 | 418 |
| |
396 | 419 |
| |
| |||
782 | 805 |
| |
783 | 806 |
| |
784 | 807 |
| |
785 |
| - | |
786 | 808 |
| |
| 809 | + | |
787 | 810 |
| |
788 |
| - | |
789 |
| - | |
790 |
| - | |
791 |
| - | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
792 | 827 |
| |
793 | 828 |
| |
794 | 829 |
| |
|
Lines changed: 40 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
688 | 688 |
| |
689 | 689 |
| |
690 | 690 |
| |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
691 | 709 |
| |
692 | 710 |
| |
693 | 711 |
| |
| |||
2081 | 2099 |
| |
2082 | 2100 |
| |
2083 | 2101 |
| |
2084 |
| - | |
2085 |
| - | |
2086 |
| - | |
2087 |
| - | |
2088 |
| - | |
2089 |
| - | |
2090 | 2102 |
| |
2091 | 2103 |
| |
2092 | 2104 |
| |
| |||
2277 | 2289 |
| |
2278 | 2290 |
| |
2279 | 2291 |
| |
| 2292 | + | |
| 2293 | + | |
2280 | 2294 |
| |
2281 | 2295 |
| |
2282 | 2296 |
| |
| |||
2407 | 2421 |
| |
2408 | 2422 |
| |
2409 | 2423 |
| |
2410 |
| - | |
2411 |
| - | |
2412 |
| - | |
2413 |
| - | |
2414 |
| - | |
2415 |
| - | |
2416 |
| - | |
2417 | 2424 |
| |
| 2425 | + | |
2418 | 2426 |
| |
| 2427 | + | |
2419 | 2428 |
| |
| 2429 | + | |
2420 | 2430 |
| |
2421 | 2431 |
| |
2422 | 2432 |
| |
| |||
2448 | 2458 |
| |
2449 | 2459 |
| |
2450 | 2460 |
| |
| 2461 | + | |
2451 | 2462 |
| |
2452 | 2463 |
| |
2453 | 2464 |
| |
| |||
2464 | 2475 |
| |
2465 | 2476 |
| |
2466 | 2477 |
| |
| 2478 | + | |
2467 | 2479 |
| |
2468 | 2480 |
| |
2469 | 2481 |
| |
| |||
2488 | 2500 |
| |
2489 | 2501 |
| |
2490 | 2502 |
| |
| 2503 | + | |
2491 | 2504 |
| |
2492 | 2505 |
| |
2493 | 2506 |
| |
| |||
2508 | 2521 |
| |
2509 | 2522 |
| |
2510 | 2523 |
| |
| 2524 | + | |
2511 | 2525 |
| |
2512 | 2526 |
| |
2513 | 2527 |
| |
| |||
2523 | 2537 |
| |
2524 | 2538 |
| |
2525 | 2539 |
| |
| 2540 | + | |
2526 | 2541 |
| |
2527 | 2542 |
| |
2528 | 2543 |
| |
| |||
2543 | 2558 |
| |
2544 | 2559 |
| |
2545 | 2560 |
| |
| 2561 | + | |
2546 | 2562 |
| |
2547 | 2563 |
| |
2548 | 2564 |
| |
| |||
2553 | 2569 |
| |
2554 | 2570 |
| |
2555 | 2571 |
| |
| 2572 | + | |
2556 | 2573 |
| |
2557 | 2574 |
| |
2558 | 2575 |
| |
| |||
2573 | 2590 |
| |
2574 | 2591 |
| |
2575 | 2592 |
| |
| 2593 | + | |
2576 | 2594 |
| |
2577 | 2595 |
| |
2578 | 2596 |
| |
2579 | 2597 |
| |
| 2598 | + | |
2580 | 2599 |
| |
2581 | 2600 |
| |
2582 | 2601 |
| |
| |||
2720 | 2739 |
| |
2721 | 2740 |
| |
2722 | 2741 |
| |
2723 |
| - | |
2724 |
| - | |
2725 |
| - | |
2726 |
| - | |
2727 |
| - | |
2728 |
| - | |
2729 |
| - | |
2730 | 2742 |
| |
2731 | 2743 |
| |
2732 | 2744 |
| |
2733 | 2745 |
| |
| 2746 | + | |
2734 | 2747 |
| |
2735 | 2748 |
| |
2736 | 2749 |
| |
| |||
2756 | 2769 |
| |
2757 | 2770 |
| |
2758 | 2771 |
| |
| 2772 | + | |
| 2773 | + | |
2759 | 2774 |
| |
| 2775 | + | |
2760 | 2776 |
| |
| 2777 | + | |
| 2778 | + | |
2761 | 2779 |
| |
| 2780 | + | |
2762 | 2781 |
| |
2763 | 2782 |
| |
2764 | 2783 |
| |
| |||
2775 | 2794 |
| |
2776 | 2795 |
| |
2777 | 2796 |
| |
| 2797 | + | |
2778 | 2798 |
| |
2779 | 2799 |
| |
2780 | 2800 |
| |
|
Lines changed: 0 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
71 | 71 |
| |
72 | 72 |
| |
73 | 73 |
| |
74 |
| - | |
75 |
| - | |
76 |
| - | |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
81 |
| - | |
82 | 74 |
| |
83 | 75 |
| |
84 | 76 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
75 | 75 |
| |
76 | 76 |
| |
77 | 77 |
| |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
78 | 91 |
| |
79 | 92 |
| |
80 | 93 |
| |
81 | 94 |
| |
82 | 95 |
| |
| 96 | + | |
83 | 97 |
| |
84 | 98 |
| |
85 | 99 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
62 | 68 |
| |
63 | 69 |
| |
64 | 70 |
| |
65 | 71 |
| |
66 | 72 |
| |
| 73 | + | |
67 | 74 |
| |
68 | 75 |
| |
69 | 76 |
| |
|
0 commit comments
Comments
(0)