The SilentText secure messaging application bundled with Blackphone had a serious vulnerability that would have allowed attackers to decrypt messages, read contact information, gather location data and even execute malicious code on the phone.

The bug, which was fixed before it was disclosed publicly Tuesday, shows that even devices built with security and privacy in mind can have serious flaws that compromise their defenses.

Blackphone is a high-end smartphone that runs a modified and locked-down version of Android called PrivatOS. It comes preloaded with apps for end-to-end encrypted text messaging, audio calling and video conferencing, as well as secure online storage.

The phone is manufactured by Switzerland-based SGP Technologies, a joint venture between Silent Circle, a provider of encrypted communications services and Spanish phone manufacturer GeeksPhone.

The vulnerability in SilentText, one of the apps bundled with Blackphone, was discovered by Mark Dowd, founder of Australian security consultancy firm Azimuth Security.

“While exploring my recently purchased BlackPhone, I discovered that the messaging application contains a serious memory corruption vulnerability that can be triggered remotely by an attacker,” Dowd said in a blog post that contains the technical details of the bug. “If exploited successfully, this flaw could be used to gain remote arbitrary code execution on the target’s handset.”

The malicious code would execute in the context of the SilentText app and would inherit its privileges. This means the attacker could decrypt text messages, gather location information, read the phone’s contacts and write to the external storage, Dowd said.

If the attacker also had knowledge of an Android privilege escalation exploit that affects PrivatOS, he could use it after exploiting the SilentText vulnerability to gain root or kernel access on the device. This would give him complete control over the phone.

The only knowledge an attacker would have needed to exploit the SilentText vulnerability was the target’s Silent Circle ID or phone number.

“This issue is now patched by both Silent Circle and Blackphone in the respective App Stores / Product updates,” Dowd said.

Blackphone users can update to the latest firmware version following the instructions on the product’s support site.

This is not the first vulnerability discovered in Blackphone, but is likely one of the most serious ones found to date. Silent Circle and SGP Technologies run vulnerability reward programs for their respective products through the Bugcrowd platform. Statistics on the Bugcrowd site show that 25 issues have been found and rewarded so far in Blackphone and 37 in the Silent Circle apps and services.