The vacuum of space shouldn't make any difference in modern ammo. Rounds have oxidizers in them. Can fire in a vacuum, under water, etc.
I was thinking of the vacuum (lack of air) in the gas system that the gas from the burning power would normally push against, and the air in front of the gas rings that would provide some tiny resistance. There’s also a non-zero amount of resistance to the buffer movement in the buffer tube from pushing the air out of it.
Maybe the two effects cancel each other (enough)
What would be interesting though is the low G's of space and the moon. I wonder if there is an angle you could shoot while standing on the moon where it would be possible to shoot around the entire moon and hit yourself with it (ie. not enough angle to escape gravitational pull, but high enough to account for minimal bullet drop and little atmosphere to reduce velocity).
Commit suicide by shooting yourself on the back from 6,800 miles away!