Two people were injured when five masked men attacked them after a high school graduation ceremony Wednesday in New York, slashing one person in the ear and another in the leg, school officials said.