Scheduler Vulnerabilities and Attacks in Cloud Computing

Fangfei Zhou, Manish Goel, Peter Desnoyers, Ravi SundaramarXiv 2011 · arXiv

Introduction

Cloud computing environments rely on hypervisors to manage and distribute physical hardware resources among multiple virtual machines (VMs). A critical component of this management is the CPU scheduler, which ensures that each tenant receives their fair share of processing power. However, researchers have identified a significant vulnerability in the Xen hypervisor’s credit-based scheduler. This flaw allows a malicious VM to "steal" nearly an entire CPU core's worth of processing power while appearing idle to the system's accounting mechanisms. By exploiting the gap between hardware precision and scheduler granularity, an attacker can bypass resource caps and obtain high-performance computing at the cost of a basic instance.

The Vulnerability: Periodic Sampling

In many cloud environments, resource accounting is based on periodic sampling rather than continuous monitoring. In the Xen hypervisor, a "scheduler tick" occurs every 10 milliseconds. When this tick fires, the system checks which VM is currently running and charges that VM for the entire preceding 10ms interval.

This creates a "granularity gap": the hardware can measure time in nanoseconds, but the scheduler only accounts for it in 10ms chunks. This mismatch allows for a "theft of service" attack. If a VM can ensure it is never the active process at the exact moment the scheduler tick occurs, it can consume significant CPU cycles without ever being "charged" for them. This is analogous to a passenger who avoids paying for a train ticket by hiding in the bathroom every time the conductor walks through the cabin.

The Cycle Stealer Attack

The researchers developed a two-pronged exploit called the "Cycle Stealer" to capitalize on this accounting flaw.

  1. The Timing Attack: Using high-precision hardware counters (the Time Stamp Counter, or TSC), the attacker tracks execution time with microsecond accuracy. The attacking VM runs for approximately 9.8ms and then voluntarily calls a Halt() command to enter a sleep state just before the 10ms scheduler tick occurs. Because the VM is asleep during the tick, the hypervisor does not charge it for the work performed during the previous interval.
  2. The Priority Exploit: To ensure it is rescheduled immediately after the tick, the attack exploits Xen's "BOOST" mechanism. This feature is designed to give high priority to VMs waking up from sleep, under the assumption they are performing latency-sensitive I/O. By pretending to be an I/O-heavy application, the attacker jumps to the head of the run queue, resuming execution almost immediately after the tick has passed.
Timing diagram of the Cycle Stealer attack avoiding the scheduler tick.

Experimental Results

The effectiveness of the Cycle Stealer was tested in both controlled lab environments and on production hardware in Amazon EC2. In a lab setting with a 2-core Intel system, a single attacking VM was able to seize approximately 98% of a CPU core, even when five other "victim" VMs were present and supposed to be sharing the resource equally.

CPU utilization of the attacker vs. victims as the number of co-located VMs increases.

On Amazon EC2 "Small" instances, which were typically capped at 40% CPU utilization, the attacker successfully evaded these limits to obtain 85% utilization. This represents a significant economic exploit, as the attacker receives more than double the resources they are paying for, potentially at the expense of other tenants on the same physical hardware.

Proposed Defenses

To mitigate these vulnerabilities, the authors proposed and implemented four "theft-resistant" scheduler modifications:

  • Exact Scheduler: This approach uses high-precision timestamps to record the exact start and stop times of every VM execution, charging for every microsecond used. This eliminates the granularity gap entirely.
  • Randomized Schedulers: These methods (Poisson, Bernoulli, and Uniform) introduce statistical noise into the accounting process by sampling at random intervals. This makes it impossible for an attacker to predict when to sleep to avoid the tick.

Testing showed that both the Exact and Poisson schedulers were highly effective, neutralizing the attack and returning the attacker to their fair share of resources with less than 1% CPU overhead.

Conclusion

The discovery of the Cycle Stealer attack highlights a fundamental tension in cloud infrastructure between performance optimization (like the BOOST mechanism) and security. While the vulnerability was responsibly disclosed and patched by major providers like Amazon, it serves as a reminder that accounting mechanisms must match the precision of the hardware they manage. Future research continues to investigate similar timing side-channels in other hypervisors like KVM and VMware to ensure the long-term stability and fairness of cloud computing environments.

Summary updated

Abstract

In hardware virtualization a hypervisor provides multiple Virtual Machines (VMs) on a single physical system, each executing a separate operating system instance. The hypervisor schedules execution of these VMs much as the scheduler in an operating system does, balancing factors such as fairness and I/O performance. As in an operating system, the scheduler may be vulnerable to malicious behavior on the part of users seeking to deny service to others or maximize their own resource usage. Recently, publically available cloud computing services such as Amazon EC2 have used virtualization to provide customers with virtual machines running on the provider's hardware, typically charging by wall clock time rather than resources consumed. Under this business model, manipulation of the scheduler may allow theft of service at the expense of other customers, rather than merely reallocating resources within the same administrative domain. We describe a flaw in the Xen scheduler allowing virtual machines to consume almost all CPU time, in preference to other users, and demonstrate kernel-based and user-space versions of the attack. We show results demonstrating the vulnerability in the lab, consuming as much as 98% of CPU time regardless of fair share, as well as on Amazon EC2, where Xen modifications protect other users but still allow theft of service. In case of EC2, following the responsible disclosure model, we have reported this vulnerability to Amazon; they have since implemented a fix that we have tested and verified (See Appendix B). We provide a novel analysis of the necessary conditions for such attacks, and describe scheduler modifications to eliminate the vulnerability. We present experimental results demonstrating the effectiveness of these defenses while imposing negligible overhead.
BibTeX
@misc{zhou2011scheduler,
  author = {Fangfei Zhou and Manish Goel and Peter Desnoyers and Ravi Sundaram},
  title = {{Scheduler Vulnerabilities and Attacks in Cloud Computing}},
  year = {2011},
  eprint = {1103.0759},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1103.0759},
}

Loading related content...

Figure