[tpm2] Re: Is the tpm2_create command safe against sniffing attacks?

Steven Clark <davolfman at gmail.com>
Newsgroups dev.linux.lists.tpm2
Message-ID <CAOCvsSmH40m_Jae0EthvvYBZEcXgykzLuqTe3JNv-jwNooY=wA@mail.gmail.com>
Hi Joseph,

I think it may be an optional standard but my TPM has some certs
permanently stored in nv-indices in the 0x1c0000x range that can be checked
against the manufacturer cert.  I haven't learned how to leverage those
into trusted parameter encryption keys yet but they should be able to
verify there's a real TPM at the other end at the very least (and more if
you learn to use them correctly).

On Sun, Aug 1, 2021 at 8:33 PM Joseph Lee (ZeronsoftN) <
joseph(a)zeronsoftn.com> wrote:

> Hi Dimi,
>
> Sorry to bother you. By installing the latest version of tpm2-tools,
> encrypted communication is possible.
> Seal/unseal was possible as shown below.
>
> But I have one question. How can I detect if a MITM attack occurs during
> the seal/unseal process? After establishing a session, is there any way to
> get the EK certificate of that session?
> It seems that the tpm2_getekcertificate command can only get certificates
> created via the createek command. I'd like to know if the TPM I've made a
> session with is genuine.
>
> Seal:
> > tpm2_createprimary -c prim.ctx
> > tpm2_startauthsession --hmac-session -c prim.ctx -S sess.ctx
> > tpm2_create -Q -g sha256 -u seal.pub -r seal.priv -i temp.key -C
> prim.ctx -S sess.ctx
> > tpm2_load -Q -C prim.ctx -u seal.pub -r seal.priv -n seal.name -c
> sealctx
> > tpm2_evictcontrol -C o -c seal.ctx 0x81010001
> > tpm2_flushcontext sess.ctx
>
> Unseal:
> > tpm2_startauthsession --hmac-session -c prim.ctx -S sess.ctx
> > tpm2_unseal -c seal.ctx -S sess.ctx -o out.key
> > tpm2_flushcontext sess.ctx
>
> Thanks & Regards,
> Joseph
>
> ------ Original Message ------
> 보낸 사람: "Joseph Lee (ZeronsoftN)" <joseph(a)zeronsoftn.com>
> 받는 사람: "Dimitar Tomov" <dimi(a)designfirst.ee>; "tpm2(a)lists.01.org" <
> tpm2(a)lists.01.org>
> 보낸 날짜: 2021-08-02 오전 6:27:36
> 제목: [tpm2] Re: Is the tpm2_create command safe against sniffing attacks?
>
> Hi Dimi,
>
> Thank you for your kind answer. Looking at the link you gave, I think I
> can get more ideas.
>
> I've been trying session encryption via tpm2-tools all weekend.
> But I haven't found a way to create an encrypted session in tpm2-tools
> yet. Maybe tpm2-tools doesn't support encrypted sessions?
>
> If this is clear, I will implement parameter encryption through tpm2-tools
> with referring to wolfTPM
>
> Thanks & Regards,
> Joseph
>
> ------ Original Message ------
> 보낸 사람: "Dimitar Tomov" <dimi(a)designfirst.ee>
> 받는 사람: "tpm2(a)lists.01.org" <tpm2(a)lists.01.org>; "Joseph Lee (ZeronsoftN)"
> <joseph(a)zeronsoftn.com>
> 보낸 날짜: 2021-08-02 오전 4:33:02
> 제목: [tpm2] Re: Is the tpm2_create command safe against sniffing attacks?
>
> Hi Joseph,
>
> TPM 2.0 offers Parameter Encryption capability and HMAC sessions as
> measures against Man-in-the-middle attacks
>
> Examples in wolfTPM demonstrate how to enable Parameter Encryption
>
>
> https://github.com/wolfSSL/wolfTPM/blob/b0a65e44b8a25be88b2f9ff4e35fbf08360e5d01/examples/nvram/store.c#L121
>
>
> There is also Keygen , Key import and Key loading examples with Parameter
> Encryption
>
>
> https://github.com/wolfSSL/wolfTPM/blob/b0a65e44b8a25be88b2f9ff4e35fbf08360e5d01/examples/nvram/store.c#L121
>
> Last week we discussed the Dolos Group story about a stolen laptop with
> TPM https://developers.tpm.dev/posts/15883726
>
> If Parameter Encryption and HMAC session have been used, this story would
> have developed differently.
>
> Hope this helps.
>
> Dimi
> --
> Founder of TPM.dev
>
> ------------------------------
> *From:* Joseph Lee (ZeronsoftN) <joseph(a)zeronsoftncom
> <joseph(a)zeronsoftn.com>>
> *Sent:* Saturday, July 31, 2021 2:09 AM
> *To:* tpm2(a)lists.01.org <tpm2(a)lists.01.org>
> *Subject:* [tpm2] Is the tpm2_create command safe against sniffing
> attacks?
>
> Hello,
>
> https://pulsesecurity.co.nz/articles/TPM-sniffing
> In this article, can see that communication with the TPM is vulnerable to
> sniffing if not careful.
>
> https://tpm2-software.github.io/2020/04/13/Disk-Encryption.html
> Is the disk encryption described in tpm2-software's blog safe against
> these attacks?
>
>
>    1. tpm2_createprimary -Q -C o -c prim.ctx
>    2. dd if=/dev/urandom bs=1 count=32 status=none | tpm2_create -Q -g
>    sha256 -u seal.pub -r seal.priv -i- -C prim.ctx
>    3. tpm2_load -Q -C prim.ctx -u seal.pub -r seal.priv -n seal.name -c
>    seal.ctx
>    4. tpm2_evictcontrol -C o -c seal.ctx 0x81010001
>
>
> My question is:
>     1. Is there a tool in linux that can sniff communication with the
> current system's TPM?
>     2. How to encrypt communications if the methods described above are
> not secure?
>         It seems that encryption is possible through tpm2_startauthsession
> , but I do not know how to apply it to tpm2_create . (The -S option simply
> did not work.)
>
> Thank you.
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> tpm2 mailing list -- tpm2(a)lists.01.org
> To unsubscribe send an email to tpm2-leave(a)lists.01.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
attachment.htm (text/html, 12.2 KB)
<div dir="ltr">Hi Joseph,<div><br></div><div>I think it may be an optional standard but my TPM has some certs permanently stored in nv-indices in the 0x1c0000x range that can be checked against the manufacturer cert.  I haven&#39;t learned how to leverage those into trusted parameter encryption keys yet but they should be able to verify there&#39;s a real TPM at the other end at the very least (and more if you learn to use them correctly).</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Aug 1, 2021 at 8:33 PM Joseph Lee (ZeronsoftN) &lt;<a href="mailto:[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div><div>Hi Dimi,</div><div><br></div><div>Sorry to bother you. By installing the latest version of tpm2-tools, encrypted communication is possible.</div><div>Seal/unseal was possible as shown below.</div><div><br></div><div>But I have one question. How can I detect if a MITM attack occurs during the seal/unseal process? After establishing a session, is there any way to get the EK certificate of that session?
</div><div>It seems that the tpm2_getekcertificate command can only get certificates created via the createek command. I&#39;d like to know if the TPM I&#39;ve made a session with is genuine.</div><div><br></div><div>Seal:</div><div>&gt; tpm2_createprimary -c prim.ctx
</div><div><span>&gt; </span>tpm2_startauthsession --hmac-session -c prim.ctx -S sess.ctx
</div><div><span>&gt; </span>tpm2_create -Q -g sha256 -u seal.pub -r seal.priv -i temp.key -C prim.ctx -S sess.ctx
</div><div><span>&gt; </span>tpm2_load -Q -C prim.ctx -u seal.pub -r seal.priv -n <a href="http://seal.name" target="_blank">seal.name</a> -c sealctx
</div><div><span>&gt; </span>tpm2_evictcontrol -C o -c seal.ctx 0x81010001
</div><div><span>&gt; </span>tpm2_flushcontext sess.ctx
</div><div><br></div><div>Unseal:</div><div><span>&gt; </span>tpm2_startauthsession --hmac-session -c prim.ctx -S sess.ctx
</div><div><span>&gt; </span>tpm2_unseal -c seal.ctx -S sess.ctx -o out.key
</div><div><span>&gt; </span>tpm2_flushcontext sess.ctx</div><div><br></div><div>Thanks &amp; Regards,
</div><div>Joseph</div>
<div><br></div>
<div>------ Original Message ------</div>
<div>보낸 사람: &quot;Joseph Lee (ZeronsoftN)&quot; &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;</div>
<div>받는 사람: &quot;Dimitar Tomov&quot; &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;; &quot;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&quot; &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;</div>
<div>보낸 날짜: 2021-08-02 오전 6:27:36</div>
<div>제목: [tpm2] Re: Is the tpm2_create command safe against sniffing attacks?</div><div><br></div>
<div id="gmail-m_-1732538254561202165x540a56993bca4ed"><blockquote cite="http://embc50f58e-9f9d-4b11-8f71-8ebc3d052ec0@desktop-hihridj" type="cite" class="gmail-m_-1732538254561202165cite2">
<div>Hi Dimi,</div><div><br></div><div>Thank you for your kind answer. Looking at the link you gave, I think I can get more ideas.
</div><div><br></div><div>I&#39;ve been trying session encryption via tpm2-tools all weekend.
</div><div>But I haven&#39;t found a way to create an encrypted session in tpm2-tools yet. Maybe tpm2-tools doesn&#39;t support encrypted sessions?</div><div><br></div><div>If this is clear, I will implement parameter encryption through tpm2-tools with referring to wolfTPM</div><div><br></div><div><span>Thanks &amp; Regards,</span></div><div>Joseph</div>
<div><br></div>
<div>------ Original Message ------</div>
<div>보낸 사람: &quot;Dimitar Tomov&quot; &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;</div>
<div>받는 사람: &quot;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&quot; &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;; &quot;Joseph Lee (ZeronsoftN)&quot; &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;</div>
<div>보낸 날짜: 2021-08-02 오전 4:33:02</div>
<div>제목: [tpm2] Re: Is the tpm2_create command safe against sniffing attacks?</div><div><br></div>
<div id="gmail-m_-1732538254561202165x8ebb9e3798dc4fa"><blockquote cite="http://HE1PR08MB265161B58D8BE61444DD11B5B5EE9@he1pr08mb2651.eurprd08prod.outlook.com" type="cite" class="gmail-m_-1732538254561202165cite2">

