Skip to content

'ccache.get_tgs' called with 'strict=False' prevents using ccache with other TGS #43

@CravateRouge

Description

@CravateRouge

I understand the strict=False mode which can be very convenient in get_tgs to use a tgs ticket even if the name is wrong but the ticket is actually valid for the target:

def get_tgs(self, spn:KerberosSPN, strict:bool=False):

However, it shoudn't be called in core functions without being able to provide a strict=True option such as in tgs_from_ccache called by get_TGS:

tgs, keystruct, err = self.ccache.get_tgs(spn_user)

This leads to not being able to use a ccache with other TGS even if there is a valid TGT inside, here is an example to understand better:

$ klist MAIN.bloody.corp.ccache
Ticket cache: FILE:MAIN.bloody.corp.ccache
Default principal: jane@TREE2.LAB

Valid starting       Expires              Service principal
11/30/2024 07:46:56  11/30/2024 17:46:56  krbtgt/TREE2.LAB@TREE2.LAB
11/30/2024 07:46:56  11/30/2024 17:46:56  ldap/dctree1.tree2.lab@TREE2.LAB
$ python3 msldapclient.py -v 'ldap+kerberos-ccache://tree2.lab\jane:MAIN.bloody.corp.ccache@MAIN.bloody.corp/?serverip=192.168.100.3&dc=192.168.100.4&dcc=192.168.100.3&realmc=bloody.corp' 'login' 
2024-11-30 07:52:08,039 msldap       DEBUG    ==== UniCredential ====
domain: tree2.lab
username: jane
secret: MAIN.bloody.corp.ccache
stype: CCACHE
protocol: KERBEROS
subprotocol: <asyauth.common.subprotocols.native.SubProtocolNative object at 0x7f19efddd910>
etypes: [23, 17, 18]
altname: None
altdomain: None
target: ==== UniTarget ====
hostname: None
port: 88
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.4
domain: None
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.4

certdata: None
keydata: None
cross_target: ==== UniTarget ====
hostname: None
port: 88
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.3
domain: None
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.3

cross_realm: bloody.corp
dh_params: {'p': 179769313486231590770839156793787453197860296048756011706444423684197180216158519368947833795864925541502180565485980503646440548199239100050792877003355816639229553136239076508735759914822574862575007425302077447712589550957937778424442426617334727629299387668709205606050270810842907692932019128194467627007, 'g': 2}

DEBUG:msldap:==== UniCredential ====
domain: tree2.lab
username: jane
secret: MAIN.bloody.corp.ccache
stype: CCACHE
protocol: KERBEROS
subprotocol: <asyauth.common.subprotocols.native.SubProtocolNative object at 0x7f19efddd910>
etypes: [23, 17, 18]
altname: None
altdomain: None
target: ==== UniTarget ====
hostname: None
port: 88
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.4
domain: None
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.4

certdata: None
keydata: None
cross_target: ==== UniTarget ====
hostname: None
port: 88
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.3
domain: None
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.3

cross_realm: bloody.corp
dh_params: {'p': 179769313486231590770839156793787453197860296048756011706444423684197180216158519368947833795864925541502180565485980503646440548199239100050792877003355816639229553136239076508735759914822574862575007425302077447712589550957937778424442426617334727629299387668709205606050270810842907692932019128194467627007, 'g': 2}

2024-11-30 07:52:08,039 msldap       DEBUG    ==== MSLDAPTarget ====
hostname: main.bloody.corp
port: 389
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.4
domain: tree2.lab
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.3
tree: None
ldap_query_page_size: 1000
ldap_query_ratelimit: 0

DEBUG:msldap:==== MSLDAPTarget ====
hostname: main.bloody.corp
port: 389
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.4
domain: tree2.lab
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.3
tree: None
ldap_query_page_size: 1000
ldap_query_ratelimit: 0

2024-11-30 07:52:08,056 msldap       DEBUG    Connecting!
DEBUG:msldap:Connecting!
2024-11-30 07:52:08,062 msldap       DEBUG    Connection succsessful!
DEBUG:msldap:Connection succsessful!
2024-11-30 07:52:08,063 msldap       DEBUG    BIND in progress...
DEBUG:msldap:BIND in progress...
2024-11-30 07:52:08,064 asyauth.kerberos DEBUG    Flags: 48
2024-11-30 07:52:08,064 asyauth.kerberos DEBUG    SPN: ldap/main.bloody.corp@tree2.lab
2024-11-30 07:52:08,064 asyauth.kerberos DEBUG    CCACHE SPN record: krbtgt/TREE2.LAB@TREE2.LAB
2024-11-30 07:52:08,065 asyauth.kerberos DEBUG    CCACHE SPN record: ldap/dctree1.tree2.lab@TREE2.LAB
silver@debianos:/mnt/hgfs/bloodyAD-dev$  cd /mnt/hgfs/bloodyAD-dev ; /usr/bin/env /bin/python3 /home/silver/.vscode/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 34279 -- /home/silver/.local/lib/python3.11/site-packages/msldap/examples/msldapclient.py -v 'ldap+kerberos-ccache://bloody.corp\jane:MAIN.bloody.corp.ccache@MAIN.bloody.corp/?serverip=192.168.100.3&dc=192.168.100.4&dcc=192.168.100.3&realmc=bloody.corp' 'login' 
2024-11-30 07:54:36,182 msldap       DEBUG    ==== UniCredential ====
domain: bloody.corp
username: jane
secret: MAIN.bloody.corp.ccache
stype: CCACHE
protocol: KERBEROS
subprotocol: <asyauth.common.subprotocols.native.SubProtocolNative object at 0x7f3bb24f99d0>
etypes: [23, 17, 18]
altname: None
altdomain: None
target: ==== UniTarget ====
hostname: None
port: 88
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.4
domain: None
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.4

