Missiles were fired from a Russian Black Sea fleet missile carrier on August 24 but were shot down by the Ukrainian armed forces.
One of the intended targets was reportedly a Libyan-flagged cargo ship berthed at the port of Odesa.
Prime Minister Rishi Sunak told the House of Commons about the attack as he updated MPs on his G20 visit.
“I can tell the House today that thanks to declassified intelligence, we know the Russian military targeted a civilian cargo ship in the Black Sea with multiple missiles on August 24, demonstrating just how desperate [President Vladimir] Putin is," he said.
News of the attack comes after Russia withdrew from the Black Sea Grain Initiative, an effort to ship grain out of Ukraine to countries in Africa and other parts of the world which could otherwise face famine.
Mr Sunak criticised Mr Putin in the Commons for not attending the G20, and claimed Russia had destroyed enough food to feed one million people for a year after pulling out of the deal.
“Even as most G20 leaders came together in Delhi in the spirit of co-operation, one did not," the Prime Minister said.
“For two years now, Putin has lacked the courage to face his G20 peers. Day after day his actions cause horrendous suffering in Ukraine, violating the UN Charter, threatening European security and disrupting global energy supplies."
Ukraine and Russia conflict latest - in pictures
“The spillovers have driven up prices here at home and they are hurting people all around the world," Mr Sunak added.
“Russia’s withdrawal from the Black Sea Grain Initiative exposes their willingness to spread that suffering further. While Putin stalls, making unmeetable demands, he is destroying Ukraine’s ports and grain silos.
“In just one month, Russia has destroyed over 270,000 tonnes of grain, enough to feed a million people for a year.”
The assault on the Libyan cargo vessel follows US government warnings that the Russian military could launch attacks on civilian shipping in the Black Sea.
The Russians have reportedly been laying sea mines around Ukrainian ports and have also targeted shipping infrastructure in the country in recent months.
Mr Sunak later suggested in the Commons that he would have liked the G20’s statement on the war in Ukraine to have been stronger.
Liberal Democrat defence spokesman Richard Foord (Tiverton and Honiton) said it was “disappointing” the statement did not explicitly name Russia as the perpetrator of aggression in Ukraine.
“Does the Prime Minister agree with Canada’s liberal Prime Minister Justin Trudeau, who said yesterday that if it were up to him the language on the war would have been stronger?” Mr Foord asked.
“It goes without saying, because this is not the G7, indeed it’s not the G1, it’s not just for us to dictate the language that we ourselves would like," Mr Sunak responded.
“The G20 is a collection of a large group of countries that do not all share the same perspective on global affairs, or indeed the same values, and to assume that it can reflect the unanimity that we have in the G7 is simply to just misunderstand how foreign affairs actually works," he added.
But the Prime Minister also defended the joint statement, adding: “The statement agreed on the significance of securing a comprehensive, just and lasting peace.
"The statement specifically called for an end to attacks on food and civilian infrastructure, for Russia to rejoin the Black Sea Grain Initiative and indeed highlighted the suffering that it’s causing.”