The U.S. government has long known about its cybersecurity vulnerabilities, and the problem is only getting worse, President Barack Obama said Monday.

"We have known for a long time that there are significant vulnerabilities, and that these vulnerabilities are going to accelerate as time goes by, both in systems within government and within the private sector," Obama said at news conference from the Group of Seven summit in Germany.

Obama declined to say who the U.S. thinks is responsible for a massive hack attack that exposed the data of about 4 million current and former federal employees. Several media reports have indicated, however, that investigators believe Chinese hackers are to blame.

Read MoreUp to 4 million exposed in deep federal data breach

The president emphasized the escalating digital threats mean Congress should move ahead with passing cybersecurity legislation.

Part of the U.S. problem is that the country has "very old systems," he said, adding that the recent breach was discovered because of efforts to install newer and better systems.

"Both state and non-state actors are sending everything they've got at trying to breach these systems," he said. "And this problem is not going to go away—it is going to accelerate."

Turning to international issues, Obama said Russian troops continue to operate in Ukraine, but the U.S. and its allies remain committed to continuing sanctions against Moscow.

Noting that it is the second year in a row that the group has met without Russian representation, the president noted sanctions' effects against Russia: a weakened economy in "deep recession," and struggling financial and energy sectors.

Read MoreNo place for Putin at G7: Canadian PM



Obama said the G7 is willing to continue its sanctions against Moscow, including Europe extending its sectoral sanctions beyond July. More sanctions could even be on their way, he added.

"There was discussion about additional steps that we might need to take if Russia, working through separatists, doubled down on aggression inside of Ukraine," Obama said, adding that "those discussions are taking place at a technical level, not yet at a political level."

Turning to economic considerations, the president shot down a report that he had been talking down the U.S. dollar in private meetings.

"Don't believe unnamed quotes," he said. "I did not say that, and I make a practice of not commenting on the daily fluctuations of the dollar or any other currency."