Of course there could be a legal secession. There just hasn’t been one yet.
Nearly anything can be done by constitutional amendment:normally 2/3rds of each house of congress and 3/4s of the state legislatures.
It could perhaps even be done by simple legislation. 50% of each house plus one vote, and signature of each president.
It could also practically be accomplish by litigation, with the supreme court resolving a controversy between the state and the federal government as original jurisdiction.
Rebellion is an illegal process, but after a successful rebellion legality could be restored by a treaty: Signature of the President and 2/3rds of the Senate. Here is a question: Would a state bound on secession have its representative counted towards the 2/3rds in the Senate? Would a large plurality of the states able to pull off a successful rebellion, perhaps be so large that 2/3rds of the Senate was not possible without them so no treaty could be ratified?
Madison believed that in order to permit even one state to secede, it would be necessary for the Union to be dissolved. To do that, he believed that all parties to the Union would have to agree to that secession. In other words, unanimous consent would be required.
Lincoln's position was that three-fourths of the states would have to agree to dissolve the Union and permit secession. His logic stemmed from his understanding of what the instrument of dissolution would be. He viewed it as a constitutional amendment that would consist of two parts. The first section would dissolve the Union, and the second section would reform the Union with those states that wished to remain. This amendment could come from an Amendments Convention, or via the usual congressional route. Ratification of three-fourths of the states by state legislatures or state ratifying conventions (as decided by Congress) would permit this amendment to be added to the Constitution and then executed.
This is why Lincoln asked the seceding states to send their representatives back to Congress. If secession was going to be accomplished, he wanted it done by the book.