Quantum cascade laser (QCL) frequency combs are a promising candidate for chemical sensing and biomedical diagnostics, requiring only milliseconds of acquisition time to record absorption spectra without any moving parts 1,2,3,4 . They are electrically pumped and have a small footprint, making them an ideal platform for on-chip integration 5 . Until now, optical feedback is fatal for frequency comb generation in QCLs and destroys intermodal coherence 6 . This property imposes strict limits on the possible degree of integration. Here, we demonstrate coherent injection locking of the repetition frequency to a stabilized RF oscillator. For the first time, we prove that the spectrum of the injection locked QCL can be phase-locked, resulting in the generation of a frequency comb. We show that injection locking is not only a versatile tool for all-electrical frequency stabilization, but also mitigates the fatal effect of optical feedback on the frequency comb. A prototype self-detected dualcomb setup consisting only of an injection locked dualcomb chip, a lens and a mirror demonstrates the enormous potential for on-chip dual-comb spectroscopy. These results pave the way to miniaturized and all-solid-state midinfrared spectrometers.