A ship traveling Friday through the narrow Bab el-Mandeb Strait came under attack by suspected pirates, officials said.