Using the Keck Planet Imager and Characterizer (KPIC), we obtained high-resolution (R$sim$35,000) $K$-band spectra of the four planets orbiting HR 8799. We clearly detected water{} and CO in the atmospheres of HR 8799 c, d, and e, and tentatively detected a combination of CO and water{} in b. These are the most challenging directly imaged exoplanets that have been observed at high spectral resolution to date when considering both their angular separations and flux ratios. We developed a forward modeling framework that allows us to jointly fit the spectra of the planets and the diffracted starlight simultaneously in a likelihood-based approach and obtained posterior probabilities on their effective temperatures, surface gravities, radial velocities, and spins. We measured $vsin(i)$ values of $10.1^{+2.8}_{-2.7}$~km/s for HR 8799 d and $15.0^{+2.3}_{-2.6}$~km/s for HR 8799 e, and placed an upper limit of $< 14$~km/s of HR 8799 c. Under two different assumptions of their obliquities, we found tentative evidence that rotation velocity is anti-correlated with companion mass, which could indicate that magnetic braking with a circumplanetary disk at early times is less efficient at spinning down lower mass planets.