]> git.lizzy.rs Git - plan9front.git/blob - sys/man/6/authsrv
games/mix: document -g option, rename tests to examples as it is in the man page
[plan9front.git] / sys / man / 6 / authsrv
1 .TH AUTHSRV 6
2 .SH NAME
3 authsrv, p9any, p9sk1, dp9ik \- authentication protocols
4 .SH DESCRIPTION
5 This manual page describes
6 the protocols used to authorize connections, confirm the identities
7 of users and machines, and maintain the associated databases.
8 The machine that provides these services is called the
9 .I authentication server
10 (AS).
11 The AS may be a stand-alone machine or a general-use machine such as a CPU server.
12 The network database
13 .IR ndb (6)
14 holds for each public machine, such as a CPU server or
15 file server, the name of the authentication server that machine uses.
16 .PP
17 Each machine contains four values important to authentication; a 56-bit DES
18 key, a 128-bit AES key, a 28-byte authentication ID, and a 48-byte authentication
19 domain name.
20 The ID is a user name and identifies who is currently responsible for the
21 kernel running on that machine.
22 The domain name identifies the machines across which the ID is valid.
23 Together, the ID and domain name identify the owner of a key.
24 .PP
25 When a terminal boots,
26 .IR factotum (4)
27 prompts for user name and password.
28 The user name becomes the terminal's authentication ID. 
29 The password is converted using
30 .I passtokey
31 (see
32 .IR authsrv (2))
33 into a 56-bit DES and 128-bit AES keys and saved in memory.
34 The authentication domain is set to the null string.
35 If possible,
36 .I factotum
37 validates the key with the AS
38 before saving it.
39 For Internet machines the correct AS to ask is found using
40 .IR dhcpd (8).
41 .PP
42 When a CPU or file server boots, 
43 .I factotum
44 reads the key, ID, and domain name from
45 non-volatile RAM.
46 This allows servers to reboot without operator intervention.
47 .PP
48 The details of any authentication are mixed with the semantics
49 of the particular service they are authenticating so we describe
50 them one case at a time. The following definitions will be used
51 in the descriptions:
52 .TF nullx
53 .TP
54 .I Ks
55 server's host ID's key
56 .TP
57 .I Kc
58 client's host ID's key
59 .TP
60 .I Kn
61 a nonce key created for a ticket
62 .RB ( key )
63 .TP
64 .I K{m}
65 message
66 .I m
67 encrypted with key
68 .I K
69 .TP
70 .I CHc
71 an 8-byte random challenge from a client
72 .RB ( chal )
73 .TP
74 .I CHs
75 an 8-byte random challenge from a server
76 .RB ( chal )
77 .TP
78 .I IDs
79 server's ID
80 .RB ( authid )
81 .TP
82 .I DN
83 server's authentication domain name
84 .RB ( authdom )
85 .TP
86 .I IDc
87 client's ID
88 .RB ( hostid ,
89 .BR cuid )
90 .TP
91 .I IDr
92 client's desired ID on server
93 .RB ( uid ,
94 .BR suid )
95 .TP
96 .I YAc
97 client → AS DH public key
98 .TP
99 .I YBc
100 AS → client DH public key
101 .TP
102 .I YAs
103 server → AS DH public key
104 .TP
105 .I YBs
106 AS → server DH public key
107 .TP
108 .I RNc
109 client's 32-byte random string
110 .TP
111 .I RNs
112 server's 32-byte random string
113 .PD
114 .PP
115 The parenthesized names are the ones used in the
116 .B Ticketreq
117 and
118 .B Ticket
119 structures in
120 .BR <authsrv.h> .
121 .PP
122 The message type constants
123 .IR AuthTreq ,
124 .IR AuthChal ,
125 .IR AuthPass ,
126 .IR AuthOK ,
127 .IR AuthErr ,
128 .IR AuthMod ,
129 .IR AuthApop ,
130 .IR AuthOKvar ,
131 .IR AuthChap ,
132 .IR AuthMSchap ,
133 .IR AuthCram ,
134 .IR AuthVNC ,
135 and
136 .IR AuthPAK
137 .RB ( type )
138 are defined in
139 .BR <authsrv.h> ,
140 as are the encrypted message types
141 .IR AuthTs ,
142 .IR AuthAs ,
143 .IR AuthAc ,
144 .IR AuthTp ,
145 and
146 .IR AuthHr
147 .RB ( num ).
148 .SS "Ticket Service
149 When a client and server wish to authenticate to each other,
150 they do so using
151 .I tickets
152 issued by the AS.
153 Obtaining tickets from the AS
154 is the client's responsibility.
155 .PP
156 The protocol to obtain a ticket pair is:
157 .TP
158 .I C→A:
159 .IR AuthTreq ,
160 .IR IDs ,
161 .IR DN ,
162 .IR CHs ,
163 .IR IDc ,
164 .IR IDr
165 .TP
166 .I A→C:
167 .IR AuthOK ,
168 .IR Kc { AuthTc ,
169 .IR CHs ,
170 .IR IDc ,
171 .IR IDr ,
172 .IR Kn },
173 .IR Ks { AuthTs ,
174 .IR CHs ,
175 .IR IDc ,
176 .IR IDr ,
177 .IR Kn }
178 .PP
179 The two tickets are identical except for their type fields
180 and the keys with which they are encrypted.
181 The client and server can each decrypt one of the tickets,
182 establishing a shared secret
183 .IR Kn .
184 .PP
185 The
186 tickets can be viewed as a statement by the
187 AS that
188 ``a client possessing the
189 .I Kn
190 key is allowed to authenticate as
191 .IR IDr .''
192 .PP
193 The presence of the server challenge
194 .I CHs
195 in the ticket allows the server to verify the freshness
196 of the ticket pair.
197 .PP
198 The AS sets the
199 .I IDr
200 in the tickets to the requested
201 .I IDr
202 only if
203 .I IDc
204 is allowed to
205 .I "speak for
206 .RI ( q.v. )
207 .IR IDr .
208 If not,
209 the AS sets
210 .I IDr
211 to the empty string.
212 .PP
213 If the users
214 .I IDc
215 or
216 .I IDs
217 do not exist,
218 the AS silently generates one-time
219 random keys to use in place of
220 .I Kc
221 or
222 .IR Ks ,
223 so that clients cannot probe the AS
224 to learn whether a user name is valid.
225 .SS "P9sk1
226 The Plan 9 shared key protocol
227 .I p9sk1
228 allows a client and server to authenticate each other.
229 The protocol is:
230 .TP
231 .I C→S:
232 .I CHc
233 .br
234 The client starts by sending a random challenge to the server.
235 .TP
236 .I S→C:
237 .IR AuthTreq ,
238 .IR IDs ,
239 .IR DN ,
240 .IR CHs ,
241 .IR \- ,
242 .IR \-
243 .br
244 The server replies with a ticket request giving its
245 id and authentication domain along with its own 
246 random challenge.
247 .TP
248 .I C→S:
249 .IR Ks { AuthTs ,
250 .IR CHs ,
251 .IR IDc ,
252 .IR IDr ,
253 .IR Kn },
254 .IR Kn { AuthAc ,
255 .IR CHs }
256 .br
257 The client adds 
258 .I IDc
259 and
260 .I IDr
261 to the ticket request and obtains a ticket pair
262 from the AS as described above.
263 The client relays the server's ticket along with
264 an 
265 .IR authenticator ,
266 the
267 .I AuthAc
268 message.
269 The authenticator proves to the server that the
270 client knows
271 .I Kn
272 and is therefore allowed to authenticate as
273 .IR IDr .
274 (The inclusion of
275 .IR CHs
276 in the authenticator avoids replay attacks.)
277 .TP
278 .I S→C:
279 .IR Kn { AuthAs ,
280 .IR CHc }
281 .br
282 The server replies with its own authenticator,
283 proving to the client that it also knows
284 .I Kn
285 and therefore 
286 .I Ks .
287 .PP
288 The 64-bit shared secret
289 .I Kn
290 is used as the session secret.
291 .SS "Password authenticated key exchange"
292 Initially, the server and client keys
293 .I Ks
294 and
295 .I Kc
296 where equivalent to the password derived 56-bit DES keys, which
297 made the encrypted tickets subject to offline dictionary attacks
298 and provided too small a key space against brute force attacks
299 on current hardware.
300 .PP
301 The
302 .I AuthPAK
303 protocol is used to establish new 256-bit random keys with the
304 AS for
305 .I Ks
306 and
307 .I Kc
308 before each ticket request on the connection.
309 .PP
310 The protocol is based on SPAKE2EE, where a hash of the user's secret
311 is used to encypt the public keys of a Elliptic-Curve Diffie-Hellman
312 key exchange. The user's
313 .I ID
314 and 128-bit AES key is hashed and mapped (using Elligator2)
315 into two curve points
316 .I PM
317 and
318 .IR PN ,
319 called the
320 .IR pakhash .
321 Both sides generate a random number
322 .IR xa / xb
323 and make the public keys
324 .IR YA / YB
325 as:
326 .IR YA = xa*G+PM ,
327 .IR YB = xb*G+PN .
328 After the public keys have been exchanged, each side calculates the
329 shared secret as:
330 .IR Z = xa*(YB-PN) = xb*(YA-PM) .
331 The shared secret
332 .I Z
333 is then hashed with the transmitted public keys
334 .IR YA | YB
335 producing the 256-bit
336 .IR pakkey .
337 .PP
338 The
339 .I pakkey
340 is then used in place of
341 .I Ks
342 and
343 .I Kc
344 to authenticate and encrypt tickets from the AS using
345 Chacha20/Poly1305 AEAD for the next following
346 request made on the connection.
347 .PP
348 The protocol (for
349 .IR AuthTreq )
350 to establish keys
351 .I Ks
352 and
353 .I Kc
354 with the AS for
355 .I IDs
356 and
357 .I IDc
358 is:
359 .TP
360 .I C→A:
361 .IR AuthPAK ,
362 .IR IDs ,
363 .IR DN ,
364 .IR CHs ,
365 .IR IDc ,
366 .IR IDr ,
367 .IR YAs ,
368 .I YAc
369 .TP
370 .I A→C:
371 .IR AuthOK ,
372 .IR YBs ,
373 .I YBc
374 .PP
375 The protocol (for
376 .IR AuthApop ,
377 .IR AuthChap ...)
378 to establish a single server key
379 .I Ks
380 for
381 .IR IDs :
382 .TP
383 .I C→A:
384 .IR AuthPAK ,
385 .IR \- ,
386 .IR DN ,
387 .IR CHs ,
388 .IR IDs ,
389 .IR IDc ,
390 .I YAs
391 .TP
392 .I A→C:
393 .IR AuthOK ,
394 .I YBs
395 .PP
396 The protocol (for
397 .IR AuthPass )
398 to establish a single client key
399 .I Kc
400 for
401 .IR IDc :
402 .TP
403 .I C→A:
404 .IR AuthPAK ,
405 .IR \- ,
406 .IR \- ,
407 .IR CHc ,
408 .IR \- ,
409 .IR IDc ,
410 .I YAc
411 .TP
412 .I A→C:
413 .IR AuthOK ,
414 .I YBc
415 .SS "Dp9ik"
416 The
417 .I dp9ik
418 protocol is an extended version of
419 .I p9sk1
420 that adds the random strings
421 .I RNc
422 and
423 .I RNs
424 in the
425 .I authenticator
426 messages for the session key derivation and uses the
427 password authenticated key exchange as described above
428 to derive the ticket encryption keys
429 .I Ks
430 and
431 .IR Kc :
432 .TP
433 .I C→S:
434 .I CHc
435 .br
436 The client starts by sending a random challenge to the server.
437 .TP
438 .I S→C:
439 .IR AuthPAK ,
440 .IR IDs ,
441 .IR DN ,
442 .IR CHs ,
443 .IR \- ,
444 .IR \- ,
445 .IR YAs
446 .br
447 The server generates a new public key
448 .I YAs
449 and replies with a
450 .I AuthPAK
451 request giving its
452 .I IDs
453 and authentication domain
454 .I DNs
455 along with its own random challenge
456 .I CHs
457 and its public key
458 .IR YAs .
459 .TP
460 .I C→S:
461 .IR YBs ,
462 .IR Ks { AuthTs ,
463 .IR CHs ,
464 .IR IDc ,
465 .IR IDr ,
466 .IR Kn },
467 .IR Kn { AuthAc ,
468 .IR CHs ,
469 .IR RNc }
470 .br
471 The client generates its own public key
472 .I YAc
473 and adds it along with 
474 .I IDc
475 and
476 .I IDr
477 to the
478 .I AuthPAK
479 request and obtains the public keys
480 .I YBs
481 and
482 .I YBc
483 from the AS response. At this point, client and AS
484 have completed ther authenticated key exchange and
485 derive
486 .I Kc
487 as described above.
488 Then the client requests a ticket pair using the same
489 message but with
490 .I AuthPAK
491 type changed to
492 .IR AuthTreq .
493 It decrypts his ticket with
494 .I Kc
495 extracting the shared secret
496 .IR Kn .
497 The client relays the server's
498 .I YBs
499 and ticket along with an
500 .IR authenticator ,
501 the
502 .I AuthAc
503 message.
504 The server finishes his authenticated key exchange
505 using
506 .I YBs
507 and derives
508 .I Ks
509 to decrypt his ticket to extract the shared secret
510 .IR Kn .
511 When the decryption of the clients authenticator using
512 .I Kn
513 is successfull then this proves to the server that the
514 client knows
515 .I Kn
516 and is therefore allowed to authenticate as
517 .IR IDr .
518 The random string
519 .I RNc
520 is used in the derivation of the session secret.
521 .TP
522 .I S→C:
523 .IR Kn { AuthAs ,
524 .IR CHc ,
525 .IR RNs }
526 .br
527 The server replies with its own authenticator,
528 proving to the client that it also knows
529 .I Kn
530 and contributes its random string
531 .IR RNs
532 for the session secret.
533 .PP
534 The 2048-bit session secret is derived with HKDF-SHA256 hashing the
535 concatenated random strings
536 .IR RNc | RNs
537 with the the shared secret key
538 .IR Kn .
539 .SS "P9any
540 .I P9any
541 is the standard Plan 9 authentication protocol.
542 It consists of a negotiation to determine a common
543 protocol, followed by the agreed-upon protocol.
544 .PP
545 The negotiation protocol is:
546 .TP
547 .I S→C:
548 .B v.2
549 .IB proto@authdom
550 .IB proto@authdom
551 .I ...
552 .TP
553 .I C→S:
554 .I proto
555 .I dom
556 .TP
557 .I S→C:
558 .B OK
559 .PP
560 Each message is a NUL-terminated UTF string.
561 The server begins by sending a list of
562 .IR proto ,
563 .I authdom
564 pairs it is willing to use.
565 The client
566 responds with its choice.
567 Requiring the client to wait for the final
568 .B OK
569 ensures that the client will not start
570 the chosen protocol until the server is ready.
571 .PP
572 The above is version 2 of the protocol.
573 Version 1,
574 no longer used,
575 omitted the first message's
576 .B v.2
577 prefix
578 and the 
579 .B OK
580 message.
581 .PP
582 The
583 .I p9any
584 protocol is the protocol used by all
585 Plan 9 services.
586 The file server runs it over special
587 authentication files
588 (see
589 .IR fauth (2)
590 and
591 .IR attach (5)).
592 Other services, such as
593 .IR cpu (1),
594 .IR exportfs (4)
595 and
596 .IR tlssrv (8)
597 run
598 .I p9any
599 over the network and then use the session secret to derive an
600 .IR ssl (3)
601 or
602 .IR tls (3)
603 key to encrypt the rest of their communications.
604 .SS "Password Change
605 Users connect directly to the AS
606 to change their passwords.
607 The protocol is:
608 .TP
609 .I C→A:
610 .IR AuthPass ,
611 .IR \- ,
612 .IR \- ,
613 .IR CHc ,
614 .IR \- ,
615 .IR IDc
616 .br
617 The client sends a password change ticket request.
618 .TP
619 .I A→C:
620 .IR Kc { AuthTp ,
621 .IR CHc ,
622 .IR IDc ,
623 .IR IDc ,
624 .IR Kn }
625 .br
626 The server responds with a ticket containing the key
627 .I Kn
628 encrypted with the client's key
629 .IR Kc
630 .TP
631 .I C→A:
632 .IR Kn { AuthPass ,
633 .IR old ,
634 .IR new ,
635 .IR changesecret ,
636 .IR secret }
637 .br
638 The client decrypts the ticket using the old password
639 and then sends back an encrypted password request
640 .RB ( Passwordreq
641 structure)
642 containing the old password and the new password.
643 If
644 .I changesecret
645 is set, the AS also changes
646 the user's 
647 .IR secret ,
648 the password used for non-Plan 9 authentications.
649 .TP
650 .I A→C:
651 .I AuthOK
652 or
653 .IR AuthErr ,
654 64-byte error message
655 .br
656 The AS responds with simply
657 .I AuthOK
658 or with
659 .I AuthErr
660 followed by a 64-byte error message.
661 .SS "Authentication Database
662 An
663 .IR ndb (2)
664 database file 
665 .B /lib/ndb/auth
666 exists for the AS.
667 This database maintains ``speaks for'' relationships, i.e.,
668 it lists which users may speak for other users when
669 authenticating.
670 The attribute types used by the AS are
671 .B hostid
672 and
673 .BR uid .
674 The value in the
675 .B hostid
676 is a client host's ID.
677 The values in the
678 .B uid
679 pairs in the same entry list which users that host ID
680 may speak for.
681 A uid value of
682 .B *
683 means the host ID may speak for all users.
684 A uid value of
685 .BI ! user
686 means the host ID may not speak for
687 .IR user .
688 For example:
689 .PP
690 .EX
691 hostid=bootes
692         uid=!sys uid=!adm uid=*
693 .EE
694 .PP
695 is interpreted as
696 .B bootes
697 may speak for any user except
698 .B sys
699 and
700 .BR adm .
701 This property is used heavily on CPU servers.
702 .SS "Foreign Protocols
703 The AS accepts ticket request
704 messages of types other than
705 .I AuthTreq
706 to allow users to
707 authenticate using non-Plan 9 protocols.
708 In these situations, the server communicates
709 directly with the AS.
710 Some protocols must begin without knowing the
711 client's name.  They ignore the client name in the
712 ticket request.
713 All the protocols end
714 with the AS sending
715 an
716 .I AuthOK
717 message containing a server ticket and authenticator.
718 .PP
719 .I AuthOK
720 messages
721 always have a fixed but context-dependent size.
722 The occasional variable-length OK message starts with a
723 .I AuthOKvar
724 byte and a five-byte space-padded decimal length of the
725 data that follows.
726 .PP
727 Anywhere an
728 .I AuthOK
729 message is expected, a
730 .I AuthErr
731 message may be substituted.
732 .de Ok
733 .TP
734 .I A→S:
735 .IR AuthOK ,
736 .IR Ks { AuthTs ,
737 .IR CHs ,
738 .IR IDc ,
739 .IR IDc ,
740 .IR Kn },
741 .IR Kn { AuthAc ,
742 .IR CHs }
743 ..
744 .PP
745 .TP
746 .I S→A:
747 .IR AuthChal ,
748 .IR \- ,
749 .IR DN ,
750 .IR CHs ,
751 .IR IDs ,
752 .IR IDc
753 .TP
754 .I A→S:
755 .IR AuthOK ,
756 .IR challenge
757 .TP
758 .I S→A:
759 .IR response
760 .Ok
761 .IP
762 This protocol allows the use of 
763 handheld authenticators such as SecureNet
764 keys and SecureID tokens
765 in programs such as
766 .I telnetd
767 and
768 .I ftpd
769 (see
770 .IR ipserv (8)).
771 .IP
772 .I Challenge
773 and
774 .I response 
775 are text strings,
776 .SM NUL -padded
777 to 16 bytes
778 .RB ( NETCHLEN ).
779 The
780 .I challenge
781 is a random five-digit decimal number.
782 When using a SecureNet key or
783 .I netkey
784 (see
785 .IR passwd (1)),
786 the 
787 .I response
788 is an eight-digit decimal or hexadecimal number
789 that is an encryption of the challenge
790 using the user's DES key.
791 .IP
792 When using a SecureID token,
793 the challenge is ignored.
794 The response is the user's PIN followed by
795 the six-digit number currently displayed
796 on the token.
797 In this case, the AS
798 queries an external RADIUS server
799 to check the response.
800 Use of a RADIUS server requires an entry in
801 the authentication database.  For example:
802 .IP
803 .EX
804     radius=server-name secret=xyzzy
805         uid=howard rid=trickey
806         uid=sape   rid=smullender
807 .EE
808 .IP
809 In this example, the secret
810 .B xyzzy
811 is the hash key used in talking to the RADIUS server.
812 The
813 .BR uid / rid
814 lines map from Plan 9 user ids to RADIUS ids.
815 Users not listed are assumed to have the
816 same id in both places.
817 .TP
818 .I S→A:
819 .IR AuthApop ,
820 .IR \- ,
821 .IR DN ,
822 .IR CHs ,
823 .IR IDs ,
824 .IR \-
825 .TP
826 .I A→S:
827 .IR AuthOKvar ,
828 .IR challenge
829 .TP
830 .I S→A:
831 .IR AuthApop ,
832 .IR \- ,
833 .IR DN ,
834 .IR CHs ,
835 .IR IDs ,
836 .IR IDc ;
837 hexadecimal MD5 checksum
838 .Ok
839 .IP
840 This protocol implements APOP authentication
841 (see
842 .IR pop3 (8)).
843 After receiving a ticket request of type
844 .IR AuthApop ,
845 the AS generates a random challenge
846 of the form
847 .BI < random @ domain >\fR.
848 The client then replies with a new ticket request
849 giving the user name
850 followed by the MD5 checksum of
851 the challenge concatenated with the user's secret.
852 If the response is correct, the authentication
853 server sends back a ticket
854 and authenticator.
855 If the response is incorrect, the client may repeat the
856 ticket request/MD5 checksum message to try again.
857 .IP
858 The 
859 .I AuthCram
860 protocol runs identically to the
861 .I AuthApop
862 protocol, except that the expected MD5 checksum
863 is the keyed MD5 hash using the user's secret as the key
864 (see
865 .I hmac_md5
866 in
867 .IR sechash (2)).
868 .TP
869 .I S→A:
870 .IR AuthChap ,
871 .IR \- ,
872 .IR DN ,
873 .IR CHs ,
874 .IR IDs ,
875 .IR \-
876 .TP
877 .I A→S:
878 .I challenge
879 .TP
880 .I S→A:
881 .IR pktid ,
882 .IR IDc ,
883 .IR response
884 .Ok
885 .IP
886 This protocol implements CHAP authentication
887 (see
888 .IR ppp (8)).
889 The
890 .I challenge
891 is eight random bytes.
892 The response is a 16-byte MD5 checksum
893 over the packet id, user's secret, and challenge.
894 The reply packet is defined as 
895 .B OChapreply
896 in
897 .BR <authsrv.h> .
898 .TP
899 .I S→A:
900 .IR AuthMSchap ,
901 .IR \- ,
902 .IR DN ,
903 .IR CHs ,
904 .IR IDs ,
905 .IR \-
906 .TP
907 .I A→S:
908 .I challenge
909 .TP
910 .I S→A:
911 .IR IDc ,
912 .IR lm-response ,
913 .IR nt-response
914 .Ok
915 .IP
916 This protocol implements Microsoft's MS-CHAP
917 authentication
918 (see
919 .IR ppp (8)).
920 The
921 .I challenge
922 is eight random bytes.
923 The two responses are Microsoft's LM and NT hashes.
924 Only the NT hash may be used to authenticate,
925 as the LM hash is considered too weak.
926 The reply packet is defined as
927 .B OMSchapreply
928 in
929 .BR <authsrv.h> .
930 .TP
931 .I S→A:
932 .IR AuthVNC ,
933 .IR \- ,
934 .IR DN ,
935 .IR CHs ,
936 .IR IDs ,
937 .IR IDc
938 .TP
939 .I A→S:
940 .IR AuthOKvar ,
941 .I challenge
942 .TP
943 .I S→A:
944 .I response
945 .Ok
946 .IP
947 This protocol implements VNC authentication
948 (see
949 .I vncs
950 in
951 .IR vnc (1)).
952 The challenge is 16 random bytes, and the response
953 is a DES ECB encryption of the challenge.
954 The method by which VNC converts the user's
955 secret into a DES key is weak, 
956 considering only the first eight bytes of the secret.
957 .PD
958 .SH FILES
959 .TF /lib/ndb/auth.*xxx
960 .TP
961 .B /lib/ndb/auth
962 database file
963 .TP
964 .B /lib/ndb/auth.*
965 hash files for
966 .B /lib/ndb/auth
967 .SH SEE ALSO
968 .IR auth (2),
969 .IR fauth (2),
970 .IR cons (3),
971 .IR attach (5),
972 .IR auth (8)