A security vulnerability in BMW’s Connected Drive system allowed researchers to imitate BMW servers and send remote unlocking instructions to vehicles.

The problem was discovered by the Allgemeiner Deutscher Automobil-Club (ADAC), a German motoring association, and was verified on several models of BMW cars.

The attack took advantage of a feature that allows drivers who have been locked out of their vehicles to request remote unlocking of their car from a BMW assistance line.

“They were able to reverse engineer some of the software that we use for our telematics,” said Dave Buchko , a BMW spokesman. “With that they were able to mimic the BMW server.”

The auto maker has already started sending out software patches to the 2.2 million cars equipped with Connected Drive and said it hadn’t come across any cases in which the vulnerability had been used to unlock or attempt to unlock its cars.

Vehicles in the U.S. will get it beginning from next week, said Buchko.

The fix adds HTTPS encryption to the connection from BMW to the car, which runs over the public cellular network. The added encryption will not only safeguard the content of the messages but also ensures that the car only accepts connections from a server with the correct security certificate.

The incident highlights what is likely to be a big issue for auto makers in the coming years: identifying and patching software vulnerabilities and securing the technology going into modern cars.

Today’s cars have millions of lines of computer software and are increasingly connected. Many cars offer Bluetooth, Wi-Fi and cellular connections, can be linked with smartphones and other devices and even accept third-party apps. All provide potential attack points for hackers.

“If all it does is open the locks, it’s concerning, but if that vulnerability could have also sent messages to shut off the brakes, it would have been catastrophic,” said Joshua Corman of The Cavalry, a non-profit that works with auto makers on cyber-security issues.

The organization, which launched in 2013 from the Defcon and BSides security conferences, recently published a framework with recommendations for auto-makers from the computer security industry about how to detect issues, contain and isolate them and respond to them.

In part, it calls on car makers to publish policies that welcome interaction with the computer security industry. Because of laws like the Digital Millennium Copyright Act and the Computer, Fraud and Abuse Act, some researchers are hesitant to come forward with vulnerabilities lest they be accused of hacking and prosecuted, said Corman. In that case, a potentially serious security problem could go unpatched for years.

“Our general intent is that the car industry are masters of their domain, we are the masters of ours and the safety outcome will be better if we work together,” he said.