A security expert has discovered a vulnerability in the NSA Ghidra platform that could be exploited to execute code remotely.

A security expert who goes online with the handle of sghctoma has discovered a vulnerability in Ghidra platform recently released by the US NSA, the issue could be exploited to execute code remotely.

GHIDRA is a multi-platform reverse engineering framework that runs on major OSs (Windows, macOS, and Linux).

The framework was first mentioned in the CIA Vault 7 dump that was leaked in 2017. WikiLeaks obtained thousands of files allegedly originating from a CIA high-security network that details CIA hacking techniques, tools, and capabilities. Digging in the huge trove of files, it is possible to find also information about the GHIDRA, a Java-based engineering tool.

In March the NSA has released the suite Ghidra that could be used to find vulnerabilities and security holes in applications.

Experts found an XML external entity (XXE) vulnerability that could be exploited by attackers that are able to trick a user into opening or restoring a specially crafted project.

The issue impacts the project open/restore processes, to reproduce it, the user needs to create a project, close it, and put an XXE payload in any of the XML files in the project directory. Once the project is opened again, the payload will be executed.

“Project open/restore is susceptible to XML External Entity Expansion attacks. This can be exploited in various ways by getting someone to open/restore a project prepared by attacker.” reads the description published in a report on GitHub.

“Steps to reproduce the behavior:

Create a project, and close it. Put an XXE payload in any of the XML files in the project directory (see screenshot for example). Open the project. Observe your payload doing its thing.”

The same concept works with archived projects (.gar files) too.”

Experts from Tencent Security also published an analysis that reveals how it is possible to exploit the XXE flaw to remotely execute code on the victim’s machine.

“Based on our prior research on XXE vulnerability exploitation, we found that attackers can abuse Java features and weaknesses in NTLM protocol in Windows operating system to achieve remote code execution,” reads the analysis.

The experts demonstrated that an attacker could exploit the issue by setting up an HTTP Server with NTLM authentication, then use an XXE/SSRF vulnerability to force a NTLM authentication from the victim.

“ It worth noticing that the NTLM has two versions, NTLMv1 and NTLMv2.

When authenticating with NTLMv1, attacker can directly relay the Net-NTLM Hash to the victim’s SMB service.

In the SMBv2 case, attacker must first modify the Negotiate Flags in the Type 2 Message to unset Negotiate Always Sign and Negotiate 0x00004000 flags.” continues the analysis. “This transforms it from local authentication to network authentication, and also strips the signature.”

The researchers published proof-of-concept code to exploit the XXE in Ghidra suite.

“When victim uses Ghidra to open this malicious project, attacker can obtain NTLM Hash from the victim’s machine, therefore execute arbitrary command on victim’s machine,” the researchers concludes.

Experts suggest mitigating the issue by configuring Windows firewall to block incoming SMB requests, enable SMB Sign if SMB server is required, and upgrade to the latest version of JDK.

The XXE vulnerability has been addressed with the release of Ghidra version 9.0.1 that will be available very soon.

Pierluigi Paganini

( SecurityAffairs – Ghidra, XXE)

Share this...

Linkedin Reddit Pinterest

Share On