Dust emission at sub-millimetre wavelengths allows us to trace the early phases of star formation in the Universe. In order to understand the physical processes involved in this mode of star formation, it is essential to gain knowledge about the dark matter structures - most importantly their masses - that sub-millimetre galaxies live in. Here we use the magnification effect of gravitational lensing to determine the average mass and dust content of sub-millimetre galaxies with 250mu flux densities of S_250>15mJy selected using data from the Herschel Multi-tiered Extragalactic Survey. The positions of hundreds of sub-millimetre foreground lenses are cross-correlated with the positions of background Lyman-break galaxies at z~3-5 selected using optical data from the Canada-France Hawaii Telescope Legacy Survey. We detect a cross-correlation signal at the 7-sigma level over a sky area of one square degree, with ~80% of this signal being due to magnification, whereas the remaining ~20% comes from dust extinction. Adopting some simple assumptions for the dark matter and dust profiles and the redshift distribution enables us to estimate the average mass of the halos hosting the sub-millimetre galaxies to be log(M_200/M_sun)=13.17+0.05-0.08(stat.) and their average dust mass fraction (at radii of >10kpc) to be M_dust/M_200~6x10^-5. This supports the picture that sub-millimetre galaxies are dusty, forming stars at a high rate, reside in massive group-sized halos, and are a crucial phase in the assembly and evolution of structure in the Universe.