<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Hi Joseph,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
TPM 2.0 offers Parameter Encryption capability and HMAC sessions as measures against Man-in-the-middle attacks</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Examples in wolfTPM demonstrate how to enable Parameter Encryption </div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
 <a href="https://github.com/wolfSSL/wolfTPM/blob/b0a65e44b8a25be88b2f9ff4e35fbf08360e5d01/examples/nvram/store.c#L121" id="gmail-m_-1732538254561202165LPlnk619952" target="_blank">https://github.com/wolfSSL/wolfTPM/blob/b0a65e44b8a25be88b2f9ff4e35fbf08360e5d01/examples/nvram/store.c#L121</a> </div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
There is also Keygen , Key import and Key loading examples with Parameter Encryption</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<a href="https://github.com/wolfSSL/wolfTPM/blob/b0a65e44b8a25be88b2f9ff4e35fbf08360e5d01/examples/nvram/store.c#L121" id="gmail-m_-1732538254561202165LPlnk585337" target="_blank">https://github.com/wolfSSL/wolfTPM/blob/b0a65e44b8a25be88b2f9ff4e35fbf08360e5d01/examples/nvram/store.c#L121</a><br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Last week we discussed the Dolos Group story about a stolen laptop with TPM <a href="https://developers.tpm.dev/posts/15883726" id="gmail-m_-1732538254561202165LPlnk" target="_blank">https://developers.tpm.dev/posts/15883726</a> </div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
If Parameter Encryption and HMAC session have been used, this story would have developed differently.</div>
<br>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Hope this helps.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Dimi</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
--</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
Founder of TPM.dev</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
<br>
</div>
<div id="gmail-m_-1732538254561202165appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-1732538254561202165divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Joseph Lee (ZeronsoftN) &lt;<a href="mailto:[email protected]" target="_blank">joseph@zeronsoftncom</a>&gt;<br>
<b>Sent:</b> Saturday, July 31, 2021 2:09 AM<br>
<b>To:</b> <a href="mailto:[email protected]" target="_blank">[email protected]</a> &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;<br>
<b>Subject:</b> [tpm2] Is the tpm2_create command safe against sniffing attacks?</font>
<div> </div>
</div>

