Eight Afghan security guards were killed and two others wounded in an attack on the Bagram military base.