The "Hack the Pentagon" event, the first "bug bounty" in the history of the federal government, attracted 1,410 computer-savvy Americans, according to the Defense Department. The program cost $150,000, with about half of that going to hackers.

"It's not a small sum, but if we had gone through the normal process of hiring an outside firm to do a security audit and vulnerability assessment, which is what we usually do, it would have cost us more than $1 million," Carter said during a short ceremony at the Pentagon.

"Beyond the security fixes we've made, we've built stronger bridges to innovative citizens who want to make a difference to our defense mission."

The hackers were invited to find flaws with five public websites, including defense.gov, between April 18 and May 12.

WATCH VIDEO: Is Cyber Warfare the Future of War?

During that period, the hackers reported 1,189 vulnerabilities, with 138 of them determined to be "legitimate, unique and eligible for a bounty."

David Dworken, an 18-year-old recent high school graduate from the Washington area, appeared at the Pentagon ceremony alongside Carter and said he worked on finding bugs in his spare time.