Panning for Gold - A Hacker's Guide to Next Generation Firewalls

Matthew Flanagan (Director and Principal Consultant · Subliminal)

BSides Canberra VIII (2025) · Day 3 · Main Track

Overview

In his compelling talk, "Panning for Gold - A Hacker's Guide to Next Generation Firewalls," Matthew Flanagan, Director and Principal Consultant at Subliminal, delved into the often-overlooked vulnerabilities and post-exploitation opportunities within Next Generation Firewalls (NGFWs). With over 30 years of experience spanning building, defending, and hacking networks, Flanagan presented a comprehensive overview of how these advanced security devices, intended to be a network's first line of defense, can become critical liabilities when compromised. The talk provided a hacker's perspective on identifying weaknesses, extracting valuable secrets, and weaponizing inherent NGFW features for further exploitation.

Watch on YouTube

Visual summary for Panning for Gold - A Hacker's Guide to Next Generation Firewalls by Matthew Flanagan
Visual summary for Panning for Gold - A Hacker's Guide to Next Generation Firewalls by Matthew Flanagan

Key moments

  1. 0:00 Introduction and why target NextGen Firewalls
  2. 5:00 Finding and extracting firewall configuration files
  3. 7:00 The critical default "master key" vulnerability
  4. 16:00 Abusing VPN web interface for credential harvesting
  5. 27:00 Turning clientless VPN into a network port scanner
  6. 38:00 Key mitigation strategies for firewall compromise
  7. 42:30 Q&A: CLI vs. Root Shell for secret extraction

Panning for Gold - A Hacker's Guide to Next Generation Firewalls

Speakers: Matthew Flanagan, Director and Principal Consultant, Subliminal

Conference: BSides Canberra

YouTube: https://www.youtube.com/watch?v=2PF4aSY1gVo

Overview

In his compelling talk, "Panning for Gold - A Hacker's Guide to Next Generation Firewalls," Matthew Flanagan, Director and Principal Consultant at Subliminal, delved into the often-overlooked vulnerabilities and post-exploitation opportunities within Next Generation Firewalls (NGFWs). With over 30 years of experience spanning building, defending, and hacking networks, Flanagan presented a comprehensive overview of how these advanced security devices, intended to be a network's first line of defense, can become critical liabilities when compromised. The talk provided a hacker's perspective on identifying weaknesses, extracting valuable secrets, and weaponizing inherent NGFW features for further exploitation.

The core premise of Flanagan's research is that NGFWs, due to their privileged position at the network perimeter and the extensive data they process and store, are prime targets for attackers. Beyond merely gaining initial access, Flanagan demonstrated how a compromised firewall can serve as a launchpad for deep internal reconnaissance, credential harvesting, and persistent access, often with stealthy and difficult-to-detect methods. The research highlights that despite their "next generation" branding, many firewalls still harbor fundamental design flaws and configuration pitfalls that attackers can readily exploit, turning a security asset into a goldmine of sensitive information and a powerful offensive tool.

Background

▶ Watch: Introduction and why target NextGen Firewalls (0:00)

The concept of a Next Generation Firewall emerged approximately two decades ago, signifying an evolution beyond traditional stateful inspection, Layer 4 access control, NAT, and VPN functionalities. Modern NGFWs integrate a suite of advanced features designed to enhance network security posture significantly. These include application awareness, allowing precise control over specific applications (e.g., YouTube, GitHub, M365) rather than just ports 80/443; protocol awareness, preventing tunneling of disallowed protocols over standard ports (e.g., HTTP over DNS port 53); and threat prevention mechanisms, such as intrusion prevention systems (IPS), signature-based antivirus, DNS security, and dynamic threat intelligence feeds for malicious domains and IPs.

