Articles

What Is a Side-Channel Attack?

A side-channel attack recovers secrets from a system's physical behavior — timing, power draw, cache access — rather than breaking its algorithm directly.

Chisato Chisato · · 4 min read
Abstract illustration of a security shield

A side-channel attack recovers secret information by observing a system’s physical or behavioral characteristics as it runs — how long an operation takes, how much power it draws, what it does to a shared CPU cache — rather than by attacking the cryptographic algorithm or the software logic directly. The math behind a cipher can be flawless, and the attacker still wins, because the attack targets the implementation running the math, not the math itself.

Why “side channel” is the right name

A cryptographic algorithm has an intended interface: input goes in, output comes out, and that’s supposed to be the only information available to anyone without the key. A side channel is any other, unintended information leak that comes from the fact that the algorithm has to actually run on real hardware to produce that output — and real hardware has physical properties that vary in ways correlated with what it’s computing.

Common side channels include:

  • Timing — some operations take measurably different amounts of time depending on the input or the secret key involved. A comparison that returns early on a mismatched byte, for instance, leaks information about how many leading bytes were correct through how long the comparison took. This is the same class of weakness discussed in our piece on timing attacks, which is really a specific, well-studied instance of a side-channel attack.
  • Power consumption — a device’s power draw fluctuates based on what instructions it’s executing and what data it’s processing. Measuring that draw with enough precision, especially on embedded devices and smart cards, can reveal bits of a secret key one operation at a time.
  • Electromagnetic emissions — circuits emit faint electromagnetic radiation correlated with the data moving through them, which can sometimes be picked up without physical contact with the device at all.
  • Cache access patterns — modern CPUs share cache between processes, and one process can sometimes infer what memory addresses another process recently accessed by measuring how long its own memory accesses take, since a cache hit is faster than a cache miss. This class of attack is closely tied to how CPU caches and cache coherence work under the hood.
  • Acoustic and even visual signals — in extreme but demonstrated cases, the faint sound of capacitors, or the flicker of a power LED, has been shown to correlate with computation happening inside a device closely enough to extract information from it.

A worked example: password comparison

Consider a naive password check that compares a submitted password to the correct one character by character, returning false the instant it finds a mismatch. This is faster on average, which sounds like a reasonable optimization — but it means a correct password takes measurably longer to reject than an incorrect one, because it takes longer to find the first mismatched character. An attacker who can measure response time precisely enough can guess a password one character at a time, each guess narrowing down which character makes the comparison take slightly longer, rather than having to guess the entire password at once.

The standard defense is a constant-time comparison: check every character regardless of whether a mismatch was already found, so the operation takes the same amount of time no matter what the input is. This is a deliberate performance sacrifice made purely to close a side channel, and it’s exactly the kind of function that belongs in a well-audited cryptography library rather than hand-rolled — the pitfalls are easy to reintroduce accidentally.

Side-channel attacks against shared hardware

Side channels become especially significant in shared computing environments — cloud infrastructure where multiple tenants’ workloads run on the same physical CPU. A malicious tenant sharing a CPU core with a victim’s workload can sometimes use cache-timing techniques to infer information about what the victim process is doing, even without any direct access to the victim’s memory or files. This is one of the core motivations behind confidential computing, which uses hardware-backed encrypted memory regions to keep a workload’s data and computation opaque even to the hypervisor and to other tenants on the same physical machine.

Hardware security modules and TPMs are also built with side-channel resistance specifically in mind — their entire purpose is safeguarding cryptographic keys, so they’re designed with shielding, noise injection, and constant-time operations to make power and timing analysis substantially harder than it would be on general-purpose hardware. A hardware security module that leaked its keys through power analysis would defeat the point of using dedicated hardware in the first place.

Defenses in practice

Full side-channel resistance is difficult to achieve and often expensive in performance, so defenses are typically applied where the risk is highest:

  • Constant-time algorithms for any operation that touches secret data — comparisons, cryptographic signing, key derivation — so execution time doesn’t vary with the secret.
  • Blinding — introducing random noise into intermediate computations that gets mathematically removed at the end, so an attacker observing power or timing sees noise correlated with the random blinding factor rather than the actual secret.
  • Cache partitioning and isolation — dedicating cache resources per tenant or process rather than sharing them freely, closing off cache-timing side channels in multi-tenant environments.
  • Physical shielding and noise generation — used in hardware designed specifically to resist power and electromagnetic analysis, like payment card chips and hardware security modules.

The takeaway

A side-channel attack succeeds without ever breaking the underlying cryptography — it exploits the gap between an algorithm’s mathematical definition and the physical reality of running it on real hardware, whether through timing, power draw, electromagnetic leakage, or shared-cache behavior. Defending against it means treating “how long did this take” and “how much power did this use” as information that can leak secrets just as surely as a bug in the code, which is why constant-time implementations and hardware isolation matter even when the algorithm itself is mathematically sound.

Chisato Chisato · · 4 min read

What Is a Hardware Security Module (HSM)?

A hardware security module is a dedicated device that generates, stores, and uses cryptographic keys so private keys never leave secure hardware.

#Security #Cryptography #Hardware
Chisato Chisato · · 5 min read

What Is a Padding Oracle Attack?

A padding oracle attack exploits error messages during decryption to recover plaintext byte by byte, without ever breaking the cipher itself.

#Security #Cryptography #Web Development
Chisato Chisato · · 5 min read

What Is TOTP? How Time-Based One-Time Passwords Work

TOTP generates a new six-digit code every 30 seconds from a shared secret and the current time. How authenticator apps use it, and where it falls short.

#Security #Authentication #Cryptography