Wolf in Sheep's Clothing - The Downscaling Attack Against Deep Learning Applications

Qixue Xiao, Kang Li, Deyue Zhang, Yier Jin · DOI

Abstract: This paper considers security risks buried in the data processing pipeline in common deep learning applications. Deep learning models usually assume a fixed scale for their training and input data. To allow deep learning applications to handle a wide range of input data, popular frameworks, such as Caffe, TensorFlow, and Torch, all provide data scaling functions to resize input to the dimensions used by deep learning models. Image scaling algorithms are intended to preserve the visual features of an image after scaling. However, common image scaling algorithms are not designed to handle human crafted images. Attackers can make the scaling outputs look dramatically different from the corresponding input images. This paper presents a downscaling attack that targets the data scaling process in deep learning applications. By carefully crafting input data that mismatches with the dimension used by deep learning models, attackers can create deceiving effects. A deep learning application effectively consumes data that are not the same as those presented to users. The visual inconsistency enables practical evasion and data poisoning attacks to deep learning applications. This paper presents proof-of-concept attack samples to popular deep-learning-based image classification applications. To address the downscaling attacks, the paper also suggests multiple potential mitigation strategies.

Introduction

Most deep learning models are designed to accept inputs of a specific, fixed dimension (e.g., 224x224 pixels). However, real-world data comes in various sizes. To bridge this gap, developers use scaling functions to resize images before they reach the model. This research identifies a critical "semantic gap": image scaling algorithms are designed for visual fidelity, not security. They assume the input is natural, but an attacker can craft pixels such that the downscaled version contains entirely different information than the original. This allows for data poisoning (tricking a human into labeling a malicious image as benign during training) and evasion attacks (submitting an image that looks harmless to a moderator but triggers a specific response from the AI).

Methodology

The authors introduce the Downscaling Attack, which targets the sampling logic of common interpolation algorithms. The attack exploits the fact that while a human sees the high-resolution source, the neural network only sees the sampled result.

  1. Exploiting Camouflage Regions: In simple algorithms like Nearest-neighbor, only a fraction of pixels are selected for the output. The remaining pixels (the "camouflage regions") can be filled with any data without affecting the model's input.
  2. Constraint-based Crafting: For more complex algorithms like Bilinear scaling—which uses weighted averages of neighboring pixels—the attacker must ensure the weighted average of a local region in the high-resolution image equals the desired pixel value in the target low-resolution image.
  3. Framework Analysis: Audits of Caffe, TensorFlow, and Torch revealed that all three use vulnerable default scaling implementations (mostly Bilinear or Nearest-neighbor).

Experimental Results

The study demonstrates the attack using two primary contexts: handwritten digit recognition (MNIST) and large-scale image classification (ImageNet).

MNIST Downscaling Attacks: Crafted digits (left) that transform into different identities (right) after resizing.

Key Findings

  • Successful Deception: The authors successfully created images that humans labeled as "Sheep" but the Caffe-based GoogleNet classified as "White Wolf" (88.9% confidence) or "Lynx Cat" after scaling.
  • MNIST Transformation: Proof-of-concept attacks on MNIST digits showed dramatic changes in digit identity—such as a "9" becoming a "0"—that were completely invisible in the original high-resolution source.
  • Universal Vulnerability: The attack was verified across multiple libraries (OpenCV, TensorFlow's tf.image, Torch's image.scale), proving that the risk is systemic across the industry's most popular tools.
Wolf in Sheep's Clothing: High-resolution sheep images that downscale into a white wolf and a kitten.

Discussion and Mitigation

This paper highlights that the "untrusted" pipeline begins the moment a file is loaded. The attack specifically defeats human-in-the-loop defenses; because the malicious payload is only visible to the algorithm after resizing, a human reviewer would unknowingly authorize a poisoning attack. Furthermore, the amount of data an attacker controls is proportional to the scaling factor: a very large image being scaled down to a small input size gives the attacker massive "real estate" to hide malicious features.

Proposed Defenses

To address these vulnerabilities, the authors suggest three strategies:

  1. Strict Input Validation: Only accepting images that already match the model's required dimensions.
  2. Robust Scaling: Using algorithms like Bicubic interpolation, which are harder (though not impossible) to manipulate.
  3. Detection: Comparing the color histograms or features of an image before and after scaling to detect dramatic shifts in content.

Summary updated

BibTeX
@misc{xiao2017wolf,
  author = {Qixue Xiao and Kang Li and Deyue Zhang and Yier Jin},
  title = {{Wolf in Sheep's Clothing - The Downscaling Attack Against Deep Learning Applications}},
  year = {2017},
  eprint = {1712.07805},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1712.07805},
}
Figure