Path: blob/main/crypto/krb5/src/tests/t_cve-2012-1015.py
34869 views
import base641import socket2from k5test import *34realm = K5Realm()56# CVE-2012-1015 KDC frees uninitialized pointer78# Force a failure in krb5_c_make_checksum(), which causes the cleanup9# code in kdc_handle_protected_negotiation() to free an uninitialized10# pointer in an unpatched KDC.1112s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)13a = (hostname, realm.portbase)1415x1 = base64.b16decode('6A81A030819DA103020105A20302010A' +16'A30E300C300AA10402020095A2020400' +17'A48180307EA00703050000000000A120' +18'301EA003020101A11730151B066B7262' +19'7467741B0B4B5242544553542E434F4D' +20'A20D1B0B4B5242544553542E434F4DA3' +21'20301EA003020101A11730151B066B72' +22'627467741B0B4B5242544553542E434F' +23'4DA511180F3139393430363130303630' +24'3331375AA7030201')2526x2 = base64.b16decode('A8083006020106020112')2728for x in range(0, 128):29s.sendto(x1 + bytes([x]) + x2, a)3031# Make sure kinit still works.3233realm.kinit(realm.user_princ, password('user'))3435success('CVE-2012-1015 regression test')363738