<div>Hello,
<div><br>
</div>
<div><a href="https://pulsesecurity.co.nz/articles/TPM-sniffing" target="_blank">https://pulsesecurity.co.nz/articles/TPM-sniffing</a></div>
<div>In this article, can see that communication with the TPM is vulnerable to sniffing if not careful.<br>
<div><br>
</div>
<div><span style="color:rgb(0,0,238);background-color:rgba(0,0,0,0);text-decoration:underline solid rgb(0,0,238)"><a href="https://tpm2-software.github.io/2020/04/13/Disk-Encryption.html" target="_blank">https://tpm2-software.github.io/2020/04/13/Disk-Encryption.html</a></span></div>
<div>Is the disk encryption described in tpm2-software&#39;s blog safe against these attacks?</div>
<div><br>
</div>
<ol style="margin:0px 0px 15px 30px;padding:0px;color:rgb(17,17,17);background-color:rgb(253,253,253)">
<li><code style="font-size:15px;border:1px solid rgb(232,232,232);border-radius:3px;background-color:rgb(238,238,255);padding:1px 5px">tpm2_createprimary -Q -C o -c prim.ctx</code><br>
</li><li><code style="font-size:15px;border:1px solid rgb(232,232,232);border-radius:3px;background-color:rgb(238,238,255);padding:1px 5px">dd if=/dev/urandom bs=1 count=32 status=none | tpm2_create -Q -g sha256 -u seal.pub
 -r seal.priv -i- -C prim.ctx</code><br>
