mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-20 01:32:18 +08:00
Merge remote-tracking branch 'origin/Ghidra_12.1'
This commit is contained in:
+24
-5
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user