Riders are forbidden to take food within six kilometers from the stage end.
"That's one of those things that come with the race," Froome said. Porte also got a 20-second penalty.
The 172.5-kilometer (107-mile) route from Gap to L'Alpe d'Huez featured two HC ascents of L'Alpe d'Huez meaning they were so tough they were beyond classification, known as Hors Categorie.
Riblon caught American Tejay van Garderen with about two kilometers remaining, on the second ascent.
Riblon threw his hands up and pumped his fists after clinching the second Tour stage win of his career, three years after winning another mountain trek. Van Garderen finished 59 seconds behind in second, and Italian Moreno Moser was 1:27 behind in third.
Froome finished the stage 3:18 back in seventh, rolling in alongside Porte and nearly one minute ahead of the 11th-placed Contador.
In this final week, there has been feverish media speculation about Froome's dominance, prompting heated debate on social media, cycling blogs and mainstream media and prompting his Sky team to give assurances that he is racing clean.
"I can't understand why the yellow jersey is being put on trial," said Riblon, who was part of a nine-man breakaway that surged ahead early on.
On Thursday, Froome's Sky team released his performance data from six races, including this Tour, to a French newspaper as it seeks to dispel any suspicions of doping.
"It's crazy hearing people talk like this. Of course I'm human," Froome said. "I know what I'm doing is right and I'm extremely proud of what I've done to get here. No one can take that away from me."
Like players in a card game, Froome and Contador waited for the other one to show his hand on the first climb up L'Alpe d'Huez, with its 21 hairpin bends jammed with fans in a chaotic atmosphere.
But neither did.
Until the second one, when Contador was dropped by Froome. The two-time former champion just held on to second place overall, but he is 5:11 behind Froome, and only 21 seconds ahead of third-placed Colombian Nairo Quintana.
After dropping Contador, Froome suddenly slowed down, calling for assistance. Since no team car could get up to help him due to the thousands of fans around, Porte went and brought him back the energy bar.
"He's just a super person, to have ridden the way he did today," Froome said.
When Van Garderen and Riblon reached the top of the next climb together, the Col de Sarenne, they braced themselves for a long and razor-thin descent.
In recent days, Froome expressed concerns that the Sarenne descent, with its bumpy, pockmarked surface, was too dangerous. Riblon went off the road, and luckily for him he rolled onto a grass bank.
"I have a lucky star over me," Riblon said.
Two days ago, Froome criticized Contador for riding too aggressively downhill, almost causing the Briton to crash. So, Contador attacked Froome almost immediately down Sarenne, passing him on the outside like a Formula One driver.
Contador, joined by his teammate Roman Kreuziger, opened up a gap of about 20 seconds but lost that advantage after a few minutes.
"We saw it wasn't really a tactically brilliant move," Porte said. "We sat back and relaxed and chased them back in the valley, and I think they might have paid for it a little bit."
Contador's bad day was compounded when he had to change bikes.
- AP