certdata: None
keydata: None
cross_target: ==== UniTarget ====
hostname: None
port: 88
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.3
domain: None
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.3

cross_realm: bloody.corp
dh_params: {'p': 179769313486231590770839156793787453197860296048756011706444423684197180216158519368947833795864925541502180565485980503646440548199239100050792877003355816639229553136239076508735759914822574862575007425302077447712589550957937778424442426617334727629299387668709205606050270810842907692932019128194467627007, 'g': 2}

DEBUG:msldap:==== UniCredential ====
domain: bloody.corp
username: jane
secret: MAIN.bloody.corp.ccache
stype: CCACHE
protocol: KERBEROS
subprotocol: <asyauth.common.subprotocols.native.SubProtocolNative object at 0x7f3bb24f99d0>
etypes: [23, 17, 18]
altname: None
altdomain: None
target: ==== UniTarget ====
hostname: None
port: 88
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.4
domain: None
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.4

certdata: None
keydata: None
cross_target: ==== UniTarget ====
hostname: None
port: 88
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.3
domain: None
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.3

cross_realm: bloody.corp
dh_params: {'p': 179769313486231590770839156793787453197860296048756011706444423684197180216158519368947833795864925541502180565485980503646440548199239100050792877003355816639229553136239076508735759914822574862575007425302077447712589550957937778424442426617334727629299387668709205606050270810842907692932019128194467627007, 'g': 2}

2024-11-30 07:54:36,183 msldap       DEBUG    ==== MSLDAPTarget ====
hostname: main.bloody.corp
port: 389
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.4
domain: bloody.corp
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.3
tree: None
ldap_query_page_size: 1000
ldap_query_ratelimit: 0

DEBUG:msldap:==== MSLDAPTarget ====
hostname: main.bloody.corp
port: 389
protocol: UniProto.CLIENT_TCP
timeout: 5
ssl_ctx: None
dc_ip: 192.168.100.4
domain: bloody.corp
dns: None
use_privileged_source_port: False
proxies: []
ip: 192.168.100.3
tree: None
ldap_query_page_size: 1000
ldap_query_ratelimit: 0

