People smugglers opened fire on a group of 100 migrants attempting to flee their clutches in northern Libya, aid agency MSF reports.
Twenty-five injured survivors received hospital treatment in the town of Bani Walid.
MSF says they reported at least 15 people were killed and dozens more, mostly women, were left behind.
Libya has become a key point on the route of sub-Saharan African migrants trying to reach Europe by sea.
The country has been in turmoil since the fall of Muammar Gaddafi in 2011. Power is dispersed between different militias and two rival governments, allowing illegal activities to thrive.
MSF says the survivors receiving treatment are mostly teenagers from Eritrea, Ethiopia and Somalia, who were attempting to seek asylum in Europe.
They reported being sold between groups of human traffickers during their time in captivity, which lasted up to three years.
The attempted breakout happened during the evening of 23 May, the agency reports.
Seven of the survivors required treatment for serious gunshot wounds and broken bones in Bani Walid General Hospital, while 18 received first aid for minor injuries.
They have now been transferred to detention centres or hospital in Tripoli.
"All necessary measures must be taken to ensure patients can access the required treatment and to protect these extremely vulnerable people from further harm after surviving such atrocities. Arbitrary detention cannot be a solution. They are in urgent need of protection and assistance," said Christophe Biteau, MSF's head of mission in Libya.