Hacking KPN: Lessons from the trenches
Jeremy Goldstein (Red Team · KPN), Bouke van Laethem (Red Team · KPN)
BruCON 0x08 · Day 2
Overview
In this BruCON presentation, "Hacking KPN: Lessons from the trenches," Jeremy Goldstein and Bouke van Laethem, both members of KPN's internal Red Team, share invaluable insights gained from real-world penetration testing engagements. The talk delves into three distinct vulnerabilities discovered within KPN's ecosystem—a Java deserialization flaw in a major cloud platform, an authentication bypass in Citrix NetScaler, and a custom crypto implementation in an internal tool. Beyond the technical specifics of each finding, the speakers emphasize the organizational challenges of securing a large telecommunications provider, particularly concerning vendor security, internal processes, and the often-painful journey from vulnerability discovery to validated remediation.

Key moments
- 0:00 Introduction: KPN Red Team's blocking findings policy
- 6:34 Fighting to test a resistant cloud vendor
- 14:50 Java deserialization RCE and vendor's slow fix
- 24:00 Citrix NetScaler: crafting a cookie theft attack
- 27:00 Vendor's denial and absurd NetScaler fix suggestion
- 32:30 Step-by-step crypto reverse engineering with Immunity Debugger
- 45:30 The surprising AutoIT decompilation revelation
- 47:00 Final lesson: exhaust simple options first
Hacking KPN: Lessons from the trenches
Speakers: Jeremy Goldstein (Red Team, KPN), Bouke van Laethem (Red Team, KPN)
Conference: BruCON
YouTube: https://www.youtube.com/watch?v=iTGvbi_wLE0
Overview
In this BruCON presentation, "Hacking KPN: Lessons from the trenches," Jeremy Goldstein and Bouke van Laethem, both members of KPN's internal Red Team, share invaluable insights gained from real-world penetration testing engagements. The talk delves into three distinct vulnerabilities discovered within KPN's ecosystem—a Java deserialization flaw in a major cloud platform, an authentication bypass in Citrix NetScaler, and a custom crypto implementation in an internal tool. Beyond the technical specifics of each finding, the speakers emphasize the organizational challenges of securing a large telecommunications provider, particularly concerning vendor security, internal processes, and the often-painful journey from vulnerability discovery to validated remediation.
The presentation highlights KPN's robust security posture, shaped significantly since a major hack in 2012. A cornerstone of their approach is the "blocking finding" policy, which dictates that any vulnerability with a CVSS score above 4.0 must be fixed before a product or service can go live. This policy, while sometimes clashing with business imperatives, empowers the Red Team to enforce high security standards. The talk is not merely a showcase of technical exploits but a candid discussion about the human element in cybersecurity—dealing with vendor resistance, internal friction, and the importance of persistence in ensuring true security.
Goldstein and van Laethem’s experiences underscore that effective security extends far beyond initial vulnerability identification. It encompasses rigorous retesting, strategic negotiation with vendors, and the ability to navigate complex organizational dynamics to achieve meaningful risk reduction. Their work demonstrates that even in environments with strong security mandates, unexpected vulnerabilities can lurk in seemingly mundane applications or critical infrastructure, often requiring creative approaches and unwavering commitment to uncover and remediate.
Background
▶ Watch: Introduction: KPN Red Team's blocking findings policy (0:00)
KPN, the primary Dutch telecommunications provider, has significantly bolstered its security posture since a notable hack in 2012, which led to the establishment of its dedicated KPN CISO (Chief Information Security Officer) team. This team, comprising various specialized units, including the Red Team where Goldstein and van Laethem operate, is tasked with ensuring the security of KPN’s vast array of products, services, enterprise systems, and applications. The Red Team's mandate is unique: they conduct penetration tests on systems before they go live, with the authority to issue blocking findings. A vulnerability with a CVSS score above 4.0 automatically halts deployment, a policy that empowers the team to enforce stringent security standards, even if it occasionally creates tension with business objectives.
Beyond their pre-go-live assessments, KPN's Red Team also conducts yearly red team exercises, ranging from phishing campaigns to full-scale simulated attacks. The CISO department further maintains a public, frequently updated security policy on GitHub, welcoming community feedback, and actively pushes vendors and SaaS providers to improve their security before KPN commits to their services. This proactive stance on vendor security is a recurring theme throughout the talk, as many of KPN's services rely on third-party products and platforms.
The talk explicitly avoids discussing "zero-day exploits" or "esoteric techniques," instead focusing on "previously undiscovered" findings that highlight critical security process issues, particularly in vendor management. The speakers emphasize that their goal is not just to find vulnerabilities but to learn how to deal with their aftermath, a crucial aspect often overlooked in security discussions. The three vulnerabilities presented—a Java deserialization flaw, a Citrix NetScaler authentication bypass, and a custom crypto weakness—serve as case studies illustrating these broader lessons, each presenting distinct technical and organizational challenges.
Key Findings
▶ Watch: Java deserialization RCE and vendor's slow fix (14:50)
The presentation details three significant, previously undiscovered vulnerabilities, each with unique technical implications and lessons for security processes:
- Java Deserialization Remote Code Execution (RCE) in a Cloud Platform: An unexpected unauthenticated RCE was discovered in a large enterprise cloud platform used by KPN, specifically within an unused JavaServer Faces (JSF) ViewState field of a "boring" mobile application. Despite the cloud vendor's assurances of security and initial refusal to allow testing, KPN's persistence led to the discovery of this critical flaw. The RCE was achieved by leveraging existing Java deserialization attack techniques (specifically YSoSerial) against a custom binary format hidden within the ViewState, circumventing egress filtering via DNS lookups. The most challenging aspect was not just finding the bug, but compelling the vendor to fix it thoroughly and validating the fix through multiple retests.
- Citrix NetScaler Authentication Bypass / Session Hijack: A vulnerability was identified in the Citrix NetScaler's AAA (Authentication, Authorization, and Accounting) process, allowing for an authentication bypass or session hijacking. The flaw stemmed from the NetScaler's failure to validate a base64-encoded
logparameter, which dictates the domain to which a client's valuable authentication tokens (DMAA and DMAS) are posted. An attacker could craft a malicious login page, inject a controlledlogvalue, and intercept user credentials and session tokens. This vulnerability highlighted critical input validation failures in a widely deployed application delivery controller and exposed the challenges of dealing with vendor denial and slow remediation, with the fix only materializing 14 hours before the BruCON presentation.
- Misplaced Effort in Custom Crypto Reverse Engineering (AutoIT Decompilation): While testing an in-house developed Windows executable that communicated with a web service using a custom encryption scheme, the Red Team invested significant effort in reverse engineering the crypto algorithm and key from its binary using tools like Immunity Debugger. They successfully identified the algorithm (RC2) and the password (an MD5 hash) and built a custom Burp Suite plugin for live decryption/encryption and active scanning. However, the core lesson emerged post-engagement: the executable was written in AutoIT, a scripting language whose compiled binaries can be trivially decompiled back to source code. This meant all the crypto details—algorithm, key, and password—were readily available in plain text, rendering the extensive reverse engineering effort largely unnecessary for the vulnerability itself, which ultimately yielded only minor findings related to handled error messages. This finding underscored the importance of exhausting simple analysis methods before diving into complex techniques.
Technical Deep Dive
▶ Watch: Vendor's denial and absurd NetScaler fix suggestion (27:00)
Java Deserialization Remote Code Execution
The first vulnerability was a Java deserialization RCE found in a large enterprise cloud platform. Java deserialization bugs have a history dating back to 2011 with Spring framework exploits, but gained significant traction in 2015 with the "Marshalling Pickles" presentation and the release of YSoSerial. A crucial blog post by FoxGlove Security later demonstrated YSoSerial's effectiveness against major enterprise products like IBM WebSphere, revealing widespread pre-auth root-level RCEs.
KPN's Red Team encountered strong resistance from the cloud vendor, who initially refused testing, citing prior penetration tests and assurances of security. KPN's internal "blocking finding" policy, backed by senior security officers and executives, ultimately compelled the vendor to allow testing. The target was a seemingly "boring" mobile application that primarily rendered HTML. During testing, an interesting artifact was discovered at the bottom of some pages: a JavaServer Faces (JSF) ViewState, which was clearly Base64 encoded.
Initial research led to a paper by Bison Active specifically detailing issues with this ViewState, including padding oracle attacks, XSS bypasses, and crucially, an RCE. The paper outlined a process: craft a payload string, run a tool with correct offsets, and profit. However, several problems emerged:
- The ViewState was a hidden form field, never sent across the wire by the app, suggesting unused functionality.
- The exploit required an "lvalue expression implementation," an unclear concept.
- The paper did not detail the payload string's format, only implying it was a custom binary format.
The team resolved these issues:
- They intercepted the form and added their own input tag to force the ViewState submission.
- The "in-your-face" tool (likely referring to a specific JSF ViewState tool) allowed them to inspect the ViewState and find suitable lvalue expressions.
- The payload format required extensive reverse engineering. It was determined to be a custom binary format:
[hex_size_of_full_payload] + [null_byte] + [size_of_java_object] + [java_object] + [null_byte] + [size_of_object_type] + [object_type].
Despite accurately reconstructing the ViewState and payload, the exploit from the paper failed. The conclusion was that the platform was either patched or had an accidental mitigation. Undeterred, the team pivoted, recognizing the core issue was a serialized Java object. They discarded the specific JSF ViewState paper and directly applied YSoSerial techniques.
A new challenge arose: lack of feedback. Submitting requests only returned generic errors. Through iteration, they found that a correctly formatted (but not yet exploitable) request yielded a 500 Internal Server Error, while incorrect formats resulted in a 404 Not Found. This provided a basic feedback mechanism. The breakthrough came from a colleague's observation: "Nine times out of ten you don't get out of the cloud," suggesting egress filtering on the firewall. The team then used YSoSerial to generate a proof-of-concept (PoC) with a DNS lookup to a controlled domain. This payload required specific gzip, Base64, and URL encoding to bypass filtering. This successfully achieved unauthenticated RCE.
Remediation proved difficult. The vendor initially promised a fix in six months, well after KPN's planned go-live. KPN's senior security officers, project team, and executives applied significant pressure, threatening to walk away. This forced the vendor to prioritize. Crucially, KPN insisted on retesting by their Red Team. The vendor claimed fixes twice, but KPN's retests revealed the RCE persisted. Only on the third attempt was the vulnerability properly remediated.
As a direct outcome, KPN updated the Burp plugin "Java Deserialization Scanner" by Frederick Doda. The enhanced version, available on KPN CISO's GitHub and submitted as a pull request to Doda, now detects gzip and gzipped Base64 encoded deserialization issues. Importantly, it also scans responses, not just requests, to catch vulnerabilities in unused functionality like the JSF ViewState that might never be sent in a client request.
Citrix NetScaler Authentication Bypass
The second vulnerability was found during testing of a "sexy Google Glass project" that used a Citrix NetScaler as an Application Delivery Controller (ADC), handling SSL offloading, authentication, and load balancing. The NetScaler sat in front of a web application used by the Google Glass device.
The AAA (Authentication, Authorization, and Accounting) process of the NetScaler was the target. The process, simplified, involves:
- Client connects to the Traffic Management Virtual Server (TMVS) domain on the NetScaler.
- NetScaler redirects the client to a login page, which contains an auto-submitting form. This form targets the Authentication Virtual Server (AVVS) domain (also on the NetScaler) and includes a Base64-encoded
logvalue. Thislogvalue effectively becomes the NSE test cookie content. - The client's browser posts the form to the AVVS domain, including the
logvalue. - NetScaler redirects the client to the actual login page where the user enters credentials (username, password, token).
- The client's browser posts these credentials back to the NetScaler.
- NetScaler responds with another form containing JavaScript and two critical authentication tokens: DMAA and DMAS.
- The client's browser auto-submits these tokens to the original TMVS domain, passing through the NetScaler to the backend.
The vulnerability lay in the log value. The client's browser was instructed to post to the AAA domain specified within this log value, and critically, the NetScaler did not validate this domain. An attacker could craft an auto-submitting form with a custom log value pointing to their own server. When a user clicked on this malicious link, their browser would:
- Be redirected to the attacker's server, which mimics the NetScaler's login page.
- The user would enter their credentials.
- The attacker's server would then capture the
DMAAandDMAStokens (which are designed to be posted back to the NetScaler). - Finally, the attacker's server would redirect the user back to the legitimate site, making the compromise transparent.
The speaker demonstrated this with a simple Python server that captured the tokens and then redirected the user. A quick script was developed to scan for vulnerable NetScaler instances, checking if a server returned an NSE test cookie containing the Base64-encoded attacker-controlled string. This revealed many potentially vulnerable instances, including those in US government and adult education domains.
The vendor response to this critical flaw was characterized by denial, suggesting "putting another NetScaler in front of it" as a solution. Remediation took nearly one and a half years, marked by phases of anger, bargaining, and depression from the KPN project team. The fix was finally communicated and implemented just 14 hours before the BruCON presentation, demonstrating the extreme difficulty in pushing vendors for timely security fixes, even when public disclosure is imminent.
Custom Crypto Reverse Engineering
The final case involved an in-house developed Windows executable, an admin tool that communicated with a web service. Its requests and responses contained hex-encoded encrypted data in the query string and response body. Initial black-box attempts (bit-flipping, padding oracle attacks) failed, as the web server refused to communicate without proper encrypted data.
This necessitated binary analysis. The speaker, with the help of a more experienced colleague, used Immunity Debugger. The process involved:
- Listing loaded modules (
eicon), identifyingCryptSP.dll(a common Microsoft crypto DLL). - Viewing exposed functions (
View names), noting functions likeCryptEncrypt,CryptDecrypt,CryptHashData,CryptGenKey. - Setting breakpoints on these functions. When a breakpoint was hit, the stack (
bottom right square) contained arguments. - Back-tracing from the function's first line (where the breakpoint lands) to the caller's return address on the stack (
top item, thenEnter) provided a cleaner view of arguments. - Consulting MSDN documentation for
CryptSP.dllfunctions provided crucial information on argument types, pointers, and descriptions. - To find the encryption algorithm, a breakpoint was set on
CryptDeriveKey. The second argument,AlgoID, was found to be6602. MSDN confirmed6602corresponds to RC2. - To find the password, the
CryptHashDatafunction was examined. Thedataargument revealed the password, which was being MD5 hashed before use.
With the algorithm (RC2), key derivation process (MD5-hashed password), and argument structures understood, the team re-implemented the encryption/decryption logic. They leveraged MSDN's C++ sample code, copying and pasting, and aligning arguments with what was observed on the stack in Immunity Debugger. This allowed them to encrypt arbitrary text and have the application successfully decrypt and action it.
To streamline testing, a Burp Extender plugin (JyThon) was developed:
- Custom editor tab: This tab, added to Burp's HTTP request/response editor, decrypted the hex-encoded query string/response body, allowed live editing of the plaintext data, and then re-encrypted it before sending.
- Custom scan insertion point: This was the main goal. The plugin decrypted the query string, identified parameters (e.g.,
1=,2=), told Burp's Active Scan where to inject payloads, then took Burp's payloads, re-encrypted them using the custom crypto logic, and rebuilt the request.
Despite the significant effort and successful tooling, the active scan yielded minimal results—a few "handled error messages." The developers had implemented robust input validation after decryption, negating the advantage of bypassing client-side checks via custom encryption.
The critical lesson, however, came later: the executable was written in AutoIT. AutoIT compiled binaries can be decompiled back to readable source code, much like Java or .NET applications. This meant all the reverse-engineered details—the RC2 algorithm, the MD5-hashed password, and all crypto configurations—were directly visible in the decompiled source. The extensive binary analysis, while technically accurate and a good learning experience, was largely a waste of time for this specific engagement, as a simpler approach would have yielded the same information much faster. The Burp plugin, however, remained valuable for efficient testing.
Demo / Proof of Concept
▶ Watch: Step-by-step crypto reverse engineering with Immunity Debugger (32:30)
While the talk did not feature live demonstrations, the speakers thoroughly described the proof-of-concept methods and tools developed for each vulnerability:
- Java Deserialization: The Proof of Concept (PoC) involved using YSoSerial to generate a Java deserialization payload that initiated a DNS lookup to an attacker-controlled domain. This validated the remote code execution without requiring direct command output, by observing DNS queries. The payload was carefully crafted using specific gzip, Base64, and URL encoding to ensure successful delivery through the application's unique processing and to bypass potential egress filtering. The speakers also highlighted the updated Burp Java Deserialization Scanner as a tool capable of detecting such complex deserialization flaws in practice, including those in responses and with various encodings.
- Citrix NetScaler Authentication Bypass: The PoC for this vulnerability was a simple yet effective setup. An attacker would host a web page containing an auto-submitting HTML form. This form would be configured with a malicious
logparameter, directing the authentication process to the attacker's server instead of the legitimate NetScaler AAA domain. A basic Python web server on the attacker's machine would then capture theDMAAandDMASauthentication tokens that the user's browser automatically posted. After capturing the tokens, the Python server would then gracefully redirect the user back to the legitimate NetScaler login page, making the entire interception largely transparent to the victim.
- Custom Crypto Reverse Engineering: For the custom crypto, the primary PoC and testing tool was a Burp Extender plugin written in JyThon. This plugin integrated the reverse-engineered encryption/decryption logic directly into Burp Suite. It provided two key functionalities:
- A custom editor tab: This tab would appear alongside Burp's standard "Raw," "Params," etc., tabs. When viewing an encrypted request or response, this tab would automatically decrypt the relevant data (e.g., the hex-encoded query string), display it in plaintext for easy editing, and then re-encrypt it when the user sent the modified request.
- A custom scan insertion point: This allowed Burp's Active Scanner to effectively test the encrypted parameters. The plugin would decrypt the query string, identify individual parameters, allow Burp to inject its payloads into these decrypted parameters, and then re-encrypt the entire request with the payload before sending it to the server. This ensured that Burp's powerful scanning capabilities could be applied to the custom encrypted communication.
Defensive Implications
▶ Watch: Final lesson: exhaust simple options first (47:00)
The insights from KPN's Red Team provide several critical defensive implications for organizations:
- Mandate and Validate Vendor Security: The most prominent lesson is the absolute necessity of pentesting your suppliers and rigorously validating their fixes. KPN's experience with the cloud vendor highlights that vendor assurances of security, even with prior penetration tests, are insufficient. Organizations must insist on their right to test critical third-party components and must not accept vendor claims of remediation without independent retesting. Executive and contractual pressure can be vital in enforcing this.
- Don't Underestimate "Boring" or Unused Functionality: The Java deserialization RCE in a "boring" mobile app's unused JSF ViewState demonstrates that critical vulnerabilities can lurk in unexpected places. Security teams should avoid dismissing seemingly innocuous or non-functional parts of an application. Comprehensive testing requires exploring all accessible components, regardless of perceived importance or usage.
- Implement Robust Input Validation Everywhere: The Citrix NetScaler vulnerability underscores the fundamental importance of input validation. Any data received from the client, especially in authentication or redirection flows, must be thoroughly validated against expected formats and safe values. Relying on client-side logic or assuming a trusted source for parameters like the
logvalue in a complex authentication flow is a critical security oversight.
- Stay Updated on Deserialization Vulnerabilities and Tooling: Java deserialization remains a persistent and high-impact vulnerability class. Defenders must ensure their applications are patched against known deserialization risks, implement egress filtering to detect and block malicious outbound connections from compromised systems, and utilize updated security tools. The enhancement to the Burp Java Deserialization Scanner (detecting gzipped, Base64-encoded, and response-based deserialization) is a direct defensive contribution from KPN, providing a more comprehensive detection capability.
- Avoid Security Through Obscurity for Custom Crypto: The AutoIT crypto case is a stark reminder against relying on custom, home-grown encryption schemes for security. Such implementations rarely withstand scrutiny and often introduce more weaknesses than they solve. Furthermore, assuming that obscurity will protect proprietary code is a fallacy, especially with languages like AutoIT that are easily decompilable. Defenders should always prioritize well-vetted, standard cryptographic algorithms and libraries.
- Exhaust Simple Analysis Methods First: Before diving into complex reverse engineering, security professionals should always check for simpler, quicker paths to information. For binaries, this includes looking for obvious strings, checking for common packers, and critically, attempting decompilation if the language (e.g., AutoIT, Java, .NET) supports it. This "work smarter, not harder" approach can save significant time and resources.
- Prepare for Vendor Resistance and Be Persistent: Dealing with vendors, especially when reporting critical flaws in their widely deployed products, often involves navigating denial, anger, and slow response times. Security teams must be prepared for this, maintain clear communication, document everything, and leverage internal stakeholders (like KPN's senior security officers and executives) to apply necessary pressure for timely and effective remediation.
Key Takeaways
- Always pentest your suppliers and re-validate their fixes. Vendor security claims are insufficient; independent verification is paramount, and executive backing can be crucial for enforcement.
- Don't ignore "boring" applications or unused functionality. Critical vulnerabilities, like RCEs, can reside in unexpected places, requiring thorough and comprehensive testing of all components.
- Robust input validation is non-negotiable, especially in authentication flows. The Citrix NetScaler flaw highlights that even complex, widely used systems can fail to validate critical parameters, leading to severe authentication bypasses or session hijacking.
- Java deserialization remains a significant threat. Keep applications patched, implement egress filtering, and utilize advanced tools (like the enhanced Burp Deserialization Scanner) capable of detecting obfuscated payloads and issues in responses.
- Prioritize simple analysis techniques before complex reverse engineering. Before deep-diving into binary analysis, check for easy wins like decompilation (especially for AutoIT, Java, .NET) or basic string analysis to save significant time and effort.
- Persistence and internal advocacy are key to remediation. Dealing with vendor denial and slow fixes is common; maintaining pressure and leveraging internal leadership is essential to ensure vulnerabilities are addressed properly and in a timely manner.
About the Speaker(s)
Jeremy Goldstein and Bouke van Laethem are members of the Red Team at KPN, a primary Dutch telecommunications company. Their roles involve penetration testing KPN's products and services before they go live, encompassing everything from customer premises equipment (CPE) devices and enterprise systems to websites and mobile applications. They operate under a unique mandate that allows them to issue "blocking findings" for any vulnerability with a CVSS score above 4.0, preventing deployment until the issue is resolved. Beyond pre-go-live assessments, they also conduct yearly red team exercises, ranging from phishing campaigns to full-scale attack simulations. Their work is integral to KPN's robust security posture, which has been significantly strengthened since a major hack in 2012. Both speakers contribute to KPN's public security initiatives, including maintaining a security policy on GitHub and developing tools like the enhanced Burp Java Deserialization Scanner.
Reviews
- Heather Calloway (CISO) — MUST SEE ★★★★★