Two boys, ages 8 and 9, were hurt Monday night when the vehicle they were riding in was hit by gunfire, according to police.