Автора пока нетВзять себе
- Лицензия
- CC0 1.0 (общественное достояние)По материалам www.nist.gov
- Языки
- English
- Темы
- Наука
A program that is meant to protect privacy can be wrong while every number it prints looks plausible. A NIST post in its series on differential privacy explains why. The algorithms in the series have mathematical proofs, but turning them into code can introduce bugs that quietly fail to protect privacy.
What a privacy bug looks like
Differential privacy adds random noise to the result of a data analysis. A certain amount of noise buys a certain amount of privacy. A privacy bug means too little noise, so too little privacy, or too much, which ruins the accuracy of the result.
The post’s example starts from a differentially private count of the elements in a dataset. The scale of the Laplace noise is chosen as 1/ε, and because the raw count has sensitivity 1, the result satisfies ε-differential privacy. Now suppose the program must return twice the count. If the code still uses scale 1/ε, it is wrong: the raw result is now 2-sensitive, so the program only satisfies ε/2-differential privacy. To reach ε, the scale must be 2/ε. In general, an s-sensitive function needs Laplace noise with scale s/ε.
Two common classes of bug are adding the wrong amount of noise, as above, and calculating a function’s sensitivity incorrectly. Others come from buggy proofs, details of floating-point arithmetic, flawed random-number generators and even a program’s execution time.
Why testing does not catch it
Ordinary testing compares output with an expected answer: an integer square root should give 3 for 9. Even that is only as good as the cases chosen, and the post notes a program cannot be proved 100 percent correct by testing when the possible inputs are too many. Testing is nonetheless the leading approach to software assurance, because most correctness rules can be expressed as pairs of inputs and outputs.
Privacy programs break that approach. Their outputs are random, and a privacy bug shows only in the distribution of outputs, not in any single value.

Figure 3 of the post: traditional testing works for typical programs but not for privacy programs. Image from NIST’s page.
Both a correct and a buggy program could return 42. The difference is that each draws it from a Laplace distribution with a different scale, and one draw cannot reveal that. The post shows this with two lists of ten results, both with a raw answer of 2000 and ε set to 1. Readers are asked to say which came from the buggy program, and the buggy one, with half the privacy guarantee, looks no less reasonable than the correct one. It would take hundreds or thousands of samples to tell, and the tester would have to know the exact sensitivity to know what spread to expect.
What may work instead
The post names two families of approaches, both tailored to differential privacy and both still active research:
- Sophisticated testing. One approach by Ding and colleagues uses statistical hypothesis testing and can detect privacy bugs in small programs in seconds.
- Program analysis. Several approaches reason about the code itself, varying in how much they automate and which language features they support.
The post expects practical tools of both kinds to appear in the next few years. A later post in the series was to look at how to test differentially private programs by running them many times on many inputs and analyzing the results.
Sources
- National Institute of Standards and Technology, Cybersecurity Insights blog, Differential Privacy Bugs and Why They’re Hard to Find; two images of code are left out and described in words; rewritten in hubnx’s own words.
Комментарии

Читать дальше
Ещё на тему «Наука»




