  The article is focused on research of an attack on the quantum key
distribution system and proposes a countermeasure method. Particularly
noteworthy is that this is not a classic attack on a quantum protocol. We
describe an attack on the process of calibration. Results of the research show
that quantum key distribution systems have vulnerabilities not only in the
protocols, but also in other vital system components. The described type of
attack does not affect the cryptographic strength of the received keys and does
not point to the vulnerability of the quantum key distribution protocol. We
also propose a method for autocompensating optical communication system
development, which protects synchronization from unauthorized access. The
proposed method is based on the use of sync pulses attenuated to a photon level
in the process of detecting a time interval with a signal. The paper presents
the results of experimental studies that show the discrepancies between the
theoretical and real parameters of the system. The obtained data allow the
length of the quantum channel to be calculated with high accuracy.
