Skip to content

Commit 4d21bae

Browse files
committed
Hotpatch kerberos doc. More to come later
1 parent f411bb0 commit 4d21bae

1 file changed

Lines changed: 62 additions & 48 deletions

File tree

doc/scapy/layers/kerberos.rst

Lines changed: 62 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,36 @@
11
Kerberos
22
========
33

4-
.. note:: Kerberos per `RFC4120 <https://datatracker.ietf.org/doc/html/rfc6113.html>`_ + `RFC6113 <https://datatracker.ietf.org/doc/html/rfc6113.html>`_ (FAST)
4+
.. note:: Kerberos per `RFC4120 <https://datatracker.ietf.org/doc/html/rfc6113.html>`_ + `RFC6113 <https://datatracker.ietf.org/doc/html/rfc6113.html>`_ (FAST) + `[MS-KILE] <https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-kile/2a32282e-dd48-4ad9-a542-609804b02cc9>`_ (Windows)
55

66
High-Level
77
__________
88

9+
Scapy provides several high-level utilities related to Kerberos:
10+
11+
- ``Ticketer``: a module that allows manipulating Kerberos tickets:
12+
- Request TGT/ST
13+
- Generate a ``KerberosSSP`` from a ST
14+
- Renew tickets
15+
- Read, create, write **ccache** files
16+
- Read, create, write **keytab** files
17+
- Kerberos armoring (via FAST) is available
18+
- S4U2Self / S4U2Proxy are implemented
19+
- KPasswd is implemented
20+
- ``KerberosSSP``: an implementation of a GSSAPI SSP for Kerberos, usable in any of Scapy's client that support GSSAPI.
21+
- Encryption/MIC using GSSAPI is available
22+
- Channel bindings are supported
23+
- U2U (User-To-User) is fully supported
24+
925
Ticketer module
1026
~~~~~~~~~~~~~~~
1127

12-
Scapy implements a **Ticketer** module, in order to manipulate Kerberos tickets.
13-
Ticketer++ is easy to use programmatically, and allows you to manipulate the tickets yourself.
14-
Scapy's ticketer++ implements all fields from RFC4120, [MS-KILE] and [MS-PAC], meaning you can edit ANY field in a ticket to your likings.
28+
The **Ticketer** module can be used both from the CLI or programmatically. This section tries to give many usage examples of features
29+
that are available. For more detail regarding the parameters of the functions, it is encouraged to have a look at their docstrings.
1530

16-
- **Request TGT/ST**:
31+
- **Request TGT**:
1732

18-
.. code::
33+
.. code:: pycon
1934
2035
>>> load_module("ticketer")
2136
>>> t = Ticketer()
@@ -24,22 +39,15 @@ Scapy's ticketer++ implements all fields from RFC4120, [MS-KILE] and [MS-PAC], m
2439
>>> t.show()
2540
Tickets:
2641
0. Administrator@DOMAIN.LOCAL -> krbtgt/DOMAIN.LOCAL@DOMAIN.LOCAL
27-
>>> t.request_st(0, "host/dc1.domain.local")
28-
>>> t.show()
29-
Tickets:
30-
0. Administrator@DOMAIN.LOCAL -> krbtgt/DOMAIN.LOCAL@DOMAIN.LOCAL
3142
Start time End time Renew until Auth time
3243
31/08/23 11:38:34 31/08/23 21:38:34 31/08/23 21:38:35 31/08/23 01:38:34
3344
3445
35-
- **Renew TGT/ST**: Scapy's ticketer can be used to renew TGT or ST.
46+
- **Then request a ST, using the TGT**:
3647

37-
.. code::
48+
.. code:: pycon
3849
39-
>>> load_module("ticketer")
40-
>>> t = Ticketer()
41-
>>> t.request_tgt("Administrator@DOMAIN.LOCAL")
42-
Enter password: ************
50+
>>> # The TGT we just got has an ID of 0
4351
>>> t.request_st(0, "host/dc1.domain.local")
4452
>>> t.show()
4553
Tickets:
@@ -50,8 +58,7 @@ Scapy's ticketer++ implements all fields from RFC4120, [MS-KILE] and [MS-PAC], m
5058
1. Administrator@DOMAIN.LOCAL -> host/dc1.domain.local@DOMAIN.LOCAL
5159
Start time End time Renew until Auth time
5260
31/08/23 11:39:07 31/08/23 21:38:34 31/08/23 21:38:35 31/08/23 01:38:34
53-
>>> t.renew(0) # renew TGT
54-
>>> t.renew(1) # renew ST
61+
5562
5663
- **Use ticket as SSP**: the ``.ssp()`` function.
5764

