  Attacks that control single-photon detectors in quantum key distribution
using tailored bright illumination are capable of eavesdropping the secret key.
Here we report an automated testbench that checks the detector's
vulnerabilities against these attacks. We illustrate its performance by testing
a free-running detector that includes a rudimentary countermeasure measuring an
average photocurrent. While our testbench automatically finds the detector to
be controllable in a continuous-blinding regime, the countermeasure registers
photocurrent significantly exceeding that in a quantum regime, thus revealing
the attack. We then perform manually a pulsed blinding attack, which controls
the detector intermittently. This attack is missed by the countermeasure in a
wide range of blinding pulse durations and powers, still allowing to eavesdrop
the key. We make recommendations for improvement of both the testbench and
countermeasure.
