{"id":2525,"date":"2018-03-27T16:49:01","date_gmt":"2018-03-27T14:49:01","guid":{"rendered":"http:\/\/hasselba.ch\/blog\/?p=2525"},"modified":"2018-03-27T17:50:40","modified_gmt":"2018-03-27T15:50:40","slug":"the-anatomy-of-a-ltpa-token","status":"publish","type":"post","link":"https:\/\/hasselba.ch\/blog\/?p=2525","title":{"rendered":"The anatomy of a LTPA token"},"content":{"rendered":"<h1>LTPA Token<\/h1>\n<p>LTPA token are widely used in the IBM world for authentication between different physical machines, also known as WebSSO. There are <del datetime=\"2018-03-27T15:48:34+00:00\">two<\/del> three types available, LTPA1, LTPA2 and a Domino format.<\/p>\n<p>LTPA1 and LTPA2 are commonly used with WebSphere, and Domino can import the keys to work with this kind of token. The Domino version of LTPA is normally used in the Domino world, and that&#8217;s the token I will write about.<\/p>\n<p>First, what is a Domino LTPA token in general? It is a BASE64 encoded String containing the information about the user, including some timestamps. To avoid a security problem, the token is hashed and then encrypted (see here: <a href=\"https:\/\/www.ibm.com\/support\/knowledgecenter\/en\/SS9H2Y_7.2.0\/com.ibm.dp.doc\/ltpa_versionsandtokenformats.html\">LTPA versions and token formats<\/a>).<\/p>\n<p>So let&#8217;s look into a real world example. Here is a LTPA Domino token from my server*:<\/p>\n<pre><code>77+9AQIDNUFCMTJBNjk1QUIxMzg3OUNOPVN2ZW4gSGFzc2VsYmFjaC9PPUhhc3NlbGJhL089Q0gwezcFKix7Fy00cg==<\/code><\/pre>\n<p>Now here comes the BASE64 decoded version:<br \/>\n<a href=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2018\/03\/LTPA-Token.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2530\" src=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2018\/03\/LTPA-Token.png\" alt=\"\" width=\"1288\" height=\"142\" srcset=\"https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2018\/03\/LTPA-Token.png 1288w, https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2018\/03\/LTPA-Token-300x33.png 300w, https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2018\/03\/LTPA-Token-768x85.png 768w, https:\/\/hasselba.ch\/blog\/wp-content\/uploads\/2018\/03\/LTPA-Token-1024x113.png 1024w\" sizes=\"auto, (max-width: 1288px) 100vw, 1288px\" \/><\/a><\/p>\n<p>As you can see, there is my username insinde of the token. And at this point I am a little bit confused, because the IBM writes in the linked article above:<\/p>\n<blockquote><p>Domino uses a shared key and SHA-1 to calculate a MAC over the content. After the MAC is attached, the user data and MAC are encrypted with a 3DES key obtained from the LTPA key file.<\/p><\/blockquote>\n<p>Maybe it is because I have super powers which allow me to decrypt the 3DES encrypted userdata in my brain. But I think it is just a wrong information, and the userdata are not encrypted with 3DES.<\/p>\n<p>This does not make the LTPA token unsafe, there is still a SHA-1 hash which protects the userdata from beeing changed in a text editor. Let&#8217;s look how the token is build up:<\/p>\n<h1>Anatomy of LTPA Domino Token<\/h1>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><strong>Byte<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>0-3<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>4-11<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>12-19<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>20 &#8211; ?<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>? &#8211; ? + 20<\/strong><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><strong>Content<\/strong><\/td>\n<td style=\"text-align: center;\">Header<\/td>\n<td style=\"text-align: center;\">Creation<\/td>\n<td style=\"text-align: center;\">Expiration<\/td>\n<td style=\"text-align: center;\">Username<\/td>\n<td style=\"text-align: center;\">Hash<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Header (4 Bytes)<\/h2>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><strong>Byte<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>01<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>02<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>03<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>04<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><strong>Value<\/strong><\/td>\n<td style=\"text-align: center;\">0<\/td>\n<td style=\"text-align: center;\">1<\/td>\n<td style=\"text-align: center;\">2<\/td>\n<td style=\"text-align: center;\">3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Creation &amp; Expiration (each 8 Bytes)<\/h2>\n<p>These values are Java Dates stored as Long value.<\/p>\n<h2>Username (Length different)<\/h2>\n<p>A string containing the abbreviated form of the current username. The length varies.<\/p>\n<h2>Hash (20 Bytes)<\/h2>\n<p>A SHA-1 hash, 160 Bits long. The hash is generated by adding the LTPA secret at the end of the userdata; the result is added to the end of the LTPA token.<\/p>\n<h1>The Problem<\/h1>\n<p>The problem with LTPA Domino token is the use <a href=\"https:\/\/shattered.it\/\" target=\"_blank\" rel=\"noopener\">of an insecure hash algorithm.<\/a> We had to change all SSL certificates because of it, the NIST has deprecated it in 2011. And the 3DES encryption is a myth.<\/p>\n<p>But we are still protecting our infrastructure with this weak algorithm&#8230;<\/p>\n<p><sub>*: no, it&#8217;s not \ud83d\ude09<\/sub><\/p>\n","protected":false},"excerpt":{"rendered":"<p>LTPA Token LTPA token are widely used in the IBM world for authentication between different physical machines, also known as WebSSO. There are two three types available, LTPA1, LTPA2 and a Domino format. LTPA1 and LTPA2 are commonly used with &hellip; <a href=\"https:\/\/hasselba.ch\/blog\/?p=2525\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,82],"tags":[7,90,16,12],"class_list":["post-2525","post","type-post","status-publish","format-standard","hentry","category-security","category-server","tag-domino","tag-security","tag-server","tag-web"],"_links":{"self":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2525"}],"version-history":[{"count":11,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2525\/revisions"}],"predecessor-version":[{"id":2538,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2525\/revisions\/2538"}],"wp:attachment":[{"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasselba.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}