Black-Box Attacks: Query-Based
What You'll Learn
You'll learn how attackers can craft adversarial examples by repeatedly querying a model and using the outputs to estimate gradients or explore the decision boundary—all without seeing the model's internal parameters.
Core Idea
In a query-based black-box attack, you don't have access to the model's architecture or weights (unlike white-box attacks), and you can't rely on transferability from another model (unlike transfer-based black-box attacks). Instead, you treat the target model as a complete black box that you can only interact with through its API or interface.
The key strategy: send many queries with slightly different inputs and observe how the outputs change. By analyzing these input-output pairs, you can:
- Estimate gradients numerically (like finite differences in calculus)
- Search the input space systematically to find perturbations that fool the model
- Approximate the decision boundary through trial and error
Analogy
Imagine trying to find the peak of a hill while blindfolded. You can't see the terrain (no gradient information), but you can feel whether you're going uphill or downhill by taking small steps in different directions. Each step is a query—you probe slightly different positions and use the feedback to navigate.
How It Works
- Zeroth-order optimization: Estimate gradients by querying nearby points
- Evolutionary/genetic algorithms: Mutate inputs iteratively, keeping successful perturbations
- Boundary attacks: Start from a misclassified input and walk along the decision boundary toward the target image
- Trade-off: These attacks require hundreds to thousands of queries, making them detectable but often effective
Key Takeaway: Query-based attacks probe a black-box model through repeated interactions, estimating gradients or searching the input space to craft adversarial examples without internal access—powerful but query-intensive.