<div dir="ltr"><br><br>On Thursday, 2 April 2015 08:11:16 UTC-4, Patrick Schleizer  wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Hi!
<br>
<br>Does qubes-builder check for rollback (downgrade) or indefinite freeze
<br>attacks [1]?
<br>
<br>Threat model:
<br>- a user who builds from source code
<br>- building user successfully verified Qubes' source code
<br>- user doesn't manually ensure after build, that version numbers match,
<br>doesn't read the build log [unless it stops and shows errors], and
<br>relies that the verification chain is intact
<br>- git hosting compromised [2]
<br>- eventually targeting specific builders
<br>
<br>function:
<br>verify_tag
<br>
<br>link:
<br><a href="https://github.com/QubesOS/qubes-builder/blob/7d21e6b7b0a5ab3a68e8acdbc3f540f2221b47c0/scripts/verify-git-tag#L38" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2FQubesOS%2Fqubes-builder%2Fblob%2F7d21e6b7b0a5ab3a68e8acdbc3f540f2221b47c0%2Fscripts%2Fverify-git-tag%23L38\46sa\75D\46sntz\0751\46usg\75AFQjCNHgBixE2ii27dgWQrbpX795hdBfRA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2FQubesOS%2Fqubes-builder%2Fblob%2F7d21e6b7b0a5ab3a68e8acdbc3f540f2221b47c0%2Fscripts%2Fverify-git-tag%23L38\46sa\75D\46sntz\0751\46usg\75AFQjCNHgBixE2ii27dgWQrbpX795hdBfRA';return true;">https://github.com/QubesOS/<wbr>qubes-builder/blob/<wbr>7d21e6b7b0a5ab3a68e8acdbc3f540<wbr>f2221b47c0/scripts/verify-git-<wbr>tag#L38</a>
<br>
<br>code:
<br>gpg --verify --status-fd=1 $temp_name/content.asc 2>/dev/null|grep -q
<br>'^\[GNUPG:\] TRUST_\(FULLY\|ULTIMATE\)$'
<br>
<br>It does not check freshness? So any older tag/signature would be
<br>accepted, a rollback attack would succeed?
<br>
<br>I am very much into file verification, gpg, wrote gpg-bash-lib [6] where
<br>I'd appreciate feedback and sometimes report gpg usage security issues
<br>in other projects. [non-exhaustive list [7]]
<br>
<br>Having said that, do you have any other gpg verification code in other
<br>files that I could look into?
<br></blockquote><div><br>I recently implemented some gpg verification of files, not github, in python.  Only added import key and verify.<br><a href="https://github.com/nrgaway/qubes-app-salt-config/blob/develop-wip/srv/qubes-salt/_modules/gpg.py">https://github.com/nrgaway/qubes-app-salt-config/blob/develop-wip/srv/qubes-salt/_modules/gpg.py</a><br><a href="https://github.com/nrgaway/qubes-app-salt-config/blob/develop-wip/srv/qubes-salt/_states/gpg.py">https://github.com/nrgaway/qubes-app-salt-config/blob/develop-wip/srv/qubes-salt/_states/gpg.py</a><br><a href="https://github.com/nrgaway/qubes-app-salt-config/blob/develop-wip/srv/qubes-salt/_renderers/verify.py">https://github.com/nrgaway/qubes-app-salt-config/blob/develop-wip/srv/qubes-salt/_renderers/verify.py</a> <br><br>I just finished converting a setup script from bash to python and there is a small routine that verifies fingerprint matches one from keyserver.<br><a href="https://github.com/nrgaway/qubes-builder/blob/nrgaway/setup#L927">https://github.com/nrgaway/qubes-builder/blob/nrgaway/setup#L927</a><br><a href="https://github.com/nrgaway/qubes-builder/blob/nrgaway/.setup.data">https://github.com/nrgaway/qubes-builder/blob/nrgaway/.setup.data</a><br><br></div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<br>Cheers,
<br>Patrick
<br>
<br>[1] "rollback (downgrade) or indefinite freeze attack"
<br>Defined as per TUF: Attacks and Weaknesses:
<br>- <a href="https://github.com/theupdateframework/tuf/blob/develop/SECURITY.md" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Ftheupdateframework%2Ftuf%2Fblob%2Fdevelop%2FSECURITY.md\46sa\75D\46sntz\0751\46usg\75AFQjCNEU5jzjcn96TIUdRgp4xRK20VmEtA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Ftheupdateframework%2Ftuf%2Fblob%2Fdevelop%2FSECURITY.md\46sa\75D\46sntz\0751\46usg\75AFQjCNEU5jzjcn96TIUdRgp4xRK20VmEtA';return true;">https://github.com/<wbr>theupdateframework/tuf/blob/<wbr>develop/SECURITY.md</a>
<br>- <a href="http://www.webcitation.org/6F7Io2ncN" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.webcitation.org%2F6F7Io2ncN\46sa\75D\46sntz\0751\46usg\75AFQjCNGL5wAN1oW9_g_BUMXz9b0BSC0OuQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.webcitation.org%2F6F7Io2ncN\46sa\75D\46sntz\0751\46usg\75AFQjCNGL5wAN1oW9_g_BUMXz9b0BSC0OuQ';return true;">http://www.webcitation.org/<wbr>6F7Io2ncN</a>
<br>[2]
<br>* In case github gets hacked [3] again.
<br>* Or in cases similar to:
<br> * SSL CA's such as DigiNotar was hacked or [4]
<br> * comodo resellers that got hacked. [5]
<br>[3]
<br><a href="http://www.extremetech.com/computing/120981-github-hacked-millions-of-projects-at-risk-of-being-modified-or-deleted" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.extremetech.com%2Fcomputing%2F120981-github-hacked-millions-of-projects-at-risk-of-being-modified-or-deleted\46sa\75D\46sntz\0751\46usg\75AFQjCNEh46ejZ-8XFUpTfYlgoefk7U4HvA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.extremetech.com%2Fcomputing%2F120981-github-hacked-millions-of-projects-at-risk-of-being-modified-or-deleted\46sa\75D\46sntz\0751\46usg\75AFQjCNEh46ejZ-8XFUpTfYlgoefk7U4HvA';return true;">http://www.extremetech.com/<wbr>computing/120981-github-<wbr>hacked-millions-of-projects-<wbr>at-risk-of-being-modified-or-<wbr>deleted</a>
<br>[4] <a href="https://en.wikipedia.org/wiki/DigiNotar" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDigiNotar\46sa\75D\46sntz\0751\46usg\75AFQjCNGHZFmJ0RnATbhwOxnwq5yI6jE6QA';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDigiNotar\46sa\75D\46sntz\0751\46usg\75AFQjCNGHZFmJ0RnATbhwOxnwq5yI6jE6QA';return true;">https://en.wikipedia.org/wiki/<wbr>DigiNotar</a>
<br>[5]
<br><a href="http://www.scmagazine.com/two-more-comodo-resellers-owned-in-ssl-hack/article/199620/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.scmagazine.com%2Ftwo-more-comodo-resellers-owned-in-ssl-hack%2Farticle%2F199620%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNESe6ZpRJLnsCk9cebfgiu3mvcIPQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwww.scmagazine.com%2Ftwo-more-comodo-resellers-owned-in-ssl-hack%2Farticle%2F199620%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNESe6ZpRJLnsCk9cebfgiu3mvcIPQ';return true;">http://www.scmagazine.com/two-<wbr>more-comodo-resellers-owned-<wbr>in-ssl-hack/article/199620/</a>
<br>[6] <a href="https://github.com/Whonix/gpg-bash-lib" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2FWhonix%2Fgpg-bash-lib\46sa\75D\46sntz\0751\46usg\75AFQjCNG0kJnB2UngOSoTskUPHKjJSBIrfQ';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2FWhonix%2Fgpg-bash-lib\46sa\75D\46sntz\0751\46usg\75AFQjCNG0kJnB2UngOSoTskUPHKjJSBIrfQ';return true;">https://github.com/Whonix/gpg-<wbr>bash-lib</a>
<br>[7] <a href="https://phabricator.whonix.org/T245" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\75https%3A%2F%2Fphabricator.whonix.org%2FT245\46sa\75D\46sntz\0751\46usg\75AFQjCNEZB3lobhnzG74AzkPXa8DQZlDytQ';return true;" onclick="this.href='https://www.google.com/url?q\75https%3A%2F%2Fphabricator.whonix.org%2FT245\46sa\75D\46sntz\0751\46usg\75AFQjCNEZB3lobhnzG74AzkPXa8DQZlDytQ';return true;">https://phabricator.whonix.<wbr>org/T245</a>
<br></blockquote></div>