2024-11-30 07:54:36,197 msldap       DEBUG    Connecting!
DEBUG:msldap:Connecting!
2024-11-30 07:54:36,201 msldap       DEBUG    Connection succsessful!
DEBUG:msldap:Connection succsessful!
2024-11-30 07:54:36,201 msldap       DEBUG    BIND in progress...
DEBUG:msldap:BIND in progress...
2024-11-30 07:54:36,202 asyauth.kerberos DEBUG    Flags: 48
2024-11-30 07:54:36,202 asyauth.kerberos DEBUG    SPN: ldap/main.bloody.corp@bloody.corp
2024-11-30 07:54:36,202 asyauth.kerberos DEBUG    CCACHE SPN record: krbtgt/TREE2.LAB@TREE2.LAB
2024-11-30 07:54:36,202 asyauth.kerberos DEBUG    CCACHE SPN record: ldap/dctree1.tree2.lab@TREE2.LAB
2024-11-30 07:55:41,256 asyauth.kerberos DEBUG    Got TGS from CCACHE!
2024-11-30 07:55:41,256 asyauth.kerberos DEBUG    TGS: OrderedDict([('pvno', 5), ('msg-type', 11), ('padata', None), ('crealm', 'TREE2.LAB'), ('cname', OrderedDict([('name-type', 1), ('name-string', ['jane'])])), ('ticket', OrderedDict([('tkt-vno', 5), ('realm', 'TREE2.LAB'), ('sname', OrderedDict([('name-type', 2), ('name-string', ['ldap', 'dctree1.tree2.lab'])])), ('enc-part', OrderedDict([('etype', 18), ('kvno', 3), ('cipher', b'\xc5\x88\xfc\xc8\xc0\xf3%\x1a\xf0\x94\xe0\xa5\xd3\x88\'\x12\xedC\x15z2!\x8d&\xfd5\x90\xa5\x1cF \x14)bm\xe61\x014\x12\x97\xfbD`>\x1a\xe6\xe1Il\x85\xad\xdeT\xc6.\x12\xbfRK&\x9cJ5\xf0l\xca\xbe\xa1\x82\xec\xb4\x8dW\xa8\xe5q\xb3K\xec\xde \x0b\x9b\n-\xf5fP\xf7\xbb\x9d`\xaa|\xef5\x07L)t\xa4\xb4\x04\xe6.\xa2\xf3\'\xcd\xa7\xfb\x04`\x1fr\x17\xd5Au\x05!\xa9\x9f\x01\xc7\xa0\x97\x98r\xd0\xae\x13}\x03\x9fzq;]cHKN\x13\xbd$\xe3\xf2-O\xa2\xe2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\xfbD\x88\xcb\xf0\x80I\x1b8\xdf\x8e\xae\x00\xc9\x1b\x107\xa1b\xae\x9e\xbaP\xd3\xba\xa4\xe4\xb5\rc)\xbd\xb3\xcf\x02|_\\xny\x89\xa6AG\x91\x95\x92')]))])), ('enc-part', OrderedDict([('etype', 1), ('kvno', None), ('cipher', b'')]))])
2024-11-30 07:55:41,257 asyauth.kerberos DEBUG    encpart: OrderedDict([('etype', 1), ('kvno', None), ('cipher', b'')])
2024-11-30 07:55:41,257 asyauth.kerberos DEBUG    session_key: Key(23, 4594ded5eea8f2fa7cd2163ce26ccd86)
2024-11-30 07:55:41,264 asyauth.kerberos DEBUG    APREQ constructed: b'n\x82\x04\xdb0\x82\x04\xd7\xa0\x03\x02\x01\x05\xa1\x03\x02\x01\x0e\xa2\x03\x03\x01\x00\xa3\x82\x04,a\x82\x04(0\x82\x04$\xa0\x03\x02\x01\x05\xa1\x0b\x1b\tTREE2.LAB\xa2$0"\xa0\x03\x02\x01\x02\xa1\x1b0\x19\x1b\x04ldap\x1b\x11dctree1.tree2.lab\xa3\x82\x03\xe80\x82\x03\xe4\xa0\x03\x02\x01\x12\xa1\x03\x02\x01\x03\xa2\x82\x03\xd6\x04\x82\x03\xd2\xc5\x88\xfc\xc8\xc0\xf3%\x1a\xf0\x94\xe0\xa5\xd3\x88\'\x12\xedC\x15z2!\x8d&\xfd5\x90\xa5\x1cF \x14)bm\xe61\x014\x12\x97\xfbD`>\x1a\xe6\xe1Il\x85\xad\xdeT\xc6.\x12\xbfRK&\x9cJ5\xf0l\xca\xbe\xa1\x82\xec\xb4\x8dW\xa8\xe5q\xb3K\xec\xde \x0b\x9b\n-\xf5fP\xf7\xbb\x9d`\xaa|\xef5\x07L)t\xa4\xb4\x04\xe6.\xa2\xf3\'\xcd\xa7\xfb\x04`\x1fr\x17\xd5Au\x05!\xa9\x9f\x01\xc7\xa0\x97\x98r\xd0\xae\x13}\x03\x9fzq;]cHKN\x13\xbd$\xe3\xf2-O\xa2\xe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d\xfbD\x88\xcb\xf0\x80I\x1b8\xdf\x8e\xae\x00\xc9\x1b\x107\xa1b\xae\x9e\xbaP\xd3\xba\xa4\xe4\xb5\rc)\xbd\xb3\xcf\x02|_\\xny\x89\xa6AG\x91\x95\x92\xa4\x81\x950\x81\x92\xa0\x03\x02\x01\x17\xa2\x81\x8a\x04\x81\x87\x0bM5\x98x\x11\xf2\xf7b\x16]\xf9.\xe5:KSt\'\xaa\x7f\xd3\x9b\\\xcb\xae}8^\x90\x8ew\x12\xfb\r5\x01\x07\xdaFD\x97\x0e+\xa6@\xcd\xa8\xb1\xa1\xb9I\x03\x15\x82A\x982)\xe7_\x87#\xe56\xf9\xc0\x1d\xc7\xa9\xc0+\x94S\x0el\xf6\xe3\xc3\x82\x93d\x12\x8e\r\x06\x9e\xa9\xfe\x06\xb7\xb4h\x8f\x7f"\xf5\xdf\x1a\x9dz/n\xc0q|O\xf5\x85\x90\x92\xed\xbb\x91\xe1\xae\xb8f\xec\x15x\x8e\xf4D%^u\xc9\xe8\xe5\xc9\xfd\xb9\x17e'
Traceback (most recent call last):
  File "/home/silver/.local/lib/python3.11/site-packages/msldap/examples/msldapclient.py", line 90, in do_login
    raise err
msldap.commons.exceptions.LDAPBindException: LDAP Bind failed! Result code: "invalidCredentials" Reason: "b'8009030C: LdapErr: DSID-0C090585, comment: AcceptSecurityContext error, data 52e, v4f7c\x00'"

msldap is calling authenticate from asyauth.native which calls get_TGS which will call tgs_from_ccache which will not find any valid service ticket but will return the ldap/dctree1.tree2.lab@TREE2.LAB because it's always non-strict and will try to auth with it instead of using the TGT to retrieve a referral ticket and then the right service ticket.

I think it would be good to provide a strict argument in parents functions, or let the user provide a strict=True parameter in the connection URL.

What do you think? I can provide the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions