A would-be suicide attacker in a foiled “underwear bomb” plot was an undercover agent, reports from the United States say.