Further capabilities include user awareness (mapping IP addresses to logged-in users), URL filtering, TLS inspection (for deep packet inspection of encrypted traffic), and malware sandboxing for dynamic file analysis. The market for NGFWs is dominated by a few key players, with Fortinet and Palo Alto Networks frequently trading the top two spots, collectively holding around 40% market share as of Q4 2024, according to IDC. Other significant vendors include Cisco, Checkpoint, and Topsec. While Flanagan's talk primarily focused on Palo Alto Networks firewalls, he emphasized that many of the discussed techniques are broadly applicable across different vendors.

Firewalls are inherently attractive targets for attackers for several reasons. Positioned at the network perimeter, they offer a gateway to an organization's internal network. They contain a wealth of information about network topology, internal servers, applications, and user identities. Historically, these devices have been plagued by numerous trivially exploitable bugs, including authentication bypasses, remote code execution (RCE), and command injection vulnerabilities, as evidenced by frequent high-profile disclosures affecting Palo Alto and Fortinet. Crucially, to deliver their advanced "next generation" features, firewalls store sensitive data such as service account credentials, certificates for TLS inspection, and other secrets, which become prime targets for exfiltration once initial access is gained.

Key Findings

▶ Watch: The critical default "master key" vulnerability (7:00)

Matthew Flanagan's research revealed several critical findings regarding the compromise and exploitation of NGFWs, particularly Palo Alto Networks devices:

  1. Configuration as a Treasure Trove: NGFW configuration files are not merely settings but a rich repository of sensitive information. They contain password hashes for local user accounts, and other secrets like service account credentials, private keys for TLS certificates, and API keys, all of which are crucial for deeper network penetration.
  2. Weak Default Master Keys: A pervasive vulnerability lies in the use of static, globally known default master keys for encrypting secrets within the configuration. For Palo Alto Networks, this key ("PaloAlto12345678") has been public since at least 2016. Fortinet firewalls also suffer from a similar issue. This design flaw renders "encrypted" secrets effectively plaintext to an attacker who has obtained the configuration.
  3. Crackable Hashes Even with Custom Keys: Even if an administrator changes the master key, the format of stored secrets (which includes a SHA1 hash of the plaintext secret) can still enable offline cracking, given sufficient computational resources and common password usage.
  4. Excessive Privileges for Service Accounts: User ID service accounts, critical for user-aware security policies, are frequently granted excessive privileges (e.g., Distributed COM Users or Remote Desktop User rights) within Active Directory. This misconfiguration can be abused to achieve remote code execution on internal devices by leveraging known techniques that exploit credential spraying.
  5. Weaponizing TLS Decryption Capabilities: When an NGFW is configured for TLS decryption (acting as an internal trusted Certificate Authority), its compromise yields the CA's private key. This key can be used by an attacker to mint new certificates, impersonate any server, and conduct widespread Man-in-the-Middle (MITM) attacks to snoop on encrypted traffic across the entire organization.
  6. Abusing Web Interfaces for Credential Harvesting: Flanagan developed a novel technique, "evil response pages," demonstrating how the customizable web interfaces of NGFWs (e.g., VPN login portals, URL filtering block pages) can be injected with malicious JavaScript to harvest user credentials. These harvested credentials can be logged locally to seldom-monitored backend logs or exfiltrated remotely.
  7. Clientless VPN as an Internal Reconnaissance Tool: The clientless VPN feature, designed to provide browser-based access to internal applications, can be creatively misused as an internal port scanner. By manipulating URLs, attackers can probe internal network services and identify open ports, bypassing typical firewall rules.
  8. Stealthy Persistence and Evasion: Once a foothold is established, attackers can employ various techniques for persistence (e.g., adding local admin accounts, configuring remote management profiles) and evasion (e.g., disabling log forwarding, clearing local logs, testing threat prevention policies without triggering alerts), making detection challenging for blue teams.

Technical Deep Dive

▶ Watch: Abusing VPN web interface for credential harvesting (16:00)

The technical core of Flanagan's research revolves around the acquisition, decryption, and weaponization of NGFW configuration data and features.

