CryptoAPI Spoofing Vulnerability

Akamai researchers have made available a demonstration exploit code for a significant vulnerability in Windows CryptoAPI that was identified by the National Security Agency (NSA) and the United Kingdom’s National Cyber Security Centre (NCSC). The exploit allows for the forging of certificates using MD5 collisions.

In August of 2022, Microsoft issued security updates to address a vulnerability, identified as CVE-2022-34689, however, the company did not publicly announce the flaw until October of the same year, when it released an advisory.

CryptoAPI Spoofing Vulnerability

It is possible for a threat actor to alter a legitimate x.509 certificates to impersonate someone else, thereby allowing them to carry out actions such as authentication or signing code as if they were the certificate’s rightful owner.

This vulnerability, which Microsoft has classified as critical in severity, can be easily exploited by attackers who do not require any authentication.

To aid in the detection of systems vulnerable to attacks, Akamai security researchers have both released a demonstration exploit and provided an OSQuery. The PoC exploit is aimed to help defenders identify affected versions of the CryptoAPI library.

While researchers revealed that older versions of Chrome (versions 48 and below) and applications based on Chromium can be targeted by this exploit.

In the wild, there is believed to be a greater number of vulnerable targets, and cybersecurity experts are currently continuing to pursue their research.

Among the visible devices in data centers, fewer than 1% were accounted for by a patch. As for the rest of the systems, they are left vulnerable to this vulnerability since they have not been patched.

How the Flaw can be Exploited?

A technique known as a preimage attack is used to create a certificate with an MD5 thumbprint that perfectly matches a specified MD5 value. It is considered computationally impossible to achieve, even with today’s technology.

It’s possible to create two distinct certificates by selecting specific prefixes, which results in identical MD5 fingerprints. This tactic is known as a “chosen prefix collision” attack.

This would mean that if we choose this path, we will eventually need to provide the victim application with two certificates.

A chosen prefix collision attack can be executed by generating one certificate that is properly signed, verified, and stored. This certificate is crafted in a manner that enables the collision attack. 

The second certificate, on the other hand, holds the falsified identity and shares the same MD5 fingerprint as the first certificate.

Exploiting this vulnerability allows attackers to undermine the trustworthiness of HTTPS connections and any signed executable code, files, or emails. It can compromise the validation process and potentially cause security breaches.

By leveraging this vulnerability, cybercriminals can use a forged code-signing certificate to sign malicious executable files, making them appear as if they came from a reputable source. This tactic can be used to trick victims into believing the files are legitimate and safe to run.

This vulnerability can allow cybercriminals to make malicious files appear legitimate by signing them with a counterfeit certificate, making it appear as if the files are from a trustworthy source. 

As a result, unsuspecting victims would have no reason to suspect that the files are dangerous, and may be tricked into executing them.

Recommendation

The latest security patch from Microsoft has been released for the Windows server and endpoints, and security analysts advise users to patch their Windows servers and endpoints promptly

To protect against this vulnerability, developers can take steps to verify the authenticity of a certificate before using it. One option is to utilize other WinAPIs, such as CertVerifyCertificateChainPolicy, to ensure that a certificate is valid.

An application that does not use end-certificate caching is not susceptible to this vulnerability.

Network Security Checklist – Download Free E-Book

Gurubaran is a co-founder of Cyber Security News and GBHackers On Security. He has 10+ years of experience as a Security Consultant, Editor, and Analyst in cybersecurity, technology, and communications.