According to Article II, section 1, clause 6 of the US Constitution, in the case of death, removal, resignation, or inability to discharge the powers of the office, both of the President and the Vice President, Congress may by law provide who will act as President (and it currently does in the Presidential Succession Act, with the Speaker of the House as first in line).
I have some questions about how this would work in a case where both the President and Vice President are incapacitated (i.e. alive but unable to perform any actions).
The 25th Amendment, sections 3 and 4, provide the two ways in which the President can be determined to be unable to discharge the powers of his office. Under section 3, the President can declare himself unable to discharge the powers of the officer for a period of time, which he can't do when incapacitated.
Under section 4, either the Vice President and a majority of the cabinet, or another body that Congress may by law provide, can declare the President to be unable to discharge the duties of his office. Since the Vice President is also incapacitated, the first option is unavailable. For the second option, I do not believe that Congress has passed a law to provide for such an alternative body. In such a situation, Congress could immediately pass a bill to provide for this body. However, with the President unable to sign or veto the bill, the only way for it to become law is to wait until 10 days (excluding Sundays) has passed without action from the President. Is there really no way to avoid having a power vacuum at the top of the US government for at least 10 days in such a situation? (I guess one alternative would be for Congress to impeach both the President and Vice President, which would immediately make the next in line the Acting President, although it seems unreasonable to impeach them if they did not do anything wrong.)
Assuming that they are able to invoke the 25th Amendment, section 4, to declare the President unable to discharge the powers of his office, the powers of the Presidency by default falls to the Vice President. They would also need to determine that the Vice President is unable to discharge the powers, before it can fall to the Speaker of the House and other people further down the line of succession. Can the mechanism in the 25th Amendment, section 4, also declare the Vice President (or anyone else acting as President) to be unable to discharge the duties of the Presidency? The text of section 4 mentions "President", but not "someone acting as President".