Acquiring Configuration Data:

Initial access to a firewall configuration can stem from various sources. If a root shell is obtained via a zero-day exploit, the configuration file is typically located at /opt/pan/etc/pan/config/committed-config.xml on Palo Alto devices. However, even without a zero-day, configurations are often found on unprotected network shares, cloud storage, or through targeted searches on platforms like SharePoint using specific keywords (e.g., body:pash for Palo Alto). Tech support files, generated by administrators for troubleshooting, are another rich source, as they contain extensive diagnostic logs alongside the full configuration. Furthermore, past breaches, such as the Palo Salesoft drift breach, indicate that configurations can be found on illicit marketplaces.

Extracting and Decrypting Secrets:

Once a configuration file is acquired, the first step is to extract user password hashes. Palo Alto firewalls use MD5 crypt for passwords set before 2022 and SHA256 crypt for those set afterward. Older MD5 hashes are significantly easier to crack offline.

Beyond local user passwords, other secrets (e.g., service account credentials, private keys) are "encrypted" using a master key. By default, this master key is notoriously weak and public. For Palo Alto, it's PaloAlto12345678, a fact revealed by Felix Williams at Troopers in 2016. Fortinet also historically used a static key, prompting the introduction of a "private data encryption" feature. Flanagan provides an open-source tool on GitHub to decrypt these secrets using the default or a custom master key, and an OpenSSL one-liner also exists.

Secrets within the configuration are easily identifiable by the prefix string-aq==, followed by two Base64-encoded strings: a SHA1 hash of the secret and the AES CBC encrypted ciphertext. Even if an administrator has changed the master key, the presence of the SHA1 hash of the secret within this structure still allows for offline cracking, emphasizing the need for strong passwords in addition to a custom master key.

Types of Secrets and Their Abuse:

The configuration can yield dozens of critical secrets:

  • Active Directory Credentials: Directory service accounts (LDAP bind passwords, Kerberos keytabs) used for VPN authentication, firewall admin authentication, group membership lookups, and user-to-IP mapping. Often, these accounts are granted excessive privileges.
  • Email Credentials: For sending alerts and notifications.
  • SSH and File Transfer Credentials: For remote management and data transfer.
  • Cloud Provider Credentials: VMware, AWS, GCP credentials for dynamic inventory pulling for security rules.
  • RADIUS Secrets: For authentication and accounting.
  • TLS Certificates and Private Keys: Crucial for TLS decryption features, where the firewall acts as an internal trusted CA. Compromising this private key allows an attacker to mint certificates and perform widespread MITM attacks, impersonating any server within the network.
  • SNMP Community Strings: For network reconnaissance.

User ID Service Account Privilege Escalation:

A common misconfiguration involves the User ID service account, which is used by Palo Alto to map users to IP addresses by probing internal devices. This account is often mistakenly granted Distributed COM Users or Remote Desktop User privileges. If an attacker obtains these credentials, they can leverage published techniques (e.g., from Matt Nelson and Nissan) to achieve remote code execution on any device in the network. Even if the User ID feature is disabled on the firewall, administrators often neglect to revoke these excessive privileges in Active Directory.

Demo / Proof of Concept

▶ Watch: Key mitigation strategies for firewall compromise (38:00)

Flanagan demonstrated two primary offensive techniques developed from his research, showcasing how NGFW features can be turned against the network they protect: Evil Response Pages for credential harvesting and a Clientless VPN Port Scanner.

Evil Response Pages (Credential Harvester)

