Merge remote-tracking branch 'origin/Ghidra_12.1'

This commit is contained in:
ghidra1
2026-04-13 17:56:44 -04:00
@@ -88,6 +88,27 @@ public class PKIAuthenticationModule implements AuthenticationModule {
return false;
}
private void checkTokenIntegrity(byte[] token) throws LoginException {
if (token.length != TOKEN_SIZE) {
throw new FailedLoginException("Invalid Signature callback");
}
boolean isZeroToken = true;
for (byte b : token) {
if (b != 0) {
isZeroToken = false;
break;
}
}
if (isZeroToken) {
throw new FailedLoginException("Invalid Signature callback");
}
if (!TokenGenerator.isRecentToken(token, MAX_TOKEN_TIME)) {
throw new FailedLoginException("Stale Signature callback");
}
}
/*
* @see ghidra.server.security.AuthenticationModule#authenticate(ghidra.server.UserManager, javax.security.auth.Subject, javax.security.auth.callback.Callback[])
*/
@@ -121,14 +142,12 @@ public class PKIAuthenticationModule implements AuthenticationModule {
try {
byte[] token = sigCb.getToken();
if (!TokenGenerator.isRecentToken(token, MAX_TOKEN_TIME)) {
throw new FailedLoginException("Stale Signature callback");
}
checkTokenIntegrity(token);
boolean usingSelfSignedCert =
DefaultKeyManagerFactory.usingGeneratedSelfSignedCertificate();
if (!DefaultKeyManagerFactory.isMySignature(usingSelfSignedCert ? null : authorities,
if (!DefaultKeyManagerFactory.isMySignature(
usingSelfSignedCert ? null : DefaultTrustManagerFactory.getTrustedIssuers(),
token, sigCb.getServerSignature())) {
throw new FailedLoginException("Invalid Signature callback");
}