New York (CNN) Twenty-seven countries have signed a joint agreement on what constitutes fair and foul play in cyberspace — with a nod toward condemning China and Russia.

The statement, released on Monday at the United Nations ahead of the beginning of the UN General Assembly's General Debate, is largely a broadly written agreement that countries should follow international law. While views of what constitutes acceptable state-sponsored hacking vary, the US and its allies generally agree on a basic rules. It's fair game for intelligence services to hack targets purely to spy and to attack military targets, but attacking civilian infrastructure or to give a country an economic advantage is off limits.

The signatories include the members of the Five Eyes intelligence alliance (the United States, United Kingdom, Australia, New Zealand and Canada) as well as other major European nations, Colombia, Japan and South Korea.

The signatories mirror the large group of countries involved the previous two occasions that countries jointly blamed a cyberattack on one country, China, for a more than decade-long hacking campaign, and Russia for creating the infamous NotPetya ransomware worm, which spiraled out of control and locked up computers around the world.

Though it doesn't name them, the statement also explicitly condemns two types of behavior that are each generally associated with just one country — efforts to "undermine democracies and international institutions and organizations, and undercut fair competition in our global economy by stealing ideas when they cannot create them."

Read More