After the dissolution of the USSR, a commonwealth was created called Commonwealth of Independent States. This organization is a military and economic alliance between former USSR nations (and open to foreign nations also).
A protocol was signed between the founders called Alma-Ata Protocol effectively deciding that the Russian Federation (RSFSR) was to assume the Soviet Union's UN membership, including its permanent seat on the United Nations Security Council. And I quote (Blum, 1992):
Furthermore, in Article 1 of the fifth declaration, entitled ‘On UN
Membership’, the eleven signatories agreed that ‘Member states of the
Commonwealth support Russia in taking over the USSR membership in the
UN, including permanent membership in the Security Council.’
The fate of the Soviet Union was sealed on 25 December 1991 with the resignation
of its President, Mikhail S. Gorbachev. One day earlier, on 24 December 1991, the Permanent Representative of the USSR to the United Nations, Ambassador Y. Vorontsov, transmitted to the Secretary-General of the United Nations a letter from the President of the Russian Federation, Boris N. Yeltsin, stating that:
the membership of the Union of Soviet Socialist Republics in the
United Nations, including the Security Council and all other organs
and organizations of the United Nations system, is being continued by
the Russian Federation (RSFSR) with the support of the countries of
the Commonwealth of Independent States. In this connection, I request
that the name ‘Russian Federation’ should be used in the United
Nations in place of the name ‘the Union of Soviet Socialist
Republics’. The Russian Federation maintains full responsibility for
all the rights and obligations of the USSR under the Charter of the
United Nations, including the financial obligations. I request that
you consider this letter as confirmation of the credentials to
represent the Russian Federation in United Nations organs for all the
persons currently holding the credentials of representatives of the
USSR to the United Nations.
As for the legality of the transfer of powers within the UN own protocols Blum (1992) also comments on that:
II. Does the Change of Name Affect a State’s Membership in the United Nations?
...
Consequently, the change of name per se from ‘Soviet Union’ to
‘Russian Federation’ does not affect the question of the UN membership
of Russia if it can be established that there is continuity and
identity, for the purposes of international law, between the former
Soviet Union and the Russian Federation.
So it would take a quite agressive diplomatic (perhaps worse) maneuvering to remove powers from Russia.