Stardust grains recovered from meteorites provide high-precision snapshots of the isotopic composition of the stellar environment in which they formed1. Attributing their origin to specific types of stars, however, often proves difficult. Intermediate-mass stars of 4–8 solar masses are expected to have contributed a large fraction of meteoritic stardust2,3. Yet, no grains have been found with the characteristic isotopic compositions expected for such stars4,5. This is a long-standing puzzle, which points to serious gaps in our understanding of the lifecycle of stars and dust in our Galaxy. Here we show that the increased proton-capture rate of 17O reported by a recent underground experiment6 leads to 17O/16O isotopic ratios that match those observed in a population of stardust grainsfor proton-burning temperatures of 60–80 MK. These temperatures are achieved at the base of the convective envelope during the late evolution of intermediate-mass stars of 4–8 solar masses7–9, which reveals them as the most likely site of origin of the grains. This result provides direct evidence that these stars contributed to the dust inventory from which the Solar System formed.