@@ -60,38 +67,14 @@ Scapy's ticketer++ implements all fields from RFC4120, [MS-KILE] and [MS-PAC], m
6067
>>> # We use ticket 1 from the above store.
6168
>>> smbclient("dc1.domain.local", ssp=t.ssp(1))
6269
63-
- **Perform S4U2Self**
64-
65-
.. code:: pycon
66-
67-
>>> load_module("ticketer")
68-
>>> t = Ticketer()
69-
>>> t.request_tgt("SERVER1$@domain.local", key=Key(EncryptionType.AES256_CTS_HMAC_SHA1_96, bytes.fromhex("63a2577d8bf6abeba0847cded36b9aed202c23750eb9c56b6155be1cc946bb1d")))
70-
>>> t.request_st(0, "host/SERVER1", for_user="Administrator@domain.local")
71-
>>> t.show()
72-
CCache tickets:
73-
0. SERVER1$@DOMAIN.LOCAL -> krbtgt/DOMAIN.LOCAL@DOMAIN.LOCAL
74-
canonicalize+pre-authent+initial+renewable+forwardable
75-
Start time End time Renew until Auth time
76-
15/04/25 20:15:17 16/04/25 06:10:22 16/04/25 06:10:22 15/04/25 20:15:17
77-
78-
1. Administrator@domain.local -> host/SERVER1@DOMAIN.LOCAL
79-
canonicalize+pre-authent+renewable+forwardable
80-
Start time End time Renew until Auth time
81-
15/04/25 20:15:20 16/04/25 06:10:22 16/04/25 06:10:22 15/04/25 20:15:17
70+
- **Renew a TGT or ST**:
8271

83-
- **Change password using kpasswd in 'set' mode:**
84-
85-
.. code:: pycon
72+
.. code::
8673
87-
>>> t = Ticketer()
88-
>>> t.request_tgt("Administrator@domain.local")
89-
Enter password: ************
90-
>>> t.kpasswdset(0, "SERVER1$@domain.local")
91-
INFO: Using 'Set Password' mode. This only works with admin privileges.
92-
Enter NEW password: ***********
74+
>>> t.renew(0) # renew TGT
75+
>>> t.renew(1) # renew ST. Works only with 'host/' SPNs
9376
94-
- **Import tickets**
77+
- **Import tickets from a ccache**:
9578

9679
.. note:: We first added a realm ``DOMAIN.LOCAL`` with a kdc to ``/etc/krb5.conf``
9780

@@ -109,7 +92,7 @@ Scapy's ticketer++ implements all fields from RFC4120, [MS-KILE] and [MS-PAC], m
10992
Start time End time Renew until Auth time
11093
31/08/23 12:08:15 31/08/23 22:08:15 01/09/23 12:08:12 31/08/23 12:08:15
11194
112-
- **Export tickets**
95+
- **Export tickets into a ccache**:
11396

11497
.. code:: pycon
11598
@@ -126,6 +109,26 @@ Scapy's ticketer++ implements all fields from RFC4120, [MS-KILE] and [MS-PAC], m
126109
08/31/2023 12:08:15 08/31/2023 23:08:15 krbtgt/DOMAIN.LOCAL@DOMAIN.LOCAL
127110
renew until 09/01/2023 12:08:12
128111
112+
- **Perform S4U2Self**
113+
114+
.. code:: pycon
115+
116+
>>> load_module("ticketer")
117+
>>> t = Ticketer()
118+
>>> t.request_tgt("SERVER1$@domain.local", key=Key(EncryptionType.AES256_CTS_HMAC_SHA1_96, bytes.fromhex("63a2577d8bf6abeba0847cded36b9aed202c23750eb9c56b6155be1cc946bb1d")))
119+
>>> t.request_st(0, "host/SERVER1", for_user="Administrator@domain.local")
120+
>>> t.show()
121+
CCache tickets:
122+
0. SERVER1$@DOMAIN.LOCAL -> krbtgt/DOMAIN.LOCAL@DOMAIN.LOCAL
123+
canonicalize+pre-authent+initial+renewable+forwardable
124+
Start time End time Renew until Auth time
125+
15/04/25 20:15:17 16/04/25 06:10:22 16/04/25 06:10:22 15/04/25 20:15:17
126+
127+
1. Administrator@domain.local -> host/SERVER1@DOMAIN.LOCAL
128+
canonicalize+pre-authent+renewable+forwardable
129+
Start time End time Renew until Auth time
130+
15/04/25 20:15:20 16/04/25 06:10:22 16/04/25 06:10:22 15/04/25 20:15:17
131+
129132
- **Load and use keytab for client**
130133

131134
.. code:: pycon
@@ -174,6 +177,17 @@ Scapy's ticketer++ implements all fields from RFC4120, [MS-KILE] and [MS-PAC], m
174177
175178
No tickets in CCache.
176179
180+
- **Change password using kpasswd in 'set' mode:**
181+
182+
.. code:: pycon
183+
184+
>>> t = Ticketer()
185+
>>> t.request_tgt("Administrator@domain.local")
186+
Enter password: ************
187+
>>> t.kpasswdset(0, "SERVER1$@domain.local")
188+
INFO: Using 'Set Password' mode. This only works with admin privileges.
189+
Enter NEW password: ***********
190+
177191
- **Craft tickets**: We can start by showing how to craft a **golden ticket**:
178192

179193
.. code:: pycon

0 commit comments

Comments
 (0)