</li><li><code style="font-size:15px;border:1px solid rgb(232,232,232);border-radius:3px;background-color:rgb(238,238,255);padding:1px 5px">tpm2_load -Q -C prim.ctx -u seal.pub -r seal.priv -n <a href="http://seal.name" target="_blank">seal.name</a> -c seal.ctx</code><br>
</li><li><code style="font-size:15px;border:1px solid rgb(232,232,232);border-radius:3px;background-color:rgb(238,238,255);padding:1px 5px">tpm2_evictcontrol -C o -c seal.ctx 0x81010001</code></li></ol>
<div><br>
</div>
<div>My question is:</div>
<div>    1. Is there a tool in linux that can sniff communication with the current system&#39;s TPM?</div>
<div>    2. How to encrypt communications if the methods described above are not secure?<br>
        It seems that encryption is possible through tpm2_startauthsession , but I do not know how to apply it to tpm2_create . (The -S option simply did not work.)</div>
<div><br>
</div>
<div>Thank you.</div>
<div><br>
</div>
</div>
<div><br>
<br>
<br>
<img style="max-height: 32px;" src="https://mail.zeronsoftn.com/mthumbnail/ffbd1000-b8b6-44ea-b660-35333967ae6e.png"></div>
</div>
</blockquote></div>


<div><br><br><br><img src="https://mail.zeronsoftn.com/mthumbnail/a99c90be-a687-4f14-91cc-d7f28553e551.png" style="max-height: 32px;"></div></blockquote></div>

<div><br><br><br><img src="https://mail.zeronsoftn.com/mthumbnail/2f4a800c-24cb-41fc-b4a8-d0d3eaa9ab0b.png" style="max-height: 32px;"></div></div>
_______________________________________________<br>
tpm2 mailing list -- <a href="mailto:[email protected]" target="_blank">[email protected]</a><br>
To unsubscribe send an email to <a href="mailto:[email protected]" target="_blank">[email protected]</a><br>
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s</blockquote></div>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.