Major Brazilian Signature Apps Enable RCE & Fraud
Government-sanctioned authentication middleware is used for exceptionally important legal documents, yet it’s often rife with RCE bugs.
Brazil’s digital certificate system was recently found to be rife with vulnerabilities in browser extensions used by millions of government agencies and legal, medical, and tax professionals.
That’s the assessment of researchers at Bay Area Labs, who this week flagged five particularly popular digital extensions that allow Brazilian citizens and institutions to not only sign official documents, but sign them with the greatest possible degree of trust issued by their government. All five of them possessed vulnerabilities which could’ve allowed attacker-controlled websites to run arbitrary code on users’ machines.
One can only hope that the researchers, who disclosed the vulnerabilities this week, were the first to discover them. Remote code execution (RCE) in this context could have allowed fraudsters to sign legal documents in victims’ names, and hackers to breach major government organizations (as well as professionals who manage large amounts of personal, financial, tax, and health information on behalf of their clients).
RCE in Brazil’s Digital Signing Infrastructure
On Sept. 23, 2020, Brazil’s National Congress enacted Federal Law No. 14,063. 14,063 laid the ground rules on how individuals and organizations could digitally sign documents when dealing with public institutions. Among other things, it delineated three tiers of trust that an electronic signature could carry: “simple,” “advanced,” and “qualified.” “Qualified” meant that a digital signature would be equivalent to a notarized, handwritten one. It would be sufficient for high-stakes legal proceedings, like real estate transfers and electronic tax processes. And any digital signature backed with an ICP-Brasil certificate — ICP-Brasil is the country’s official national public key infrastructure (PKI) framework — would be considered “qualified.”
Brazilian government institutions, tax professionals, and anyone in-between who wants to provide a qualified digital signature for a sensitive legal document online can use browser extensions like Lacuna Web PKI, Softplan Web Signer, Certisign WebSigner, Certisign CertiPlugin, and BRy Assinatura Digital. Each of these tools lets official government and vendor portals read ICP-Brasil certificates, to confirm that signers are who they say they are, and put pen to Web page.
These tools will also engage with non-official websites. So if an attacker can lure a victim to their own site — or, in some cases, plant a malicious ad or iframe on a legitimate site — they can engage that victim’s authentication middleware. Only one of the five extensions, CertiPlugin, had any kind of allowlist, yet it included any domain ending in “.one,” meaning that an attacker would simply need to purchase a domain with that common and freely available suffix in order to perform an attack.
The core issue endemic to each of these five extensions, and others used by other national governments, is that they allow websites to dictate the dynamic link libraries (DLLs) they load. Loading cryptographic libraries is a normal part of the way these apps work. But if they don’t properly check that a loaded file is trusted? In that case, an attacker that lures a victim to their site can trigger a malware download and then instruct the victim’s signing software to load that malware as if it were a legitimate library.
All five extensions’ RCE vulnerabilities earned “critical” 9.6 scores in the Common Vulnerability Scoring System (CVSS). Each of them was patched as of mid-September, but lessons remain.
Signing Tool Risks to High-Value Organizations
Lacuna Web PKI, Softplan Web Signer, Certisign WebSigner, Certisign CertiPlugin, and BRy Assinatura Digital have more than 10 million installs between them.
Among that user base are some of the most significant, high-value organizations and professionals in the country. On its website, Lacuna alone counts Brazil’s Federal Senate, its National Council of Justice, its navy, and its stock exchange among its clients “who trust our work.” These extensions are far from limited to major government agencies, of course. BRy advertises its work with the University of São Paulo, the São Paulo metro, and one of the country’s few biggest banks, Caixa Econômica Federal.
Attackers could have used the vulnerable authentication middleware to infect employees at major state institutions and, in Arnott’s words, “cause mayhem.” As an easier alternative, they could target middle class professionals: lawyers, doctors, accountants and so on. An accountant might manage digital signing credentials for hundreds of different individuals and businesses on their single computer. An attacker with that accountant’s access could then impersonate those people and companies in legally significant transactions — forging agreements, submitting false tax filings … the sky’s the limit.
“It’s really interesting how these signing tools always consistently have the same critical vulnerabilities,” Arnott marvels, after having found characteristically similar vulnerabilities in extensions used by Belgium, Sweden, and Qatar’s governments in recent months. “Since they are security tools, you’d expect them to be properly built. But they’re so often making the same mistake, by allowing any site to pick which DLLs to load. I imagine it’s to reduce friction so organizations can more easily load in the drivers for hardware security tokens and readers, because the driver DLLs aren’t always known to the signing tool vendor or signed properly with Authenticode. It is insane to me how many independent vendors make this same mistake though.”
Read more about:
Originally published on Dark Reading