United Nations Charter, Article 2.4.
The regulation of force and conflict begins with the UN Charter, and specifically Article 2(4), which prohibits the threat or use of force, and calls on all Members to respect the sovereignty, territorial integrity and political independence of other States.
United Nations Charter, Article 2
The Organization and its Members, in pursuit of the Purposes stated in Article 1, shall act in accordance with the following Principles.
1. The Organization is based on the principle of the sovereign equality of all its Members.
2. All Members, in order to ensure to all of them the rights and benefits resulting from membership, shall fulfill in good faith the obligations assumed by them in accordance with the present Charter.
3. All Members shall settle their international disputes by peaceful means in such a manner that international peace and security, and justice, are not endangered.
4. All Members shall refrain in their international relations from the threat or use of force against the territorial integrity or political independence of any state, or in any other manner inconsistent with the Purposes of the United Nations.
5. All Members shall give the United Nations every assistance in any action it takes in accordance with the present Charter, and shall refrain from giving assistance to any state against which the United Nations is taking preventive or enforcement action.
6. The Organization shall ensure that states which are not Members of the United Nations act in accordance with these Principles so far as may be necessary for the maintenance of international peace and security.
7. Nothing contained in the present Charter shall authorize the United Nations to intervene in matters which are essentially within the domestic jurisdiction of any state or shall require the Members to submit such matters to settlement under the present Charter; but this principle shall not prejudice the application of enforcement measures under Chapter Vll.
United Nations Charter, Article 51.
Nothing in the present Charter shall impair the inherent right of individual or collective self-defence if an armed attack occurs against a Member of the United Nations, until the Security Council has taken measures necessary to maintain international peace and security. Measures taken by Members in the exercise of this right of self-defence shall be immediately reported to the Security Council and shall not in any way affect the authority and responsibility of the Security Council under the present Charter to take at any time such action as it deems necessary in order to maintain or restore international peace and security.
Cyber attacks and United Nations Charter, Articles 2.4 and 51.
The use of military force authorized under Article 51 is not prohibited under Article 2(4).
It is difficult to define the threshold at which a cyber attack becomes a use of force. This is a political decision for every country, based on strategy, evidence and intelligence. When cyber operations produce severe consequences, that qualify as a use of force, according to the military doctrine in several countries. So, cyber attacks can constitute a prohibited use of force, and can give rise to the right to use military force in self-defensive response, pursuant to the rights reserved in Article 51 of the United Nations Charter.
Cyber attacks targeting the critical infrastructure that injure or kill persons, can be considered equal to an armed attack against which a country enjoys the right to resort to force in self-defense. The degree of damage or injury is a political decision.
Many nondestructive cyber operations like intelligence gathering, cyber theft, or periodic disruption or denial of nonessential cyber services can not be considered equal to an armed attack, according to international law.
Vienna Convention on Diplomatic Relations (VCDR).
Diplomats have multiple functions, including the protection of the interests of a country.
1. The functions of a diplomatic mission consist, inter alia, in:
(a). Representing the sending State in the receiving State;
(b). Protecting in the receiving State the interests of the sending State and of its nationals, within the limits permitted by international law;
(c). Negotiating with the Government of the receiving State;
(d). Ascertaining by all lawful means conditions and developments in the receiving State, and reporting thereon to the Government of the sending State;
(e). Promoting friendly relations between the sending State and the receiving State, and developing their economic, cultural and scientific relations.
Intelligence gathering is not prohibited by international law. Certain actions may be illegal in most countries.