The analysis of the security of quantum key distribution systems with respect to an attack with nondemolishing measurement of the number of photons (photon number splitting—PNS attack) is carried out under the assumption that in the communication channel in each parcel there is a pure Fock state with a different number of photons, and the distribution of states by number of photons has Poisson statistics. In reality, in the communication channel in each parcel there are not individual Fock states, but a pure coherent state with a random phase—a superposition of Fock states with different numbers of photons. The paper analyzes the necessary experimental resources necessary to prepare individual Fock states with a certain number of photons from the superposition of Fock states for a PNS attack. Optical schemes for implementing such an attack are given, and estimates of experimental parameters at which a PNS attack is possible are made.