Skip to content

Commit

Permalink
Test bogus KDC-REQs
Browse files Browse the repository at this point in the history
Send encodings that are invalid KDC-REQs, but pass krb5_is_as_req()
and krb5_is_tgs_req(), to make sure that the KDC recovers correctly
from failures in decode_krb5_as_req() and decode_krb5_tgs_req().  Also
send an encoding that isn't a valid KDC-REQ.

(back ported from commit dae7693)

ticket: 7832 (new)
version_fixed: 1.11.5
status: resolved
  • Loading branch information
tlyu committed Jan 16, 2014
1 parent 8acb855 commit 262207d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tests/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ check-pytests:: hist
$(RUNPYTEST) $(srcdir)/t_cve-2012-1014.py $(PYTESTFLAGS)
$(RUNPYTEST) $(srcdir)/t_cve-2012-1015.py $(PYTESTFLAGS)
$(RUNPYTEST) $(srcdir)/t_cve-2013-1417.py $(PYTESTFLAGS)
$(RUNPYTEST) $(srcdir)/t_bogus_kdc_req.py $(PYTESTFLAGS)

clean::
$(RM) krb5.conf kdc.conf
Expand Down
44 changes: 44 additions & 0 deletions src/tests/t_bogus_kdc_req.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/python

import base64
import socket
from k5test import *

realm = K5Realm()

# Send encodings that are invalid KDC-REQs, but pass krb5_is_as_req()
# and krb5_is_tgs_req(), to make sure that the KDC recovers correctly
# from failures in decode_krb5_as_req() and decode_krb5_tgs_req().

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
a = (hostname, realm.portbase)


# Bogus AS-REQ

x1 = base64.b16decode('6AFF')
s.sendto(x1, a)

# Make sure kinit still works.

realm.kinit(realm.user_princ, password('user'))

# Bogus TGS-REQ

x2 = base64.b16decode('6CFF')
s.sendto(x2, a)

# Make sure kinit still works.

realm.kinit(realm.user_princ, password('user'))

# Not a KDC-REQ, even a little bit

x3 = base64.b16decode('FFFF')
s.sendto(x3, a)

# Make sure kinit still works.

realm.kinit(realm.user_princ, password('user'))

success('Bogus KDC-REQ test')

0 comments on commit 262207d

Please sign in to comment.