Inspired by a Palo Alto release note mentioning a fix for cleartext password logging in the GlobalProtect portal, Flanagan set out to create a custom response page that would log credentials.

  1. Initial Attempts & CSP Bypass: The GlobalProtect VPN login page is a customizable HTML template. Initial attempts to simply change the form method to GET or log credentials to the browser console via JavaScript were either blocked by server-side code or restricted by the firewall's Content Security Policy (CSP). The CSP specifically allowed images to be fetched from anywhere, which proved to be the key bypass.
  2. The Harvester Mechanism: Flanagan's prototype JavaScript gadget hooks the form's submit event. When a user enters credentials and attempts to log in, the JavaScript captures the username and password. It then constructs a GET request to an image URL, appending the captured username and password as query parameters. This image could be a local image on the firewall (available pre-authentication) or a remote 1x1 transparent pixel image hosted on an attacker's server.
  3. Logging Credentials:
  • Local Logging: When targeting a local image, the firewall's backend SSLVPN access logs would record the GET request, including the username and password in cleartext. This method is stealthy because these backend logs are rarely surfaced to administrators or forwarded to SIEMs.
  • Remote Logging: By pointing to a remote 1x1 pixel image on an attacker-controlled server, credentials could be exfiltrated directly, providing a persistent channel even if the attacker loses access to the firewall's logs.
  1. Refinements and Reliability: Early versions of the harvester only worked about 30% of the time due to browser caching issues and asynchronous JavaScript interactions. Flanagan refined the gadget by:
  • Adding a cache-busting random value to the image URL to ensure it was fetched every time.
  • Wrapping the entire authentication flow within his JavaScript event listener to control the sequence, preventing the credential harvesting request from being canceled by the portal's quick response.
  • Implementing logic to check for successful logins and only log valid credentials.
  1. Detection Challenges:
  • Client-side requests mean regular firewall traffic logs won't show the credential harvesting attempt.
  • Endpoint Detection and Response (EDR) solutions might log the client's connection to the remote harvesting URL, but this relies on robust EDR monitoring.
  • Changes to response pages are stored as Base64-encoded blobs in the configuration, making detection via audit logs difficult without decoding and reviewing the actual HTML.

Clientless VPN Port Scanner

This technique abuses the clientless VPN feature, which allows users to access internal applications via a web portal without installing a VPN client.

  1. Feature Overview: The Palo Alto clientless VPN portal typically presents users with a list of "published applications" as clickable tiles. Crucially, it also includes an "Application URL" menu item that, by default, allows users to type in arbitrary URLs to connect to. The firewall then proxies these connections.
  2. Initial Discovery: Flanagan observed that the clientless VPN portal would encode the target URL in the browser's address bar (e.g., HTTPS-domain-path). By manipulating this path, he discovered he could access external URLs not explicitly published. This led to accessing the AWS instance metadata service (revealing cloud credentials) and even the firewall's private management IP address.
  3. Port Scanning Mechanism: Flanagan realized that the URL schema could be modified to probe non-HTTP services and specific ports (e.g., HTTP-8000-domain, HTTP-22-domain for SSH). A GET request to HTTP-22-domain would return the SSH banner if the port was open, effectively turning the clientless VPN into a rudimentary port scanner.
  4. Prototype and Tooling: Flanagan initially created a simple curl command within a for loop to automate this. He later rewrote it as a Python script, an "Nmap light" tool, available on GitHub. This script requires the target network, the portal address, and a valid session cookie from a logged-in user.
  5. Limitations and Palo Alto's Stance: The scanner is limited to TCP ports and can produce false negatives if a remote port doesn't respond with data. Flanagan reported this finding to Palo Alto, who responded that it was "working as designed" and the onus was on the customer to correctly configure firewall security policies to prevent such access.
  6. Future Work: Flanagan plans to investigate tunneling non-HTTP protocol data (SMB, RDP) and using timing analysis to detect open non-HTTP ports more reliably.

Defensive Implications

▶ Watch: Q&A: CLI vs. Root Shell for secret extraction (42:30)

