Government officials said a series of recent attacks and threats have highlighted the vulnerability of U.S. military bases.