forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit077711c
committed
Remove arbitrary limitation on length of common name in SSL certificates.
Both libpq and the backend would truncate a common name extracted from acertificate at 32 bytes. Replace that fixed-size buffer with dynamicallyallocated string so that there is no hard limit. While at it, remove thecode for extracting peer_dn, which we weren't using for anything; anddon't bother to store peer_cn longer than we need it in libpq.This limit was not so terribly unreasonable when the code was written,because we weren't using the result for anything critical, just logging it.But now that there are options for checking the common name against theserver host name (in libpq) or using it as the user's name (in the server),this could result in undesirable failures. In the worst case it even seemspossible to spoof a server name or user name, if the correct name isexactly 32 bytes and the attacker can persuade a trusted CA to issue acertificate in which that string is a prefix of the certificate's commonname. (To exploit this for a server name, he'd also have to send theconnection astray via phony DNS data or some such.) The case that this isa realistic security threat is a bit thin, but nonetheless we'll treat itas one.Back-patch to 8.4. Older releases contain the faulty code, but it's nota security problem because the common name wasn't used for anythinginteresting.Reported and patched by Heikki LinnakangasSecurity:CVE-2012-08671 parent891e6e7 commit077711c
File tree
4 files changed
+105
-65
lines changed- src
- backend/libpq
- include/libpq
- interfaces/libpq
4 files changed
+105
-65
lines changedLines changed: 38 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
73 | 73 |
| |
74 | 74 |
| |
75 | 75 |
| |
| 76 | + | |
76 | 77 |
| |
77 | 78 |
| |
78 | 79 |
| |
| |||
945 | 946 |
| |
946 | 947 |
| |
947 | 948 |
| |
948 |
| - | |
| 949 | + | |
949 | 950 |
| |
950 |
| - | |
951 |
| - | |
952 |
| - | |
953 |
| - | |
954 |
| - | |
955 |
| - | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
956 | 955 |
| |
957 |
| - | |
958 |
| - | |
959 |
| - | |
960 |
| - | |
961 |
| - | |
962 |
| - | |
963 |
| - | |
964 |
| - | |
965 |
| - | |
966 |
| - | |
967 |
| - | |
968 |
| - | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
969 | 961 |
| |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
970 | 976 |
| |
971 | 977 |
| |
972 | 978 |
| |
973 | 979 |
| |
974 |
| - | |
| 980 | + | |
975 | 981 |
| |
976 | 982 |
| |
977 | 983 |
| |
978 | 984 |
| |
| 985 | + | |
979 | 986 |
| |
980 | 987 |
| |
981 | 988 |
| |
| 989 | + | |
| 990 | + | |
982 | 991 |
| |
983 | 992 |
| |
| 993 | + | |
984 | 994 |
| |
985 |
| - | |
| 995 | + | |
| 996 | + | |
986 | 997 |
| |
987 | 998 |
| |
988 | 999 |
| |
| |||
1008 | 1019 |
| |
1009 | 1020 |
| |
1010 | 1021 |
| |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
1011 | 1028 |
| |
1012 | 1029 |
| |
1013 | 1030 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
175 | 175 |
| |
176 | 176 |
| |
177 | 177 |
| |
178 |
| - | |
179 |
| - | |
| 178 | + | |
180 | 179 |
| |
181 | 180 |
| |
182 | 181 |
| |
|
Lines changed: 66 additions & 40 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
733 | 733 |
| |
734 | 734 |
| |
735 | 735 |
| |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
736 | 741 |
| |
737 | 742 |
| |
738 | 743 |
| |
739 | 744 |
| |
740 | 745 |
| |
741 | 746 |
| |
742 | 747 |
| |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
743 | 798 |
| |
744 | 799 |
| |
745 | 800 |
| |
746 | 801 |
| |
747 |
| - | |
| 802 | + | |
748 | 803 |
| |
749 | 804 |
| |
750 | 805 |
| |
751 |
| - | |
752 |
| - | |
753 |
| - | |
754 |
| - | |
755 |
| - | |
756 |
| - | |
| 806 | + | |
757 | 807 |
| |
758 |
| - | |
759 |
| - | |
| 808 | + | |
| 809 | + | |
760 | 810 |
| |
761 |
| - | |
| 811 | + | |
762 | 812 |
| |
763 | 813 |
| |
764 | 814 |
| |
765 | 815 |
| |
766 |
| - | |
767 |
| - | |
| 816 | + | |
| 817 | + | |
768 | 818 |
| |
769 | 819 |
| |
| 820 | + | |
| 821 | + | |
| 822 | + | |
770 | 823 |
| |
771 | 824 |
| |
772 | 825 |
| |
| |||
1372 | 1425 |
| |
1373 | 1426 |
| |
1374 | 1427 |
| |
1375 |
| - | |
| 1428 | + | |
1376 | 1429 |
| |
1377 | 1430 |
| |
1378 | 1431 |
| |
| |||
1386 | 1439 |
| |
1387 | 1440 |
| |
1388 | 1441 |
| |
1389 |
| - | |
1390 |
| - | |
1391 |
| - | |
1392 |
| - | |
1393 |
| - | |
1394 |
| - | |
1395 |
| - | |
1396 |
| - | |
1397 |
| - | |
1398 |
| - | |
1399 |
| - | |
1400 |
| - | |
1401 |
| - | |
1402 |
| - | |
1403 |
| - | |
1404 |
| - | |
1405 |
| - | |
1406 |
| - | |
1407 |
| - | |
1408 |
| - | |
1409 |
| - | |
1410 |
| - | |
1411 |
| - | |
1412 |
| - | |
1413 |
| - | |
1414 |
| - | |
1415 |
| - | |
1416 | 1442 |
| |
1417 | 1443 |
| |
1418 | 1444 |
| |
|
Lines changed: 0 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
406 | 406 |
| |
407 | 407 |
| |
408 | 408 |
| |
409 |
| - | |
410 |
| - | |
411 | 409 |
| |
412 | 410 |
| |
413 | 411 |
| |
|
0 commit comments
Comments
(0)