## 1 Introduction  
Randomness is the key ingredient in the security of any cryptographic protocol, including quantum key distribution (QKD) protocols. To understand the role of randomness in the security of QKD, I herein study the so-called _detector-blinding attack_ (DBA) [1; 2; 3; 4; 5; 6; 7; 8; 9], which injects strong light into the quantum channel and exploits the technological weaknesses/features of the single-photon detectors used within with the purpose of controlling the internal entropy source and thus breaching the security. This particularly successful attack strategy makes it possible to not only eavesdrop completely undetected but also to fully recover the secret key, thus defying the two most notable strengths of QKD: (1) the ability to detect eavesdropping, and (2) the security of the generated secret key, which is unconditional according to information theory. Various adaptations of the DBA have been mounted on a range of scientific and commercial bipartite QKD systems [1; 2] rendering them completely unusable even though their manufacturers had claimed that they were provably and unbreakably secure for years before the blinding attack became publicly known.  
Each instance of DBA is specifically tailored to the detector feature that is being exploited, for example, passive quenching [5], active quenching [4], superlinearity [5], and thermal effects [1; 2; 5], as well as the specific architecture of the receiving station, such as passive or semi-active base control. In the demonstrated attacks the optical power of the incoming blinding light ranges from up to 10 mW continuous light [7], 8 mW continuous pulsing [4], all the way down to a few pW continuous pulsing [5] or even less than 120 photons per pulse [6], which is a power span of over 15 decades! Most scientific and research works propose defending against a detector-blinding attack by upgrading hardware so as to be able to detect strong light incoming from the quantum channel [10; 11; 12; 13; 14]. Apart from being technologically challenging, the main problem with this approach is that while it may prevent a specific attack, it does not guarantee the restoration of provable security, as noted in [4] and experimentally demonstrated in [14]. Repelling the attack via \"brute force\", i.e., without a deeper understanding of how and why it works, leaves a bitter aftertaste which suggests that a clever modification of the attack could make it work again.  
In this paper, I investigate the information-theory-based background of this devastating attack strategy on so-called \"discrete variable QKD\", that is, QKD protocols which communicate via single qubits. I show that the success of a blinding attack relies on the attacker's ability to obtain information about the receiver's choice of detection base. A detector-blinding attack is achieved by actively sending a combination of a blinding light and a multi-qubit message with the purpose of taking control of the internal entropy source that selects the base. Based on this insight, an elegant defense strategy is developed for preventing the whole family of multi-qubit attacks on a receiver's entropy source, restoring the unconditional security of a QKD protocol. Additionally, by monitoring an additional parameter of the communication over the quantum channel, it is possible to detect a general entropy source attack at no further cost with respect to hardware.  
Even though blinding attacks work well on virtually any QKD protocol [8], for the sake of simplicity and without the loss of generality, I will study attacks on two implementations of the BB84 protocol [15; 16] which were broken in [4; 5].