<metaproperty="og:description"content="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>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<emclass="footnotelabel"></em>.</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 Apple’s new proposal for on-device scanning<emclass="footnotelabel"></em><aclass="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 <strong>Apple themselves who are charged with generating and maintaining the safety parameters of the system</strong><emclass="footnotelabel"></em>.
<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 assume that the database of images to compare is <em>incorruptible</em><emclass="footnotelabel"></em><spanclass="sidenote">This is clearly not the case.</span>.</p>
<p>At the heart of system is a (mostly) black box that contains a <strong>perceptual</strong> hash function that analyzes an image 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><emclass="footnotelabel"></em>. <spanclass="sidenote">As we will see later on, perceptual hashes are <strong>not</strong> cryptographic hashes.<span></p>
<p>Throughout this article I will use the term <strong>match</strong> when talking about both true and false positives, though I will mostly assume any matches are false positives.</p>
<p>According to documentation provided by Apple, the server learns any matches occurred on the phone during the PSI protocol.<emclass="footnotelabel"></em></p>
<p>When a certain threshold of matches are reached, the server gains the ability to decrypt all data associated , a human reviews that data, and a determination is made.</p>
<p>As presented the system above has one major flaw<emclass="footnotelabel"></em><spanclass="sidenote">(besides the gross nature of co-opting a personal device as a surveillance system)</span>: the server learns how many matches the device has reported prior to being able to decrypt those matches.</p>
<p>This is obviously very important metadata in the context of the system and as such needs to be protected - if it is not then Apple, or someone who can compel Apple to release the data, can identify potential targets based on this metadata.<emclass="footnotelabel"></em><spanclass="sidenote">As we shall soon discuss targeting people in way would be highly irrational if your goal was to actually hunt people doing harm, but people are not rational actors.</span></p>
<p>To protect this data Apple relies on the invocation of so-called “Synthetic Vouchers” with the following property:</p>
<blockquote>
“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”
<p>From what we know so far there are a few interesting parameters in this system that Apple must determine values for.</p>
<p>There is the threshold <spanclass="math inline"><em>t</em></span> of matches necessary to decrypt the data, there is the probability of a device generating a synthetic match <spanclass="math inline"><em>P</em>(<code>synthetic</code>)</span> and there is the probability of a false positive match <spanclass="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 <spanclass="math inline"><em>M</em>><em>t</em></span> is <spanclass="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.<emclass="footnotelabel"></em></p>
“The threshold is selected to provide an extremely low (1 in 1 trillion) probability of incorrectly flagging a given account.” - Apple Technical Summary
<p>In order to finalize this we only need to make educated guesses about 2 parameters: the threshold value, <spanclass="math inline"><em>t</em></span>, and the total number of photos checked per year, <spanclass="math inline"><em>T</em></span>. Apple throws out the number <spanclass="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 <spanclass="math inline"><em>T</em>≈1278</span> over a year. Plugging in those numbers, and we get <spanclass="math inline"><em>P</em>(<code>falsepositive</code>)≈0.00035</span> or <strong>1 in 2858</strong>.</p>
<p>Does that number have any relation to reality? There is evidence<emclass="footnotelabel"></em> to suggest <spanclass="sidenote"><ahref="https://arxiv.org/abs/2106.09820">Adversarial Detection Avoidance Attacks: Evaluating the robustness of perceptual hashing-based client-side scanning.</a> Shubham Jain, Ana-Maria Cretu, Yves-Alexandre de Montjoye</span> that the false acceptance rate for common perceptual hashing algorithms is between 0.001-0.01 for a database size of 500K.</p>
<p>That makes our guesstimate of 0.00035 an order of magnitude smaller than the most generous empirical estimate. We will be generous and assume Apple broke some new ground with NeuralHash and 0.00035 represents a major improvement in perceptual hashing false acceptance rates.</p>
<p>Given that we can go back and calculate the probability of observing, <spanclass="math inline"><em>P</em>(<code>match</code>)</span>, a match each day…</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 <spanclass="math inline"><em>P</em>(<code>falsepositive</code>)</span> to a new parent who takes upwards of 50 photos per day, then their <spanclass="math inline"><em>P</em>(<code>match</code>)</span> is:</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%<emclass="footnotelabel"></em><spanclass="sidenote">assuming <spanclass="math inline"><em>t</em></span> is 10</span>.</p>
<p>It is also worth mentioning that even though we ballparked <spanclass="math inline"><em>t</em></span> and <spanclass="math inline"><em>T</em></span> there are explicit constraints on what their values can be. If Apple generates a single <spanclass="math inline"><em>t</em></span> for all accounts, then <spanclass="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 <spanclass="math inline"><em>t</em></span> value for every account, then it has enough information already to derive <spanclass="math inline"><em>P</em>(<code>observation</code>)</span> and break its own obfuscation.</p>
<p>Using what we now know we can assess 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>
<h3id="the-probability-of-synthetic-matches">The Probability of Synthetic Matches</h3>
<p>Before we go any further, we should address one particular complication. Apple appears to suggest that images are probabilistically replaced with synthetic matches:</p>
<blockquote>
“the device occasionally produces synthetic vouchers for images as opposed to ones corresponding to their image”
</blockquote>
<p>Given that, the rate of real matches v.s. synthetic matches isn’t independent. <strong>Actual matches might be replaced by synthetic matches</strong>.</p>
<p>Or, to put it another way, the probability of a match being reported as a match is dependent on the probability it isn’t reported as a synthetic. Either way, <spanclass="math inline"><em>P</em>(<code>observation</code>|<code>match</code>)=1</span></p>
<p>Further we can actually make a guess at the value of <spanclass="math inline"><em>P</em>(<code>synthetic</code>)</span> under the assumption that it is calculated globally. Since Apple have stated that <spanclass="math inline"><em>P</em>(<code>synthetic</code>)</span> is dependent on <spanclass="math inline"><em>t</em></span> and is designed such that it generates synthetic matches in the same order or magnitude as <spanclass="math inline"><em>t</em></span> we can derive <spanclass="math inline"><em>P</em>(<code>synthetic</code>)</span> such that each device generates <spanclass="math inline"><em>t</em></span> synthetic matches a year on average.</p>
<p>Using our numbers from earlier we can place <spanclass="math inline"><em>P</em>(<code>synthetic</code>)≈0.01</span> which would mean that over the course of a year, an average account storing 3-4 messages a day would have ~70% chance of generating 10 or more synthetic vouchers.</p>
<p>The exact value doesn’t really matter for our purposes. Any order of magnitude greater than <spanclass="math inline">0.01</span> results in too many synthetic matches, and any order of magnitude smaller results in too few.</p>
<p>Given what we know about the probabilities in this system we can now piece together a server-side attribution attack to break the privacy provided by synthetic matches.</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>
<p>We can now plug in our values from earlier. Remember, <strong>Apple has stated</strong> that the actual probability of observing <spanclass="math inline"><em>t</em></span> false positive matches, <spanclass="math inline"><em>P</em>(<code>flag</code>)</span>, is <strong>1 in a trillion</strong> and as such we have been able to derive approximate probabilities for false positives.</p>
<p>For an “average” account that stores 3-4 photos per day we know that <spanclass="math inline"><em>P</em>(<code>match</code>)=≈0.001225</span>, allowing Apple, who defines P() to calculate:</p>
<p>Given that we are aiming for ~10 synthetics over the course of a year, an 11% probability of any observation being a real match seems about the right level of indistinguishably.</p>
<p>But, what about our prolific “parent” account that stores 50 photos per day? We know that <spanclass="math inline"><em>P</em>(<code>match</code>)≈0.01735</span>, allowing Apple, who defines <spanclass="math inline"><em>P</em>(<code>synthetic</code>)</span> to calculate:</p>
If Apple define a global <spanclass="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.<emclass="footnotelabel"></em>
And, again, if Apple can define <spanclass="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>The secrecy of this metadata is then is <strong>paradoxically dependent</strong> on both Apple never deriving <spanclass="math inline"><em>P</em>(<code>observation</code>)</span> for themselves <em>and</em> on Apple generating a distinct <spanclass="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 much worse than that though.</p>
<p>While priors may start as an unknown<emclass="footnotelabel"></em><spanclass="sidenote">(setting aside the fact that Apple already has enough data to derive this themselves)</span>, 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>There are also additional discriminating events in the system itself.</p>
<h3id="matches-over-threshold-without-decryption">Matches over Threshold without Decryption</h3>
<p>One of the most obvious sources of discriminating information is built explicitly into the design. The threshold scheme as proposed requires <spanclass="math inline"><em>t</em></span> real matches in order to decrypt the inner envelopes containing the matches images.</p>
<p>As such. every time a new match is observed and <spanclass="math inline"><em>t</em>′</span> is over the threshold the system learns additional information regarding the makeup of previous matches.</p>
<p>To illustrate, if we set the <spanclass="math inline"><em>t</em>=10</span>, then after the system observes <spanclass="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>Combining that with our bayesian estimates fom earlier we can see how an adversarial observer could update their estimates of <spanclass="math inline"><em>P</em>(<code>synthetic</code>)</span> based on the total number of observations, and the fact that no decryption has taken place.</p>
<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>
<p>In reality, an adversary will have far greater access to auxiliary data about the environment and target sets than simply raw probabilities.</p>
<p>In that kind of environment, no amount of server-defined obfuscation is enough to protect the metadata that the server holds.</p>
<p>In this case that metadata is a rather controversial number i.e.<strong>the number of possible matches to illegal material detected on the device</strong>.</p>
<p>That is interesting metadata to countless entities including the law enforcement and intelligence agencies of multiple jurisdictions and states.</p>
<p>Even if we strictly limit the type of material that Apple is searching for, the high likelihood of false positive events combined with the ease at which Apple can likely distinguish true matching events from synthetic events<emclass="footnotelabel"></em><spanclass="sidenote"> (as worked through above)</span> should concern any potential subject of the system.</p>