UN has no mandate to give away land belonging to others.
Only the original owners can do that.
So if the UN acted in contravention of their own Charter, the creation of the state of Israel was illegal, according to the UN Charter.
But the Palestinians have since accepted the creation of the state of Israel, within the pre 1967 and original UN lines.
Now Israel has taken even more land and refuses to follow UN Resolutions to return that land.
Israel cannot claim that UN Resolutions gifted them land then ignore the same organisation's resolutions when it feels like it.