Madara has a rinnesharingan. There is no way to know the extent of madara's capabilities. HOWEVER Both sasuke and naruto have a powerful seal (yin and yang seal) to trap immortal being. But in my opinion the author had no choice but to use "deus ex machina". ONLY KISHI knows every character, he said that he has no idea how to beat him in proper way.