Part 3 of Adversarial Attacks
Black-box and real-world attacks
Module 3 · 5 min read
Black-box and real-world attacks
TL;DR
- Keeping the weights secret doesn’t protect a model. Attacks transfer from a copy, scores leak the gradient, and even label-only APIs can be attacked.
- Query-based attacks cost API calls. Rate limits raise that cost but do nothing against transfer attacks.
- Patterns optimised over many random transformations (EOT) survive a real camera, e.g. stickers on stop signs, patches and a 3D-printed turtle.
“But the attacker doesn’t have my model”
Every attack in module 2 needs gradients, so full access to the weights. APIs never hand those out, and for a while that felt like protection. It isn’t. Attacks transfer between models, gradients can be estimated by asking, and some attacks only need the final label.
1. Attack a copy, hit the original
Szegedy’s first paper noticed that adversarial examples made for one network often fool another. Papernot et al. (2017) turned that into a practical attack.
- Send inputs to the target and record its answers.
- Train a substitute model on those answers (any architecture).
- Attack the substitute with white-box methods (FGSM, PGD).
- Send the adversarial examples to the target. Many fool it too.
Against real online machine-learning services they reported high misclassification rates. Two models trained for the same task on similar data learn similar boundaries, so pushing an input across one often crosses the other too.
originalafter the attackmodel B’s boundary
2. Estimate the gradient by asking
If the model returns probabilities, you can estimate its gradient from outside by nudging a pixel up, then down, and seeing which way the score moves. ZOO (Chen et al., 2017) did this, with tricks to probe fewer pixels. The catch is that an image has tens of thousands of pixels and every probe is an API call.
Later attacks got far more efficient. Square Attack (Andriushchenko et al., 2020) skips gradients. It tries a random square-shaped change, keeps it if confidence in the right answer drops, and repeats. This simple random search is surprisingly hard to beat.
3. When you only get the label
Some APIs only return “cat”. The Boundary Attack (Brendel, Rauber & Bethge, 2018) still works. It starts from an input that’s already misclassified (a dog photo, or random noise) and walks towards the original in small random steps, keeping only those that stay misclassified. After many queries it hugs the boundary, close to the original but still on the wrong side.
original inputcurrent adversarial point
4. Physical attacks
In the real world the attacker changes an object and a camera decides the pixels, with different angles, distances, lighting and blur. That partly destroys a tuned pattern, but not enough.
- Kurakin et al. (module 2) printed adversarial images and photographed them with a phone, and a large share still fooled the classifier.
- In Robust Physical Perturbations (Eykholt et al., 2018), black and white stickers on a real stop sign made a road-sign classifier read a speed-limit sign in almost all lab photos and most frames of a drive-by video.
- Adversarial Patch (Brown et al., 2017) dropped the “invisible” rule with a visible, printable, round sticker that makes a classifier say “toaster” wherever it sits in a scene.
- Expectation over Transformation (Athalye et al., 2018) 3D-printed a turtle that an ImageNet classifier saw as a rifle from most viewpoints.
The last three share one trick. They optimise for the average over many random transformations (rotations, scales, lighting, camera noise) instead of one exact photo, and a pattern that works across all of them in simulation tends to survive a real camera.
Why this changed the conversation. Before 2017 a lot of people saw adversarial examples as a lab curiosity. Stickers on a stop sign made them a safety question for self-driving cars, face recognition and any camera-based system. Physical attacks are much harder, since the pattern has to survive the camera, but they’ve been shown many times, which is one reason safety-critical vision systems combine several sensors and checks.
| Setting | Attacker sees | Example methods | Main cost |
|---|---|---|---|
| Transfer | Nothing during the attack | Substitute models, ensembles | Lower success rate |
| Score-based | Probabilities | ZOO, Square Attack | Many queries |
| Decision-based | Final label only | Boundary Attack | Even more queries |
| Physical | The camera’s view | RP2 stickers, patches, EOT | Must survive real-world changes |
Quick check
An API returns only the predicted label, never scores. Which attack can still work?
FGSM needs gradients and ZOO needs scores. The Boundary Attack uses only labels, and transfer attacks need no feedback from the target during the attack.
Q&A
Can rate limits stop query-based attacks?
They raise the cost, and flagging lots of near-identical queries from one user helps. But attackers can spread queries across accounts and time, and transfer attacks need no queries during the attack. A speed bump at best.
Why do adversarial examples transfer at all?
Models trained on the same task pick up similar features from similar data, including useful ones a human wouldn’t use. Ilyas et al. (2019) argued adversarial examples exploit exactly these real but “non-robust” features, so different models fall for the same patterns.
Papers
- Papernot et al., Practical Black-Box Attacks against Machine Learning (AsiaCCS 2017).
- Chen et al., ZOO: Zeroth Order Optimization Based Black-box Attacks (2017).
- Brendel, Rauber & Bethge, Decision-Based Adversarial Attacks (ICLR 2018).
- Andriushchenko et al., Square Attack (ECCV 2020).
- Eykholt et al., Robust Physical-World Attacks on Deep Learning Visual Classification (CVPR 2018).
- Brown et al., Adversarial Patch (2017).
- Athalye et al., Synthesizing Robust Adversarial Examples (ICML 2018).
- Ilyas et al., Adversarial Examples Are Not Bugs, They Are Features (NeurIPS 2019).