It is possible that Russian hackers are holding their fire until closer to Election Day in November. Given the indictments this month of 12 Russian military officers who are accused of American election interference, the agency once known as the G.R.U. may be all too aware it is being closely watched by the National Security Agency and other American intelligence services.

But that has not completely deterred Russia’s intelligence agencies from targeting politicians.

Microsoft announced at a security conference last week that it stopped an attack last fall aimed at congressional staff offices. While the company did not identify who was targeted, Senator Claire McCaskill, Democrat of Missouri, who faces a tight race for re-election, said on Thursday night that her office had been struck in what she called an unsuccessful attack.

She acknowledged the breach only after The Daily Beast identified her as one of the lawmakers whose offices had been the target of an effort to obtain passwords.

“Russia continues to engage in cyberwarfare against our democracy,” Ms. McCaskill said in a statement. “While this attack was not successful, it is outrageous that they think they can get away with this. I will not be intimidated.”

American officials said it was unclear whether the attack was related to Ms. McCaskill’s re-election bid. She serves on the Senate Armed Services Committee, and one senior official said it was possible that the hackers were seeking a way into the panel’s access to classified military operations and budgets.

Officials of Microsoft, which detected the intrusion in October and November, agreed.

“When we see an attempt like this, we have no way of discerning what the attacker’s motivation is,” Tom Burt, the vice president for customer security and trust at Microsoft, said on Friday.