Photon-Number-Splitting Attacks on BB84
June 16, 2026
Photon-Number-Splitting Attacks on a Noisy BB84 Channel
A computational quantum-cryptography project that models the Photon-Number-Splitting (PNS) attack on a practical BB84 link built from weak coherent pulses. It quantifies exactly how much of the key an eavesdropper can steal through multiphoton emissions, and finds the secrecy-capacity threshold: the fibre length and source intensity at which the distillable secret key vanishes.

Overview
The BB84 protocol is provably secure — if Alice owns a perfect single-photon source. Real transmitters do not. They use a laser attenuated to the single-photon level, and the number of photons in each pulse follows Poisson statistics. A stubborn fraction of pulses therefore carries two or more photons, and that is a gift to an eavesdropper.
This project simulates the attack that exploits exactly that gift. It covers:
- Weak-coherent-pulse (WCP) photon statistics — the Poissonian source and its multiphoton tail.
- A lossy, noisy channel model — fibre attenuation, detector efficiency, dark counts, and misalignment error.
- The PNS eavesdropper — how much of the sifted key Eve learns with certainty and without introducing errors.
- The GLLP secret-key rate — where secure communication survives, where it dies, and how decoy states rescue it.
Everything is benchmarked against a pulse-by-pulse Monte-Carlo simulation of the photon transport.
Physical Background
Weak coherent pulses
An attenuated laser emits a coherent state whose photon number is Poisson-distributed with mean :
Three regimes matter, and the third is the whole story:
| pulse type | probability | consequence |
|---|---|---|
| vacuum () | no signal, only dark counts | |
| single () | the only provably private bits | |
| multi () | exploitable by the eavesdropper |
The channel
The single-photon transmittance combines fibre attenuation with detector efficiency:
An -photon pulse survives with probability , so its yield (including background/dark counts ) is . Averaging over the Poisson distribution gives the closed-form gain and QBER that Bob actually measures:
where is the intrinsic misalignment error and is the error of a random dark count.
What the eavesdropper learns
The only provably private resource is the single-photon detections. In the worst case Eve keeps a perfect copy of every multiphoton bit, so the fraction of the sifted key she knows for free — the tagged fraction — is
The provably single-photon gain and its error rate are then bounded by
When (that is, ), Eve can forward only multiphoton pulses while still faking the expected count rate — she knows the entire key and no secrecy remains.
The secret-key rate (GLLP)
The distillable rate follows the Gottesman–Lo–Lütkenhaus–Preskill bound:
with (four-state sifting), (error-correction inefficiency), and the binary entropy. The first term is the price of error correction; the second is the privately amplifiable single-photon yield. The secrecy threshold is where .
Project Structure
simulation/
├── qkd_pns/
│ ├── entropy.py # binary Shannon entropy H2(x)
│ ├── source.py # WCP Poisson photon statistics
│ ├── channel.py # lossy + noisy channel: yields, gain Q_mu, QBER E_mu
│ ├── pns_attack.py # PNS eavesdropper: tagged fraction Δ, Q1/e1 bounds
│ ├── keyrate.py # GLLP rate, decoy vs PNS, optimal μ, thresholds
│ └── montecarlo.py # pulse-by-pulse validation of the analytic model
└── run_simulation.py # reproduces all figures + summary.json
Run with:
cd simulation
pip install -r requirements.txt
python run_simulation.py
Default parameters (telecom fibre): dB/km, , , , , , .
Results
1. Validating the channel model

A 1.5-million-pulse Monte-Carlo (markers) samples , transmits each photon independently as , fires dark counts, and assigns errors. The gain tracks the analytic curve to within about 1% across the full range. The QBER matches at short distance but scatters at long distance (more on this below).
2. Photon statistics and the leaked fraction

The multiphoton term grows quadratically with intensity — this is the resource Eve harvests. On the right, the tagged fraction rises with distance (because shrinks while is fixed by ), reaching 1 sooner for larger . This is the fundamental tension: turning up buys raw key rate but hands Eve quadratically more information.
3. Secure range and optimal intensity

Each fixed-distance curve has a sharp interior optimum: too little intensity is swamped by dark counts, too much floods Eve with multiphoton pulses. The optimum drifts to smaller with distance — the known scaling , which degrades the achievable rate from to .

The secrecy map of over the plane. The red contour is the zero-key threshold; secure operation is confined to a small island of short distance and low intensity.
Headline numbers (from summary.json):
| distance | optimal | PNS-secure | tagged fraction | upper bound |
|---|---|---|---|---|
| 25 km | 0.025 | 0.39 | 3.4 % | |
| 50 km | — | 0 (no key) | — | > 45 % |
| 100 km | — | 0 (no key) | — | ≈ 50 % |
Key Results
- The WCP side channel is real and irreducible. Multiphoton pulses () are baked into any Poissonian source and form a lossless channel Eve needs only a QND photon-number measurement, a quantum memory, and a better fibre to exploit.
- The leakage is quantifiable. The tagged fraction gives the bits-per-sifted-bit Eve learns with certainty.
- PNS slashes the secure range. With these telecom parameters, non-decoy BB84 dies at ≈ 11.5 km at a naive fixed , and only reaches ≈ 47 km even when is re-optimised at every distance.
- Decoy states restore it. Using the true single-photon parameters recoverable with decoy states pushes the secure range beyond 120 km — the gap between the two curves in Figure 3 is the throughput sacrificed to the vulnerability, and it is exactly why decoy states are standard in every modern QKD deployment.
References
- C. H. Bennett and G. Brassard, “Quantum cryptography: Public key distribution and coin tossing,” Proc. IEEE Int. Conf. Computers, Systems and Signal Processing (Bangalore, 1984), pp. 175–179; reprinted in Theor. Comput. Sci. 560, 7–11 (2014).
- B. Huttner, N. Imoto, N. Gisin, and T. Mor, “Quantum cryptography with coherent states,” Phys. Rev. A 51, 1863 (1995).
- G. Brassard, N. Lütkenhaus, T. Mor, and B. C. Sanders, “Limitations on practical quantum cryptography,” Phys. Rev. Lett. 85, 1330 (2000).
- N. Lütkenhaus, “Security against individual attacks for realistic quantum key distribution,” Phys. Rev. A 61, 052304 (2000).
- D. Gottesman, H.-K. Lo, N. Lütkenhaus, and J. Preskill, “Security of quantum key distribution with imperfect devices,” Quantum Inf. Comput. 4(5), 325 (2004).
- W.-Y. Hwang, Phys. Rev. Lett. 91, 057901 (2003); H.-K. Lo, X. Ma, K. Chen, “Decoy state quantum key distribution,” Phys. Rev. Lett. 94, 230504 (2005); X.-B. Wang, “Beating the photon-number-splitting attack in practical quantum cryptography,” Phys. Rev. Lett. 94, 230503 (2005).
- X. Ma, B. Qi, Y. Zhao, and H.-K. Lo, “Practical decoy state for quantum key distribution,” Phys. Rev. A 72, 012326 (2005).
- V. Scarani et al., “The security of practical quantum key distribution,” Rev. Mod. Phys. 81, 1301 (2009).
- N. Gisin, G. Ribordy, W. Tittel, and H. Zbinden, “Quantum cryptography,” Rev. Mod. Phys. 74, 145 (2002).