The defining characteristic of the cold dark matter ( CDM ) hypothesis is the presence of a very large number of low-mass haloes , too small to have made a visible galaxy . Other hypotheses for the nature of the dark matter , such as warm dark matter ( WDM ) , predict a much smaller number of such low-mass haloes . Strong lensing systems offer the possibility of detecting small-mass haloes through the distortions they induce in the lensed image . Here we show that the main contribution to the image distortions comes from haloes along the line of sight rather than subhaloes in the lens as has normally been assumed so far . These interlopers enhance the differences between the predictions of CDM and WDM models . We derive the total perturber mass function , including both subhaloes and interlopers , and show that measurements of approximately 20 strong lens systems with a detection limit of M _ { low } = 10 ^ { 7 } h ^ { -1 } { M _ { \odot } } would distinguish ( at 3 \sigma ) between CDM and a WDM model consisting of 7 keV sterile neutrinos such as those required to explain the recently detected 3.5 keV X-ray emission line from the centres of galaxies and clusters .