Exposing a Vulnerable Keycloak Server to the Internet

    Published: 2026-12-04. Last Updated: 2026-12-04 17:26:31 UTC
    by Johannes Ullrich (Version: 1)
    0 comment(s)

    About two weeks ago, the "Java4Shell" vulnerability was announced and patched (CVE-2026-114938). This memory corruption vulnerability in Java's BASE64 decoder can be exploited by passing specially crafted BASE64 strings to a Java application. Web applications do, of course, love to use BASE64, and are often exposed. One application specifically identified as vulnerable and exploitable was Keycloak. So I decided to expose a vulnerable Keycloak instance to the internet to see what happens. Below is the summary of the attacks we have seen.

    The setup used Keycloak behind a mitmproxy. I like mitmproxy as it logs complete requests in easy-to-parse JSON, and it does allow me to offer a proper TLS configuration to the attacker, not asking them to risk their l33t spl01ts by exposing them in the clear. 

    No, I did not see ANY Java4Shell exploits. Of approximately 30,000 requests, only 1,532 were specific to Keycloak. Of those, many came from internet-wide "research" scans such as Palo Alto's Cortex Xpanse, or were otherwise classified as reconnaissance aimed at identifying the Keycloak version and configuration.

    Vulnerability Scan10,797Generic fingerprinting (/, favicon, robots, in7,078ASUS router CVE/brute force6,454Citrix/Fortinet/Exchange/VPN probes1,957Keycloak console/realm/asset recon1,252Secrets/config file hunting (.env, .git)1,187CMS/admin-panel hunting (WordPress, cPanel, ge988API/debug/framework probing (GraphQL, actuator977Keycloak recon scans (/auth, /keycloak276Odd HTTP verbs91Admin-cli password guess4

    (red: Keycloak Specific)

    Only four requests attempted to log in. Oddly enough, the most common attack targeted ASUS routers, not Keycloak:

    GET /SETTINGS.CFG HTTP/1.1
    Host: [redacted]:8443
    User-Agent: asusrouter--
    Connection: close
    Cookie: asus_token=\0Invalid; clickedItem_tab=0
    Referer: https://[redacted]:8443
    Accept-Encoding: gzip

    This is a simple authentication-bypass vulnerability that is currently being heavily exploited.

    I did find 13 distinct BASE64 encoded payloads. But none of them indicates Java4Shell. ASUS is again featured prominently with requests like:

    SETROOTCERTIFICATE /favicon.ico/ HTTP/1.0
    Host: 73.148.200.126
    Content-Length: 935
    Connection: close

    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><content><key>-----BEGIN RSA PRIVATE KEY-----id</key><cert>#!/bin/sh
    #-----BEGIN CERTIFICATE-----

    echo YT1YN2..[part omitted]...tkb25l|base64 -d|sh
    </cert><intermediate_crt>-----BEGIN CERTIFICATE-----</intermediate_crt></content>

    This somewhat odd "SETROOTCERTIFICATE" can be used on affected ASUS routers running AICloud. I shortened the base64 part for readability. In short, it is a botnet that replicates and is unrelated to Java.

    In addition, some Next.JS/React Server payload, and of course scans for credential files, some of which appear to use Base64 encoding to brute-force authentication headers.

    Lesson to me: Some old random ASUS router that an employee may have left behind in your network ("I just wanted WiFi in the office") is more likely to do you in than the latest Java4Shell hype vulnerability.

    --
    Johannes B. Ullrich, Ph.D. , Dean of Research, SANS.edu
    Twitter|

    0 comment(s)
    ISC Stormcast For Friday, December 4th, 2026 https://isc.sans.edu/podcastdetail/10204

      Comments


      Diary Archives