pseudorandom/obfuscated_apples.html

126 lines
15 KiB
HTML
Raw Normal View History

2021-08-10 18:34:54 +00:00
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset="utf-8">
<title>Obfuscated Apples | pseudorandom</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="styles.css">
<link rel="stylesheet" href="/katex/katex.min.css" integrity="sha384-RZU/ijkSsFbcmivfdRBQDtwuwVqK7GMOw6IMvKyeWL2K5UAlyp6WonmB8m7Jd0Hn" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="/katex//katex.min.js" integrity="sha384-pK1WpvzWVBQiP0/GjnvRxV4mOb0oxFuyRxJlk6vVw146n3egcN5C925NCP7a7BY8" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="/katex/auto-render.min.js" integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
</head>
<body>
<header>
<nav>
<strong>pseudorandom</strong>
<a href="./index.html">home</a>
<a href="mailto:sarah@openprivacy.ca">email</a>
<a href="cwtch:icyt7rvdsdci42h6si2ibtwucdmjrlcb2ezkecuagtquiiflbkxf2cqd">cwtch</a>
</nav>
</header>
<article>
<h1 id="obfuscated-apples">Obfuscated Apples</h1>
Generating noise in a way which is indistinguishable from real signal is a ridiculously hard problem. Obfuscation does not hide signal, it only adds noise.
<p class="sidenote">
if you take anything away from this article please let it be this fact.
</p>
<p>Sadly, most people operate under the assumption that adding noise to a system is all that it takes to make the signal unrecoverable. This logic is very clearly in operation in Apples new proposal of on-device scanning <a class="sidenote" href="https://www.apple.com/child-safety/pdf/CSAM_Detection_Technical_Summary.pdf">technical summary</a> which,among other things, proposes generating <em>synthetic</em> matches to hide the true number of <em>real</em> matches in the system.</p>
I want to take this opportunity to break down how this kind of obfuscation can be defeated even when not considering the fact that it is Apple themselves who are charged with generating and maintaining the safety parameters of the system.
<p class="sidenote">
i.e. even if we treat the people who design and build this system as honest adversaries.
</p>
<h2 id="sketching-a-basic-scheme">Sketching a Basic Scheme</h2>
<p>For the sake of clarity I will omit the technical details of the private set intersection protocol, and the threshold scheme, and we will operate under the assumption that both are cryptographically secure. We will also, for now, assume that the database of images to compare is incorruptible.</p>
<p>At the heart of system is a (mostly) black box that contains a perceptual hash function that analyzes an images and spits out a hash, this hash is then compared against a database of known hashes and if a match is found the system reports <code>true</code> and otherwise reports <code>false</code>.</p>
<p>Throughout this article I will use <strong>match</strong> when talking about both true and false positives.</p>
<p>Without question, the server learns a match occurred on the phone during the PSI protocol.</p>
<blockquote class="sidenote">
“The output of PSI protocol on the server reveals whether there is a match or not” - Apple Technical Summary
</blockquote>
<p>When a certain threshold of real matches is reached, the server gains the ability to decrypt all real matches, a human reviews them, and a determination is made.</p>
As presented the system above has one major flaw
<p class="sidenote">
(besides the gross nature of co-opting a personal device as a surveillance system)
</p>
<p>: the server learns how many matches the device has reported prior to being able to decrypt those matches. This is obviously very important metadata in the context of the system and as such needs to be protected.</p>
<p>To do so Apple rely on the invocation of “Synthetic Vouchers” with the following property:</p>
<ul>
<li>“The probability that a device uploads a synthetic voucher instead of a real voucher for an image is calibrated to ensure the total number of synthetics is of the same order of magnitude as the threshold”</li>
</ul>
<h2 id="additional-metadata">Additional Metadata</h2>
<p>So, that is it right? Problem averted? Lets not be too hasty…</p>
<p>From what we know so far there are a few interest parameters in this system, a threshold <span class="math inline"><em>t</em></span>, a probability of generating a synthetic match <span class="math inline"><em>P</em>(<code>synthetic</code>)</span> and the probability of a false positive match <span class="math inline"><em>P</em>(<code>falsepositive</code>)</span>.</p>
<p>We also know that Apple has constructed these parameters such that the probability of an account being flagged for human review (i.e. when number of matches <span class="math inline"><em>M</em>&gt;<em>t</em></span> is <span class="math inline"><em>P</em>(<em>f</em><em>l</em><em>a</em><em>g</em>)=1<em>e</em><sup>12</sup></span> or one in one trillion.</p>
<blockquote class="sidenote">
“The threshold is selected to provide an extremely low (1 in 1 trillion) probability of incorrectly flagging a given account.” - Apple Technical Summary
</blockquote>
<p>From these parameters we can start to derive some additional metadata that exists within the system:</p>
<h3 id="matches-over-threshold-without-decryption">Matches over Threshold without Decryption</h3>
<p>One of the most obvious sources of distinguishing information is built explicitly into the design. The threshold scheme as proposed requires <span class="math inline"><em>t</em></span> real matches in order to decrypt the inner envelopes containing the matches images.</p>
<p>Taking the number of observed matches, <span class="math inline"><em>o</em></span>, the system is able to derive a value <span class="math inline"><em>t</em>=<em>o</em>/<em>t</em></span> or, the number of observed matches divided by the threshold.</p>
<p>Every time a new match is observed and <span class="math inline"><em>t</em></span> is over the threshold the system learns additional information regarding the makeup of previous matches.</p>
<p>For example, if we set the <span class="math inline"><em>t</em>=10</span>, then after the system observes <span class="math inline">10</span> matches (made up of a number of an unknown number of real or synthetic matches) then every additional match until decryption can be used to derive information about the previous matches. If the next match to arrive does not allow decryption then the server can derive that there are at least 2 synthetic matches in the bucket. This confidence increases with every observation that does not result in decryption.</p>
<p>Further we know that synthetic matches happen with probability <span class="math inline"><em>P</em>(<code>synthetic</code>)</span> and as such the <strong>rate</strong> at which observed matches in combination with the above allows us to define a probability <span class="math inline"><em>P</em>(<code>match</code>)</span> given that the observation did not result in decryption, and the known probability of a device generating a synthetic value <span class="math inline"><em>P</em>(<code>synthetic</code>)</span>.</p>
<p><br /><span class="math display">$$P(\texttt{match}| \texttt{observation}) = \frac{P(\texttt{match}|\texttt{real}) \times P(\texttt{observation})}{P(\texttt{synthetic})}$$</span><br /></p>
<p>We know that all matches will result in an observation and so…</p>
<p><br /><span class="math display">$$P(\texttt{match}| \texttt{observation}) = \frac{1 \times P(\texttt{observation})}{P(\texttt{synthetic})}$$</span><br /></p>
<p>Or more simply:</p>
<p><br /><span class="math display">$$P(\texttt{match}| \texttt{observation}) = \frac{P(\texttt{observation})}{P(\texttt{synthetic})}$$</span><br /></p>
<p>Finally, we can state the the probability of an observation (say over the period of a day) is the probability of a real match on any given day plus the probability of a synthetic match on any given day:</p>
<p><br /><span class="math display">$$P(\texttt{match}| \texttt{observation}) = \frac{P(\texttt{synthetic})+P(\texttt{match})}{P(\texttt{synthetic})}$$</span><br /></p>
<p>Given that the probability of a synthetic match is defined by Apple, the only unknown in the system is the probability of a match.</p>
While this may start as an unknown
<p class="sidenote">
setting aside the fact that Apple already has enough data to derive this themselves
</p>
<p>, Apple quickly generates a large amount of data relating to when new observations are made. Since people are different in the ways these take and store photos and live in different parts of the world, the exact probability of them triggering a check is dependent on them.</p>
<p>It is also obvious at this point that if <span class="math inline"><em>P</em>(<code>synthetic</code>)</span> is generated <em>naively</em> <span class="sidenote">(<em>naively</em> as in not account specific)</span> then <em>any</em> additional information known about a particular account e.g. the number of photos they are likely to store over a period of time is enough for <strong>anyone</strong> who knows <span class="math inline"><em>P</em>(<code>synthetic</code>)</span> to derive <span class="math inline"><em>P</em>(<code>match</code>)</span>. <span class="sidenote">We will come back to this point shortly</span></p>
<p>The secrecy then is highly dependent on both Apple never deriving <span class="math inline"><em>P</em>(<code>observation</code>)</span> for themselves <em>and</em> on Apple generating a distinct <span class="math inline"><em>P</em>(<code>synthetic</code>)</span> for each account. Or rather, the privacy of one of the most sensitive aspects of this system requires Apple both collecting no information on accounts, and also on Apple knowing enough about accounts to derive the parameters necessary to keep the information private.</p>
<hr/>
<p>It is actually worse than that through. Remember that Apple has stated that the actual probability of observing <span class="math inline"><em>M</em>&gt;<em>t</em></span> false positive matches is 1 in a trillion.</p>
<p>We can work backwards from that number to derive <span class="math inline"><em>P</em>(<code>falsepositive</code>)</span>:</p>
<p><br /><span class="math display">$$P(\texttt{flag}) = \sum_{\substack{x = t}}^T {T \choose x} \cdot P(\texttt{falsepositive})^x \cdot P(\texttt{falsepositive})^{100 - x} \approx 1\mathrm{e}^{-12}$$</span><br /></p>
<p>In order to finalize this we only need to make educated guesses about 2 parameters: the threshold value <span class="math inline"><em>t</em></span> and the total number of photos checked per year <span class="math inline"><em>T</em></span>. Apple throws out the number <span class="math inline"><em>t</em>=10</span> in their technical summary, which seems like a good place to start.</p>
<p>Assuming an average account generates 3-4 pictures a day to be checked then <span class="math inline"><em>T</em>1278</span> over a year. Plugging in those numbers, and we get <span class="math inline"><em>P</em>(<code>falsepositive</code>)0.00035</span> or 1 in 2858. <span class="sidenote">yikes</span>.</p>
<p>Given that we can go back and calculate the probability of observing, <span class="math inline"><em>P</em>(<code>match</code>)</span>, a match each day…</p>
<p><br /><span class="math display">$$P(\texttt{match}) = 1 - (( 1 - 0.00035)^3.5) \approx 0.001225 \approx \frac{1}{816}$$</span><br /></p>
<p>Or, a match once on average every 816 days for a person that only stores 3-4 photos per day.</p>
<p>Not everybody is every person though, if we applied the same <span class="math inline"><em>P</em>(<code>falsepositive</code>)</span> to a new parent who takes upwards of 50 photos per day, then their <span class="math inline"><em>P</em>(<code>match</code>)</span> is:</p>
<p><br /><span class="math display">$$P(\texttt{match}) = 1 - (( 1 - 0.00035)^50) \approx 0.01735 \approx \frac{1}{57}$$</span><br /></p>
<p>Or, a match on average every 57 days.</p>
<p>At this point I feel compelled to point out that these are <strong>average</strong> match probabilities. For the prolific photo taking parent who takes 18250 photos a year, the probability that they actually exceed the threshold in false matches is 6% <span class="sidenote">assuming <span class="math inline"><em>t</em></span> is 10</span>.</p>
<p>It is also worth mentioning that even though we ballparked <span class="math inline"><em>t</em></span> and <span class="math inline"><em>T</em></span> there are explicit constraints on what their values can be. If Apple generates a single <span class="math inline"><em>t</em></span> for all accounts, then <span class="math inline"><em>T</em></span> needs to be an approximation on the average number of photos an account stores per year. If Apple generates a different <span class="math inline"><em>t</em></span> value for every account, then it has enough information already to derive <span class="math inline"><em>P</em>(<code>observation</code>)</span> and break its own obfuscation.</p>
<hr/>
<p>Using what we now know we can revisit the server side operations show how the observer can calculate the probability of a real match given the probability of any q observation and the probability of a synthetic match.</p>
<p>For an “average” account that stores 3-4 photos per day we know that <span class="math inline"><em>P</em>(<code>match</code>)=0.001225</span>, allowing Apple, who defines P() to calculate:</p>
<p><br /><span class="math display">$$P(\texttt{match}| \texttt{observation}) = \frac{P(\texttt{synthetic}) + 0.001225}{P(\texttt{synthetic})}$$</span><br /></p>
<p>For our prolific “parent” account that stores 50 photos per day we know that <span class="math inline"><em>P</em>(<code>observation</code>)0.01735</span>, allowing Apple, who defines P() to calculate:</p>
<p><br /><span class="math display">$$P(\texttt{match}| \texttt{observation}) = \frac{P(\texttt{synthetic}) + 0.01735}{P(\texttt{synthetic})}$$</span><br /></p>
This clarifies our observation from earlier, if Apple define a global <span class="math inline"><em>P</em>(<code>synthetic</code>)</span> then different accounts will naturally have different server-side distributions of observations, and these can be used to tighten the estimates of true matches.
<p class="sidenote">
And, again, if Apple can define <span class="math inline"><em>P</em>(<code>synthetic</code>)</span> on a per-account basis then they have <strong>more</strong> information to use when tightening these estimates
</p>
<hr/>
<p>In this analysis we have deliberately left out other information that Apple, or someone who can compel Apple, may use to tighten these estimates e.g. derived from public social media feeds.</p>
</article>
<hr/>
<h2>
Recent Articles
</h2>
<p>2021-08-10 <a href="obfuscated_apples.html">Obfuscated Apples</a><br></p>
<footer>
Sarah Jamie Lewis
</footer>
</body>
</html>