The security of cryptographic systems is an ever-evolving subject, and the methods used to attack them are continuously improving. Among the various types of side channel attacks, timing attacks and scan chain attacks stand out as particularly sophisticated threats. In this article, we explore how these attacks work using the RSA algorithm as an example, and we present the main countermeasures to protect your systems.
A Quick Review of the RSA Algorithm
Before diving into the attacks, it’s useful to recall how the RSA algorithm functions—a widely used method in cryptography:
- Key Generation: Two large prime numbers, p and q, are chosen. Their product, n, is computed and used as part of the public key. Then, an exponent e is selected such that it is relatively prime to (p-1)·(q-1). The secret exponent d is calculated so that the product of e and d is congruent to 1 modulo (p-1)·(q-1).
- Encryption and Decryption: To encrypt a message m, the operation c = me mod n is performed. For decryption, the calculation m = cd mod n is used, thereby recovering the original message.
The security of RSA is based on the difficulty of factoring n into its prime components p and q. However, inefficient implementations can create exploitable vulnerabilities through side channel attacks.
Timing Attacks: Measuring Execution Time to Break Cryptography
How a Timing Attack Works
A timing attack relies on precisely measuring the execution time of operations during the decryption process. If the RSA implementation uses methods such as “square and multiply” without additional protections, variations in execution time can reveal information about the secret exponent d. In summary:
- Guessing the Bits: The attacker attempts to guess portions of the exponent by observing how the execution time varies as the bits of d are processed.
- Correlation with Execution: When the attacker’s prediction about an operation aligns with the actual process, a correlation in the measured time appears. If not, the timing appears random.
- Iterative Reconstruction: Based on this correlation, the attacker can reconstruct the exponent bit by bit, ultimately compromising the system’s security.
This approach shows how even slight timing variations can become an entry point for extracting sensitive information.
Scan Chain Attacks: Exploiting Internal System Access
Understanding the Scan Chain and Its Risks
The scan chain concept refers to a series of flip-flops that allow for testing and verification of an integrated circuit. Two main types of scan chain attacks deserve attention:
- Internal State Capture: The attacker forces the system to switch between normal and test modes (controlled by the signal TC). In test mode, the system’s internal state is exposed via the scan out port, enabling the attacker to collect critical data.
- Fault Injection via Scan In: In addition to capturing information, the attacker can manipulate the flip-flop contents by using the scan in port, injecting faults that alter the system’s behavior. This technique can be used to extract keys or to induce controlled errors.
These vulnerabilities are particularly concerning in devices that combine high complexity with physical access, where protecting test channels is crucial.
Countermeasures to Mitigate Side Channel Attacks
Protecting systems against timing and scan chain attacks requires a multifaceted approach. Below are some essential strategies:
1. Masking Techniques
- Description: Masking involves scrambling internal data and operations so that the correlation with the secret information is eliminated or significantly reduced.
- Benefits: This method makes it much harder for an attacker to extract useful patterns, as the operational behavior becomes unpredictable.
2. Noise Injection
- Description: Intentional noise (e.g., electromagnetic or power fluctuations) is added during execution to obscure measurable signals.
- Benefits: Injecting noise makes both timing and power analysis far more challenging for potential attackers.
3. Resilient Hardware Designs
- Physical Separation: Dividing critical components—such as power lines, clock networks, and test facilities—can isolate cryptographic operations from other system functions.
- Asynchronous Design: Implementing asynchronous logic eliminates reliance on a common clock, reducing the risk of synchronization-based attacks.
4. Physical and Access Protection
- Shielding and Absorbing Materials: Using upper-level metal layers and sound-dampening materials can block emissions that might otherwise leak sensitive information.
- Access Control: Restricting physical access to devices and maintaining secure environments are fundamental measures to prevent proximity attacks.

Conclusion
Side channel attacks like timing and scan chain attacks demonstrate that cryptographic security extends beyond robust mathematical algorithms. A secure implementation must consider vulnerabilities in both software and hardware. By combining techniques—from masking and noise injection to resilient hardware design and physical protection—it is possible to significantly mitigate the risks posed by these sophisticated attacks.
As attack techniques continue to evolve, maintaining cryptographic security demands ongoing research and the adoption of best practices. Investing in robust security measures is essential for protecting data and ensuring the integrity of your systems.
To deepen your knowledge about side channel attacks and defense strategies, check out the following articles:
- Physical Attacks: Unveiling Hardware Security Threats: Explore the fundamentals of physical attacks and discover effective countermeasures to protect your devices.
- Physical Attacks on Hardware: Unveiling Threats and Defense Strategies: Learn more about practical strategies to mitigate physical and side channel attacks.
- Side-Channel Attacks: Exploring Vulnerabilities in Modern Cryptography: Understand how side channel attacks, such as power analysis and electromagnetic emissions, can compromise cryptographic systems.
- Power Analysis Attacks: Unveiling SPA and DPA in Cryptographic Security: Discover how power analysis attacks work and which countermeasures can be implemented.
These articles complement the topics discussed here, offering a comprehensive view on hardware security and cryptography.