But while the authorities have reacted with force to the crime wave, Vega turned to software engineers at his CargoX startup. By studying a range of industry and security data, CargoX developed software that identifies risks and helps drivers avoid crime hot spots, or if a robbery does happen, alerts the company in real time.

CargoX says that in Brazil, 0.1 percent by value of all cargo transported by trucks is stolen. “We are about 50 percent lower than that, but we still have tons of work to do,” says São Paulo–based Vega.

What we do is like providing a security camera that you would have in the physical world but doing it online.

Tom Canabarro, Konduto

CargoX is one of a growing number of Brazilian technology startups that are seeking digital solutions to the problem of endemic crime in Latin America’s largest country.

Organized crime is targeting everything from highway robbery to the illegal plunder of tropical hardwoods in the Amazon while online crime such as credit card fraud is also rampant, analysts say.

The traditional policing approach of direct confrontation is costly — 134 police officers were killed in Rio last year. Hence, more companies are turning to data analysis to deal more intelligently with security.

“This is a trend that’s going to be irreversible,” says Geert Aalbers, senior partner in Brazil at Control Risks, a risk consultancy firm. “One reason is the increased cost benefit — you can allocate expensive resources, like guards, where they are most needed.”

Having started from zero two years ago, CargoX today has signed up more than 5,000 truckers. The company scans data from all sources to screen its motorists and study past crimes to see what routes, times, neighborhoods and types of cargo represent the highest risk.

Certain gas stations that might, for instance, be known for prostitution are avoided because of their criminal associations. Daytime delivery is better than night. Drivers are tracked by GPS and must stay inside “geofences” — known safe routes. Foraying outside these alerts the system.

Vega says the key is to learn from the data. “Everyone says it’s good to learn from your mistakes, but it’s even better to learn from other people’s mistakes.”

The use of big data to anticipate crime is at the center of the approach of another tech-savvy entrepreneur, Pedro Moura Costa, the founder of BVRio Institute, an organization that seeks market solutions to environmental issues.

In Brazil’s Amazon, organized crime gangs often use official logging permits to launder timber they have illegally plundered from land outside their license area. Deforestation is up nearly 50 percent from its low in 2012, fueled by the illegal timber trade.

Corruption and lack of resources characterize the official response, while criminals are heavily armed. But by using data to analyze the record of the companies involved in a timber consignment for past infractions and inconsistencies, Costa’s system can help customers avoid shipments of wood that may have been illegally harvested.

For instance, he found that as much as 84 percent of Brazilian timber bought by UK traders since March 2016 had a high or very high risk of illegality. “Most people who buy tropical timber, and not only from Brazil, are getting involved in illegality, unfortunately,” he warns. While the system had not yet been commercialized, he says traders had used it to scan 20,000 shipments of timber worth $1 billion.

Prevention lies at the heart of the strategy of Konduto, another technology startup in São Paulo, which is helping vendors with credit card fraud. This type of crime cost Brazilian consumers $22.5 billion last year, second only to China, according to the 2017 Norton Cyber Security Insights Report.

Trying to catch the perpetrators is usually a waste of time. “Retailers try to take legal action, but the police basically say: ‘Look, I’ve got this murderer, I’ve got that rapist. Am I going to go after the person who stole a television? No,’ ” says Tom Canabarro, co-founder of Konduto.

Konduto uses artificial intelligence to scan the behavior of online buyers entering a site. If they exhibit certain suspicious characteristics, such as someone very young using a credit card with no spending limit or someone using multiple names and mobile phone chips to buy the same product across various sites, Konduto advises its client to reject the transaction. “What we do is like providing a security camera that you would have in the physical world but doing it online,” says Canabarro.