The research underscores the critical need for robust defensive strategies to protect NGFWs and mitigate the impact of their compromise.

  1. Patching and Secure Backups: Regularly patch firewalls to prevent initial compromise. Store configuration backups and tech support files in highly secure, restricted locations, deleting support files immediately after use.
  2. Strong Authentication and Master Key Management: For local accounts, use them only for "break-glass" scenarios with strong, unique passwords. Centralize authentication for all other administrative users and enforce Multi-Factor Authentication (MFA). Crucially, organizations must implement a process to change the default master key despite the vendor's scary warnings about potential outages. This process should include secure key management and scheduled renewal to prevent expiration.
  3. Principle of Least Privilege: Rigorously apply the principle of least privilege, especially for service accounts used by the firewall (e.g., User ID service accounts). Ensure these accounts have only the absolute minimum required permissions within Active Directory and regularly review these privileges against vendor recommendations.
  4. Enhanced Monitoring and Auditing:
  • Monitor for the creation of new admin accounts and logins to local admin accounts.
  • Implement alerts for any changes to response pages and trigger an immediate audit of the Base64-encoded content to detect malicious code injection.
  • Monitor changes to logging settings (e.g., disabling log forwarding) and interface management profiles.
  • While disabling log forwarding might be detected as a lack of logs, the stealthy nature of local backend logs often means they go unnoticed.
  1. Network Segmentation and Egress Filtering:
  • Strictly segment the firewall's management interface, ensuring it is not exposed to the internet and restricting internal access to only trusted sources (e.g., via firewall rules or built-in ACLs). Numerous high-severity vulnerabilities have historically affected management interfaces.
  • Implement egress filtering on the firewall itself. NGFWs typically only need to communicate with a limited set of internal (LDAP, DNS, RADIUS, Syslog) and cloud services. Blocking arbitrary outbound connections from the firewall can prevent command-and-control (C2) communications and data exfiltration.
  1. Treat Firewalls as High-Value Assets: Organizations must treat their firewall infrastructure with the same level of security and scrutiny as domain controllers or other critical systems. A compromised firewall undermines the entire network defense and provides attackers with persistent, often invisible, access.

Key Takeaways

  • NGFWs are High-Value Targets: Due to their perimeter location, extensive network insight, and storage of critical secrets, Next Generation Firewalls represent a prime target for attackers, offering significant post-exploitation opportunities.
  • Default Master Keys are a Critical Weakness: The use of static, globally known default master keys renders many "encrypted" secrets within NGFW configurations effectively plaintext to an attacker, making credential exfiltration trivial.
  • NGFW Features Can Be Weaponized: Capabilities like customizable web response pages (for VPN portals) and clientless VPNs can be creatively abused for stealthy credential harvesting and internal network reconnaissance/port scanning, respectively.
  • Service Account Misconfigurations Lead to RCE: Over-privileged service accounts (e.g., User ID service accounts in Active Directory) are a common vulnerability that attackers can exploit for widespread remote code execution across the internal network.
  • TLS Decryption Compromise is Catastrophic: A compromised firewall performing TLS decryption can yield its private CA key, enabling attackers to conduct pervasive Man-in-the-Middle attacks and snoop on all encrypted traffic within the organization.
  • Vigilant Defense is Paramount: Defenders must treat NGFWs as critical infrastructure, implementing robust patching, secure configuration management, least privilege principles, strict network segmentation, egress filtering, and comprehensive monitoring to detect and prevent compromise.

About the Speaker(s)

Matthew Flanagan is the Director and Principal Consultant at Subliminal, a consultancy he founded in 2022. With over 30 years of experience, he possesses a unique blend of expertise as a builder, defender, and hacker of organizational networks. Throughout his career, while managing network equipment, he has frequently identified and published research on vulnerabilities in firewalls from leading vendors such as Checkpoint, Cisco, and Palo Alto Networks, for which he has received recognition. He can be found online via his email address and on Mastodon.

Reviews

→ Top-rated talks at BSides Canberra VIII (2025)

All talks from BSides Canberra VIII (2025)