How borders are drawn and enforced has far-reaching consequences, whether we live on either side of them or halfway across the world.

The US embargo on Cuba may not exist much longer. But now we know how Cuba’s socialist government dodged it, using offshore banks and shell companies to do business in US dollars and protect foreign partners from American retribution.

The network of secret companies was discovered in the Panama Papers, a collection of documents from the law firm Mossack Fonseca in Panama that was leaked to a consortium of international journalists. The papers showed how everyone from the former Prime Minister of Iceland to US heiresses leveraged corporate secrecy to keep their money untaxed and hidden from law enforcement.

And Cuba was in on the act. The Miami Herald found how one Lebanese oil trading firm, BB Energy, used a shell company to supply Cuba with oil from 1992 to 2001, the years when the island nation lost a key economic backer in the Soviet Union, but before Venezuela became a major source of oil.

The scheme allowed BB Energy to continue doing business with the US financial system while trading $300 million of oil for sugar with Cuba. The deal moved through an undisclosed company set up in Panama and directed by Jürgen Mossack, a founder of the law firm. While BB Energy denies that the companies are related, the Panama Papers documents show that they share directors and financial obligations.

In all, 25 shell companies at Mossack Fonseca were found to have links to Cuba. Many were directed by high-ranking Cuban officials and apparently used to trade in food, medicine and cigars, key industries run by the state. Others were used to hide foreign assets of the Cuban state that may have been threatened by seizure.

While the US embargo on Cuba has proven an ineffective sanctions regime largely because the rest of the world has not played along, these revelations demonstrate that the offshore finance system—often protected by US law—provides a surprisingly straightforward way around financial sanctions.

More worrying than economically desperate Cuba smuggling oil past sanctions is the idea of a country like North Korea using shell companies to smuggle nuclear technology or weapons past the international community. And we have some sense that they are trying—this news brings to mind the 2013 incident in the Panama Canal, when two MIG-21 fighters and missile parts were seized in a freighter, underneath a load of Cuban sugar, bound for Pyongyang.